unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#40857: Invisibility specs do not apply to specified spaces
@ 2020-04-25 23:18 Clément Pit-Claudel
  2020-04-26 15:20 ` Eli Zaretskii
  0 siblings, 1 reply; 8+ messages in thread
From: Clément Pit-Claudel @ 2020-04-25 23:18 UTC (permalink / raw)
  To: 40857

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





^ permalink raw reply	[flat|nested] 8+ messages in thread

* bug#40857: Invisibility specs do not apply to specified spaces
  2020-04-25 23:18 bug#40857: Invisibility specs do not apply to specified spaces Clément Pit-Claudel
@ 2020-04-26 15:20 ` Eli Zaretskii
  2020-04-26 16:04   ` Clément Pit-Claudel
  2020-04-26 19:01   ` Pip Cet
  0 siblings, 2 replies; 8+ messages in thread
From: Eli Zaretskii @ 2020-04-26 15:20 UTC (permalink / raw)
  To: Clément Pit-Claudel; +Cc: 40857

> From: Clément Pit-Claudel <cpitclaudel@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.





^ permalink raw reply	[flat|nested] 8+ messages in thread

* bug#40857: Invisibility specs do not apply to specified spaces
  2020-04-26 15:20 ` Eli Zaretskii
@ 2020-04-26 16:04   ` Clément Pit-Claudel
  2020-04-26 17:01     ` Eli Zaretskii
  2020-04-26 19:01   ` Pip Cet
  1 sibling, 1 reply; 8+ messages in thread
From: Clément Pit-Claudel @ 2020-04-26 16:04 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 40857

On 26/04/2020 11.20, Eli Zaretskii wrote:
>> From: Clément Pit-Claudel <cpitclaudel@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.





^ permalink raw reply	[flat|nested] 8+ messages in thread

* bug#40857: Invisibility specs do not apply to specified spaces
  2020-04-26 16:04   ` Clément Pit-Claudel
@ 2020-04-26 17:01     ` Eli Zaretskii
  2020-04-26 17:25       ` Clément Pit-Claudel
  0 siblings, 1 reply; 8+ messages in thread
From: Eli Zaretskii @ 2020-04-26 17:01 UTC (permalink / raw)
  To: Clément Pit-Claudel; +Cc: 40857

severity 40857 wishlist
thanks

> Cc: 40857@debbugs.gnu.org
> From: Clément Pit-Claudel <cpitclaudel@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.





^ permalink raw reply	[flat|nested] 8+ messages in thread

* bug#40857: Invisibility specs do not apply to specified spaces
  2020-04-26 17:01     ` Eli Zaretskii
@ 2020-04-26 17:25       ` Clément Pit-Claudel
  2020-04-26 17:45         ` Eli Zaretskii
  0 siblings, 1 reply; 8+ messages in thread
From: Clément Pit-Claudel @ 2020-04-26 17:25 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 40857

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.








^ permalink raw reply	[flat|nested] 8+ messages in thread

* bug#40857: Invisibility specs do not apply to specified spaces
  2020-04-26 17:25       ` Clément Pit-Claudel
@ 2020-04-26 17:45         ` Eli Zaretskii
  0 siblings, 0 replies; 8+ messages in thread
From: Eli Zaretskii @ 2020-04-26 17:45 UTC (permalink / raw)
  To: Clément Pit-Claudel; +Cc: 40857

> Cc: 40857@debbugs.gnu.org
> From: Clément Pit-Claudel <cpitclaudel@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...





^ permalink raw reply	[flat|nested] 8+ messages in thread

* bug#40857: Invisibility specs do not apply to specified spaces
  2020-04-26 15:20 ` Eli Zaretskii
  2020-04-26 16:04   ` Clément Pit-Claudel
@ 2020-04-26 19:01   ` Pip Cet
  2020-04-27 15:20     ` Eli Zaretskii
  1 sibling, 1 reply; 8+ messages in thread
From: Pip Cet @ 2020-04-26 19:01 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: Clément Pit-Claudel, 40857

On Sun, Apr 26, 2020 at 3:22 PM Eli Zaretskii <eliz@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.





^ permalink raw reply	[flat|nested] 8+ messages in thread

* bug#40857: Invisibility specs do not apply to specified spaces
  2020-04-26 19:01   ` Pip Cet
@ 2020-04-27 15:20     ` Eli Zaretskii
  0 siblings, 0 replies; 8+ messages in thread
From: Eli Zaretskii @ 2020-04-27 15:20 UTC (permalink / raw)
  To: Pip Cet; +Cc: cpitclaudel, 40857

> From: Pip Cet <pipcet@gmail.com>
> Date: Sun, 26 Apr 2020 19:01:29 +0000
> Cc: Clément Pit-Claudel <cpitclaudel@gmail.com>, 
> 	40857@debbugs.gnu.org
> 
> On Sun, Apr 26, 2020 at 3:22 PM Eli Zaretskii <eliz@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.





^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2020-04-27 15:20 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-04-25 23:18 bug#40857: Invisibility specs do not apply to specified spaces Clément Pit-Claudel
2020-04-26 15:20 ` Eli Zaretskii
2020-04-26 16:04   ` Clément Pit-Claudel
2020-04-26 17:01     ` Eli Zaretskii
2020-04-26 17:25       ` Clément Pit-Claudel
2020-04-26 17:45         ` Eli Zaretskii
2020-04-26 19:01   ` Pip Cet
2020-04-27 15:20     ` Eli Zaretskii

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).