Helm: Helm odd highlighting with emacs-27

Created on 25 Oct 2019  路  17Comments  路  Source: emacs-helm/helm

Expected behavior

Same behavior as with emacs-26

Actual behavior (from emacs-helm.sh if possible, see note at the bottom)

Face are not extended to EOL due to emacs bug #37774

Same bug as magit #3986

Workaround: Use emacs-26 or use this code in init file:

;; Fix issue with the new :extend face attribute in emacs-27
;; Prefer to extend to EOL as in previous emacs.
(defun tv/extend-faces-matching (regexp)
  (cl-loop for f in (face-list)
           for face = (symbol-name f)
           when (and (string-match regexp face)
                     (eq (face-attribute f :extend t 'default)
                         'unspecified))
           do (set-face-attribute f nil :extend t)))

(when (fboundp 'set-face-extend)
  (with-eval-after-load "magit"
    (tv/extend-faces-matching "\\`magit"))
  (with-eval-after-load "helm"
    (tv/extend-faces-matching "\\`helm")))

emacsbug

All 17 comments

UPDATE: With last emacs-27 (16 December) the code above is only working on some faces, many faces in helm being now broken, for now don't know what to do to fix these faces (helm-header, symlinks etc...).

I seems that now it is no more possible to add a face with :extend t to text displayed with a display property, this affect helm for sources with a header-name attribute, symlinks in HFF, Magit log etc...
The culprit commit in emacs-27 is:
dd3f2130cf2 * A better fix for extension of overlay string's faces

Here a recipe:

(defun insert-string-with-display-prop (str disp)
  (let ((disp-str (concat str disp))
        ov)
    (insert str)
    (overlay-put (setq ov (make-overlay (point-at-bol) (point-at-eol)))
                 'display disp-str)
    (insert "\n")
    (add-face-text-property (overlay-start ov) (overlay-end ov)
                            '((:background "Blue")))))

(with-current-buffer (get-buffer-create "*test*")
  (insert-string-with-display-prop "foo" " (with more info)"))

With emacs-27 prior "dd3f2130cf2":
Capture d鈥櫭ヽran_2019-12-16_09-43-30

After "dd3f2130cf2" there is no face, still can't provide a recipe with the face extending from eol to end of screen.

Here screenshot with same code as above in emacs-27 master
Capture d鈥櫭ヽran_2019-12-16_12-31-12
On the blue frame the output of describe-text-properties.

Fixed now by commit 1e240a0ecdc in emacs master branch.

I'm still seeing this issue, I have to manually add :extend t in my theme to see lines properly in helm, should I have to do that from emacs 27 onwards?

Fernando V谩squez notifications@github.com writes:

I'm still seeing this issue, I have to manually add :extend t in my
theme to see lines properly in helm, should I have to do that from
emacs 27 onwards?

Yes, this is a new annoyance that will be part of Emacs-27.
See
https://github.com/thierryvolpiatto/emacs-tv-config/blob/master/init.el#L2283
to fix it.

--
Thierry

Get my Gnupg key:
gpg --keyserver pgp.mit.edu --recv-keys 59F29997

@deviantfero It could actually just depend on the theme you are using. For instance, I am using modus-operandi which extends the necessary Helm faces for Emacs 27.

Helm should add :extend t to the faces that need it, then the themes wouldn't need to do that anymore.

And you should probably use the same trick as Magit here: https://github.com/magit/magit/blob/master/lisp/magit-diff.el#L492

Dmitry Gutov notifications@github.com writes:

Helm should add :extend t to the faces that need it, then the themes wouldn't need to do that anymore.

And you should probably use the same trick as Magit here: https://github.com/magit/magit/blob/master/lisp/magit-diff.el#L492

Terrible to have to do this on our side, it would have been much better
to add to the faces that need it in Emacs with :extend==nil and nobody
would have been annoyed.

--
Thierry

Get my Gnupg key:
gpg --keyserver pgp.mit.edu --recv-keys 59F29997

That ship has sailed, unfortunately.

But it's still better to do in one place, instead of putting it on theme authors' shoulders.

Dmitry Gutov notifications@github.com writes:

That ship has sailed, unfortunately.

That's sad.

But it's still better to do in one place, instead of putting it on theme authors' shoulders.

Yes I agree, I was just hooping Emacs changes its mind before releasing
Emacs-27.

Thanks.

--
Thierry

Get my Gnupg key:
gpg --keyserver pgp.mit.edu --recv-keys 59F29997

Now fixed all face with :extend

Thank you @thierryvolpiatto.

Also, FYI @protesilaos, you may want to update your themes.

Thank you @manuel-uberti! Will review this thread and act accordingly.

Thanks, let me know if some faces are not working, I may have done errors when rewriting.

I updated both Helm and the Modus themes this morning and everything seems to look good as expected. I'll report here if something's missing.

Was this page helpful?
0 / 5 - 0 ratings