[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: comint-carriage-motion causes severe problems.
From: |
Stefan Monnier |
Subject: |
Re: comint-carriage-motion causes severe problems. |
Date: |
Tue, 02 Jul 2002 11:34:36 -0400 |
> address@hidden (Kai Großjohann) writes:
> > It seems, however, that M-x ielm RET should lead to a buffer where
> > comint-carriage-motion is off. Is there a way to do that?
>
> I guess it could be done by having ielm make
> `comint-output-filter-functions' a buffer-local copy of the global value,
> excluding `comint-carriage-motion'.
But we need to be careful that this local copy does not contain t.
And if the global hook is modified afterwards, the local copy will not
see the change.
> `remove-hook' actually contains commented-out code that would do this sort
> of thing more elegantly, by adding a local `not'-hook that would
> effectively override a global hook. I don't know why that code is
> commented out; perhaps it doesn't work.
Because it requires support in the C code that I have not installed (yet)
because I haven't felt like arguing about its usefulness.
Stefan
Index: eval.c
===================================================================
RCS file: /cvsroot/emacs/emacs/src/eval.c,v
retrieving revision 1.189
diff -u -r1.189 eval.c
--- eval.c 28 May 2002 20:24:32 -0000 1.189
+++ eval.c 2 Jul 2002 15:30:55 -0000
@@ -90,7 +90,7 @@
Lisp_Object Qautoload, Qmacro, Qexit, Qinteractive, Qcommandp, Qdefun;
Lisp_Object Qinhibit_quit, Vinhibit_quit, Vquit_flag;
Lisp_Object Qand_rest, Qand_optional;
-Lisp_Object Qdebug_on_error;
+Lisp_Object Qdebug_on_error, Qnot;
Lisp_Object Qdeclare;
/* This holds either the symbol `run-hooks' or nil.
@@ -2338,7 +2366,8 @@
{
Lisp_Object sym, val, ret;
Lisp_Object globals;
- struct gcpro gcpro1, gcpro2, gcpro3;
+ Lisp_Object negatives = Qnil;
+ struct gcpro gcpro1, gcpro2, gcpro3, gcpro4;
/* If we are dying or still initializing,
don't do anything--it would probably crash if we tried. */
@@ -2359,7 +2388,7 @@
else
{
globals = Qnil;
- GCPRO3 (sym, val, globals);
+ GCPRO4 (sym, val, globals, negatives);
for (;
CONSP (val) && ((cond == to_completion)
@@ -2381,10 +2410,15 @@
args[0] = XCAR (globals);
/* In a global value, t should not occur. If it does, we
must ignore it to avoid an endless loop. */
- if (!EQ (args[0], Qt))
+ if (!(EQ (args[0], Qt))
+ && NILP (Fmember (args[0], negatives)))
ret = Ffuncall (nargs, args);
}
}
+ else if (CONSP (XCAR (val)) && (EQ (XCAR (XCAR (val)), Qnot)))
+ /* (not . FUNCTION) indicates that any subsequent FUNCTION
+ should be ignored. */
+ negatives = Fcons (XCDR (XCAR (val)), negatives);
else
{
args[0] = XCAR (val);
@@ -3276,6 +3310,9 @@
Qdebug_on_error = intern ("debug-on-error");
staticpro (&Qdebug_on_error);
+ Qnot = intern ("not");
+ staticpro (&Qnot);
+
Qmacro = intern ("macro");
staticpro (&Qmacro);
Index: subr.el
===================================================================
RCS file: /cvsroot/emacs/emacs/lisp/subr.el,v
retrieving revision 1.311
diff -u -r1.311 subr.el
--- subr.el 27 Jun 2002 16:08:56 -0000 1.311
+++ subr.el 2 Jul 2002 15:32:59 -0000
@@ -58,6 +58,17 @@
(defalias 'not 'null)
+(if (not (fboundp 'while))
+ (defmacro while (test &rest body)
+ "Like `until' except TEST is negated."
+ `(progn (until (not ,test) ,@body) nil)))
+(if (not (fboundp 'until))
+ (defmacro until (test &rest body)
+ "Like `while' except TEST is negated and the form returns non-nil."
+ `(let (-until-res)
+ (while (not (setq -until-res ,test)) ,@body)
+ -until-res)))
+
(defmacro lambda (&rest cdr)
"Return a lambda expression.
A call of the form (lambda ARGS DOCSTRING INTERACTIVE BODY) is
@@ -833,9 +844,13 @@
(if (equal hook-value function) (setq hook-value nil))
(setq hook-value (delete function (copy-sequence hook-value))))
;; If the function is on the global hook, we need to shadow it locally
- ;;(when (and local (member function (default-value hook))
- ;; (not (member (cons 'not function) hook-value)))
- ;; (push (cons 'not function) hook-value))
+ (when (and local (local-variable-if-set-p hook)
+ (member function
+ (let ((val (default-value hook)))
+ (if (or (not (listp val)) (functionp val))
+ (list val) val)))
+ (not (member (cons 'not function) hook-value)))
+ (push (cons 'not function) hook-value))
;; Set the actual variable
(if (not local)
(set-default hook hook-value)
- comint-carriage-motion causes severe problems., Luc Teirlinck, 2002/07/01
- Re: comint-carriage-motion causes severe problems., Miles Bader, 2002/07/01
- Re: comint-carriage-motion causes severe problems., Kai Großjohann, 2002/07/02
- Re: comint-carriage-motion causes severe problems., Miles Bader, 2002/07/02
- Re: comint-carriage-motion causes severe problems.,
Stefan Monnier <=
- Re: comint-carriage-motion causes severe problems., Luc Teirlinck, 2002/07/02
- Re: comint-carriage-motion causes severe problems., Richard Stallman, 2002/07/03
- Re: comint-carriage-motion causes severe problems., Stefan Monnier, 2002/07/03
- Re: comint-carriage-motion causes severe problems., Luc Teirlinck, 2002/07/03
- Re: comint-carriage-motion causes severe problems., Stefan Monnier, 2002/07/04
- Re: comint-carriage-motion causes severe problems., Luc Teirlinck, 2002/07/04
- Re: comint-carriage-motion causes severe problems., Stefan Monnier, 2002/07/04
- Re: comint-carriage-motion causes severe problems., Kai Großjohann, 2002/07/04
- Re: comint-carriage-motion causes severe problems., Luc Teirlinck, 2002/07/04
- Re: comint-carriage-motion causes severe problems., Miles Bader, 2002/07/04