[Top][All Lists]

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

Re: How to apply a minor mode to all buffers

From: Robert Thorpe
Subject: Re: How to apply a minor mode to all buffers
Date: 23 Jan 2007 09:48:47 -0800
User-agent: G2/1.0

Eli Zaretskii wrote:
> > From: "Robert Thorpe" <address@hidden>
> > Date: 22 Jan 2007 03:48:30 -0800
> >
> > The after-change-mode-hook is still quite tedious.
> > Let's say you want to enable hide-show mode in every mode in which it's
> > useful.  Generally it's only useful in programming language modes and a
> > few text modes, currently the only way to accurately do this is to
> > enable it individually in many hooks.
> Here's a simple solution to a similar problem I have in my .emacs for
> quite some time:
>     ;;; Turn on trailing whitespace highlighting in modes where
>     ;;; it makes sense.
>     (let* ((twh-modes '("texinfo-mode" "makefile-mode" "c-mode-common"
>                       "emacs-lisp-mode" "outline-mode" "sh-mode"
>                       "shell-script-mode"
>                       ))
>          (elt (car twh-modes)))
>       (while elt
>       (add-hook (intern (concat elt "-hook"))
>                 (function (lambda ()
>                             (setq show-trailing-whitespace t))))
>       (setq twh-modes (cdr twh-modes)
>             elt (car twh-modes))))
> If I ever need to do that in an additional mode, all I have to do is
> add another mode name to the list at the beginning of this snippet:
> hardly a tedious job.

Sure, I once did something similar in .emacs. It's not exactly friendly
to beginners who might want to do this though.

Feel free to ignore my suggestion for until I send you a patch, which
might be never.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]