0

This is my theme config.

I am trying to modify the face list-matching-lines-buffer-name-face, which is part of the result window of occur (see replace.el.gz).

Using customize-option on list-matching-lines-buffer-name-face, I am experimenting with what works and what doesn't.

In the customization buffer, I can use some other faces to assign to list-matching-lines-buffer-name-face. For example, reusing magit-bisect-bad works (sample shows that directly). Some others, which are in my theme linked above, do not work, for example linum.

enter image description here

enter image description here

Extract of the theme file:

`(linum ((t (:foreground ,bisque-green+2 :background ,bisque-bg))))
...
`(magit-bisect-bad  ((t (:foreground ,bisque-red))))

Why are only some of the faces available to assign to my option?


How do I set the value of list-matching-lines-buffer-name-face in my theme file? I eventually don't want to set it with customize, I want it to be only for that theme, not in my init file.

I've tried to set faces in my theme file:

`(occur-buffer-name-face ((t (:foreground ,bisque-bg :background ,bisque-green  :weight bold))))
`(list-matching-lines-buffer-name-face ((t (:foreground ,bisque-bg :background ,bisque-green  :weight bold))))

with no success. The first of these two (occur-buffer-name-face) I've tried to use in the customize interface, with no luck either.


As a summary, this is what I have:

  • The result of occur has standard face for buffer names (it is as default, plus underline)
  • M-x customize-face
  • search for list-matching-lines-buffer-name-face
  • check that the face description on the right of the sample text sample only says underline. The sample text shows underlined text with default foreground color.
  • change underline to magit-bisect-bad. The sample text changes as soon as the face name is done (turns red in my case).
  • change magit-bisect-bad to linum

Expected behavior: the sample text turns to green foreground, as set by my theme.

Actual behavior: the sample text stays as default foreground.

8
  • It's not clear what you're doing, and thus why you say only some faces are available etc. Please provide a step-by-step recipe of what you are doing in each case in M-x customize-face. Say what you do at each step (in each case - setting the var to face linum and setting it to face magit-bisect-bad), and say what you see in each step, and what you expected/want to see instead.
    – Drew
    Feb 26 at 3:26
  • The screenshots you show indicate that you edited the option value, but you didn't set it. Did you actually set it in your testing?
    – Drew
    Feb 26 at 3:27
  • As I mentioned in previous comment, you should use setq rather than custom-theme-set-faces to modified list-matching-lines-buffer-name-face Feb 26 at 4:16
  • @Drew I am reading face names in my theme file, and trying them out in the interface of customize. When I'm done writing magit-bisect-bad, the sample text sample changes accordingly. No need to apply, set, it changes as soon as the face name is there. This is not the case with linum, it does not change.
    – Gauthier
    Feb 27 at 21:48
  • Put all such info in your question, as part of the recipe/description. Questions need to stand on their own. Comments are not searchable, and they can be deleted at any time. Thx.
    – Drew
    Feb 28 at 0:59

1 Answer 1

0

My current way to solve this is this, in my theme file:

;; In the big `let` statement of my theme.
(defface occur-buffer-name '((t (:background "#5c888b" :foreground "#45423f")))
  "Occur buffer name lineface"
  :group 'basic-faces)
(setq list-matching-lines-buffer-name-face 'occur-buffer-name)

Unfortunately, I cannot find the correct way not to use hard-coded values there. Since my theme defines a palette, I would like to use the palette colors.

Thanks @TianshuWang for guiding me to using setq.

(but I still don't understand why this face cannot be set like the other faces, in my theme's custom-theme-set-faces.)


As reference, this is how my colors are defined in my theme file:

(deftheme bisque "The bisque color theme, based on zenburn")

;; Palette
(let ((class '((class color) (min-colors 89)))
      ;; Zenburn palette
      ;; colors with +x are lighter, colors with -x are darker
      ;; #ac9a85 = (bisque3 + bisque4) / 2
      (bisque-fg "#ac9a85")
      (bisque-fg-1 "bisque4")
      (bisque-fg-2 "#5f5549")
;; ...

then comes the definition of the faces, within the same let:

  (custom-theme-set-faces
   'bisque
   '(button ((t (:underline t))))
   `(link ((t (:foreground ,bisque-yellow :underline t :weight bold))))
   `(link-visited ((t (:foreground ,bisque-yellow-2 :underline t :weight normal))))

   ;;; basic coloring
   `(default ((t (:foreground ,bisque-fg :background ,bisque-bg))))
   `(cursor ((t (:foreground ,bisque-fg :background ,bisque-yellow+1))))
   `(escape-glyph ((t (:foreground ,bisque-yellow :bold t))))
   `(fringe ((t (:foreground ,bisque-yellow+1 :background ,bisque-bg))))
   `(header-line ((t (:foreground ,bisque-yellow
                                  :background ,bisque-bg-1))))
                                  ;;:box (:line-width -1 :style released-button)))))
   `(highlight ((t (:background ,bisque-bg-05))))

   ;;; compilation
   `(compilation-column-face ((t (:foreground ,bisque-yellow))))
   `(compilation-enter-directory-face ((t (:foreground ,bisque-green))))
;; ...

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.