GNU bug report logs - #15155
24.3; wrap-prefix in adaptive-wrap-prefix-mode with variable-pitch has wrong face

Previous Next

Package: emacs;

Reported by: Frank Fischer <frank.fischer <at> mathematik.tu-chemnitz.de>

Date: Wed, 21 Aug 2013 20:23:01 UTC

Severity: normal

Found in version 24.3

Fixed in version 24.4

Done: Glenn Morris <rgm <at> gnu.org>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Frank Fischer <frank.fischer <at> mathematik.tu-chemnitz.de>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: monnier <at> iro.umontreal.ca, 15155 <at> debbugs.gnu.org
Subject: bug#15155: 24.3;	wrap-prefix in adaptive-wrap-prefix-mode with variable-pitch has	wrong face
Date: Fri, 23 Aug 2013 15:17:58 +0200
Am Fri, 23 Aug 2013 09:41:01 +0300
schrieb Eli Zaretskii <eliz <at> gnu.org>:

> > Date: Thu, 22 Aug 2013 22:32:46 +0200
> > From: Frank Fischer <frank.fischer <at> mathematik.tu-chemnitz.de>
> > Cc: monnier <at> iro.umontreal.ca, 15155 <at> debbugs.gnu.org
> > 
> > Am Thu, 22 Aug 2013 19:56:05 +0300
> > schrieb Eli Zaretskii <eliz <at> gnu.org>:
> > 
> > > Can you build Emacs from the trunk?  I would like to ask you to
> > > try a patch that might fix this in your use case.
> > 
> > Sure, I'd be happy to help ;)
> 
> Thank you.  Please try the patch below.  It should solve the problem
> with the font; you will still need to make sure on the Lisp level that
> the prefix has the right face, to get the color you want.

That patch seems to work, thank you.

I have only one (very) minor issue left: depending on the mode the
wrap-prefix may contain characters with different faces (e.g. in
emacs-lisp mode !!!;;; would be a correct prefix, the first three
characters with default face, the latter three with comment-face), hence
there is not really "the one" correct face to assign 'wrap-prefix with
`propertize`. That why I tried the variant

(setq adaptive-fill-function
  (lambda ()
    (and adaptive-fill-regexp
         (looking-at adaptive-fill-regexp)
         (match-string 0))))

hoping that (match-string 0) returns the whole prefix with the correct
fontification. However, there are situations where this does not work:
for example if one has a (very long) wrapped line without comment and
then inserts a semicolon (only one) at the beginning of that line to
comment it out, then the wrap-prefix does not get comment face (to be
precise, it has the correct font, thus your patch works, but not the
correct color). But if one inserts a second semicolon then the
wrap-prefix gets the correct color. I assume this happens because the
wrap-prefix is set before font-lock changed the face of inserted
semicolon. 

Perhaps this is a more an issue of adaptive-wrap-mode, I
don't know. If my guess is correct, is it possible to run the
appropriate hooks (I think adaptive-wrap uses
`jit-lock-register`) *after* font-lock changed the face? Or is there
another, better way to detect the correct face?

If you don't have a solution to this question, don't worry. I'm quite
happy with your patch and it does already what I want ;)

Thank you again,
Frank





This bug report was last modified 11 years and 324 days ago.

Previous Next


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