global tags over tramp (gtags.el)
[email protected] Wed, 16 Oct 2019 14:39:39 +0000
| Newsgroups | gmane.comp.gnu.global.bugs |
|---|---|
| Message-ID | <[email protected]> |
Hi Guys.
I am editing files remotely with tramp. Then I run gtags-goto-tag And I
am getting this error:
--8<---------------cut here---------------start------------->8---
Debugger entered--Lisp error: (file-missing "Searching for program" "No such file or directory" "global-client")
call-process("global-client" nil t nil "-xi" "--encode-path=\" \011\"" #("QUERY_FOR_SINGLE_SALE" 0 21 (fontified t)))
(if (equal flag "C") (call-process gtags-global-command nil t nil option "--encode-path=\" \011\"" context tagname) (call-process gtags-global-command nil t nil option "--encode-path=\" \011\"" tagname))
(setq status (if (equal flag "C") (call-process gtags-global-command nil t nil option "--encode-path=\" \011\"" context tagname) (call-process gtags-global-command nil t nil option "--encode-path=\" \011\"" tagname)))
(let (status) (gtags-push-tramp-environment) (cond ((equal gtags-path-style (quote absolute)) (setq option (concat option "a"))) ((and (not gtags-tramp-active) (equal gtags-path-style (quote root))) (let (rootdir) (if gtags-rootdir (setq rootdir gtags-rootdir) (setq rootdir (gtags-get-rootpath))) (if rootdir (cd rootdir))))) (setq status (if (equal flag "C") (call-process gtags-global-command nil t nil option "--encode-path=\" \011\"" context tagname) (call-process gtags-global-command nil t nil option "--encode-path=\" \011\"" tagname))) (gtags-pop-tramp-environment) (if (not (= 0 status)) (progn (message (buffer-substring (point-min) (1- (point-max)))) (gtags-pop-context)) (goto-char (point-min)) (setq lines (count-lines (point-min) (point-max))) (cond ((= 0 lines) (cond ((char-equal flag-char 80) (message "%s: path not found" tagname)) ((char-equal flag-char 103) (message "%s: pattern not found" tagname)) ((char-equal flag-char 73) (message "%s: token not found" tagname)) ((char-equal flag-char 115) (message "%s: symbol not found" tagname)) (t (message "%s: tag not found" tagname))) (gtags-pop-context) (kill-buffer buffer) (set-buffer save)) ((= 1 lines) (message "Searching %s ... Done" tagname) (gtags-select-it t other-win)) (t (if (null other-win) (switch-to-buffer buffer) (switch-to-buffer-other-window buffer)) (gtags-select-mode)))))
(let (option context save prefix buffer lines flag-char) (setq save (current-buffer)) (setq flag-char (string-to-char flag)) (if (equal flag-char nil) (setq flag-char (string-to-char " "))) (setq option "-x") (if (gtags-ignore-casep) (setq option (concat option "i"))) (if (char-equal flag-char 67) (setq context (concat "--from-here=" (number-to-string (gtags-current-lineno)) ":" (replace-in-string (gtags-buffer-file-name) "\\\\" "/"))) (setq option (concat option flag))) (cond ((char-equal flag-char 67) (setq prefix "(CONTEXT)")) ((char-equal flag-char 80) (setq prefix "(P)")) ((char-equal flag-char 102) (setq prefix "(F)")) ((char-equal flag-char 103) (setq prefix "(GREP)")) ((char-equal flag-char 73) (setq prefix "(IDUTILS)")) ((char-equal flag-char 115) (setq prefix "(S)")) ((char-equal flag-char 114) (setq prefix "(R)")) (t (setq prefix "(D)"))) (if gtags-select-buffer-single (progn (let (now-gtags-buffer-stack now-buffer now-gtags-point-stack now-point) (setq now-gtags-buffer-stack (reverse gtags-buffer-stack)) (setq now-gtags-point-stack (reverse gtags-point-stack)) (setq gtags-buffer-stack nil) (setq gtags-point-stack nil) (while now-gtags-buffer-stack (setq now-buffer (car now-gtags-buffer-stack)) (setq now-point (car now-gtags-point-stack)) (if (and (buffer-name now-buffer) (not ...)) (progn (setq gtags-buffer-stack ...) (setq gtags-point-stack ...))) (setq now-gtags-buffer-stack (cdr now-gtags-buffer-stack)) (setq now-gtags-point-stack (cdr now-gtags-point-stack)))) (let (now-buffer-list now-buffer) (setq now-buffer-list (buffer-list)) (while now-buffer-list (setq now-buffer (car now-buffer-list)) (if (string-match "*GTAGS SELECT*" (buffer-name now-buffer)) (kill-buffer now-buffer)) (setq now-buffer-list (cdr now-buffer-list)))))) (setq buffer (generate-new-buffer (generate-new-buffer-name (concat "*GTAGS SELECT* " prefix tagname)))) (set-buffer buffer) (message "Searching %s ..." tagname) (let (status) (gtags-push-tramp-environment) (cond ((equal gtags-path-style (quote absolute)) (setq option (concat option "a"))) ((and (not gtags-tramp-active) (equal gtags-path-style (quote root))) (let (rootdir) (if gtags-rootdir (setq rootdir gtags-rootdir) (setq rootdir (gtags-get-rootpath))) (if rootdir (cd rootdir))))) (setq status (if (equal flag "C") (call-process gtags-global-command nil t nil option "--encode-path=\" \011\"" context tagname) (call-process gtags-global-command nil t nil option "--encode-path=\" \011\"" tagname))) (gtags-pop-tramp-environment) (if (not (= 0 status)) (progn (message (buffer-substring (point-min) (1- (point-max)))) (gtags-pop-context)) (goto-char (point-min)) (setq lines (count-lines (point-min) (point-max))) (cond ((= 0 lines) (cond ((char-equal flag-char 80) (message "%s: path not found" tagname)) ((char-equal flag-char 103) (message "%s: pattern not found" tagname)) ((char-equal flag-char 73) (message "%s: token not found" tagname)) ((char-equal flag-char 115) (message "%s: symbol not found" tagname)) (t (message "%s: tag not found" tagname))) (gtags-pop-context) (kill-buffer buffer) (set-buffer save)) ((= 1 lines) (message "Searching %s ... Done" tagname) (gtags-select-it t other-win)) (t (if (null other-win) (switch-to-buffer buffer) (switch-to-buffer-other-window buffer)) (gtags-select-mode))))))
gtags-goto-tag(#("QUERY_FOR_SINGLE_SALE" 0 21 (fontified t)) "")
(let (tagname prompt input) (setq tagname (gtags-current-token)) (gtags-push-context) (gtags-goto-tag tagname ""))
sunshavi/find-tag()
funcall-interactively(sunshavi/find-tag)
call-interactively(sunshavi/find-tag nil nil)
command-execute(sunshavi/find-tag)
--8<---------------cut here---------------end--------------->8---
Besides that i have found this on gtags.el
--8<---------------cut here---------------start------------->8---
(defun gtags-push-tramp-environment ()
(let ((tramp-path default-directory))
(if (string-match gtags-tramp-path-regexp tramp-path)
(let ((shell (match-string 1 tramp-path))
(user-and-host (match-string 2 tramp-path))
(cwd (match-string 3 tramp-path)))
;
; Server side GLOBAL cannot treat other than rsh and ssh.
;
(cond
((equal shell "rsh"))
((equal shell "ssh"))
((equal shell "rcp")
(setq shell "rsh"))
((equal shell "scp")
(setq shell "ssh"))
(t
(setq shell "ssh")))
(let (host user)
(if (string-match gtags-tramp-user-host-regexp user-and-host)
(progn
(setq user (match-string 1 user-and-host))
(setq host (match-string 2 user-and-host)))
(progn
(setq user nil)
(setq host user-and-host)))
;
; Move to tramp mode only when all the items are assembled.
;
(if (and shell host cwd)
(progn
(setq gtags-tramp-active t)
(setq gtags-tramp-saved-global-command gtags-global-command)
; Use 'global-client even if environment variable GTAGSGLOBAL is set.
;(setq gtags-global-command (getenv "GTAGSGLOBAL"))
;(if (or (not gtags-global-command) (equal gtags-global-command ""))
(setq gtags-global-command "global-client")
;)
(push (concat "GTAGSREMOTESHELL=" shell) process-environment)
(push (concat "GTAGSREMOTEHOST=" host) process-environment)
(push (concat "GTAGSREMOTEUSER=" user) process-environment)
(push (concat "GTAGSREMOTECWD=" cwd) process-environment))))))))
--8<---------------cut here---------------end--------------->8---
I have contacted the tramp author: Michael Albinus. Who have told me:
--8<---------------cut here---------------start------------->8---
The backtrace shows that call-process is applied. This runs always a
*local* process; Tramp is not involved.
--8<---------------cut here---------------end--------------->8---
As a workaround. I have tested etags and ggtags.el. Let me know If You
need more information about the issue.
Best Regards. AR
_______________________________________________
Bug-global mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/bug-global