在emacs中编辑.emacs.el时,我运行了Alt + X eval-buffer命令.我的操作系统是Windows.当我重新启动emacs时,它会显示以下警告:
警告(初始化):加载`... /.emacs.el'时发生错误:
错误:用于Unicode转义的非十六进制数字
为确保正常运行,您应该调查并删除初始化文件中的错误原因.使用`--debug-init'选项启动Emacs以查看完整的错误回溯.
.emacs.el是:
;;Open all fine in one running instance
;;Ref:http://www.johndcook.com/blog/2010/07/28/miscellaneous-emacs-adventures/
;;(server-start)
;;TEST
(custom-set-variables
;; custom-set-variables was added by Custom.
;; If you edit it by hand, you could mess it up, so be careful.
;; Your init file should contain only one such instance.
;; If there is more than one, they won't work right.
`(ansi-color-names-vector ["#242424" "#e5786d" "#95e454" "#cae682" "#8ac6f2" "#333366" "#ccaa8f" "#f6f3e8"])
`(custom-enabled-themes (quote (wheatgrass))))
(custom-set-faces
;; custom-set-faces was added by Custom.
;; If you edit it by hand, you could mess it up, so be careful.
;; Your init file should contain only one such instance.
;; If there is more than one, they won't work right.
)
;;Set auto save backup location, failed with following warning
(setq backup-directory-alist
`((".*" . ,"D:\Unix-Tmp")))
(setq auto-save-file-name-transforms
`((".*" ,"D:\Unix-Tmp" t)))
(require 'recentf)
(recentf-mode 1)
(setq inhibit-startup-screen t)
(put 'upcase-region 'disabled nil)
(put 'downcase-region 'disabled nil)
;;Aspell install failed
;;(setq-default ispell-program-name "C:/bin/Aspell/bin/aspell.exe")
;;(setq text-mode-hook '(lambda() (flyspell-mode t) ))
Run Code Online (Sandbox Code Playgroud)
我怎么解决它?
问题是这些问题:
(setq backup-directory-alist
`((".*" . ,"D:\Unix-Tmp")))
(setq auto-save-file-name-transforms
`((".*" ,"D:\Unix-Tmp" t)))
Run Code Online (Sandbox Code Playgroud)
在\U引入了Unicode转义......并且必须后跟十六进制数字.
你实际上想要的是一个字面反斜杠字符,所以你需要逃避它; 即
(setq backup-directory-alist
`((".*" . ,"D:\\Unix-Tmp")))
(setq auto-save-file-name-transforms
`((".*" ,"D:\\Unix-Tmp" t)))
Run Code Online (Sandbox Code Playgroud)
参考:http://www.gnu.org/software/emacs/manual/html_node/elisp/Basic-Char-Syntax.html#Basic-Char-Syntax
UPDATE
但是,这似乎会导致另一个问题.更好的解决方案是做@Stefan建议的事情.使用"/"代替"\"作为路径名分隔符.(它应该在Windows上工作......)
| 归档时间: |
|
| 查看次数: |
3741 次 |
| 最近记录: |