From: Stefan Monnier <monnier@iro.umontreal.ca>
To: "Kévin Le Gouguec" <kevin.legouguec@gmail.com>
Cc: 41810@debbugs.gnu.org, Stephen Berman <stephen.berman@gmx.net>
Subject: bug#41810: 28.0.50; [ELPA] adaptive-wrap: Fontify wrap-prefix
Date: Fri, 12 Jun 2020 11:33:25 -0400 [thread overview]
Message-ID: <jwvbllo5mv6.fsf-monnier+emacs@gnu.org> (raw)
In-Reply-To: <87bllovfb5.fsf@gmail.com> ("Kévin Le Gouguec"'s message of "Fri, 12 Jun 2020 10:50:06 +0200")
> Or has it? The string returned by fill-context-prefix *has* the correct
> face, that's why the first two semicolons are fontified IIUC; only the
> *extra* padding characters are unfontified, those that we generate with:
>
> #+begin_src
> ;; Reconstructed from `adaptive-wrap-fill-context-prefix':
> (make-string
> adaptive-wrap-extra-indent
> (string-to-char (substring (fill-context-prefix beg end) -1)))
> #+end_src
Ah, indeed, it's because we go through `string-to-char` which has no way
to preserve the text properties.
Yes, we should fix that to just concatenate `adaptive-wrap-extra-indent`
times the string returned by (substring (fill-context-prefix beg end) -1).
> I think I narrowed it down to this condition in fill-context-prefix:
>
> #+begin_src
> (if (or (and first-line-regexp
> (string-match first-line-regexp
> first-line-prefix))
> (and comment-start-skip
> (string-match comment-start-skip
> first-line-prefix)))
> first-line-prefix
> (make-string (string-width first-line-prefix) ?\s))
> #+end_src
>
> In the *scratch* buffer, the condition holds true, so first-line-prefix
> is returned, text properties and all: that's why the first two
> semicolons are fontified.
>
> In a diff buffer,
>
> 1. for removed lines, the condition is false, so we make a new,
> unfontified string, without the diff-removed face,
We should be able to make this work by trying to preserve
`first-line-prefix`s text properties somehow.
> 2. for added lines and headers, there is no prefix at all, so
> fill-context-prefix has nothing to tell us about what faces to apply.
>
> I don't know if the fix belongs in fill-context-prefix, or if it should
> be adaptive-wrap-fill-context-prefix's job to fixup faces…
I don't think it could be fixed in `fill-context-prefix`.
I guess we could try and fix it in `adaptive-wrap-fill-context-prefix`
by trying to preserve any face that covers the whole line (including the
final newline).
I'm glad I'm not the one who'll write the code ;-)
Stefan
next prev parent reply other threads:[~2020-06-12 15:33 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-06-11 16:16 bug#41810: 28.0.50; [ELPA] adaptive-wrap: Fontify wrap-prefix Kévin Le Gouguec
2020-06-11 22:42 ` Stefan Monnier
2020-06-12 8:50 ` Kévin Le Gouguec
2020-06-12 15:33 ` Stefan Monnier [this message]
2020-06-12 22:48 ` Kévin Le Gouguec
2020-06-21 15:34 ` bug#41810: [PATCH][ELPA] " Kévin Le Gouguec
2020-06-21 18:32 ` Basil L. Contovounesios
2020-06-21 22:01 ` Kévin Le Gouguec
2020-08-14 17:15 ` Lars Ingebrigtsen
2020-08-14 17:58 ` Kévin Le Gouguec
2020-08-14 17:59 ` Lars Ingebrigtsen
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=jwvbllo5mv6.fsf-monnier+emacs@gnu.org \
--to=monnier@iro.umontreal.ca \
--cc=41810@debbugs.gnu.org \
--cc=kevin.legouguec@gmail.com \
--cc=stephen.berman@gmx.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.