如何在elisp中正确使用setq?

时间:2017-08-20 07:25:43

标签: variables emacs elisp

在我的emacs配置中,我尝试使用以下代码为jedi配置项目根目录:

(setq jedi:server-args '("--sys-path" (projectile-project-root)))

哪一个抛出:

deferred error : (wrong-type-argument stringp (projectile-project-root))

(我有(setq debug-on-error t)但是回溯没有显示任何内容)

如果我对这样的路径进行硬编码,那么一切都按预期工作:

(setq jedi:server-args '("--sys-path" "/some/path"))

为此行提供一些上下文,这是周围的代码:

(add-hook 'python-mode-hook 'jedi:setup)
(setq debug-on-error t)
(defun jedi-config:setup-server-args ()
  (message (format "Configuring current project dir: %s"
           (projectile-project-root)))
  (setq jedi:server-args '("--sys-path" (projectile-project-root))))

(add-hook 'python-mode-hook
      'jedi-config:setup-server-args)

如何使用projectile变量为jedi设置server-args?

1 个答案:

答案 0 :(得分:1)

我终于明白了 - 真的很简单:

(setq jedi:server-args (list "--sys-path" (projectile-project-root)))
相关问题