Emacs - 要注册的变量中的文件路径

时间:2013-07-01 09:24:12

标签: emacs elisp

我对Emacs很新,我遇到了一个问题。我想将寄存器设置为变量,我的代码在这里:

(defvar org-file-location "")
(defvar system-name-as-string (prin1-to-string system-name))

(cond ((string-match "WIN-WORK" system-name-as-string)
           (setq org-file-location "~/../My Documents/Google Drive/Org"))
          )

(set-register ?o '(file . org-file-location))

但是当我尝试通过键序列 CX rjo 进行注册时,我收到错误: find-file-noselect:错误的类型参数:stringp,org-file-location < / b>。 有谁知道,问题是什么? 我将不胜感激任何帮助。 提前谢谢。

1 个答案:

答案 0 :(得分:1)

您将寄存器设置为包含符号org-file-location的值,但您希望将其值作为变量。

试试这个:

(set-register ?o (cons 'file org-file-location))

或者,使用反引号语法来插值:

(set-register ?o `(file . ,org-file-location))