GithubHelp home page GithubHelp logo

Comments (6)

dkogan avatar dkogan commented on August 26, 2024

Hi. Thanks for the report.

I'm somewhat mystified by this. xcscope has worked with TRAMP for years, and I use it this way all the time. Let's try to figure out what's going on before patching this.

First off, can you confirm that you're running xcscope.el from this repo (or from Debian or Ubuntu)? The copy the cscope project ships is ancient, and does not work with TRAMP.

If so, let's look at the properties on your end. In your *cscope* buffer put the point on the m in memory_global_dirty_log_start[2568] and hit C-u C-x =

A new window will open up, telling you things. Towards the end it should say something like

There are text properties here:
  cscope-file          "/scp:val17:......."

Do you see that? Specifically, the cscope-file property should contain the full TRAMP path. Does it?

from xcscope.el.

Raphus-cucullatus avatar Raphus-cucullatus commented on August 26, 2024
  1. xcscope.el from MELPA (xcscope-20180426.712) was used. Though, I re-produced the issue using the xcscope.el from this repo (I used Emacs 25.2.2 and 26.2).

  2. C-u C-x = in my case shows

There are text properties here:
  cscope-file          "/home/yf/src/qemu-git/memory.c"
  cscope-fuzzy-search-text-regexp "void\\s-*memory\\s-*_\\s-*global\\s-*_\\s-*dirty\\s-*_\\s-*log\\s-*_\\s-*start\\s-*(\\s-*void\\s-*)"
  cscope-line-number   2568
  face                 cscope-function-face
  mouse-face           cscope-mouse-face

I see. I guess this issue is related to how the cscope database is generated. I use make cscope to generate the database. And it turns out absolute path is used for file names.

In this case, expand-file-name does not expand the "absolute" file name with the TRAMP prefix. So the "absolute" file name "(/home/yf/src/qemu-git/memory.c") is inserted in the text properties.

(expand-file-name file)

Therefore, my fix #21 does not work either. It only works when the file names are absolute. For relative file names, it produces "/scp:yf@val17:memory.c" which also leads to "is not readable or exists" :P

from xcscope.el.

dkogan avatar dkogan commented on August 26, 2024

OK. What does make cscope do? All my testing was done with indexing with C-c s I. This doesn't request absolute or relative, but rather does the default thing. You should try it to see what it does for you. And you should tell me what your command does so that I can test it here.

from xcscope.el.

Raphus-cucullatus avatar Raphus-cucullatus commented on August 26, 2024

Sorry for insufficient information.

make cscope does:

rm -f "/home/yf/src/qemu-git"/cscope.*
find "/home/yf/src/qemu-git/" -name "*.[chsS]" -print > "/home/yf/src/qemu-git/cscope.files"
cscope -b -i"/home/yf/src/qemu-git/cscope.files"

The head of the cscope.files:

/home/yf/src/qemu-git/migration/xbzrle.h
/home/yf/src/qemu-git/migration/rdma.h
/home/yf/src/qemu-git/migration/channel.h
/home/yf/src/qemu-git/migration/socket.c
/home/yf/src/qemu-git/migration/qjson.h
/home/yf/src/qemu-git/migration/migration.h
/home/yf/src/qemu-git/migration/tls.h
/home/yf/src/qemu-git/migration/qemu-file-channel.h
/home/yf/src/qemu-git/migration/global_state.c
/home/yf/src/qemu-git/migration/fd.h

from xcscope.el.

dkogan avatar dkogan commented on August 26, 2024

Please try this patch:

diff --git a/xcscope.el b/xcscope.el
index e6f8a6b..539e5ad 100644
--- a/xcscope.el
+++ b/xcscope.el
@@ -2144,6 +2144,18 @@ concatenation of ARGS is returned"
   dir
   )
 
+
+(defun cscope--expand-file-name-with-absolute-remote (file)
+  "Returns an expanded filename, with the remote prefix.
+This is just like `expand-file-name', but will always contain the
+remote prefix if `default-directory' has one. `expand-file-name'
+will not do this if FILE is an absolute (but local) path"
+  (let ((file-expanded (expand-file-name file)))
+    (if (file-remote-p file-expanded)
+        file-expanded
+      (concat (or (file-remote-p default-directory) "")
+              file-expanded))))
+
 (defun cscope-construct-custom-options-list ()
   "Returns a list of cscope options defined by the
 cscope-option-* variables"
@@ -2361,7 +2373,7 @@ using the mouse."
                                                  str))
                           (cscope-insert-with-text-properties
                            str
-                           (expand-file-name file))
+                           (cscope--expand-file-name-with-absolute-remote file))
                           (insert "\n")))
 
                     (if cscope-first-match-point
@@ -2374,7 +2386,7 @@ using the mouse."
                      (cscope-make-entry-line function-name
                                              line-number
                                              line)
-                     (expand-file-name file)
+                     (cscope--expand-file-name-with-absolute-remote file)
                      line-number
                      line)
                     (insert "\n")

from xcscope.el.

Raphus-cucullatus avatar Raphus-cucullatus commented on August 26, 2024

OK, it fixes this issue.

from xcscope.el.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.