|
From: | Shigio YAMAGUCHI |
Subject: | Re: Proposed patch - Better choice of default for gtags-visit-rootdir |
Date: | Mon, 28 Sep 2015 07:38:49 +0900 |
When in a file buffer that resides in what will be the gtags
root directory (because the GTAGS et al have not yet been created),
invoking gtags-visit-rootdir and pressing RETURN to accept the
default results in the file being chosen rather than the
(displayed) directory.
This is because read-file-name is using the absolute file name
of the file:
> If both default and initial are nil and the buffer is visiting
> a file, read-file-name uses the absolute file name of that
> file as default.
--- gtags.el 2015-09-14 19:48:17.000000000 -0700
+++ ../share/gtags/gtags.el 2015-09-26 13:22:52.490185835 -0700
@@ -515,13 +515,17 @@
(defun gtags-visit-rootdir ()
"Tell tags commands the root directory of source tree."
(interactive)
- (let (path input)
+ (let (path input default-path)
(setq path gtags-rootdir)
(if (not path)
(setq path (gtags-get-rootpath)))
(if (not path)
(setq insert-default-directory (if (string-match gtags-tramp-path-regexp default-directory) nil t)))
- (setq input (read-file-name "Visit root directory: " path path t))
+ (setq default-path
+ (if (and insert-default-directory (not path))
+ default-directory
+ path))
+ (setq input (read-file-name "Visit root directory: " path default-path t))
(if (equal "" input) nil
(if (not (file-directory-p input))
(message "%s is not directory." input)
_______________________________________________
Bug-global mailing list
address@hidden
https://lists.gnu.org/mailman/listinfo/bug-global
[Prev in Thread] | Current Thread | [Next in Thread] |