reddit / emacs

Problems with automatically setting a theme-dependent internal-border background color in Doom Emacs

Psychological-Try449 · 2022-08-15 10:53
Hi there, I am an Emacs newbie coming from vim. So far I really like the Emacs experience! However, I still struggle with a very simple task: I like having an internal border around my frame, which I set via the `default-frame-alist` list. While that works fine I am not able to automatically adjust the internal-frame color to the theme's background color. I can do it manually buy using (defun my/adjust_internal_border_color () "Adjust the internal border color to match the theme's background color" (custom-set-faces! '(internal-border :background "#FAFAFA" ;; (format "%s" (upcase (prin1-to-string ((car (cdr (assoc 'bg doom-themes--colors))))))) ;; (car (cdr (assoc 'bg doom-themes--colors))) )) ) Though, when I try to do it automatically by using one of the commented lines above instead of the color string, I get a `Wrong type argument: strings, ...` error. I guess this is due to my very poor knowledge of Lisp and probably very easy to fix. Maybe one of you can help me out? Many thanks in advance!
organic-bookworm · 2022-08-16 06:57
(custom-set-faces! `(internal-border :background ,(doom-color 'bg)))
Psychological-Try449 · 2022-08-17 20:38
Hi, thank you for your suggestion. Unfortunately, it does not work. The type error persists.
organic-bookworm · 2022-08-18 09:40
The [docs](https://github.com/doomemacs/doomemacs/blob/050624d47532cef18fcb41daa4e626576b00659c/modules/lang/emacs-lisp/demos.org#L160-L162) suggest that's a correct usage and it works for me (though I'm a bit behind Doom's master and it's been rushing lately). You may wanna post your issue at [discourse](https://discourse.doomemacs.org/c/support/81) with extra details to clear out if this is Doom's fault. The `doom/report-bug` command will give you a good [template](https://github.com/doomemacs/doomemacs/blob/master/.github/ISSUE_TEMPLATE/bug_report.yml) and steps to follow.
Psychological-Try449 · 2022-08-20 17:20
Hi, thanks for pointing me to the doom docs. I did not know these. I played around a little and discovered that actually you are right. It does work. My mistake was that I used (custom-set-faces! '(internal-border :background ,(doom-color 'bg))) instead of (custom-set-faces! `(internal-border :background ,(doom-color 'bg))) Both versions (note the differences between the tick `'` and the backtick \`\`\`. appear in the docs. For me, though, only the backtick version does the job. A little search in the web (see [here](https://stackoverflow.com/questions/30150186/what-does-backtick-mean-in-lisp) and [here](http://www.lispworks.com/documentation/HyperSpec/Body/02_df.htm)) yields an explanation to this phenomenon: A normal quote does not know about the comma convention, hence, the symbol instead of the value of the symbol (which is returned by `(doom-color 'bg)` is inserted. Wow, did not know `lisp` has pitfalls like these... Now I know better :) I will keep learning... By.
organic-bookworm · 2022-08-20 18:34
Glad you sorted it out and learned new things. >thanks for pointing me to the doom docs These demos are actually meant to be shown in `help`/`helpful` buffers for corresponding functions/macros (try e.g. `(helpful-callable 'custom-set-faces!)`) together with descriptions.