1

I'm setting up emacs for Ruby on Rails development, and would like the ECB window to show only the directory for the project I'm working on. Is that possible?

Let's assume that I start emacs after I cd to the project's directory. I've added the following to my .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))

Notice I've created a list containing only the start-dir. However ECB shows both the start-dir and the root (/) dir.

Luke Girvin
  • 13,221
  • 9
  • 64
  • 84
erturne
  • 1,799
  • 1
  • 15
  • 29
  • If you use Aquamacs, apart from those settings, I would recommend this setting to enable ECB context menu: http://stackoverflow.com/questions/7541693/ecb-context-menu-in-aquamacs/7591540 – Ngoc Dao Sep 29 '11 at 02:10

2 Answers2

2

I figured out a solution to only show the directory from which I run emacs in the ECB window:

(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))
erturne
  • 1,799
  • 1
  • 15
  • 29
  • "defvar start-dir-name (car (last (split-string start-dir "/")))" can not work on MAC OX – why Feb 05 '12 at 13:04
0

Try (setq ecb-source-path (quote "/path/to/project/")). Your present setup makes ecb-source-path nil, which you can see if you do describe-variable.

vpit3833
  • 7,817
  • 2
  • 25
  • 25
  • My original attempt set ecb-source-path to a string containing the directory that emacs was run from, not nil. Also, the point of the question was to make ecb show ONLY the directory that emacs was run from, but it was showing that AND the root directory. – erturne Mar 22 '11 at 11:34