help-gnu-emacs
[Top][All Lists]
Advanced

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

Re: Compacting calls to add-hook


From: weber
Subject: Re: Compacting calls to add-hook
Date: Thu, 3 Jul 2008 08:55:15 -0700 (PDT)
User-agent: G2/1.0

On Jul 3, 11:55 am, Nordlöw <address@hidden> wrote:
> Can we make the following repetitive code more compact (perhaps using
> a map-function)?:
>
>     (add-hook 'c-mode-hook '(lambda () (outline-minor-mode t)))
>     (add-hook 'c++-mode-hook '(lambda () (outline-minor-mode t)))
>     (add-hook 'text-mode-hook '(lambda () (outline-minor-mode t)))
>     (add-hook 'emacs-lisp-mode-hook '(lambda () (outline-minor-mode
> t)))
>     (add-hook 'sh-mode-hook '(lambda () (outline-minor-mode t)))2
>     (add-hook 'octave-mode-hook '(lambda () (outline-minor-mode t)))
>     (add-hook 'matlab-mode-hook '(lambda () (outline-minor-mode t)))
>     (add-hook 'help-mode-hook '(lambda () (outline-minor-mode t)))
>     (add-hook 'info-mode-hook '(lambda () (outline-minor-mode t)))
>
> /Nordlöw

You mean something like this ?

(mapc (lambda (x) (add-hook x (lambda () (outline-minor-mode t))))
          '(vhdl-mode-hook lua-mode-hook))

I'm curious about how you're using outline-minor-mode with all those
modes.
Cheers,
weber


reply via email to

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