]> code.delx.au - gnu-emacs-elpa/commitdiff
Teach ggtags-visit-project-root to visit past projects
authorLeo Liu <sdl.web@gmail.com>
Wed, 3 Dec 2014 02:37:24 +0000 (10:37 +0800)
committerLeo Liu <sdl.web@gmail.com>
Wed, 3 Dec 2014 02:38:51 +0000 (10:38 +0800)
README.rst
ggtags.el

index 832d74ff1d1529b51a0ba83d296897fb7d597c3c..409b09a1529eef5a738364a2fe16b3e1f45e75c8 100644 (file)
@@ -308,6 +308,11 @@ Integration with other packages
 NEWS
 ~~~~
 
+(devel) 0.8.9
++++++++++++++
+
+#. ``ggtags-visit-project-root`` can visit past projects.
+
 [2014-12-03 Wed] 0.8.8
 ++++++++++++++++++++++
 
index 52081c92019255b301c12d239ca64f26696e784e..9e45a6fac390c6065b01a0b539160715a31edc90 100644 (file)
--- a/ggtags.el
+++ b/ggtags.el
@@ -3,7 +3,7 @@
 ;; Copyright (C) 2013-2014  Free Software Foundation, Inc.
 
 ;; Author: Leo Liu <sdl.web@gmail.com>
-;; Version: 0.8.8
+;; Version: 0.8.9
 ;; Keywords: tools, convenience
 ;; Created: 2013-01-29
 ;; URL: https://github.com/leoliu/ggtags
@@ -608,10 +608,15 @@ Value is new modtime if updated."
       (message "Project read-only-mode is %s" (if val "on" "off")))
     val))
 
-(defun ggtags-visit-project-root ()
-  (interactive)
-  (ggtags-ensure-project)
-  (dired (ggtags-current-project-root)))
+(defun ggtags-visit-project-root (&optional project)
+  "Visit the root directory of (current) PROJECT in dired.
+When called with a prefix \\[universal-argument], choose from past projects."
+  (interactive (list (and current-prefix-arg
+                          (completing-read "Project: " ggtags-projects))))
+  (dired (cl-typecase project
+           (string project)
+           (ggtags-project (ggtags-project-root project))
+           (t (ggtags-ensure-project) (ggtags-current-project-root)))))
 
 (defmacro ggtags-with-current-project (&rest body)
   "Eval BODY in current project's `process-environment'."