GNU bug report logs - #40857
Invisibility specs do not apply to specified spaces

Previous Next

Package: emacs;

Reported by: Clément Pit-Claudel <cpitclaudel <at> gmail.com>

Date: Sat, 25 Apr 2020 23:19:02 UTC

Severity: wishlist

To reply to this bug, email your comments to 40857 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 bug-gnu-emacs <at> gnu.org:
bug#40857; Package emacs. (Sat, 25 Apr 2020 23:19:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Clément Pit-Claudel <cpitclaudel <at> gmail.com>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Sat, 25 Apr 2020 23:19:02 GMT) Full text and rfc822 format available.

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

From: Clément Pit-Claudel <cpitclaudel <at> gmail.com>
To: bug-gnu-emacs <bug-gnu-emacs <at> gnu.org>
Subject: Invisibility specs do not apply to specified spaces
Date: Sat, 25 Apr 2020 19:18:55 -0400
Consider the following program:

(with-current-buffer (get-buffer-create "*spaces*")
  (erase-buffer)
  (let ((indent (propertize " " 'display '(space :width 3))))
    (put-text-property (point) (progn (insert indent "r1\n") (point)) 'invisible 'a)
    (put-text-property (point) (progn (insert indent "r2\n") (point)) 'invisible 'b))
  (add-to-invisibility-spec 'a)
  (pop-to-buffer (current-buffer)))

The first record (r1) is hidden, but not the indentation that precedes it; so, instead of looking like this:

   r2

The buffer looks like this:

      r2

(This is because the invisible property doesn't apply to the display spec.)
It's easy to fix when the replacing display spec is a string (by putting the same invisibility spec on the string), but there doesn't seem to be a way to add an 'invisible property to the specified space.

Clément




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#40857; Package emacs. (Sun, 26 Apr 2020 15:22:01 GMT) Full text and rfc822 format available.

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

From: Eli Zaretskii <eliz <at> gnu.org>
To: Clément Pit-Claudel <cpitclaudel <at> gmail.com>
Cc: 40857 <at> debbugs.gnu.org
Subject: Re: bug#40857: Invisibility specs do not apply to specified spaces
Date: Sun, 26 Apr 2020 18:20:55 +0300
> From: Clément Pit-Claudel <cpitclaudel <at> gmail.com>
> Date: Sat, 25 Apr 2020 19:18:55 -0400
> 
> Consider the following program:
> 
> (with-current-buffer (get-buffer-create "*spaces*")
>   (erase-buffer)
>   (let ((indent (propertize " " 'display '(space :width 3))))
>     (put-text-property (point) (progn (insert indent "r1\n") (point)) 'invisible 'a)
>     (put-text-property (point) (progn (insert indent "r2\n") (point)) 'invisible 'b))
>   (add-to-invisibility-spec 'a)
>   (pop-to-buffer (current-buffer)))
> 
> The first record (r1) is hidden, but not the indentation that precedes it; so, instead of looking like this:
> 
>    r2
> 
> The buffer looks like this:
> 
>       r2

I don't think this is a bug.  A "replacing" display property in effect
forces the display engine to ignore the entire chunk of text "covered"
by that display property, so the fact that this chunk of text is in
this case invisible is never seen, nor acted upon.  Once the display
engine is done producing the stretch of white space for the display
property, it jumps to the end of the text "covered" by the property,
and continues from there.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#40857; Package emacs. (Sun, 26 Apr 2020 16:05:01 GMT) Full text and rfc822 format available.

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

From: Clément Pit-Claudel <cpitclaudel <at> gmail.com>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 40857 <at> debbugs.gnu.org
Subject: Re: bug#40857: Invisibility specs do not apply to specified spaces
Date: Sun, 26 Apr 2020 12:04:43 -0400
On 26/04/2020 11.20, Eli Zaretskii wrote:
>> From: Clément Pit-Claudel <cpitclaudel <at> gmail.com>
>> Date: Sat, 25 Apr 2020 19:18:55 -0400
>>
>> Consider the following program:
>>
>> (with-current-buffer (get-buffer-create "*spaces*")
>>   (erase-buffer)
>>   (let ((indent (propertize " " 'display '(space :width 3))))
>>     (put-text-property (point) (progn (insert indent "r1\n") (point)) 'invisible 'a)
>>     (put-text-property (point) (progn (insert indent "r2\n") (point)) 'invisible 'b))
>>   (add-to-invisibility-spec 'a)
>>   (pop-to-buffer (current-buffer)))
>>
>> The first record (r1) is hidden, but not the indentation that precedes it; so, instead of looking like this:
>>
>>    r2
>>
>> The buffer looks like this:
>>
>>       r2
> 
> I don't think this is a bug.

Indeed not. As I said in the original method, and as you summarized: (This is because the invisible property doesn't apply to the display spec.)
The feature request is to have a way to add an invisible property to specified spaces.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#40857; Package emacs. (Sun, 26 Apr 2020 17:16:01 GMT) Full text and rfc822 format available.

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

From: Eli Zaretskii <eliz <at> gnu.org>
To: Clément Pit-Claudel <cpitclaudel <at> gmail.com>
Cc: 40857 <at> debbugs.gnu.org
Subject: Re: bug#40857: Invisibility specs do not apply to specified spaces
Date: Sun, 26 Apr 2020 20:01:36 +0300
severity 40857 wishlist
thanks

> Cc: 40857 <at> debbugs.gnu.org
> From: Clément Pit-Claudel <cpitclaudel <at> gmail.com>
> Date: Sun, 26 Apr 2020 12:04:43 -0400
> 
> > I don't think this is a bug.
> 
> Indeed not. As I said in the original method, and as you summarized: (This is because the invisible property doesn't apply to the display spec.)

Not because it doesn't apply to the display spec, because it at all is
not considered when a display property is on the same text as
invisible property.

> The feature request is to have a way to add an invisible property to specified spaces.

Ah, okay.  Didn't realize this was a feature request.




Severity set to 'wishlist' from 'normal' Request was from Eli Zaretskii <eliz <at> gnu.org> to control <at> debbugs.gnu.org. (Sun, 26 Apr 2020 17:16:02 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#40857; Package emacs. (Sun, 26 Apr 2020 17:26:02 GMT) Full text and rfc822 format available.

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

From: Clément Pit-Claudel <cpitclaudel <at> gmail.com>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 40857 <at> debbugs.gnu.org
Subject: Re: bug#40857: Invisibility specs do not apply to specified spaces
Date: Sun, 26 Apr 2020 13:25:09 -0400
On 26/04/2020 13.01, Eli Zaretskii wrote:
>> The feature request is to have a way to add an invisible property to specified spaces.
> 
> Ah, okay.  Didn't realize this was a feature request.

Sorry, it's because I wasn't clear.  Specified spaces are very convenient for displaying tabulated lists, and the buffer-invisibility-spec is supposed to be particularly useful for displaying database records, but in practice these two don't work together.  It would be great if they did.







Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#40857; Package emacs. (Sun, 26 Apr 2020 17:46:02 GMT) Full text and rfc822 format available.

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

From: Eli Zaretskii <eliz <at> gnu.org>
To: Clément Pit-Claudel <cpitclaudel <at> gmail.com>
Cc: 40857 <at> debbugs.gnu.org
Subject: Re: bug#40857: Invisibility specs do not apply to specified spaces
Date: Sun, 26 Apr 2020 20:45:25 +0300
> Cc: 40857 <at> debbugs.gnu.org
> From: Clément Pit-Claudel <cpitclaudel <at> gmail.com>
> Date: Sun, 26 Apr 2020 13:25:09 -0400
> 
> > Ah, okay.  Didn't realize this was a feature request.
> 
> Sorry, it's because I wasn't clear.  Specified spaces are very convenient for displaying tabulated lists, and the buffer-invisibility-spec is supposed to be particularly useful for displaying database records, but in practice these two don't work together.  It would be great if they did.

I still haven't abandon the hope that such feature requests will draw
volunteers other than myself...




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#40857; Package emacs. (Sun, 26 Apr 2020 19:03:02 GMT) Full text and rfc822 format available.

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

From: Pip Cet <pipcet <at> gmail.com>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: Clément Pit-Claudel <cpitclaudel <at> gmail.com>,
 40857 <at> debbugs.gnu.org
Subject: Re: bug#40857: Invisibility specs do not apply to specified spaces
Date: Sun, 26 Apr 2020 19:01:29 +0000
On Sun, Apr 26, 2020 at 3:22 PM Eli Zaretskii <eliz <at> gnu.org> wrote:
> I don't think this is a bug.  A "replacing" display property in effect
> forces the display engine to ignore the entire chunk of text "covered"
> by that display property,

That's only true for text properties: a display property on an empty
overlay is ignored. So it would be consistent with that to ignore
display text properties on invisible strings.

The right fix, I think, is to apply the patch in bug#40845, possibly
extending it to pass in an "invisible" flag to the Lisp code that
calculates the actual display spec to be used.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#40857; Package emacs. (Mon, 27 Apr 2020 15:21:01 GMT) Full text and rfc822 format available.

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

From: Eli Zaretskii <eliz <at> gnu.org>
To: Pip Cet <pipcet <at> gmail.com>
Cc: cpitclaudel <at> gmail.com, 40857 <at> debbugs.gnu.org
Subject: Re: bug#40857: Invisibility specs do not apply to specified spaces
Date: Mon, 27 Apr 2020 18:20:03 +0300
> From: Pip Cet <pipcet <at> gmail.com>
> Date: Sun, 26 Apr 2020 19:01:29 +0000
> Cc: Clément Pit-Claudel <cpitclaudel <at> gmail.com>, 
> 	40857 <at> debbugs.gnu.org
> 
> On Sun, Apr 26, 2020 at 3:22 PM Eli Zaretskii <eliz <at> gnu.org> wrote:
> > I don't think this is a bug.  A "replacing" display property in effect
> > forces the display engine to ignore the entire chunk of text "covered"
> > by that display property,
> 
> That's only true for text properties: a display property on an empty
> overlay is ignored.

Can you show a Lisp snippet for that?  I don't think I have a clear
idea of the use case.

> The right fix, I think, is to apply the patch in bug#40845, possibly
> extending it to pass in an "invisible" flag to the Lisp code that
> calculates the actual display spec to be used.

I explained elsewhere why I think we shouldn't move display
functionalities to Lisp, except as the last resort, more or less.




This bug report was last modified 5 years and 52 days ago.

Previous Next


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