2

Using Emacs 24.4 with projectile and helm I am trying to customize some faces of the grep results.

;; Helm face customization (M-x helm-colors)
(set-face-underline-p 'helm-selection nil)
(set-face-underline-p 'helm-grep-file t)
(set-face-background 'helm-match "#002b36")
(set-face-foreground 'helm-match "#CB4B16")
(set-face-background 'helm-grep-match "#002b36")
(set-face-foreground 'helm-grep-match "#CB4B16")

By default with solarized-theme files are underlined and candidates on cursor as well. What I'm trying to achieve with lines 1 and 2 is:

  • Disable underlining on cursor
  • Keep files underlined, even on cursor

enter image description here

I assume that 'helm-selection is computed everytime I move my cursor and update the styles, thus files won't be underlined.

Is there a way to provide something like !important (CSS) to face attributes in Elisp ?

3

The easiest way to do this is to just manually update the colors for what you need. I suggest:

a. taking a look at all the helm faces: M-xcustomize-groupRET helm.

There you can browse to the one you want to customize, and just do it. (Read the description to find what every one is about.)

b. If you already know what you want to customize:

M-xcustomize-faceRET helm-selection (or the name of the face you want to change).

These settings will be added to your custom file. (You can change the location and name of this file by setting the custom-file variable).


If you want to customize the faces inside your init file, use set-face-attribute.

You can find out more about it with C-h fset-face-attributeRET. For example:

(set-face-attribute 'helm-selection nil :background "#073642" :underline nil)

This will override your helm-selection face for all frames and give it a #073642 background and no underline.

To find what attributes you can customize, check the manual section.

I know this is tedious work, but once you get the hang of it you will be able to customize or create your theme in no time.

| improve this answer | |
  • I'm sorry, but did you read my post ? – Mathieu Marques Nov 4 '14 at 22:06
  • :) I did, and I think set-face-attribute is what you are looking for. Sorry if I misunderstood the question, but I thought you wanted to customize some faces for helm. In that regard you can manually set all those faces as I mentioned in my answer. Have you tried it, and is there something not working? – caisah Nov 5 '14 at 5:41
  • No worries : ] As far as I know the way I've put it (one definition at a time) works the same as yours (multiple face definitons into one call). So I don't see how I can make helm-selection not underlined but keep helm-grep-file underlined at all time (including when cursor is on the same line <=> helm-selection active as well). – Mathieu Marques Nov 5 '14 at 9:23
  • I see. But I don't think the helm api permits this kind of customization right now. You could create an issue on github github.com/emacs-helm/helm. As far as I know the maintainer of helm is pretty opened to adding new functionality, and if it's something not very difficult to implement he will help you. – caisah Nov 5 '14 at 16:18
  • Oh this is helm-related, I thought it was more about styling with Elisp. This is a little vague to me, can 2 faces be applied at the same time ? If not helm could be modified to add a third different face when sexp is both on selection and a file, but I don't see this being added as it seems very specific and unusual. Thanks anyway, I'll see what I can do. – Mathieu Marques Nov 5 '14 at 19:27
2

Found help on GitHub, here is what should be done when attempting at removing a property:

(set-face-attribute 'helm-selection nil :underline 'unspecified)

See the GitHub issue: https://github.com/emacs-helm/helm/issues/697#issuecomment-62362671.

| improve this answer | |
0

Emacs themes can be used in parallel (for example: smart-mode-line is doing this to provide theme that contain only mode line faces), so you can also define your own "custom" theme with and use it alongside the other themes. Load theme in sequence and the later will override the former.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.