[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/gtags-mode 9dcb18fbe7 58/61: Use cscope output; it is e
From: |
ELPA Syncer |
Subject: |
[elpa] externals/gtags-mode 9dcb18fbe7 58/61: Use cscope output; it is easier to parse. |
Date: |
Thu, 28 Apr 2022 10:57:42 -0400 (EDT) |
branch: externals/gtags-mode
commit 9dcb18fbe730e0492d794b3ac97c513882207304
Author: Jimmy Aguilar Mena <kratsbinovish@gmail.com>
Commit: Jimmy Aguilar Mena <kratsbinovish@gmail.com>
Use cscope output; it is easier to parse.
Use --path-style=through because it asserts relative results and
reduces the size of the output to process/transfer.
---
gtags-mode.el | 42 ++++++++++++++++++++++--------------------
1 file changed, 22 insertions(+), 20 deletions(-)
diff --git a/gtags-mode.el b/gtags-mode.el
index ed66559ab6..2a0b2f4193 100644
--- a/gtags-mode.el
+++ b/gtags-mode.el
@@ -61,11 +61,11 @@ The address is absolute for remote hosts.")
"Project Global root for this buffer.")
(defconst gtags-mode--output-format-regex
-
"^\\([^[:blank:]]+\\)[[:blank:]]+\\([[:digit:]]+\\)[[:blank:]]+\\([^[:blank:]]+\\)[[:blank:]]+\\(.*\\)"
+ "^\\([^ ]+\\) \\([^ ]+\\) \\([[:digit:]]+\\) \\(.*\\)"
"Regex to filter the output with `gtags-mode--output-format-options'.")
(defconst gtags-mode--output-format-options
- '("--result=ctags-x" "--path-style=absolute" "--color=never")
+ '("--result=cscope" "--path-style=through" "--color=never")
"Command line options to use with `gtags-mode--output-format-regex'.")
;; Connection functions
@@ -199,16 +199,19 @@ completions usually from the cache when possible."
Returns the results as a list of CREATORS outputs similar to
`mapcar'. Creator should be a function with 4 input arguments:
name, code, file, line."
- (delete nil (mapcar
- (lambda (line)
- (when (string-match gtags-mode--output-format-regex line)
- (funcall creator
- (match-string-no-properties 1 line) ;; name
- (match-string-no-properties 4 line) ;; code
- (match-string-no-properties 3 line) ;; file
- (string-to-number (match-string-no-properties 2
line))))) ;; line
- (gtags-mode--exec-sync
- (append args gtags-mode--output-format-options) symbol))))
+ (if-let ((root (plist-get (gtags-mode--local-plist) :gtagsroot)))
+ (delete nil (mapcar
+ (lambda (line)
+ (when (string-match gtags-mode--output-format-regex line)
+ (funcall creator
+ (match-string-no-properties 2 line) ;; name
+ (match-string-no-properties 4 line) ;; code
+ (concat root (substring-no-properties
+ line (1+ (match-beginning 1))
(match-end 1))) ;; file
+ (string-to-number (match-string-no-properties 3
line))))) ;; line
+ (gtags-mode--exec-sync
+ (append args gtags-mode--output-format-options) symbol)))
+ (error "Calling gtags-mode--filter-find-symbol without GTAGSROOT")))
(defun gtags-mode--update-buffers-plist ()
"Actions to perform after creating a database.
@@ -247,11 +250,10 @@ This iterates over the buffers and tries to reset
(defun gtags-mode--xref-find-symbol (args symbol)
"Run GNU Global to create xref input list with ARGS on SYMBOL.
Return as a list of xref location objects."
- (let ((remote (file-remote-p default-directory)))
- (gtags-mode--filter-find-symbol
- args symbol
- (lambda (_name code file line)
- (xref-make code (xref-make-file-location (concat remote file) line
0))))))
+ (gtags-mode--filter-find-symbol
+ args symbol
+ (lambda (_name code file line)
+ (xref-make code (xref-make-file-location file line 0)))))
(cl-defmethod xref-backend-identifier-completion-table ((_backend (head
:gtagsroot)))
"List all symbols."
@@ -294,13 +296,13 @@ Return as a list of xref location objects."
(cl-defmethod project-files ((project (head :gtagsroot)) &optional dirs)
"List files inside all the PROJECT or in DIRS if specified."
(let* ((root (project-root project))
- (remote (file-remote-p root))
(results (mapcan
(lambda (dir)
(when (string-prefix-p root dir)
- (mapcar (lambda (file) (concat remote file)) ;; Add
remote prefix
+ (mapcar (lambda (file)
+ (concat root (substring-no-properties file 1)))
(gtags-mode--exec-sync
- '("--path-style=absolute" "--path")
+ '("--path-style=through" "--path")
(string-remove-prefix root dir)))))
(or dirs `(,root)))))
(if (> (length dirs) 1) (delete-dups results) results)))
- [elpa] externals/gtags-mode 076ae4a55e 51/61: Fall back to default on imenu., (continued)
- [elpa] externals/gtags-mode 076ae4a55e 51/61: Fall back to default on imenu., ELPA Syncer, 2022/04/28
- [elpa] externals/gtags-mode c60bb82307 42/61: Don't use with-memoization it is too new., ELPA Syncer, 2022/04/28
- [elpa] externals/gtags-mode 54368ee7e0 38/61: Better use of the new plist., ELPA Syncer, 2022/04/28
- [elpa] externals/gtags-mode 053184f8b5 14/61: Don't call with-connection-local-variables, ELPA Syncer, 2022/04/28
- [elpa] externals/gtags-mode 192258fa32 17/61: Use list instead of quotes., ELPA Syncer, 2022/04/28
- [elpa] externals/gtags-mode 9fc5c618a1 36/61: Simplify a bit more the cache handling code., ELPA Syncer, 2022/04/28
- [elpa] externals/gtags-mode c823dcffc9 49/61: Assert not call plist-put for nil, ELPA Syncer, 2022/04/28
- [elpa] externals/gtags-mode d4890f5bb3 45/61: Small simplification., ELPA Syncer, 2022/04/28
- [elpa] externals/gtags-mode 95b730930b 27/61: Remove global-xref--sync-sentinel, ELPA Syncer, 2022/04/28
- [elpa] externals/gtags-mode 1f2f3d272b 57/61: Fix performance issue., ELPA Syncer, 2022/04/28
- [elpa] externals/gtags-mode 9dcb18fbe7 58/61: Use cscope output; it is easier to parse.,
ELPA Syncer <=
- [elpa] externals/gtags-mode 0954a065d3 37/61: Miscellaneous fixes, ELPA Syncer, 2022/04/28
- [elpa] externals/gtags-mode a14940cd98 35/61: Reorder some code and simplify cache code, ELPA Syncer, 2022/04/28
- [elpa] externals/gtags-mode e8d19c4333 52/61: Add code to run extra sentinel, ELPA Syncer, 2022/04/28
- [elpa] externals/gtags-mode 9c4323a5e6 13/61: Improve connection local code., ELPA Syncer, 2022/04/28
- [elpa] externals/gtags-mode a9f6acbaba 22/61: List GTAGS buffers., ELPA Syncer, 2022/04/28
- [elpa] externals/gtags-mode 04c2d9fbaf 24/61: Use file-truename, ELPA Syncer, 2022/04/28
- [elpa] externals/gtags-mode 599dfb8002 18/61: Improve debug of async processes., ELPA Syncer, 2022/04/28