GNU bug report logs - #6922
23.1; Setting read-only property in an overlay has no effect

Previous Next

Package: emacs;

Reported by: "MT" <mt_void <at> warpmail.net>

Date: Thu, 26 Aug 2010 14:51:02 UTC

Severity: normal

Found in version 23.1

To reply to this bug, email your comments to 6922 AT debbugs.gnu.org.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org:
bug#6922; Package emacs. (Thu, 26 Aug 2010 14:51:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to "MT" <mt_void <at> warpmail.net>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Thu, 26 Aug 2010 14:51:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: "MT" <mt_void <at> warpmail.net>
To: bug-gnu-emacs <at> gnu.org
Subject: 23.1; Setting read-only property in an overlay has no effect
Date: Thu, 26 Aug 2010 16:46:56 +0200
If I create an overlay in a buffer and set the 'read-only' property to
t, it seems to make no difference, and I can still make changes to the
text in the region where the overlay is active. Setting other overlay
properties does have an effect. Setting the read-only property as a text
property however works as expected.

To demonstrate:
1. Type some text in an empty buffer.
2. (setq overlay (make-overlay 1 10)) ; Creates an overlay in this
buffer between positions 1-10 named 'overlay'
3. (overlay-put overlay 'read-only t) ; Applies the read-only property
to this overlay.
4. Type some characters at the beginning of the buffer. Emacs doesn't
complain that the text is read-only, and text is edited as normal.

I do this instead:
   (put-text-property 1 10 'read-only t) ; Apply the read-only property
   as a text property rather than an overlay
Now if I try typing text in the same region as before, Emacs prevents me
from doing so and says 'Text is read-only'.



In GNU Emacs 23.1.1 (i486-pc-linux-gnu, GTK+ Version 2.20.0)
 of 2010-03-29 on rothera, modified by Debian
Windowing system distributor `The X.Org Foundation', version
11.0.10706000
configured using `configure  '--build=i486-linux-gnu'
'--host=i486-linux-gnu' '--prefix=/usr' '--sharedstatedir=/var/lib'
'--libexecdir=/usr/lib' '--localstatedir=/var/lib'
'--infodir=/usr/share/info' '--mandir=/usr/share/man' '--with-pop=yes'
'--enable-locallisppath=/etc/emacs23:/etc/emacs:/usr/local/share/emacs/23.1/site-lisp:/usr/local/share/emacs/site-lisp:/usr/share/emacs/23.1/site-lisp:/usr/share/emacs/site-lisp:/usr/share/emacs/23.1/leim'
'--with-x=yes' '--with-x-toolkit=gtk' '--with-toolkit-scroll-bars'
'build_alias=i486-linux-gnu' 'host_alias=i486-linux-gnu'
'CFLAGS=-DDEBIAN -g -O2' 'LDFLAGS=-g' 'CPPFLAGS=''

Important settings:
  value of $LC_ALL: nil
  value of $LC_COLLATE: nil
  value of $LC_CTYPE: nil
  value of $LC_MESSAGES: nil
  value of $LC_MONETARY: nil
  value of $LC_NUMERIC: C
  value of $LC_TIME: en_DK.UTF-8
  value of $LANG: en_IN.UTF-8
  value of $XMODIFIERS: nil
  locale-coding-system: utf-8-unix
  default-enable-multibyte-characters: t

Major mode: Fundamental

Minor modes in effect:
  tooltip-mode: t
  tool-bar-mode: t
  mouse-wheel-mode: t
  menu-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  blink-cursor-mode: t
  global-auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  line-number-mode: t
  transient-mark-mode: t

Recent input:
M-x r e p o r t - e m a c s - b u g <return>

Recent messages:
Setting up ede...
Loading `eieio': old-style backquotes detected!
Setting up ede...done
Setting up eieio...done
Setting up semantic...done
Setting up speedbar...done
Setting up cedet-contrib...done
Loading /etc/emacs/site-start.d/55ecb.el (source)...done
For information about GNU Emacs and the GNU system, type C-h C-a.
/usr/bin/mail is not an executable.  Setting mail-interactive to t.

-- 
http://www.fastmail.fm - Or how I learned to stop worrying and
                          love email again





Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#6922; Package emacs. (Sat, 10 Dec 2011 12:12:01 GMT) Full text and rfc822 format available.

Message #8 received at 6922 <at> debbugs.gnu.org (full text, mbox):

From: Johan Bockgård <bojohan <at> gnu.org>
To: 6922 <at> debbugs.gnu.org
Subject: Re: bug#6922: 23.1;
	Setting read-only property in an overlay has no effect
Date: Sat, 10 Dec 2011 13:09:44 +0100
Cf. the discussion on emacs-devel

http://lists.gnu.org/archive/html/emacs-devel/2008-01/msg01498.html




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#6922; Package emacs. (Mon, 18 Jan 2016 21:31:01 GMT) Full text and rfc822 format available.

Message #11 received at 6922 <at> debbugs.gnu.org (full text, mbox):

From: Marcin Borkowski <mbork <at> mbork.pl>
To: 6922 <at> debbugs.gnu.org
Cc: MT <mt_void <at> warpmail.net>
Subject: Re: bug#6922: 23.1;
 Setting read-only property in an overlay has no effect
Date: Mon, 18 Jan 2016 22:29:53 +0100
For the record, the problem persists in GNU Emacs 25.1.50.1.  Neither
seems there to be any change in the manual (as RMS suggested in the
discussion at
http://lists.gnu.org/archive/html/emacs-devel/2008-01/msg01598.html).

Regards,
Marcin Borkowski


On 2010-08-26, at 17:46, "MT" <mt_void <at> warpmail.net> wrote:

> If I create an overlay in a buffer and set the 'read-only' property to
> t, it seems to make no difference, and I can still make changes to the
> text in the region where the overlay is active. Setting other overlay
> properties does have an effect. Setting the read-only property as a text
> property however works as expected.
>
> To demonstrate:
> 1. Type some text in an empty buffer.
> 2. (setq overlay (make-overlay 1 10)) ; Creates an overlay in this
> buffer between positions 1-10 named 'overlay'
> 3. (overlay-put overlay 'read-only t) ; Applies the read-only property
> to this overlay.
> 4. Type some characters at the beginning of the buffer. Emacs doesn't
> complain that the text is read-only, and text is edited as normal.
>
> I do this instead:
>    (put-text-property 1 10 'read-only t) ; Apply the read-only property
>    as a text property rather than an overlay
> Now if I try typing text in the same region as before, Emacs prevents me
> from doing so and says 'Text is read-only'.
>
>
>
> In GNU Emacs 23.1.1 (i486-pc-linux-gnu, GTK+ Version 2.20.0)
>  of 2010-03-29 on rothera, modified by Debian
> Windowing system distributor `The X.Org Foundation', version
> 11.0.10706000
> configured using `configure  '--build=i486-linux-gnu'
> '--host=i486-linux-gnu' '--prefix=/usr' '--sharedstatedir=/var/lib'
> '--libexecdir=/usr/lib' '--localstatedir=/var/lib'
> '--infodir=/usr/share/info' '--mandir=/usr/share/man' '--with-pop=yes'
> '--enable-locallisppath=/etc/emacs23:/etc/emacs:/usr/local/share/emacs/23.1/site-lisp:/usr/local/share/emacs/site-lisp:/usr/share/emacs/23.1/site-lisp:/usr/share/emacs/site-lisp:/usr/share/emacs/23.1/leim'
> '--with-x=yes' '--with-x-toolkit=gtk' '--with-toolkit-scroll-bars'
> 'build_alias=i486-linux-gnu' 'host_alias=i486-linux-gnu'
> 'CFLAGS=-DDEBIAN -g -O2' 'LDFLAGS=-g' 'CPPFLAGS=''
>
> Important settings:
>   value of $LC_ALL: nil
>   value of $LC_COLLATE: nil
>   value of $LC_CTYPE: nil
>   value of $LC_MESSAGES: nil
>   value of $LC_MONETARY: nil
>   value of $LC_NUMERIC: C
>   value of $LC_TIME: en_DK.UTF-8
>   value of $LANG: en_IN.UTF-8
>   value of $XMODIFIERS: nil
>   locale-coding-system: utf-8-unix
>   default-enable-multibyte-characters: t
>
> Major mode: Fundamental
>
> Minor modes in effect:
>   tooltip-mode: t
>   tool-bar-mode: t
>   mouse-wheel-mode: t
>   menu-bar-mode: t
>   file-name-shadow-mode: t
>   global-font-lock-mode: t
>   blink-cursor-mode: t
>   global-auto-composition-mode: t
>   auto-encryption-mode: t
>   auto-compression-mode: t
>   line-number-mode: t
>   transient-mark-mode: t
>
> Recent input:
> M-x r e p o r t - e m a c s - b u g <return>
>
> Recent messages:
> Setting up ede...
> Loading `eieio': old-style backquotes detected!
> Setting up ede...done
> Setting up eieio...done
> Setting up semantic...done
> Setting up speedbar...done
> Setting up cedet-contrib...done
> Loading /etc/emacs/site-start.d/55ecb.el (source)...done
> For information about GNU Emacs and the GNU system, type C-h C-a.
> /usr/bin/mail is not an executable.  Setting mail-interactive to t.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#6922; Package emacs. (Wed, 20 Jan 2016 18:01:02 GMT) Full text and rfc822 format available.

Message #14 received at 6922 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Marcin Borkowski <mbork <at> mbork.pl>, John Wiegley <johnw <at> gnu.org>,
 Richard Stallman <rms <at> gnu.org>
Cc: mt_void <at> warpmail.net, 6922 <at> debbugs.gnu.org
Subject: Re: bug#6922: 23.1;
 Setting read-only property in an overlay has no effect
Date: Wed, 20 Jan 2016 20:00:01 +0200
> From: Marcin Borkowski <mbork <at> mbork.pl>
> Date: Mon, 18 Jan 2016 22:29:53 +0100
> Cc: MT <mt_void <at> warpmail.net>
> 
> For the record, the problem persists in GNU Emacs 25.1.50.1.  Neither
> seems there to be any change in the manual (as RMS suggested in the
> discussion at
> http://lists.gnu.org/archive/html/emacs-devel/2008-01/msg01598.html).

What is the current consensus? should we adjust the documentation or
fix the code?  John?  Richard?

Which other overlay properties don't cause exactly the same effect as
the corresponding text properties?




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#6922; Package emacs. (Thu, 21 Jan 2016 03:03:01 GMT) Full text and rfc822 format available.

Message #17 received at 6922 <at> debbugs.gnu.org (full text, mbox):

From: Richard Stallman <rms <at> gnu.org>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: mt_void <at> warpmail.net, johnw <at> gnu.org, mbork <at> mbork.pl, 6922 <at> debbugs.gnu.org
Subject: Re: bug#6922: 23.1;
 Setting read-only property in an overlay has no effect
Date: Wed, 20 Jan 2016 22:02:19 -0500
[[[ To any NSA and FBI agents reading my email: please consider    ]]]
[[[ whether defending the US Constitution against all enemies,     ]]]
[[[ foreign or domestic, requires you to follow Snowden's example. ]]]

I have not been looking at this issue.  Do I need to?

-- 
Dr Richard Stallman
President, Free Software Foundation (gnu.org, fsf.org)
Internet Hall-of-Famer (internethalloffame.org)
Skype: No way! See stallman.org/skype.html.





Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#6922; Package emacs. (Thu, 21 Jan 2016 17:34:03 GMT) Full text and rfc822 format available.

Message #20 received at 6922 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: rms <at> gnu.org
Cc: mt_void <at> warpmail.net, johnw <at> gnu.org, mbork <at> mbork.pl, 6922 <at> debbugs.gnu.org
Subject: Re: bug#6922: 23.1;
 Setting read-only property in an overlay has no effect
Date: Thu, 21 Jan 2016 19:33:46 +0200
> From: Richard Stallman <rms <at> gnu.org>
> CC: mbork <at> mbork.pl, johnw <at> gnu.org, 6922 <at> debbugs.gnu.org,
> 	mt_void <at> warpmail.net
> Date: Wed, 20 Jan 2016 22:02:19 -0500
> 
> I have not been looking at this issue.  Do I need to?

There was an old discussion of this

  http://lists.gnu.org/archive/html/emacs-devel/2008-01/msg01598.html

In that discussion, you said:

  It is no accident that read-only works only as a text property.
  It is tested for in textprop.c only as a text property.

  I am not sure that a read-only property on an overlay makes much sense.
  It is a strange thing to do.  So I will fix the documentation.

I'm asking if you still think the same.  If so, perhaps you could try
explaining why you do (in that old discussion, you said it was hard
for you to put this into words).

Thanks.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#6922; Package emacs. (Fri, 22 Jan 2016 03:26:02 GMT) Full text and rfc822 format available.

Message #23 received at 6922 <at> debbugs.gnu.org (full text, mbox):

From: Richard Stallman <rms <at> gnu.org>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: mt_void <at> warpmail.net, johnw <at> gnu.org, mbork <at> mbork.pl, 6922 <at> debbugs.gnu.org
Subject: Re: bug#6922: 23.1;
 Setting read-only property in an overlay has no effect
Date: Thu, 21 Jan 2016 22:24:37 -0500
[[[ To any NSA and FBI agents reading my email: please consider    ]]]
[[[ whether defending the US Constitution against all enemies,     ]]]
[[[ foreign or domestic, requires you to follow Snowden's example. ]]]

    > I am not sure that a read-only property on an overlay makes much sense.
    > It is a strange thing to do.  So I will fix the documentation.

I don't remember why I wrote that.  It was 6 years ago.  My guess is
that I considered it strange to make certain text read-only
temporarily.  If it isn't supposed to change, it should never change,
right?

-- 
Dr Richard Stallman
President, Free Software Foundation (gnu.org, fsf.org)
Internet Hall-of-Famer (internethalloffame.org)
Skype: No way! See stallman.org/skype.html.





Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#6922; Package emacs. (Fri, 22 Jan 2016 07:38:01 GMT) Full text and rfc822 format available.

Message #26 received at 6922 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: rms <at> gnu.org
Cc: mt_void <at> warpmail.net, johnw <at> gnu.org, mbork <at> mbork.pl, 6922 <at> debbugs.gnu.org
Subject: Re: bug#6922: 23.1;
 Setting read-only property in an overlay has no effect
Date: Fri, 22 Jan 2016 09:37:40 +0200
> From: Richard Stallman <rms <at> gnu.org>
> CC: mbork <at> mbork.pl, johnw <at> gnu.org, 6922 <at> debbugs.gnu.org,
> 	mt_void <at> warpmail.net
> Date: Thu, 21 Jan 2016 22:24:37 -0500
> 
>     > I am not sure that a read-only property on an overlay makes much sense.
>     > It is a strange thing to do.  So I will fix the documentation.
> 
> I don't remember why I wrote that.  It was 6 years ago.  My guess is
> that I considered it strange to make certain text read-only
> temporarily.  If it isn't supposed to change, it should never change,
> right?

I see your point, thanks.

What do others think?




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#6922; Package emacs. (Fri, 22 Jan 2016 11:01:02 GMT) Full text and rfc822 format available.

Message #29 received at 6922 <at> debbugs.gnu.org (full text, mbox):

From: Lars Magne Ingebrigtsen <larsi <at> gnus.org>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: mt_void <at> warpmail.net, johnw <at> gnu.org, mbork <at> mbork.pl, rms <at> gnu.org,
 6922 <at> debbugs.gnu.org
Subject: Re: bug#6922: 23.1;
 Setting read-only property in an overlay has no effect
Date: Fri, 22 Jan 2016 11:59:56 +0100
Eli Zaretskii <eliz <at> gnu.org> writes:

> What do others think?

I think read-only overlays sound kinda nonsensical, too.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#6922; Package emacs. (Fri, 22 Jan 2016 12:59:01 GMT) Full text and rfc822 format available.

Message #32 received at 6922 <at> debbugs.gnu.org (full text, mbox):

From: Marcin Borkowski <mbork <at> mbork.pl>
To: Lars Magne Ingebrigtsen <larsi <at> gnus.org>
Cc: Eli Zaretskii <eliz <at> gnu.org>, johnw <at> gnu.org, mt_void <at> warpmail.net,
 rms <at> gnu.org, 6922 <at> debbugs.gnu.org
Subject: Re: bug#6922: 23.1;
 Setting read-only property in an overlay has no effect
Date: Fri, 22 Jan 2016 13:58:08 +0100
On 2016-01-22, at 11:59, Lars Magne Ingebrigtsen <larsi <at> gnus.org> wrote:

> Eli Zaretskii <eliz <at> gnu.org> writes:
>
>> What do others think?
>
> I think read-only overlays sound kinda nonsensical, too.

Not necessarily.  This is not the same, of course, but compare Dired to
Wdired: the same text is sometimes read-only and sometimes not, and it
does make a lot of sense.

Another possible use-case: a feature like narrowing, but not making some
text invisible, but read-only instead.  (This might actually be useful,
e.g. in Org-mode.)

Of course, you could do this with text properties and not overlays, but
what I'm saying is that the assumption "it [is] strange to make certain
text read-only temporarily.  If it isn't supposed to change, it should
never change, right?" is false in general, even in current stock Emacs.

Best,

-- 
Marcin Borkowski
http://octd.wmi.amu.edu.pl/en/Marcin_Borkowski
Faculty of Mathematics and Computer Science
Adam Mickiewicz University




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#6922; Package emacs. (Sun, 07 Feb 2016 22:25:02 GMT) Full text and rfc822 format available.

Message #35 received at 6922 <at> debbugs.gnu.org (full text, mbox):

From: John Wiegley <jwiegley <at> gmail.com>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: mt_void <at> warpmail.net, Marcin Borkowski <mbork <at> mbork.pl>,
 Richard Stallman <rms <at> gnu.org>, 6922 <at> debbugs.gnu.org
Subject: Re: bug#6922: 23.1;
 Setting read-only property in an overlay has no effect
Date: Sun, 07 Feb 2016 17:24:26 -0500
>>>>> Eli Zaretskii <eliz <at> gnu.org> writes:

> What is the current consensus? should we adjust the documentation or fix the
> code? John? Richard?

I think read-only overlays could be very useful. For example:

 1. Create a command called `mask-regexp'. It creates read-only overlays for
    matching text throughout the buffer.
 2. There should also be a way to add manual masks, using `mask-region'.
 3. Now use `replace-string' or any other command to bulk transform text.
    However, masked text is not changed.
 4. Then execute unmask-all, and the mask disappears.

This method of editing is key to video editing workflows. I think the only
reason I never thought to use it in Emacs is because it's never been there
(and so never occurred to me until now).

-- 
John Wiegley                  GPG fingerprint = 4710 CF98 AF9B 327B B80F
http://newartisans.com                          60E1 46C4 BD1A 7AC1 4BA2




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#6922; Package emacs. (Sun, 07 Feb 2016 22:31:01 GMT) Full text and rfc822 format available.

Message #38 received at 6922 <at> debbugs.gnu.org (full text, mbox):

From: Marcin Borkowski <mbork <at> mbork.pl>
To: John Wiegley <johnw <at> gnu.org>
Cc: Eli Zaretskii <eliz <at> gnu.org>, mt_void <at> warpmail.net,
 Richard Stallman <rms <at> gnu.org>, 6922 <at> debbugs.gnu.org
Subject: Re: bug#6922: 23.1;
 Setting read-only property in an overlay has no effect
Date: Sun, 07 Feb 2016 23:30:42 +0100
On 2016-02-07, at 23:24, John Wiegley <jwiegley <at> gmail.com> wrote:

>>>>>> Eli Zaretskii <eliz <at> gnu.org> writes:
>
>> What is the current consensus? should we adjust the documentation or fix the
>> code? John? Richard?
>
> I think read-only overlays could be very useful. For example:
>
>  1. Create a command called `mask-regexp'. It creates read-only overlays for
>     matching text throughout the buffer.
>  2. There should also be a way to add manual masks, using `mask-region'.
>  3. Now use `replace-string' or any other command to bulk transform text.
>     However, masked text is not changed.
>  4. Then execute unmask-all, and the mask disappears.
>
> This method of editing is key to video editing workflows. I think the only
> reason I never thought to use it in Emacs is because it's never been there
> (and so never occurred to me until now).

That's a fantastic idea!  I envision "LaTeX-mask-environment", and bam!
query-replace does not touch verbatim, for instance.  That could be very
useful!  I did something similar with texmathp and math mode, but I like
your approach with "masking".

Best,

-- 
Marcin Borkowski
http://octd.wmi.amu.edu.pl/en/Marcin_Borkowski
Faculty of Mathematics and Computer Science
Adam Mickiewicz University




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#6922; Package emacs. (Mon, 08 Feb 2016 18:27:04 GMT) Full text and rfc822 format available.

Message #41 received at 6922 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: "John Wiegley" <johnw <at> gnu.org>
Cc: mt_void <at> warpmail.net, mbork <at> mbork.pl, rms <at> gnu.org, 6922 <at> debbugs.gnu.org
Subject: Re: bug#6922: 23.1;
 Setting read-only property in an overlay has no effect
Date: Mon, 08 Feb 2016 19:55:19 +0200
> From: John Wiegley <jwiegley <at> gmail.com>
> Cc: Marcin Borkowski <mbork <at> mbork.pl>,  Richard Stallman <rms <at> gnu.org>,  6922 <at> debbugs.gnu.org,  mt_void <at> warpmail.net
> Date: Mon, 08 Feb 2016 11:04:06 -0500
> 
> >>>>> Eli Zaretskii <eliz <at> gnu.org> writes:
> 
> > What is the current consensus? should we adjust the documentation or fix the
> > code? John? Richard?
> 
> Eli, can you fix to code to allows read-only overlays? Once you do, I'd like
> to write a mask.el module for GNU ELPA to support masked editing.

I'll take a look.  Of course, if someone wants to beat me to it, feel
free.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#6922; Package emacs. (Mon, 08 Feb 2016 18:48:02 GMT) Full text and rfc822 format available.

Message #44 received at 6922 <at> debbugs.gnu.org (full text, mbox):

From: John Wiegley <jwiegley <at> gmail.com>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: mt_void <at> warpmail.net, Marcin Borkowski <mbork <at> mbork.pl>,
 Richard Stallman <rms <at> gnu.org>, 6922 <at> debbugs.gnu.org
Subject: Re: bug#6922: 23.1;
 Setting read-only property in an overlay has no effect
Date: Mon, 08 Feb 2016 11:04:06 -0500
>>>>> Eli Zaretskii <eliz <at> gnu.org> writes:

> What is the current consensus? should we adjust the documentation or fix the
> code? John? Richard?

Eli, can you fix to code to allows read-only overlays? Once you do, I'd like
to write a mask.el module for GNU ELPA to support masked editing.

Thanks,
-- 
John Wiegley                  GPG fingerprint = 4710 CF98 AF9B 327B B80F
http://newartisans.com                          60E1 46C4 BD1A 7AC1 4BA2




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#6922; Package emacs. (Thu, 18 Feb 2016 05:13:02 GMT) Full text and rfc822 format available.

Message #47 received at 6922 <at> debbugs.gnu.org (full text, mbox):

From: Marcin Borkowski <mbork <at> mbork.pl>
To: John Wiegley <johnw <at> gnu.org>
Cc: Richard Stallman <rms <at> gnu.org>, 6922 <at> debbugs.gnu.org,
 emacs-devel <emacs-devel <at> gnu.org>,
 Org-Mode mailing list <emacs-orgmode <at> gnu.org>, Eli Zaretskii <eliz <at> gnu.org>,
 mt_void <at> warpmail.net
Subject: Re: bug#6922: 23.1;
 Setting read-only property in an overlay has no effect
Date: Thu, 18 Feb 2016 06:12:42 +0100
On 2016-02-07, at 23:24, John Wiegley <jwiegley <at> gmail.com> wrote:

>>>>>> Eli Zaretskii <eliz <at> gnu.org> writes:
>
>> What is the current consensus? should we adjust the documentation or fix the
>> code? John? Richard?
>
> I think read-only overlays could be very useful. For example:
>
>  1. Create a command called `mask-regexp'. It creates read-only overlays for
>     matching text throughout the buffer.
>  2. There should also be a way to add manual masks, using `mask-region'.
>  3. Now use `replace-string' or any other command to bulk transform text.
>     However, masked text is not changed.
>  4. Then execute unmask-all, and the mask disappears.
>
> This method of editing is key to video editing workflows. I think the only
> reason I never thought to use it in Emacs is because it's never been there
> (and so never occurred to me until now).

Hi,

I just realized that this idea could be /extremely/ useful.  Here's the
case: I start a clock in Org-mode (C-c C-x C-i), and an entry with the
starting time is added in the :LOGBOOK: drawer (and btw, it is
invisible).  While working on the file, I hit C-/ (undo) once too many,
and the entry disappears (and this fact is still invisible to me!).
Then, after some more work, I stop the clock only to see "org-clock-out:
Clock start time is gone", and my clock is still going on (!).

While the last thing (about the clock still going on) is probably an
Org-mode bug (I'll propbably report it later "officially", I'm now
Cc-ing this message to the Org-mode ML), the whole experience (and yes,
it happened to me) is /very/ confusing.

When read-only properties and masking are here, Org could just mark the
half-done entry as read-only.  I suspect that trying to undo it would
perhaps trigger some error, which could be confusing, but it would be
still better than silently removing a vital information.

Best,

-- 
Marcin Borkowski
http://octd.wmi.amu.edu.pl/en/Marcin_Borkowski
Faculty of Mathematics and Computer Science
Adam Mickiewicz University




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#6922; Package emacs. (Thu, 18 Feb 2016 16:53:01 GMT) Full text and rfc822 format available.

Message #50 received at 6922 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Marcin Borkowski <mbork <at> mbork.pl>
Cc: johnw <at> gnu.org, mt_void <at> warpmail.net, rms <at> gnu.org, 6922 <at> debbugs.gnu.org
Subject: Re: bug#6922: 23.1;
 Setting read-only property in an overlay has no effect
Date: Thu, 18 Feb 2016 18:52:43 +0200
> From: Marcin Borkowski <mbork <at> mbork.pl>
> Cc: Eli Zaretskii <eliz <at> gnu.org>, Richard Stallman <rms <at> gnu.org>,
>  6922 <at> debbugs.gnu.org, mt_void <at> warpmail.net,
>  Org-Mode mailing list <emacs-orgmode <at> gnu.org>, emacs-devel <emacs-devel <at> gnu.org>
> Date: Thu, 18 Feb 2016 06:12:42 +0100
> 
> I just realized that this idea could be /extremely/ useful.  Here's the
> case: I start a clock in Org-mode (C-c C-x C-i), and an entry with the
> starting time is added in the :LOGBOOK: drawer (and btw, it is
> invisible).  While working on the file, I hit C-/ (undo) once too many,
> and the entry disappears (and this fact is still invisible to me!).
> Then, after some more work, I stop the clock only to see "org-clock-out:
> Clock start time is gone", and my clock is still going on (!).
> 
> While the last thing (about the clock still going on) is probably an
> Org-mode bug (I'll propbably report it later "officially", I'm now
> Cc-ing this message to the Org-mode ML), the whole experience (and yes,
> it happened to me) is /very/ confusing.
> 
> When read-only properties and masking are here, Org could just mark the
> half-done entry as read-only.  I suspect that trying to undo it would
> perhaps trigger some error, which could be confusing, but it would be
> still better than silently removing a vital information.

If you are arguing for having a feature that marks some portion of
buffer text read-only, then we already have that: the 'read-only' text
property.  The issue in this discussion is whether we should _also_
have a similar overlay property.

(Please don't cross-post to the bug tracker and to emacs-devel.)




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#6922; Package emacs. (Thu, 18 Feb 2016 18:54:02 GMT) Full text and rfc822 format available.

Message #53 received at 6922 <at> debbugs.gnu.org (full text, mbox):

From: John Wiegley <jwiegley <at> gmail.com>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: mt_void <at> warpmail.net, Marcin Borkowski <mbork <at> mbork.pl>, rms <at> gnu.org,
 6922 <at> debbugs.gnu.org
Subject: Re: bug#6922: 23.1;
 Setting read-only property in an overlay has no effect
Date: Thu, 18 Feb 2016 10:53:00 -0800
>>>>> Eli Zaretskii <eliz <at> gnu.org> writes:

> If you are arguing for having a feature that marks some portion of buffer
> text read-only, then we already have that: the 'read-only' text property.
> The issue in this discussion is whether we should _also_ have a similar
> overlay property.

That said, I think the right way to implement clock-masking in Org would be to
use an overlay whose existence is tied to the clock. A text-property might be
incompatible with the way Org uses font-locking.

-- 
John Wiegley                  GPG fingerprint = 4710 CF98 AF9B 327B B80F
http://newartisans.com                          60E1 46C4 BD1A 7AC1 4BA2




This bug report was last modified 8 years and 80 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.