bug-global
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: client on freebsd over tramp server on archlinux


From: andrés ramírez
Subject: Re: client on freebsd over tramp server on archlinux
Date: Wed, 21 Oct 2020 17:50:36 +0000

Hi. Michael.

>>>>> "Michael" == Michael Albinus <michael.albinus@gmx.de> writes:

    Michael> Shigio YAMAGUCHI <shigio@gnu.org> writes: Hi,

    >>> Perhaps gtags.el could be improved for transparent access through TRAMP.
    >> 
    >> You are right.  However, it is a little difficult to realize your idea, 
because the
    >> architecture is different between etags and Global.  If you make it, 
please post it on this
    >> mailing list.

    Michael> I don't use GNU GLOBAL, but I took a look on gtags.el. My 
recommendation is to replace
    Michael> `call-process' by `process-file'. Furthermore, in 
`gtags-get-rootpath' the result is
    Michael> used as file name. Perhaps it is needed to transform the file name 
into a remote file
    Michael> name, like in

I am going to give You a little bit more info about how global and
gtags.el works. On the client machine gtags-goto-tag uses 'call-process'
for invoking the utility global-client
which needs to have ssh access without password. This could lead for
this arquitecture not working with tramp multihops, right?. And also the
major issue is requiring ssh access without password (because of the
utility global-client).

I think the change should be very similar to the way etags is invoked
over tramp. But find-tag is very simple:
--8<---------------cut here---------------start------------->8---
(defun find-tag (tagname &optional next-p regexp-p)
  "Find tag (in current tags table) whose name contains TAGNAME.
Select the buffer containing the tag's definition, and move point there.
The default for TAGNAME is the expression in the buffer around or before point.

If second arg NEXT-P is t (interactively, with prefix arg), search for
another tag that matches the last tagname or regexp used.  When there are
multiple matches for a tag, more exact matches are found first.  If NEXT-P
is the atom `-' (interactively, with prefix arg that is a negative number
or just \\[negative-argument]), pop back to the previous tag gone to.

If third arg REGEXP-P is non-nil, treat TAGNAME as a regexp.

A marker representing the point when this command is invoked is pushed
onto a ring and may be popped back to with \\[pop-tag-mark].
Contrast this with the ring of marks gone to by the command.

See documentation of variable `tags-file-name'."
  (declare (obsolete xref-find-definitions "25.1"))
  (interactive (find-tag-interactive "Find tag: "))
  (let* ((buf (find-tag-noselect tagname next-p regexp-p))
         (pos (with-current-buffer buf (point))))
    (condition-case nil
        (switch-to-buffer buf)
      (error (pop-to-buffer buf)))
    (goto-char pos)))
--8<---------------cut here---------------end--------------->8---

find-tag never realizes it is being executed over tramp. Unless I am
missing something.

    Michael> (concat (file-remote-p default-directory) path)

I have edebugged it. and the running-path for this case does not use
rootdir. So. Let's skip it by now. Talking about it later. Just We would
need to remind it.


BTW. Just In case. I am testing with this source code:
--8<---------------cut here---------------start------------->8---
// cc -o borrame.bin borrame.c
#include <stdio.h>

static void myfunct() {
  printf("test") ;
}

int main(int argc, char *argv[]) {
  myfunct();
}
--8<---------------cut here---------------end--------------->8---

>From cli. Run gtags on the directory where source code file is located. This 
>should
create three files:
--8<---------------cut here---------------start------------->8---
  /tmp/global_test:
  total used in directory 56 available 825.7 MiB
  drwxr-xr-x  3 olla users   160 Oct 21 16:39 .
  drwxrwxrwt 10 root root    560 Oct 21 17:31 ..
  -rw-r--r--  1 olla users 16384 Oct 20 23:24 GPATH
  -rw-r--r--  1 olla users 16384 Oct 20 23:24 GRTAGS
  -rw-r--r--  1 olla users 16384 Oct 20 23:24 GTAGS
  -rw-r--r--  1 olla users   148 Oct 20 18:03 borrame.c
  drwxrwxrwx  2 root root     60 Oct 21 16:44 lisp
--8<---------------cut here---------------end--------------->8---

eval gtags.el {which on my case is inside the lisp directory}

eval snippet below too. Select or mark it and M-x eval-region
--8<---------------cut here---------------start------------->8---
(global-set-key (kbd "M-.") 'sunshavi/find-tag)
(defun sunshavi/find-tag (askp)
  "replacement for gtags-find-tag without prompt. For changing it go to 
.emacs-rc-binding.el and search for gtags"
  (interactive "P")
  (if askp
      (call-interactively #'gtags-find-tag)
    (let (tagname prompt input)
      (setq tagname (gtags-current-token))
      (gtags-push-context)
      (gtags-goto-tag tagname ""))))
--8<---------------cut here---------------end--------------->8---

Then M-x goto-line 9 on source code {borrame.c}
Them M-m
Then M-. {when done over tramp. It is not working If You do not have ssh
access to server machine without password}

With All that explanation. I could have done an "emacs -Q" batch
script. :)

Best Regards



reply via email to

[Prev in Thread] Current Thread [Next in Thread]