aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEric S. Raymond <[email protected]>2008-05-10 12:40:57 +0000
committerEric S. Raymond <[email protected]>2008-05-10 12:40:57 +0000
commit2cd5294d11827e2146c24173b13338e8c9a284c2 (patch)
tree27b5a4b2d77349e1ab50c12f8b24b8a71232cbbc
parent6af511e3228b185df40e303ce0463d2e4d30293a (diff)
New functions implementing motion to next and previous directory.
-rw-r--r--lisp/ChangeLog5
-rw-r--r--lisp/vc-dispatcher.el43
2 files changed, 46 insertions, 2 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 74652cf84d..2b45d7b6e7 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,8 @@
+2008-05-10 Eric S. Raymond <[email protected]>
+
+ * vc-dispatcher.el (vc-dir-next-directory, vc-dir-prev-directory):
+ New functions implementing motion to next and previous directory.
+
2008-05-10 Dan Nicolaescu <[email protected]>
* vc.el: Update todo.
diff --git a/lisp/vc-dispatcher.el b/lisp/vc-dispatcher.el
index 16c8a0fc5a..8fe42f183f 100644
--- a/lisp/vc-dispatcher.el
+++ b/lisp/vc-dispatcher.el
@@ -117,8 +117,6 @@
;;
;; - vc-dir toolbar needs more icons.
;;
-;; - add commands to move to the prev/next directory in vc-dir.
-;;
;; - vc-dir-menu-map-filter hook call needs to be moved to vc.el.
;;
@@ -743,6 +741,11 @@ See `run-hooks'."
(define-key map "\t" 'vc-dir-next-line)
(define-key map "p" 'vc-dir-previous-line)
(define-key map [backtab] 'vc-dir-previous-line)
+ ;;; Rebind paragraph-movement commands.
+ (define-key map "\M-}" 'vc-dir-next-directory)
+ (define-key map "\M-{" 'vc-dir-prev-directory)
+ (define-key map "\M-<down>" 'vc-dir-next-directory)
+ (define-key map "\M-<up>" 'vc-dir-prev-directory)
;; The remainder.
(define-key map "f" 'vc-dir-find-file)
(define-key map "\C-m" 'vc-dir-find-file)
@@ -930,6 +933,42 @@ If a prefix argument is given, move by that many lines."
(ewoc-goto-prev vc-ewoc arg)
(vc-dir-move-to-goal-column))
+(defun vc-dir-next-directory ()
+ "Go to the next directory."
+ (interactive)
+ (let ((orig (point)))
+ (if
+ (catch 'foundit
+ (while t
+ (let* ((next (ewoc-next vc-ewoc (ewoc-locate vc-ewoc))))
+ (cond ((not next)
+ (throw 'foundit t))
+ (t
+ (progn
+ (ewoc-goto-node vc-ewoc next)
+ (vc-dir-move-to-goal-column)
+ (if (vc-dir-fileinfo->directory (ewoc-data next))
+ (throw 'foundit nil))))))))
+ (goto-char orig))))
+
+(defun vc-dir-prev-directory ()
+ "Go to the previous directory."
+ (interactive)
+ (let ((orig (point)))
+ (if
+ (catch 'foundit
+ (while t
+ (let* ((prev (ewoc-prev vc-ewoc (ewoc-locate vc-ewoc))))
+ (cond ((not prev)
+ (throw 'foundit t))
+ (t
+ (progn
+ (ewoc-goto-node vc-ewoc prev)
+ (vc-dir-move-to-goal-column)
+ (if (vc-dir-fileinfo->directory (ewoc-data prev))
+ (throw 'foundit nil))))))))
+ (goto-char orig))))
+
(defun vc-dir-mark-unmark (mark-unmark-function)
(if (use-region-p)
(let ((firstl (line-number-at-pos (region-beginning)))