Re: Proposed patch - Better choice of default for gtags-visit-rootdir

Shigio YAMAGUCHI <[email protected]>
Newsgroups gmane.comp.gnu.global.bugs
Message-ID <CADJmJYpw1ys4WZA9a0Q=Oh4PPK-V14513VExD6sEmKpkj8209g@mail.gmail.com>
Hello,
Sorry but I don't understand what is problem.
Would you please tell me a method by example which reproduce
the situation of the problem?

Regards,
Shigio


2015-09-27 5:56 GMT+09:00 Earl Chew <[email protected]>:

> 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
> [email protected]
> https://lists.gnu.org/mailman/listinfo/bug-global
>



-- 
Shigio YAMAGUCHI <[email protected]>
PGP fingerprint: D1CB 0B89 B346 4AB6 5663  C4B6 3CA5 BBB3 57BE DDA3

_______________________________________________
Bug-global mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/bug-global
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.