unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#33435: 27.0.50; A use case for recursive display specifications
@ 2018-11-19 18:51 Pip Cet
  2018-11-19 19:37 ` Eli Zaretskii
  2019-10-03  0:20 ` Stefan Kangas
  0 siblings, 2 replies; 7+ messages in thread
From: Pip Cet @ 2018-11-19 18:51 UTC (permalink / raw)
  To: 33435

This is a feature request: I'd like to be able to display an empty line
as a non-empty line with images in it.

If there's a way to do that with standard display specs, I haven't
found it. It's possible I'm merely missing an obvious way to do so.

I think there are two almost-equivalent approaches to achieving this:

1. interpret a list of display specifications by displaying the first
element of the list, then the second, and so, on, so I could use
(put-text-property beg end 'display `(,image1 ,image2 ,image3 "\n"))

2. allow a single level of recursion in display specifications, so I
could use
(put-text-property beg end 'display (concat (propertize " " 'display
image1) (propertize " " 'display image2) (propertize " " 'display
image3) "\n"))

I've tried simply disabling the checks for recursive display
specifications and (2) appears to work, but I don't know the precise
rationale for their existence, so it's possible that breaks the display
engine somehow.

If the problem is merely the possibility of creating an infinite loop
by setting a string's display property to the string itself (indeed,
in my test build, that crashes emacs), that could be avoided while
still allowing a single level of recursion.

(I'm using this to highlight syntactic indentation with SVG images,
and that's much prettier if empty lines are interpreted as being
indented to the minimum of the preceding and following levels of
indentation, rather than merely being empty.)





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

* bug#33435: 27.0.50; A use case for recursive display specifications
  2018-11-19 18:51 bug#33435: 27.0.50; A use case for recursive display specifications Pip Cet
@ 2018-11-19 19:37 ` Eli Zaretskii
  2018-11-20 15:16   ` Pip Cet
  2019-10-03  0:20 ` Stefan Kangas
  1 sibling, 1 reply; 7+ messages in thread
From: Eli Zaretskii @ 2018-11-19 19:37 UTC (permalink / raw)
  To: Pip Cet; +Cc: 33435

> From: Pip Cet <pipcet@gmail.com>
> Date: Mon, 19 Nov 2018 18:51:37 +0000
> 
> This is a feature request: I'd like to be able to display an empty line
> as a non-empty line with images in it.

I don't think I understand this.  Can you elaborate what that means?

In case I did understand: did you try an overlay with after-string
that has an image display property on it?





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

* bug#33435: 27.0.50; A use case for recursive display specifications
  2018-11-19 19:37 ` Eli Zaretskii
@ 2018-11-20 15:16   ` Pip Cet
  2018-11-20 16:30     ` Eli Zaretskii
  0 siblings, 1 reply; 7+ messages in thread
From: Pip Cet @ 2018-11-20 15:16 UTC (permalink / raw)
  To: eliz; +Cc: 33435

On Mon, Nov 19, 2018 at 7:37 PM Eli Zaretskii <eliz@gnu.org> wrote:
> > This is a feature request: I'd like to be able to display an empty line
> > as a non-empty line with images in it.
>
> I don't think I understand this.  Can you elaborate what that means?
>
> In case I did understand: did you try an overlay with after-string
> that has an image display property on it?

First, thanks for the suggestion; sorry, it simply hadn't occurred to
me that after/before-string can do things display specifications
cannot.

Obviously I'm still thinking of a display-propertized display
specification string as the more natural thing to do, and things are
slightly different (cursor placement, modifications, highlighting of
included text) with the after-string solution, but I'll try to get
things working that way. Thanks again.





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

* bug#33435: 27.0.50; A use case for recursive display specifications
  2018-11-20 15:16   ` Pip Cet
@ 2018-11-20 16:30     ` Eli Zaretskii
  0 siblings, 0 replies; 7+ messages in thread
From: Eli Zaretskii @ 2018-11-20 16:30 UTC (permalink / raw)
  To: Pip Cet; +Cc: 33435

> From: Pip Cet <pipcet@gmail.com>
> Date: Tue, 20 Nov 2018 15:16:25 +0000
> Cc: 33435@debbugs.gnu.org
> 
> > In case I did understand: did you try an overlay with after-string
> > that has an image display property on it?
> 
> First, thanks for the suggestion; sorry, it simply hadn't occurred to
> me that after/before-string can do things display specifications
> cannot.

Well, it's still a display spec, just on a string, not on buffer text.

> Obviously I'm still thinking of a display-propertized display
> specification string as the more natural thing to do, and things are
> slightly different (cursor placement, modifications, highlighting of
> included text) with the after-string solution, but I'll try to get
> things working that way. Thanks again.

Let me know if you have other difficulties.  I should warn you that
the combination of an overlay string and a display spec is used
rarely, so you might bump into weird behavior and even bugs.  Until
Emacs 25 I think this combination was very buggy.





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

* bug#33435: 27.0.50; A use case for recursive display specifications
  2018-11-19 18:51 bug#33435: 27.0.50; A use case for recursive display specifications Pip Cet
  2018-11-19 19:37 ` Eli Zaretskii
@ 2019-10-03  0:20 ` Stefan Kangas
  2019-10-03 12:33   ` Pip Cet
  1 sibling, 1 reply; 7+ messages in thread
From: Stefan Kangas @ 2019-10-03  0:20 UTC (permalink / raw)
  To: Pip Cet; +Cc: 33435

Pip Cet <pipcet@gmail.com> writes:

> On Mon, Nov 19, 2018 at 7:37 PM Eli Zaretskii <eliz@gnu.org> wrote:
>> > This is a feature request: I'd like to be able to display an empty line
>> > as a non-empty line with images in it.
>>
>> I don't think I understand this.  Can you elaborate what that means?
>>
>> In case I did understand: did you try an overlay with after-string
>> that has an image display property on it?
>
> First, thanks for the suggestion; sorry, it simply hadn't occurred to
> me that after/before-string can do things display specifications
> cannot.
>
> Obviously I'm still thinking of a display-propertized display
> specification string as the more natural thing to do, and things are
> slightly different (cursor placement, modifications, highlighting of
> included text) with the after-string solution, but I'll try to get
> things working that way. Thanks again.

Is this feature request still relevant, or did Eli's reply solve this
use case?  Thanks.

Best regards,
Stefan Kangas





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

* bug#33435: 27.0.50; A use case for recursive display specifications
  2019-10-03  0:20 ` Stefan Kangas
@ 2019-10-03 12:33   ` Pip Cet
  2019-10-03 16:42     ` Stefan Kangas
  0 siblings, 1 reply; 7+ messages in thread
From: Pip Cet @ 2019-10-03 12:33 UTC (permalink / raw)
  To: Stefan Kangas; +Cc: 33435

On Thu, Oct 3, 2019 at 12:20 AM Stefan Kangas <stefan@marxist.se> wrote:
> Is this feature request still relevant, or did Eli's reply solve this
> use case?  Thanks.

I think we can close this bug. It would be nice to have a way to do
this without using overlays or modifying buffer text (the latter of
which is what I ended up doing), but hopefully new ideas for how to
handle overlay/text properties will take care of that one day...

Thanks!

Pip





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

* bug#33435: 27.0.50; A use case for recursive display specifications
  2019-10-03 12:33   ` Pip Cet
@ 2019-10-03 16:42     ` Stefan Kangas
  0 siblings, 0 replies; 7+ messages in thread
From: Stefan Kangas @ 2019-10-03 16:42 UTC (permalink / raw)
  To: Pip Cet; +Cc: 33435-done

skrev Pip Cet <pipcet@gmail.com> writes:

> On Thu, Oct 3, 2019 at 12:20 AM Stefan Kangas <stefan@marxist.se> wrote:
> > Is this feature request still relevant, or did Eli's reply solve this
> > use case?  Thanks.
>
> I think we can close this bug. It would be nice to have a way to do
> this without using overlays or modifying buffer text (the latter of
> which is what I ended up doing), but hopefully new ideas for how to
> handle overlay/text properties will take care of that one day...
>
> Thanks!

Thank you for clarifying!  Closing now.

Best regards,
Stefan Kangas





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

end of thread, other threads:[~2019-10-03 16:42 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-11-19 18:51 bug#33435: 27.0.50; A use case for recursive display specifications Pip Cet
2018-11-19 19:37 ` Eli Zaretskii
2018-11-20 15:16   ` Pip Cet
2018-11-20 16:30     ` Eli Zaretskii
2019-10-03  0:20 ` Stefan Kangas
2019-10-03 12:33   ` Pip Cet
2019-10-03 16:42     ` Stefan Kangas

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