From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.devel Subject: Re: define-derived-mode runs parent mode hook after evaluating body Date: Sun, 22 Jul 2007 14:36:40 -0400 Message-ID: References: <46A079C2.4000802@gmx.at> <46A1CFFE.7010405@gmx.at> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1185129684 25887 80.91.229.12 (22 Jul 2007 18:41:24 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Sun, 22 Jul 2007 18:41:24 +0000 (UTC) Cc: emacs-devel To: martin rudalics Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sun Jul 22 20:41:21 2007 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1ICgMn-0002nf-Pu for ged-emacs-devel@m.gmane.org; Sun, 22 Jul 2007 20:41:18 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1ICgMn-0007HV-CJ for ged-emacs-devel@m.gmane.org; Sun, 22 Jul 2007 14:41:17 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1ICgKn-00068M-Bo for emacs-devel@gnu.org; Sun, 22 Jul 2007 14:39:13 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1ICgKk-00067F-UM for emacs-devel@gnu.org; Sun, 22 Jul 2007 14:39:12 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1ICgKk-000679-M4 for emacs-devel@gnu.org; Sun, 22 Jul 2007 14:39:10 -0400 Original-Received: from tomts43.bellnexxia.net ([209.226.175.110] helo=tomts43-srv.bellnexxia.net) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1ICgKk-0005f0-Av for emacs-devel@gnu.org; Sun, 22 Jul 2007 14:39:10 -0400 Original-Received: from pastel.home ([70.55.146.210]) by tomts43-srv.bellnexxia.net (InterMail vM.5.01.06.13 201-253-122-130-113-20050324) with ESMTP id <20070722183909.HNZE26794.tomts43-srv.bellnexxia.net@pastel.home> for ; Sun, 22 Jul 2007 14:39:09 -0400 Original-Received: by pastel.home (Postfix, from userid 20848) id CFC9A8036; Sun, 22 Jul 2007 14:36:40 -0400 (EDT) In-Reply-To: <46A1CFFE.7010405@gmx.at> (martin rudalics's message of "Sat\, 21 Jul 2007 11\:21\:02 +0200") User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.1.50 (gnu/linux) X-detected-kernel: Solaris 8 (1) 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:75316 Archived-At: > Which would solve this special case. In general, however, I want to add > something to a parent-mode hook and pass it on to its derivatives unless > the derivatives have their own opinion about that. Well, I could do > (add-hook > 'text-mode-hook > '(lambda () > (unless (and (local-variable-p 'fill-column) > (not (equal fill-column > (default-value 'fill-column)))) > (setq fill-column 72)))) Other than spurious quote in front of the lambda, this looks fine to me. More specifically it says in Elisp basically the same as what you said above in English, so it seems to be The Right Thing. > but this strikes me as inconvenient, ugly, and maybe faulty. The problem is that if what you want to do is "always add 4 to fill-column", the current behavior allows you to do that whereas your suggestion to run the parent mode early would preclude it. Stefan