--- Begin Message ---
Subject: |
Should show-trailing-whitespace highlight specified spaces? |
Date: |
Sat, 27 May 2017 12:47:40 -0400 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.1.1 |
Hi emacs-devel,
I'm trying to display "/// " comment markers as a thin vertical line. At first,
I went for something like the following font-lock rule:
'(face my-vertical-line-face display (space :width 0.5))
This worked fine, until I decided to add a fringe icon, too:
'(face my-vertical-line-face display [(space :width 0.5) (left-margin
left-arrow)])
Now (with show-trailing-whitespace set to t) Emacs highlight lines that just
contain "///" in bright red. Here's a quick way to reproduce this:
(dotimes (_ 25) (insert (propertize "///" 'display '((space :width 10)
(left-fringe left-arrow))) "\n"))
Contrast with this, which doesn't show trailing-whitespace highlights:
(dotimes (_ 25) (insert (propertize "///" 'display '(space :width 10)) "\n"))
Am I doing something wrong? Or is this a bug, and if so which behavior is the
correct one? Is there a way to disable the trailing whitespace highlighting
here?
The best I've managed is to put the left-fringe property on the first "/"
character, and the display property on the next two, but this interacts in
annoying ways with point motion. I added cursor-intangible properties to the
mix too, but no luck (they interacted badly with insertion/deletion)
Thanks,
Clément.
signature.asc
Description: OpenPGP digital signature
--- End Message ---
--- Begin Message ---
Subject: |
Re: bug#27103: Should show-trailing-whitespace highlight specified spaces? |
Date: |
Mon, 29 May 2017 05:30:38 +0300 |
> Cc: address@hidden
> From: Clément Pit--Claudel <address@hidden>
> Date: Sun, 28 May 2017 16:18:02 -0400
>
> >> (insert (propertize "AA" 'line-prefix (propertize "_" 'display
> >> '(left-fringe right-arrow))))
> >
> > That's not what I meant, but if you are happy, it's fine with me.
>
> I didn't realize that this was possible. It fits my use case very nicely :)
> In the (defun example, I can just put the line-prefix property on the defun,
> and everything works perfectly.
>
> I wonder if we should mention this in the manual. Maybe in the "display
> specs" section, where (fringe …) is described, we could add this:
>
> `left-fringe' and `right-fringe' are replacing specs: the span of text that
> they apply to is made invisible. To add a fringe to a line without hiding
> any of its contents, put the fringe property on the before-string of an
> overlay or on the line-prefix of your text.
That's the kind of "howto" stuff that doesn't really belong to a
manual.
> >> Anything bad with this?
> >
> > It's just a display property. Nothing wrong with that, of course.
>
> Thanks!
OK, closing.
--- End Message ---