I have defined 2 variables as such:

(defconst zenburn/bg-1 "#2B2B2B" "Zenburn palette: bg-1.")
(defconst me/helm-header-color zenburn/bg-1 "Custom palette: helm headers.")

(set-face-attribute 'helm-source-header nil
                    :background me/helm-header-color
                    :box '(:line-width 4 :color me/helm-header-color))

The background color is correctly applied but the box's color isn't. It seems I have to specify the raw hex string. Why ?


This happens because the quoted list, '(:line-width 4 :color me/helm-header-color) evaluates to (:line-width 4 :color me/helm-header-color) not (:line-width 4 :color "2B2B2B"). The quote stops me/helm-header-color from being evaluated. You can use the a backtick (`) instead to pick which parts get evaluated:

(set-face-attribute 'helm-source-header nil
                    :background me/helm-header-color
                    :box `(:line-width 4 :color ,me/helm-header-color))

Anything inside the back-quoted list that is preceded by a comma will be evaluated.

  • In which case do I not want a value to be evaluated ? Also, slightly irrelevant, how can I have left padding in my box ? The 4 pixels seem to be for top and bottom only :/. Jan 27 '15 at 23:54
  • You have to decided based on when you want the variable to replace by its value ("now" in your case). You might want to hold the variable in case it isn't known yet or might change. Can't help you with the boxes.
    – erikstokes
    Jan 28 '15 at 0:04

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.