Fork me on GitHub

Elisp help please. Is there a recommended way to use an environment variable when setting the location of my auth-sources? It seems auth-sources wants a quoted list of values, which means pulling out the environment variable and adding the filename isnt going to be evaluated. So the following doesnt quite work...

(setq auth-sources '((concat (getenv "XDG_CONFIG_HOME") "/authinfo.gpg")
I guess I could just use the relative locations in the list
(setq auth-sources '("~/.config/authinfo.gpg" "~/.authinfo.gpg"))
But wonder if there is a nicer approach



(setq auth-sources `((concat ,(getenv "XDG_CONFIG_HOME") "/authinfo.gpg")

👍 1

which is the fancy way to quote/unquote something


even simpler:

(setq auth-sources (list
                    (concat (getenv "XDG_CONFIG_HOME") "/authinfo.gpg")


ah, so , is unquoting and therefore the concat expression evaluates to a string, nice. I like the list approach, more obvious to me. Thank you.

👍 1

Since Emacs 26 I think, instead of (getenv "XDG_CONFIG_HOME") you can require 'xdg package and call (xdg-config-home). It's basically just getenv plus a fallback to ~/.config, so probably doesn't matter much.


I recently followed this tip from HN which is how I always wanted merge conflicts to be rendered. The cool part being, Emacs already understands this diff3 format OOTB. The new part is rendered in yellow: highly recommended emacs

🙏 3

That does look nice. Fwiw, I've always used ediff in emacs from a magit status buffer and it's similar to what you're showing but it also has each version in a separate buffer. I use n and p to go to the previous/next conflict and choose a (local), b (remote) or c (ancestor). Haven't used smerge though so not sure if I'm missing out on something...

💯 1

@U45T93RA6 so if I set

git config --global merge.conflictstyle diff3
then Emacs will show the common ancestor automatically when I have a merge conflict in magit? Or is there something else needed?


I don't know for magit specifically, but yes, I had to do nothing in Emacs :)


So is the screenshot an example of ediff? Or something in the Emacs version control?


diff3 format shows in Magit status once merge.conflictstyle diff3 is set in the git config, nice

🙌 2