Emacs &引用;“格式不正确的函数”;警告和要求;无法打开加载文件:";错误
我有两个问题: 以顶级形式: 初始el:28:1:警告:`(添加路径(p)(添加到列表中(引用加载路径)(concat emacs root(p))”是一个格式不正确的函数 init.el:42:1:错误:无法从shell打开加载文件:exec路径 在编译以下elisp时:Emacs &引用;“格式不正确的函数”;警告和要求;无法打开加载文件:";错误,emacs,elisp,Emacs,Elisp,我有两个问题: 以顶级形式: 初始el:28:1:警告:`(添加路径(p)(添加到列表中(引用加载路径)(concat emacs root(p))”是一个格式不正确的函数 init.el:42:1:错误:无法从shell打开加载文件:exec路径 在编译以下elisp时: (eval-when-compile (require 'cl)) ;; root of all emacs-related stuff (eval-when-compile (defvar emacs-root
(eval-when-compile (require 'cl))
;; root of all emacs-related stuff
(eval-when-compile
(defvar emacs-root
(if (or (eq system-type 'cygwin)
(eq system-type 'gnu/linux)
(eq system-type 'linux)
(eq system-type 'darwin))
"~/.emacs.d/" "z:/.emacs.d/")
"Path to where EMACS configuration root is."))
(eval-when-compile
(defvar emacs-root "~/.emacs.d"
"Path to where EMACS configuration root is."))
;; path to where plugins are kept
(defvar plugin-path (concat emacs-root "el-get")
"*Path to el-get plugins.")
;; for portability with < 24.3 EMACS
(unless (fboundp 'cl-labels) (fset 'cl-labels 'labels))
;; add paths to various configuration modes
(cl-labels
((add-path (p)
(add-to-list 'load-path
(concat emacs-root p))))
(add-path ".")
(add-path "settings")
(add-path "site-lisp")
(add-path "erlang")
(add-path "exec-path-from-shell"))
;; set PATH, because we don't load .bashrc
(require 'exec-path-from-shell) ;; <- Error: Cannot open load file: exec-path-from-shell
(编译时求值(需要'cl))
;; 所有emacs相关内容的根
(编译时求值)
(定义emacs根)
(如果(或)(eq系统类型“cygwin”)
(eq系统类型“gnu/linux”)
(eq系统类型“linux”)
(均衡器系统类型“达尔文”)
“~/.emacs.d/”z:/.emacs.d/”)
“EMACS配置根目录所在的路径。”)
(编译时求值)
(定义emacs根“~/.emacs.d”
“EMACS配置根目录所在的路径。”)
;; 保存插件的路径
(defvar插件路径(concat emacs根“el get”)
“*获取插件的路径。”)
;; 对于<24.3 EMACS的可移植性
(除非(fboundp'cl标签)(fset'cl标签)
;; 向各种配置模式添加路径
(cl)标签
((添加路径(p)
(添加到列表的“加载路径”
(concat emacs根(p)))
(添加路径“”)
(添加路径“设置”)
(添加路径“site lisp”)
(添加路径“erlang”)
(添加路径“exec path from shell”))
;; 设置路径,因为我们不加载.bashrc
(需要“来自shell的exec路径”) 您需要在编译时加载“cl lib”:
(eval-when-compile (require 'cl-lib))
此外,正如Stefan在中的评论中所解释的,编译时不应在eval中定义变量。只需使用defvar
cl标签
由cl-lib
提供,而不是由cl
提供。因此,您需要(需要'cl-lib)
(在编译时也可以将其包装在eval中
)。如果要使用cl标签
,则可能需要确保变量词法绑定
为非nil
。请参阅doc字符串。但我确实加载(编译时求值(要求'cl))-我的lisp列表的第一行。在编译时不使用eval而使用defvar似乎不会产生差异。第一个(require)语句总是导致无法打开加载文件:此emacs设置的repo位于此处: