unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: "Stefan Monnier" <monnier+gnu/emacs@rum.cs.yale.edu>
Cc: JD Smith <jdsmith@as.arizona.edu>,
	Stefan Monnier <monnier+gnu/emacs@rum.cs.yale.edu>,
	Miles Bader <miles@lsi.nec.co.jp>,
	"Marshall, Simon" <simon.marshall@misys.com>,
	"'Emacs Developers'" <emacs-devel@gnu.org>
Subject: Re: comint read-only prompt
Date: Tue, 20 Aug 2002 12:14:29 -0400	[thread overview]
Message-ID: <200208201614.g7KGETp18927@rum.cs.yale.edu> (raw)
In-Reply-To: 20020819234511.GD3763@gnu.org

> 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	other threads:[~2002-08-20 16:14 UTC|newest]

Thread overview: 36+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-08-19  8:24 comint read-only prompt Marshall, Simon
2002-08-19 10:59 ` Miles Bader
2002-08-19 15:40   ` Stefan Monnier
2002-08-19 15:57     ` JD Smith
2002-08-19 23:45       ` Miles Bader
2002-08-20 16:14         ` Stefan Monnier [this message]
2002-08-21  0:12           ` Richard Stallman
2002-08-21 15:06             ` Stefan Monnier
2002-08-21  0:11         ` Richard Stallman
2002-08-20 17:21       ` Richard Stallman
2002-08-20 18:03         ` JD Smith
2002-08-20 21:17           ` Miles Bader
2002-08-20 22:01             ` JD Smith
2002-08-21  0:18               ` Miles Bader
2002-08-21  1:24                 ` JD Smith
2002-08-21  1:36                   ` Miles Bader
2002-08-21 15:28                     ` Stefan Monnier
2002-08-20 18:36         ` Luc Teirlinck
2002-08-20 21:12         ` Miles Bader
2002-08-20 23:23           ` Kim F. Storm
2002-08-21 11:05         ` Kai Großjohann
2002-08-22  1:57           ` Richard Stallman
2002-08-22  2:21             ` JD Smith
2002-08-22  2:35             ` Miles Bader
2002-08-24  2:33               ` Richard Stallman
2002-08-19 23:41     ` Miles Bader
2002-08-19 20:46 ` Richard Stallman
2002-08-21  0:23   ` Noah Friedman
2002-08-21  1:21     ` Miles Bader
2002-08-21  1:38       ` Miles Bader
2002-08-21  1:32     ` JD Smith
2002-08-21 15:23       ` Stefan Monnier
2002-08-22  1:21         ` Miles Bader
2002-08-22  7:57         ` Eli Zaretskii
2002-08-24  2:32           ` Richard Stallman
2002-08-21  0:23   ` Noah Friedman

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=200208201614.g7KGETp18927@rum.cs.yale.edu \
    --to=monnier+gnu/emacs@rum.cs.yale.edu \
    --cc=emacs-devel@gnu.org \
    --cc=jdsmith@as.arizona.edu \
    --cc=miles@lsi.nec.co.jp \
    --cc=simon.marshall@misys.com \
    /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).