emacs-devel
[Top][All Lists]
Advanced

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

Re: turn-on-*-mode


From: Stuart D. Herring
Subject: Re: turn-on-*-mode
Date: Tue, 16 May 2006 11:35:09 -0700 (PDT)
User-agent: SquirrelMail/1.4.3a-11.EL3

> Or maybe we should have something like
>
> (defun add-hook-turn-on (hook mode)
>   (add-hook hook `(lambda nil (,mode 1))))
>
> So that one can write
> (add-hook-turn-on 'text-mode-hook 'auto-fill-mode)

Or (somewhat tongue-in-cheek) have
(defun curry (func &rest args)
  `(lambda (&rest args2) (apply ',func (append ',args args2))))

So that one can write
(add-hook 'text-mode-hook (curry 'auto-fill-mode 1))
(add-hook 'makefile-mode-hook (curry 'auto-fill-mode -1))
(add-hook 'dired-after-readin-hook (curry 'message "T%ss i%sge%sng%sly!"
"hi" "s " "tti" " sil"))
(add-hook 'pre-command-hook
          (let* ((y (curry 'mapc (curry 'apply 'remove-hook)
                           '((pre-command-hook x) (post-command-hook y))))
                 (x (curry 'add-hook 'post-command-hook y)))
            (funcall #0=(lambda (c) (when (consp c)
                                      (funcall #0# (car c))
                                      (funcall #0# (cdr c))
                                      (if (memq (car c) '(x y))
                                          (setcar c (eval (car c)))))) x)
            x))

Too bad there's no IOLFC, eh?

Davis

-- 
This product is sold by volume, not by mass.  If it appears too dense or
too sparse, it is because mass-energy conversion has occurred during
shipping.




reply via email to

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