【发布时间】:2014-04-08 21:13:51
【问题描述】:
我遇到了这两个问题:
在顶级形式中: init.el:28:1:Warning: `(add-path (p) (add-to-list (quote load-path) (concat emacs-root p)))' 是一个格式错误的函数 init.el:42:1:错误:无法打开加载文件:exec-path-from-shell
在编译以下 elisp 期间:
(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
这两个问题都让我很困惑。
我不明白为什么这个基金被认为是“畸形” `(add-path (p) (add-to-list (quote load-path) (concat emacs-root p)))'
其次为什么“require”无法加载文件。
这些问题只发生在编译期间,未编译的代码可以正常工作
非常感谢任何指点
问候,罗曼
【问题讨论】:
-
如果您想使用
cl-labels,那么您可能需要确保变量lexical-binding不是nil。请参阅文档字符串。