unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: "Stefan Monnier" <monnier+gnu/emacs@rum.cs.yale.edu>
Cc: Kai.Grossjohann@CS.Uni-Dortmund.DE (Kai Großjohann),
	"Luc Teirlinck" <teirllm@dms.auburn.edu>,
	emacs-devel@gnu.org
Subject: Re: comint-carriage-motion causes severe problems.
Date: Tue, 02 Jul 2002 11:34:36 -0400	[thread overview]
Message-ID: <200207021534.g62FYao17897@rum.cs.yale.edu> (raw)
In-Reply-To: buo65zysej1.fsf@mcspd15.ucom.lsi.nec.co.jp

> Kai.Grossjohann@CS.Uni-Dortmund.DE (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)

  reply	other threads:[~2002-07-02 15:34 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 [this message]
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
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=200207021534.g62FYao17897@rum.cs.yale.edu \
    --to=monnier+gnu/emacs@rum.cs.yale.edu \
    --cc=Kai.Grossjohann@CS.Uni-Dortmund.DE \
    --cc=emacs-devel@gnu.org \
    --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).