|
View:
New views
6 Messages
—
Rating Filter:
Alert me
|
|
|
gtags.el: Completion while "Find files:"Hi,
thanks for gnu global! gtags.el enables completion on "tab" only for tag and symbols. I am so used to completion, that I find myself often removing a "tab" from the "Find files:" prompt :-). So, I patched "Find files:" to enable completion. I find it useful, and it makes the emacs user interface more consistent. A patch against 5.7.6 is attached. As I am not a lisp expert, there may be better ways to do this. Regards, Tobias [gtags.el.patch] --- gtags.el.orig 2009-10-15 14:11:39.000000000 +0200 +++ gtags.el 2009-10-15 14:13:28.000000000 +0200 @@ -223,8 +223,10 @@ (gtags-completing 'gtags string predicate code)) (defun gtags-completing-gsyms (string predicate code) (gtags-completing 'gsyms string predicate code)) +(defun gtags-completing-files (string predicate code) + (gtags-completing 'files string predicate code)) ;; common part of completing-XXXX -;; flag: 'gtags or 'gsyms +;; flag: 'gtags or 'gsyms or 'files (defun gtags-completing (flag string predicate code) (let ((option "-c") (complete-list (make-vector 63 0)) @@ -233,11 +235,18 @@ (set-buffer (generate-new-buffer "*Completions*")) (if (eq flag 'gsyms) (setq option (concat option "s"))) + (if (eq flag 'files) + (setq option "-P")) (call-process "global" nil t nil option string) (goto-char (point-min)) - (while (looking-at gtags-symbol-regexp) - (intern (gtags-match-string 0) complete-list) - (forward-line)) + (if (eq flag 'files) + (while (looking-at (concat ".*\\(" string ".*\\)")) + (intern (gtags-match-string 1) complete-list) + (forward-line)) + (while (looking-at gtags-symbol-regexp) + (intern (gtags-match-string 0) complete-list) + (forward-line)) + ) (kill-buffer (current-buffer)) ; recover current buffer (set-buffer prev-buffer) @@ -349,7 +358,8 @@ (interactive) (let (tagname prompt input) (setq prompt "Find files: ") - (setq input (read-string prompt)) + (setq input (completing-read prompt 'gtags-completing-files + nil nil nil gtags-history-list)) (if (not (equal "" input)) (setq tagname input)) (gtags-push-context) (gtags-goto-tag tagname "P"))) _______________________________________________ Bug-global mailing list Bug-global@... http://lists.gnu.org/mailman/listinfo/bug-global |
|
|
Re: gtags.el: Completion while "Find files:"Hi,
It's very convenient! But it seems that it generates too many candidates. How about changing like follows? (call-process "global" nil t nil option string) | v (call-process "global" nil t nil option (concat "/" string)) "global -P /ab" matches to: abc/efg.c == xyz/abx.c == but doesn't match to: xab/yyy.c == xxx/yab.c == What do you think? > Hi, > > thanks for gnu global! > > gtags.el enables completion on "tab" only for tag and symbols. I am so > used to completion, that I find myself often removing a "tab" from the > "Find files:" prompt :-). > > So, I patched "Find files:" to enable completion. I find it useful, > and it makes the emacs user interface more consistent. Shigio YAMAGUCHI <shigio@...> PGP fingerprint: D1CB 0B89 B346 4AB6 5663 C4B6 3CA5 BBB3 57BE DDA3 _______________________________________________ Bug-global mailing list Bug-global@... http://lists.gnu.org/mailman/listinfo/bug-global |
|
|
Re: gtags.el: Completion while "Find files:"Good idea, but the change of behavior should also apply to the found
files, not only to the completion list, right? So, (gtags-goto-tag tagname "P") in gtags-find-file could be changed into (gtags-goto-tag (concat "/" tagname) "P") ? Regards, Tobias 2009/10/16 Shigio YAMAGUCHI <shigio@...>: > Hi, > It's very convenient! > > But it seems that it generates too many candidates. > How about changing like follows? > > (call-process "global" nil t nil option string) > | > v > (call-process "global" nil t nil option (concat "/" string)) > > "global -P /ab" matches to: > > abc/efg.c > == > xyz/abx.c > == > > but doesn't match to: > > xab/yyy.c > == > xxx/yab.c > == > > What do you think? > >> Hi, >> >> thanks for gnu global! >> >> gtags.el enables completion on "tab" only for tag and symbols. I am so >> used to completion, that I find myself often removing a "tab" from the >> "Find files:" prompt :-). >> >> So, I patched "Find files:" to enable completion. I find it useful, >> and it makes the emacs user interface more consistent. > -- > Shigio YAMAGUCHI <shigio@...> > PGP fingerprint: D1CB 0B89 B346 4AB6 5663 C4B6 3CA5 BBB3 57BE DDA3 > > _______________________________________________ Bug-global mailing list Bug-global@... http://lists.gnu.org/mailman/listinfo/bug-global |
|
|
Re: gtags.el: Completion while "Find files:"> Good idea, but the change of behavior should also apply to the found
> files, not only to the completion list, right? > > So, > (gtags-goto-tag tagname "P") > in gtags-find-file could be changed into > (gtags-goto-tag (concat "/" tagname) "P") > ? Only the input part might be suitable for the change. The word 'completing read' generally means a input method supported by collecting candidates of object whose name starts by the input string. For example: > a<TAB> axxx ayyy azzz <= start by 'a' If this is as follows: > a<TAB> xaxx yyya zzaz <= include 'a' it contradicts the intuition of the user. However, since a path name consists of one or more units, we should make candidates for each unit. On the other hand, since user should be able to use all of the function of the -P option, the entire function need not change, I think. Regards, Shigio -- Shigio YAMAGUCHI <shigio@...> PGP fingerprint: D1CB 0B89 B346 4AB6 5663 C4B6 3CA5 BBB3 57BE DDA3 _______________________________________________ Bug-global mailing list Bug-global@... http://lists.gnu.org/mailman/listinfo/bug-global |
|
|
Re: gtags.el: Completion while "Find files:"Hi Shigio,
> Only the input part might be suitable for the change. > The word 'completing read' generally means a input method supported > by collecting candidates of object whose name starts by the input string. One could argue, that 'completing read' means: "show all candidates of possible extensions of the current string that lead to a non-zero match." Personally, I think it would be unintuitive to have, for example: user: a<TAB> emacs: axxx somepath/azzz <= start by 'a' user: RETURN emacs: axxx yyyyayyy <= contains 'a' wwwawww/wwwww somepath/azzzz For me, it would be most sensible to restrict the use of the function -P (i.e., completing and searching with /), but any other option (completing with /, search without /, or completing and searching without /) would be an advantage. So I would happily leave the decision to your expertise. Regards, Tobias _______________________________________________ Bug-global mailing list Bug-global@... http://lists.gnu.org/mailman/listinfo/bug-global |
|
|
Re: gtags.el: Completion while "Find files:"Hi Tobias
> One could argue, that 'completing read' means: "show all candidates of > possible extensions of the current string that lead to a non-zero > match." > > Personally, I think it would be unintuitive to have, for example: > > user: a<TAB> > emacs: axxx somepath/azzz <= start by 'a' > user: RETURN > emacs: > axxx > yyyyayyy <= contains 'a' > wwwawww/wwwww > somepath/azzzz You are right. I accept your concept. Completing read for 'gtags-find-file' will be included in the next release. Thank you. Regards, Shigio -- Shigio YAMAGUCHI <shigio@...> PGP fingerprint: D1CB 0B89 B346 4AB6 5663 C4B6 3CA5 BBB3 57BE DDA3 _______________________________________________ Bug-global mailing list Bug-global@... http://lists.gnu.org/mailman/listinfo/bug-global |
| Free embeddable forum powered by Nabble | Forum Help |