From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: "Stuart D. Herring" Newsgroups: gmane.emacs.devel Subject: Re: turn-on-*-mode Date: Tue, 16 May 2006 11:35:09 -0700 (PDT) Message-ID: <45658.128.165.123.132.1147804509.squirrel@webmail.lanl.gov> References: <4469D3B6.2040904@student.lu.se> <85odxyugsx.fsf@lola.goethe.zz> Reply-To: herring@lanl.gov NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain;charset=iso-8859-1 Content-Transfer-Encoding: 8bit X-Trace: sea.gmane.org 1147804567 21453 80.91.229.2 (16 May 2006 18:36:07 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Tue, 16 May 2006 18:36:07 +0000 (UTC) Cc: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Tue May 16 20:36:01 2006 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1Fg4OO-000699-Pp for ged-emacs-devel@m.gmane.org; Tue, 16 May 2006 20:35:37 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Fg4OO-0005IJ-Sv for ged-emacs-devel@m.gmane.org; Tue, 16 May 2006 14:35:36 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Fg4OA-0005Gh-5G for emacs-devel@gnu.org; Tue, 16 May 2006 14:35:22 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1Fg4O8-0005GI-Bd for emacs-devel@gnu.org; Tue, 16 May 2006 14:35:21 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Fg4O8-0005GF-7K for emacs-devel@gnu.org; Tue, 16 May 2006 14:35:20 -0400 Original-Received: from [192.65.95.54] (helo=mailwasher-b.lanl.gov) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA:32) (Exim 4.52) id 1Fg4Qm-0006wq-6e; Tue, 16 May 2006 14:38:04 -0400 Original-Received: from mailrelay3.lanl.gov (mailrelay3.lanl.gov [128.165.4.104]) by mailwasher-b.lanl.gov (8.12.11.20060308/8.12.11/(ccn-5)) with ESMTP id k4GIZBv5014356; Tue, 16 May 2006 12:35:11 -0600 Original-Received: from webmail1.lanl.gov (webmail1.lanl.gov [128.165.4.106]) by mailrelay3.lanl.gov (8.12.11.20060308/8.12.11/(ccn-5)) with ESMTP id k4GIZ9Bb020393; Tue, 16 May 2006 12:35:10 -0600 Original-Received: from webmail1.lanl.gov (localhost.localdomain [127.0.0.1]) by webmail1.lanl.gov (8.12.11.20060308/8.12.11) with ESMTP id k4GIZ9rX018078; Tue, 16 May 2006 12:35:09 -0600 Original-Received: (from apache@localhost) by webmail1.lanl.gov (8.12.11.20060308/8.12.11/Submit) id k4GIZ9qt018076; Tue, 16 May 2006 11:35:09 -0700 X-Authentication-Warning: webmail1.lanl.gov: apache set sender to herring@lanl.gov using -f Original-Received: from 128.165.123.132 (SquirrelMail authenticated user 196434); by webmail.lanl.gov with HTTP; Tue, 16 May 2006 11:35:09 -0700 (PDT) In-Reply-To: <85odxyugsx.fsf@lola.goethe.zz> Original-To: "David Kastrup" User-Agent: SquirrelMail/1.4.3a-11.EL3 X-Mailer: SquirrelMail/1.4.3a-11.EL3 X-Priority: 3 (Normal) Importance: Normal X-PMX-Version: 4.7.1.128075 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:54599 Archived-At: > 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.