[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: How to apply a minor mode to all buffers
From: |
Eli Zaretskii |
Subject: |
Re: How to apply a minor mode to all buffers |
Date: |
Mon, 22 Jan 2007 23:23:29 +0200 |
> From: "Robert Thorpe" <rthorpe@realworldtech.com>
> 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.
- Re: How to apply a minor mode to all buffers, (continued)
- Re: How to apply a minor mode to all buffers, James Aguilar, 2007/01/18
- RE: How to apply a minor mode to all buffers, Drew Adams, 2007/01/18
- Re: How to apply a minor mode to all buffers, Eli Zaretskii, 2007/01/19
- Re: How to apply a minor mode to all buffers, James Aguilar, 2007/01/19
- Re: How to apply a minor mode to all buffers, Juanma Barranquero, 2007/01/19
- Re: How to apply a minor mode to all buffers, Eli Zaretskii, 2007/01/20
- Message not available
- Re: How to apply a minor mode to all buffers, Robert Thorpe, 2007/01/20
- Re: How to apply a minor mode to all buffers, Lennart Borgman (gmail), 2007/01/20
- Re: How to apply a minor mode to all buffers, Mathias Dahl, 2007/01/22
- Message not available
- Re: How to apply a minor mode to all buffers, Robert Thorpe, 2007/01/22
- Re: How to apply a minor mode to all buffers,
Eli Zaretskii <=
- Message not available
- Re: How to apply a minor mode to all buffers, Robert Thorpe, 2007/01/23
- Re: How to apply a minor mode to all buffers, Eli Zaretskii, 2007/01/23
- Re: How to apply a minor mode to all buffers, Stefan Monnier, 2007/01/22
- Message not available
- Re: How to apply a minor mode to all buffers, Stefan Monnier, 2007/01/22