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: Juanma Barranquero
Subject: Re: Compacting calls to add-hook
Date: Thu, 3 Jul 2008 18:19:08 +0200

On Thu, Jul 3, 2008 at 16:55, Nordlöw <address@hidden> wrote:
> Can we make the following repetitive code more compact (perhaps using
> a map-function)?:

What do you mean, "can we"? It's trivial:

(let ((func (lambda () (outline-minor-mode 1))))
  (dolist (hook '(c-mode-hook c++-mode-hook text-mode-hook
                  emacs-lisp-mode-hook sh-mode-hook octave-mode-hook
                  matlab-mode-hook help-mode-hook info-mode-hook))
    (add-hook hook func)))

though I'm not sure that's optimizing for readability...

   Juanma

reply via email to

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