Emacs ECB ecb-source-path中的一个目录?

时间:2011-03-20 16:18:51

标签: emacs elisp emacs-ecb

我正在为Ruby on Rails开发设置emacs,并且希望ECB窗口只显示我正在处理的项目的目录。这可能吗?

我们假设在cd到项目目录后启动emacs。我已将以下内容添加到我的.emacs中:

(defvar start-dir (getenv "PWD"))
(custom-set-variables
 '(ecb-layout-name "left14")
 '(ecb-layout-window-sizes (quote (("left14" (0.2564102564102564 . 0.6949152542372882) (0.2564102564102564 . 0.23728813559322035)))))
 '(ecb-options-version "2.32")
 '(ecb-primary-secondary-mouse-buttons (quote mouse-1--C-mouse-1))
 '(ecb-source-path (list start-dir))
 '(ecb-tip-of-the-day nil)
 '(ecb-tree-buffer-style (quote ascii-guides))
 '(inhibit-startup-screen t))

注意我创建了一个仅包含start-dir的列表。但是,ECB显示start-dir 根(/)目录。

2 个答案:

答案 0 :(得分:2)

我想出了一个解决方案,只显示我在ECB窗口中运行emacs的目录:

(defvar start-dir (getenv "PWD"))
(defvar start-dir-name (car (last (split-string start-dir "/"))))
(custom-set-variables
 '(ecb-layout-name "left14")
 '(ecb-layout-window-sizes (quote (("left14" (0.2564102564102564 . 0.6949152542372882) (0.2564102564102564 . 0.23728813559322035)))))
 '(ecb-options-version "2.32")
 '(ecb-primary-secondary-mouse-buttons (quote mouse-1--C-mouse-1))
 '(ecb-source-path (list (list start-dir start-dir-name)))
 '(ecb-tip-of-the-day nil)
 '(ecb-tree-buffer-style (quote ascii-guides))
 '(inhibit-startup-screen t))

答案 1 :(得分:0)

试试(setq ecb-source-path (quote "/path/to/project/"))。您当前的设置会生成ecb-source-path nil,如果您describe-variable,则可以看到。