Search code examples
elisp

emacs lisp expand-file-name to string


    (setq jedi:server-args
          '("--sys-path" "/usr/lib/python3.6"
            "--sys-path" "/home/jerryzhang/.local/lib/python3.6/site-packages"))

worked well, but I want use $HOME replace /home/jerryzhang/ for more general. So I guess can use expand-file-name

(setq jedi:server-args
          '("--sys-path" "/usr/lib/python3.6"
            "--sys-path" (expand-file-name "~/.local/lib/python3.6/site-packages")))

but it not same as I thought, looks like expand-file-name not execute.

sorry, I am not leaned lisp, but as an emacser.


Solution

  • Alternatively, you can use a backquote to substitute the result into the list, eg.

    (setq jedi:server-args
          `("--sys-path" "/usr/lib/python3.6"
            "--sys-path" ,(expand-file-name "~/.local/lib/python3.6/site-packages")))
    

    This is commonly used in lisps -- see elisp backquote