emacs-helm / helm

Emacs incremental completion and selection narrowing framework
https://emacs-helm.github.io/helm/
GNU General Public License v3.0
3.37k stars 390 forks source link

Can I have a third faces representing both helm-selection and helm-grep-file ? #697

Closed angrybacon closed 9 years ago

angrybacon commented 9 years ago

I know this is trivial, but it is bothering me.

http://emacs.stackexchange.com/questions/3056/persistent-effects-on-overwriting-faces

Thanks !

thierryvolpiatto commented 9 years ago

Mathieu Marques notifications@github.com writes:

I know this is trivial, but it is bothering me.

http://emacs.stackexchange.com/questions/3056/persistent-effects-on-overwriting-faces

So IIUC what you want is grep filename part underlined and helm selection not underlined, right ?

What's the problem with customize-group => helm => helm-selection and uncheck underline ?

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

angrybacon commented 9 years ago

Sorry if I was too long to reply.

As illustrated in my post on SE, the file part won't be underlined if on the highlighted line (the new face applies to the whole line).

michael-heerdegen commented 9 years ago

What you want is desireable, but AFAICT hard to accomplish, because Emacs doesn't mix faces from overlays as one might expect. So to say, it is a limitation of Emacs, not one of helm. There is probably no simple way to work around it.

angrybacon commented 9 years ago

I've known recently that it is indeed not possible to stack 2 faces (this is not how it works). But isn't it do'able to create a third face (see the title) which will combine the 2 others ?

michael-heerdegen commented 9 years ago

Mathieu Marques notifications@github.com writes:

I've known recently that it is indeed not possible to stack 2 faces (this is not how it works). But isn't it do'able to create a third face (see the title) which will combine the 2 others ?

Wait a moment. I just tried here with my Emacs trunk built, and it seems to work. Are you able to try a built of trunk?

angrybacon commented 9 years ago

I'm sorry I'm not your regular Emacs guru, what do you mean by built of trunk ? A freshly compiled Emacs with nothing but Company ?

On Mon, Nov 10, 2014 at 10:26 AM, Michael Heerdegen < notifications@github.com> wrote:

Mathieu Marques notifications@github.com writes:

I've known recently that it is indeed not possible to stack 2 faces (this is not how it works). But isn't it do'able to create a third face (see the title) which will combine the 2 others ?

Wait a moment. I just tried here with my Emacs trunk built, and it seems to work. Are you able to try a built of trunk?

— Reply to this email directly or view it on GitHub https://github.com/emacs-helm/helm/issues/697#issuecomment-62359589.

"Copying all or parts of a program is as natural to a programmer as breathing, and as productive. It ought to be as free." - Richard Matthew Stallman, founder of the GNU Project

Mathieu Marques | www.mathieumarques.info

angrybacon commented 9 years ago

I made a mistake (still I can't do what my issue is about). The files we can see when grep'ping (using ag here) are corresponding to the face helm-moccur-buffer and not helm-grep-file. Here is what does not work for me:

(with-eval-after-load 'helm
  (set-face-attribute 'helm-action nil :underline nil :weight 'bold)
  (set-face-attribute 'helm-grep-file nil :underline nil :weight 'bold)
  (set-face-attribute 'helm-moccur-buffer nil :underline t :weight 'bold)
  (set-face-attribute 'helm-selection nil :underline nil)
  (set-face-attribute 'helm-source-header nil
                      :background nil
                      :foreground "#268BD2"
                      :weight 'bold)
  )

Everytime my cursor moves, a new line is updated and the face helm-selection is added on that line (which will thus overwrite helm-moccur-buffer's attributes).

michael-heerdegen commented 9 years ago

No, this isn't working with Emacs trunk either (this is the developer repository of Emacs btw).

But I found out that what you do is not correct. Specifying nil for the :underline attribute means to explicitly remove underlining - see the doc. You want

(set-face-attribute 'helm-selection nil :underline 'unspecified)
angrybacon commented 9 years ago

All those times where I was foolishly trying to unset a background with :background nil... As all I wanted was the default background color. Thanks : j literally made my day