Mailing List Archive


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[tlug] XEmacs and MMM-Mode: The Hack-tacular Saga Continues



Josh Glover writes:
 > I have solved a few more MMM-Mode problems, but this one still plagues me.
 > 
 > I like my code folded, and indent-mode

>From which library?

 > ; Add code folding to Perl mode (but not in mmm-mode, due to hack-cakes)
 > (add-hook    'cperl-mode-hook        'my-fold-hook)
 > (remove-hook 'mmm-mason-submode-hook 'my-fold-hook)

This just stops mmm-mason-submode from invoking my-fold-hook, it
doesn't turn anything OFF.  If you enter cperl mode, my-fold-hook will
be invoked regardless, and the conflicting mode will be on.

What you would need to do is write my-fold-hook as something like

(defun my-fold-hook ()
  (cond ((eq major-mode 'mmm-mode)) ; pass
        ((memq minor-modes 'mmm-mason-submode)) ; pass
        ((eq major-mode 'cperl-mode) (indent-mode 1))
        ;; etc
  ))

Don't take that too seriously, the minor-modes variable doesn't exist,
and I'm pretty sure that mmm-mode isn't a real major mode, it's a mode
multiplexer (ie, when you're in a cperl part of the buffer, the major
mode is cperl-mode).

 > Is there an easy way to accomplish what I want, namely just turning
 > indent-mode off for mmm-mode or mmm-mason-submode?

This depends on internals.  mmm-mode should provide a
post-mode-invocation hook for this purpose, and you could turn it off
there.  The problem you may run into is that "never turn it on" and
"turn it on then turn it right off" may not be semantically
equivalent.



Home | Main Index | Thread Index

Home Page Mailing List Linux and Japan TLUG Members Links