emacs-devel
[Top][All Lists]
Advanced

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

Re: comint read-only prompt


From: Stefan Monnier
Subject: Re: comint read-only prompt
Date: Tue, 20 Aug 2002 12:14:29 -0400

> On Mon, Aug 19, 2002 at 08:57:59AM -0700, JD Smith wrote:
> > Another option I tried is adding, at the time of overlay move, a
> > read-only text property (and don't forget rear-nonsticky).  I reasoned
> > that this is perfectly acceptable given the new use of text properties
> > in CVS comint.  I didn't like the error message as much.
> 
> Given how often this sort of complaint turns up (that a read-only property is
> a good solution except for the error message), how about this idea: If a
> signalling an error due to a read-only property, if the property's value is a
> string, use that as the error message rather than the default.

I can only agree given that I've thought about the same thing a few
months back and even did some attempt at coding; see patch below.
The print_error_message needs to be updated as well, but I didn't
go that far.


        Stefan


Index: textprop.c
===================================================================
RCS file: /cvsroot/emacs/emacs/src/textprop.c,v
retrieving revision 1.132
diff -u -r1.132 textprop.c
--- textprop.c  16 Jul 2002 17:37:14 -0000      1.132
+++ textprop.c  20 Aug 2002 16:10:19 -0000
@@ -83,9 +83,10 @@
    to capture that error in GDB by putting a breakpoint on it.  */
 
 static void
-text_read_only ()
+text_read_only (propval)
+     Lisp_Object propval;
 {
-  Fsignal (Qtext_read_only, Qnil);
+  Fsignal (Qtext_read_only, STRINGP (propval) ? Fcons (propval, Qnil) : Qnil);
 }
 
 
@@ -2051,7 +2052,7 @@
                      if (TMEM (Qread_only, tem)
                          || (NILP (Fplist_get (i->plist, Qread_only))
                              && TMEM (Qcategory, tem)))
-                       text_read_only ();
+                       text_read_only (after);
                    }
                }
 
@@ -2071,7 +2072,7 @@
                      if (! TMEM (Qread_only, tem)
                          && (! NILP (Fplist_get (prev->plist,Qread_only))
                              || ! TMEM (Qcategory, tem)))
-                       text_read_only ();
+                       text_read_only (before);
                    }
                }
            }
@@ -2090,13 +2091,13 @@
                  if (TMEM (Qread_only, tem)
                      || (NILP (Fplist_get (i->plist, Qread_only))
                          && TMEM (Qcategory, tem)))
-                   text_read_only ();
+                   text_read_only (after);
 
                  tem = textget (prev->plist, Qrear_nonsticky);
                  if (! TMEM (Qread_only, tem)
                      && (! NILP (Fplist_get (prev->plist, Qread_only))
                          || ! TMEM (Qcategory, tem)))
-                   text_read_only ();
+                   text_read_only (after);
                }
            }
        }
@@ -2118,7 +2119,7 @@
       do
        {
          if (! INTERVAL_WRITABLE_P (i))
-           text_read_only ();
+           text_read_only (textget (i->plist, Qread_only));
 
          if (!inhibit_modification_hooks)
            {





reply via email to

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