[Top][All Lists]

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

Re: comint-carriage-motion causes severe problems.

From: Luc Teirlinck
Subject: Re: comint-carriage-motion causes severe problems.
Date: Thu, 4 Jul 2002 15:19:30 -0500 (CDT)

Richard Stallman wrote:
   This is semantically incoherent.  It is very dangerous for two
   identical calls to remove-hook to be different in effect from one.

Indeed, what happens, for instance, if a file containing such a call gets
accidentally loaded a second time in the same session?

I start again to lean somewhat towards my original 'override proposal
with Richard's amendments, but I have no strong feelings about that.

Anyway, first we need to decide whether the feature is needed, then we
can worry about its concrete implementation.  I personally do not feel
like further discussing implementation before discussing desirability,
unless desirability depends on implementation.

First question:

What are hooks meant for?

>From the Emacs Lisp manual:

Emacs provides hooks for the sake of customization.  Most often hooks
are set in the init file, but Lisp programs can set them also.

What Lisp programs are meant?

If these are user files or external packages or specialized very
optional packages and no major Emacs file is ever supposed to add
functions to a global hook, then indeed the new feature is not needed.

But if so, one has the problem that that convention is not followed in
the actual Emacs code.  In a previous message I gave an example of how
functions get into global hooks just by looking at documentation.

Given the fact that this is the actual behavior, I believe that we
need some form of the feature.  Let us first see whether or not we can
agree on that and then we can discuss implementation details.
   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.

I do not believe comint-carriage-motion should be called completely
unconditionally, not even in shell buffers, but I could temporarily
turn it off, using the variable in question, in shell or inferior Lisp
buffers anyway, so that is no problem.

But plenty of Emacs code would need to be changed if the above
principles should be followed rigorously everywhere.  Moreover, we
could wind up with plenty of turn-this-function-off variables.  Does
comint-postoutput-scroll-to-bottom belong in the hook or should it too
be called explicitly from code?  Is it OK for customize-browse to
unconditionally add ansi-color-process-output to the same global hook,
just because I happen to consult documentation?  (I do not mind about
ansi-color-process-output itself, it causes no harm, but it is a good

I agree that the turn-off variable solution provides an adequate
solution to the comint-ielm problem.  The new feature is more
convenient in that it only requires changes in the local specialized
package rather than in both the specialized and the general package.
However, it would make no sense to add a feature just for this one
problem, which can indeed easily be solved in other ways.

To summarize, I personally believe that there is a need for this
feature because of the ways hooks are used in practice in Emacs,
regardless of how they are theoretically supposed to be used.



reply via email to

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