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

Emacs-要注册的变量中的文件路径,emacs,elisp,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 Dri

我是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))
但当我尝试按键序列C-XRJO跳转注册时,我得到了一个错误:find file noselect:错误的类型参数:stringp,org file location。 有人知道问题出在哪里吗? 我将感谢任何帮助。
提前感谢。

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

试试这个:

(set-register ?o (cons 'file org-file-location))
或者,使用反引号语法插入值:

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

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

试试这个:

(set-register ?o (cons 'file org-file-location))
或者,使用反引号语法插入值:

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