branch: externals/company commit dccd04b7fb658d366c2081b6ce7ddcd208ce7ae0 Author: Dmitry Gutov <dgu...@yandex.ru> Commit: Dmitry Gutov <dgu...@yandex.ru>
company-gtags--fetch-tags: Revert an earlier change Just to simplify, #1038. --- company-gtags.el | 48 +++++++++++++++++++++++------------------------- 1 file changed, 23 insertions(+), 25 deletions(-) diff --git a/company-gtags.el b/company-gtags.el index 06a303b..daf067f 100644 --- a/company-gtags.el +++ b/company-gtags.el @@ -89,31 +89,29 @@ completion." company-gtags-executable))) (defun company-gtags--fetch-tags (prefix) - "Call global executable " - (let ((caller-buffer (current-buffer))) - (with-temp-buffer - (let ((temp-buffer (current-buffer))) - (when (with-current-buffer caller-buffer - ;; Execute the command in the local buffer but output in the temporal one. - (/= 3 (process-file (company-gtags--executable) nil - ;; "-T" goes through all the tag files listed in GTAGSLIBPATH - temp-buffer nil "-xGqT" (concat "^" prefix)))) - (goto-char (point-min)) - (cl-loop while - (re-search-forward (concat - "^" - "\\([^ ]*\\)" ;; completion - "[ \t]+\\([[:digit:]]+\\)" ;; linum - "[ \t]+\\([^ \t]+\\)" ;; file - "[ \t]+\\(.*\\)" ;; definition - "$" - ) nil t) - collect - (propertize (match-string 1) - 'meta (match-string 4) - 'location (cons (expand-file-name (match-string 3)) - (string-to-number (match-string 2))) - ))))))) + (with-temp-buffer + (let (tags) + ;; For some reason Global v 6.6.3 is prone to returning exit status 1 + ;; even on successful searches when '-T' is used. + (when (/= 3 (process-file company-gtags-executable nil + ;; "-T" goes through all the tag files listed in GTAGSLIBPATH + (list (current-buffer) nil) nil "-xGqT" (concat "^" prefix))) + (goto-char (point-min)) + (cl-loop while + (re-search-forward (concat + "^" + "\\([^ ]*\\)" ;; completion + "[ \t]+\\([[:digit:]]+\\)" ;; linum + "[ \t]+\\([^ \t]+\\)" ;; file + "[ \t]+\\(.*\\)" ;; definition + "$" + ) nil t) + collect + (propertize (match-string 1) + 'meta (match-string 4) + 'location (cons (expand-file-name (match-string 3)) + (string-to-number (match-string 2))) + )))))) (defun company-gtags--annotation (arg) (let ((meta (get-text-property 0 'meta arg)))