ECB windows display their number: W-0, W-1, etc.

Is there a way to define bindings so that I can get to these windows using bindings such as C-c . w 0, C-c . w 1, rather than using C-c . g d to go to directories, C-c . g s to go to sources?

enter image description here

Alternatively, is there a way to display the key bindings for the windows in the frame modelines?

2 Answers 2


Here's what to do, and how to discover it :)

Navigating to one of these windows, we see that the local value of mode-line-format is:

    (format " W-%d"
 (#(" " 0 1
    (face ecb-mode-line-prefix-face)))
 (#("/Volumes/Home/hodiquey/Projects/git/ecb" 0 39
    (help-echo "Mouse-2 toggles maximizing, mouse-3 displays a popup-menu" face ecb-mode-line-data-face))))

Therefore, ecb-window-in-window-list-number and ecb-canonical-windows-list are the key (and the actual numbers is 1 more than what's displayed)

You can then do something like

(defun my-jump-to-ecb-number (n)
  (interactive "p")
  (let ((winlist (ecb-canonical-windows-list)))
      (assoc (+ n 1)
             (mapcar (lambda (win)
                       (cons (ecb-window-in-window-list-number winlist win)

And use it with something like

(define-key ecb-mode-map (kbd "w 0") (lambda () (interactive) (my-jump-to-ecb-number 0)))

The generic solution would be:

  1. Use describe-key (C-h k) or describe-key-briefly(C-h c) to get the names of the commands invoked by the original bindings:

    • C-h c C-c . g d
    • C-h c C-c . g s
  2. Set up additional bindings for the commands:

    (define-key ecb-mode-map (kbd "w 0") 'goto-dirs)
    (define-key ecb-mode-map (kbd "w 1") 'goto-sources)

    ... where goto-dirs and goto-sources are the names of the commands you obtained in step 1.

  • that wouldn't work too well when switching layouts (which would potentially change the number associated with dirs/sources)
    – Sigma
    Commented Oct 10, 2014 at 22:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.