From: Richard Stallman <rms@gnu.org>
Cc: teirllm@dms.auburn.edu, monnier+gnu/emacs@rum.cs.yale.edu,
miles@lsi.nec.co.jp, Kai.Grossjohann@CS.Uni-Dortmund.DE,
emacs-devel@gnu.org
Subject: Re: comint-carriage-motion causes severe problems.
Date: Thu, 4 Jul 2002 12:24:08 -0600 (MDT) [thread overview]
Message-ID: <200207041824.g64IO8i06426@aztec.santafe.edu> (raw)
In-Reply-To: <200207032111.g63LBAv25925@rum.cs.yale.edu> (monnier+gnu/emacs@rum.cs.yale.edu)
Actually, there are some unclear semantics when you do things like
(add-hook 'foo 'bar)
(add-hook 'foo 'bar nil 'local)
(remove-hook 'foo 'bar 'local)
The current code removes `bar' from the local value of `foo' but
leaves it in the global one. My new code does the same and only a second
(remove-hook 'foo 'bar 'local) will add a (not . bar) such that the
global setting is overridden.
This is semantically incoherent. It is very dangerous for two
identical calls to remove-hook to be different in effect from one.
I am starting to believe that it might be good to keep the present
behavior of remove-hook, unless the third argument is the symbol
'override, in which case it would override any function later in the
hook, including global functions.
That gives a clean and predictable semantics for remove-hook.
However, this leaves the question of how you remove one of these
overrides. Related question: how should add-hook deal with them?
This relates to another question: what should (remove-hook 'foo 'bar
'local) do after (remove-hook 'foo 'bar 'override)? Nothing? I don't
think that is right, because doing nothing would leave the override
marker in place; the state for `bar' would not be "no local hook".
There are three states that the local hook list can have, for any
function `bar':
1. Present
2. Absent
3. Overridden.
We could say that (add-hook 'foo 'bar 'local) puts it in state 1,
(remove-hook 'foo 'bar 'local) puts it in state 2, and (remove-hook
'foo 'bar 'override) puts it in state 3. None of them changes the
global hook list, and global use of add-hook or remove-hook does not
change the local hook list. Now we have fully coherent semantics
for both add-hook and remove-hook.
However, I think it is even cleaner to regard (not . bar) as a kind
of local hook value in its own right, and use add-hook to add that
and remove-hook to remove it.
(add-hook 'foo 'bar 'local) puts it in state 1
(remove-hook 'foo 'bar 'local) puts it in state 2
(add-hook 'foo '(not . bar) 'local) puts it in state 3
(remove-hook 'foo '(not . bar) 'local) puts it in state 2
so this is equivalent to (remove-hook 'foo 'bar 'local).
This is a coherent feature. Is it really useful? I am not sure.
The reason is, it is wrong to call comint-carriage-motion by adding it
globally and unconditionally to the hook. When a function should be
called unconditionally, it should be called explicitly from the code,
not thru a hook.
Once this change is made, the way to fix the present problem is for
ielm to bind a variable that tells the code not to call
comint-carriage-motion, or tells comint-carriage-motion to do nothing.
The hook override feature won't be used here.
Do we have any other occasion to use the hook override feature?
Is that a useful feature?
next prev parent reply other threads:[~2002-07-04 18:24 UTC|newest]
Thread overview: 38+ messages / expand[flat|nested] mbox.gz Atom feed top
2002-07-02 0:35 comint-carriage-motion causes severe problems Luc Teirlinck
2002-07-02 1:32 ` Miles Bader
2002-07-02 8:33 ` Kai Großjohann
2002-07-02 8:46 ` Miles Bader
2002-07-02 15:34 ` Stefan Monnier
2002-07-02 16:18 ` Luc Teirlinck
2002-07-03 20:57 ` Richard Stallman
2002-07-03 21:11 ` Stefan Monnier
2002-07-04 1:18 ` Luc Teirlinck
2002-07-04 15:43 ` Stefan Monnier
2002-07-04 16:56 ` Luc Teirlinck
2002-07-04 17:04 ` Stefan Monnier
2002-07-04 17:18 ` Kai Großjohann
2002-07-04 17:31 ` Luc Teirlinck
2002-07-04 18:21 ` Miles Bader
2002-07-04 1:38 ` Luc Teirlinck
2002-07-04 3:49 ` Luc Teirlinck
[not found] ` <200207040337.WAA22499@eel.dms.auburn.edu>
[not found] ` <200207041531.g64FVRp29714@rum.cs.yale.edu>
2002-07-04 16:07 ` Luc Teirlinck
2002-07-04 18:24 ` Richard Stallman [this message]
2002-07-04 20:19 ` Luc Teirlinck
2002-07-05 22:07 ` Richard Stallman
2002-07-05 0:47 ` Luc Teirlinck
2002-07-05 22:07 ` Richard Stallman
2002-08-07 1:16 ` Luc Teirlinck
2002-08-07 20:58 ` Richard Stallman
2002-08-07 22:19 ` Luc Teirlinck
2002-08-07 22:27 ` Luc Teirlinck
2002-08-09 2:47 ` Richard Stallman
2002-08-18 2:39 ` Luc Teirlinck
2002-08-18 3:01 ` Luc Teirlinck
2002-08-18 3:59 ` Luc Teirlinck
2002-08-19 5:04 ` Miles Bader
2002-07-02 17:08 ` Luc Teirlinck
2002-07-02 19:45 ` Richard Stallman
2002-07-03 0:02 ` Miles Bader
2002-07-03 0:06 ` Miles Bader
2002-07-04 7:07 ` Richard Stallman
2002-07-03 1:51 ` Luc Teirlinck
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=200207041824.g64IO8i06426@aztec.santafe.edu \
--to=rms@gnu.org \
--cc=Kai.Grossjohann@CS.Uni-Dortmund.DE \
--cc=emacs-devel@gnu.org \
--cc=miles@lsi.nec.co.jp \
--cc=monnier+gnu/emacs@rum.cs.yale.edu \
--cc=teirllm@dms.auburn.edu \
/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).