From: martin rudalics <rudalics@gmx.at>
To: Stefan Monnier <monnier@iro.umontreal.ca>
Cc: emacs-devel <emacs-devel@gnu.org>
Subject: Re: define-derived-mode runs parent mode hook after evaluating body
Date: Sat, 21 Jul 2007 11:21:02 +0200 [thread overview]
Message-ID: <46A1CFFE.7010405@gmx.at> (raw)
In-Reply-To: <jwv4pjzys3a.fsf-monnier+emacs@gnu.org>
>>(define-derived-mode change-log-mode text-mode "Change Log"
>> "..."
>> (setq left-margin 8
>> fill-column 74
>> ...
>
>
>>...but in my .emacs I have:
>
>
>>(add-hook
>> 'text-mode-hook
>> '(lambda () (setq fill-column 72)))
>
>
> The problem here is that we use text-mode both as a parent and as a real
> major-mode, so you can't change "text-mode" without changing all
> its derivatives.
>
> Maybe the real text-mode should be renamed to plain-text-mode (and derive
>>from text-mode, of course).
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))))
but this strikes me as inconvenient, ugly, and maybe faulty.
next prev parent reply other threads:[~2007-07-21 9:21 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-07-20 9:00 define-derived-mode runs parent mode hook after evaluating body martin rudalics
2007-07-20 16:09 ` Stefan Monnier
2007-07-21 16:54 ` Richard Stallman
2007-07-22 3:08 ` Stefan Monnier
2007-07-22 18:37 ` Richard Stallman
2007-07-20 16:11 ` Stefan Monnier
2007-07-21 9:21 ` martin rudalics [this message]
2007-07-22 18:36 ` Stefan Monnier
2007-07-22 21:22 ` martin rudalics
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=46A1CFFE.7010405@gmx.at \
--to=rudalics@gmx.at \
--cc=emacs-devel@gnu.org \
--cc=monnier@iro.umontreal.ca \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).