From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: "Stefan Monnier" Newsgroups: gmane.emacs.devel Subject: Re: comint-carriage-motion causes severe problems. Date: Tue, 02 Jul 2002 11:34:36 -0400 Sender: emacs-devel-admin@gnu.org Message-ID: <200207021534.g62FYao17897@rum.cs.yale.edu> References: <200207020035.TAA19789@eel.dms.auburn.edu> NNTP-Posting-Host: localhost.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable X-Trace: main.gmane.org 1025624154 5658 127.0.0.1 (2 Jul 2002 15:35:54 GMT) X-Complaints-To: usenet@main.gmane.org NNTP-Posting-Date: Tue, 2 Jul 2002 15:35:54 +0000 (UTC) Cc: Kai.Grossjohann@CS.Uni-Dortmund.DE (Kai =?iso-8859-15?q?Gro=DFjohann?=), Luc Teirlinck , emacs-devel@gnu.org Return-path: Original-Received: from quimby.gnus.org ([80.91.224.244]) by main.gmane.org with esmtp (Exim 3.33 #1 (Debian)) id 17PPh4-0001T9-00 for ; Tue, 02 Jul 2002 17:35:54 +0200 Original-Received: from fencepost.gnu.org ([199.232.76.164]) by quimby.gnus.org with esmtp (Exim 3.12 #1 (Debian)) id 17PPm9-0005jR-00 for ; Tue, 02 Jul 2002 17:41:09 +0200 Original-Received: from localhost ([127.0.0.1] helo=fencepost.gnu.org) by fencepost.gnu.org with esmtp (Exim 3.34 #1 (Debian)) id 17PPhL-0000we-00; Tue, 02 Jul 2002 11:36:11 -0400 Original-Received: from rum.cs.yale.edu ([128.36.229.169]) by fencepost.gnu.org with esmtp (Exim 3.34 #1 (Debian)) id 17PPg2-0000n6-00 for ; Tue, 02 Jul 2002 11:34:50 -0400 Original-Received: (from monnier@localhost) by rum.cs.yale.edu (8.11.6/8.11.6) id g62FYao17897; Tue, 2 Jul 2002 11:34:36 -0400 X-Mailer: exmh version 2.4 06/23/2000 with nmh-1.0.4 Original-To: Miles Bader X-MIME-Autoconverted: from 8bit to quoted-printable by rum.cs.yale.edu id g62FYao17897 Errors-To: emacs-devel-admin@gnu.org X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.0.11 Precedence: bulk List-Help: List-Post: List-Subscribe: , List-Id: Emacs development discussions. List-Unsubscribe: , List-Archive: Xref: main.gmane.org gmane.emacs.devel:5324 X-Report-Spam: http://spam.gmane.org/gmane.emacs.devel:5324 > Kai.Grossjohann@CS.Uni-Dortmund.DE (Kai Gro=DFjohann) 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? >=20 > I guess it could be done by having ielm make > `comint-output-filter-functions' a buffer-local copy of the global valu= e, > 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 s= ort > 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 =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D 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; =20 /* 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 =3D Qnil; + struct gcpro gcpro1, gcpro2, gcpro3, gcpro4; =20 /* If we are dying or still initializing, don't do anything--it would probably crash if we tried. */ @@ -2359,7 +2388,7 @@ else { globals =3D Qnil; - GCPRO3 (sym, val, globals); + GCPRO4 (sym, val, globals, negatives); =20 for (; CONSP (val) && ((cond =3D=3D to_completion) @@ -2381,10 +2410,15 @@ args[0] =3D 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 =3D Ffuncall (nargs, args); } } + else if (CONSP (XCAR (val)) && (EQ (XCAR (XCAR (val)), Qnot))) + /* (not . FUNCTION) indicates that any subsequent FUNCTION + should be ignored. */ + negatives =3D Fcons (XCDR (XCAR (val)), negatives); else { args[0] =3D XCAR (val); @@ -3276,6 +3310,9 @@ Qdebug_on_error =3D intern ("debug-on-error"); staticpro (&Qdebug_on_error); =20 + Qnot =3D intern ("not"); + staticpro (&Qnot); + Qmacro =3D intern ("macro"); staticpro (&Qmacro); =20 Index: subr.el =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D 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 @@ =20 (defalias 'not 'null) =20 +(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 local= ly - ;;(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)