From ffb47a2edc76f9eeea6e7619e2d79daa591b36f6 Mon Sep 17 00:00:00 2001 From: Andreas Gerler Date: Sat, 20 Feb 2016 12:54:09 +0100 Subject: [PATCH] update ggtags and helm-gtags. --- bba.org | 4 +- elpa/ggtags-20150814.842/ggtags-pkg.el | 1 - .../ggtags-autoloads.el | 2 +- elpa/ggtags-20151214.1344/ggtags-pkg.el | 1 + .../ggtags.el | 53 +++--- elpa/ggtags-readme.txt | 10 +- .../helm-gtags-20151016.201/helm-gtags-pkg.el | 1 - .../helm-gtags-autoloads.el | 2 +- .../helm-gtags-20160202.503/helm-gtags-pkg.el | 1 + .../helm-gtags.el | 166 ++++++++++-------- 10 files changed, 132 insertions(+), 109 deletions(-) delete mode 100644 elpa/ggtags-20150814.842/ggtags-pkg.el rename elpa/{ggtags-20150814.842 => ggtags-20151214.1344}/ggtags-autoloads.el (95%) create mode 100644 elpa/ggtags-20151214.1344/ggtags-pkg.el rename elpa/{ggtags-20150814.842 => ggtags-20151214.1344}/ggtags.el (98%) delete mode 100644 elpa/helm-gtags-20151016.201/helm-gtags-pkg.el rename elpa/{helm-gtags-20151016.201 => helm-gtags-20160202.503}/helm-gtags-autoloads.el (98%) create mode 100644 elpa/helm-gtags-20160202.503/helm-gtags-pkg.el rename elpa/{helm-gtags-20151016.201 => helm-gtags-20160202.503}/helm-gtags.el (92%) diff --git a/bba.org b/bba.org index 0b034434..ede7315d 100644 --- a/bba.org +++ b/bba.org @@ -1998,9 +1998,9 @@ If you are new to tags check [[http://tuhdo.github.io/c-ide.html][this]]. #+BEGIN_SRC emacs-lisp (if (>= emacs-major-version 24) (progn - (add-to-list 'load-path "~/.emacs.d/elpa/ggtags-20150814.842" t) + (add-to-list 'load-path "~/.emacs.d/elpa/ggtags-20151214.1344" t) (require 'ggtags) - (add-to-list 'load-path "~/.emacs.d/elpa/helm-gtags-20151016.201" t) + (add-to-list 'load-path "~/.emacs.d/elpa/helm-gtags-20160202.503" t) (require 'helm-gtags) (add-hook 'puppet-mode-hook (lambda() diff --git a/elpa/ggtags-20150814.842/ggtags-pkg.el b/elpa/ggtags-20150814.842/ggtags-pkg.el deleted file mode 100644 index b4845fe2..00000000 --- a/elpa/ggtags-20150814.842/ggtags-pkg.el +++ /dev/null @@ -1 +0,0 @@ -(define-package "ggtags" "20150814.842" "emacs frontend to GNU Global source code tagging system" '((emacs "24") (cl-lib "0.5")) :url "https://github.com/leoliu/ggtags" :keywords '("tools" "convenience")) diff --git a/elpa/ggtags-20150814.842/ggtags-autoloads.el b/elpa/ggtags-20151214.1344/ggtags-autoloads.el similarity index 95% rename from elpa/ggtags-20150814.842/ggtags-autoloads.el rename to elpa/ggtags-20151214.1344/ggtags-autoloads.el index c094eb8f..50d3db47 100644 --- a/elpa/ggtags-20150814.842/ggtags-autoloads.el +++ b/elpa/ggtags-20151214.1344/ggtags-autoloads.el @@ -3,7 +3,7 @@ ;;; Code: (add-to-list 'load-path (or (file-name-directory #$) (car load-path))) -;;;### (autoloads nil "ggtags" "ggtags.el" (22057 58127 0 0)) +;;;### (autoloads nil "ggtags" "ggtags.el" (22215 7674 0 0)) ;;; Generated autoloads from ggtags.el (autoload 'ggtags-find-project "ggtags" "\ diff --git a/elpa/ggtags-20151214.1344/ggtags-pkg.el b/elpa/ggtags-20151214.1344/ggtags-pkg.el new file mode 100644 index 00000000..f505ad71 --- /dev/null +++ b/elpa/ggtags-20151214.1344/ggtags-pkg.el @@ -0,0 +1 @@ +(define-package "ggtags" "20151214.1344" "emacs frontend to GNU Global source code tagging system" '((emacs "24") (cl-lib "0.5")) :url "https://github.com/leoliu/ggtags" :keywords '("tools" "convenience")) diff --git a/elpa/ggtags-20150814.842/ggtags.el b/elpa/ggtags-20151214.1344/ggtags.el similarity index 98% rename from elpa/ggtags-20150814.842/ggtags.el rename to elpa/ggtags-20151214.1344/ggtags.el index ac29b0f0..2aaacced 100644 --- a/elpa/ggtags-20150814.842/ggtags.el +++ b/elpa/ggtags-20151214.1344/ggtags.el @@ -4,7 +4,7 @@ ;; Author: Leo Liu ;; Version: 0.8.11 -;; Package-Version: 20150814.842 +;; Package-Version: 20151214.1344 ;; Keywords: tools, convenience ;; Created: 2013-01-29 ;; URL: https://github.com/leoliu/ggtags @@ -37,13 +37,11 @@ ;; ;; All commands are available from the `Ggtags' menu in `ggtags-mode'. -;;; NEWS 0.8.10 (2015-06-12): +;;; NEWS 0.8.11 (2015-12-15): -;; - Tags update on save is configurable by `ggtags-update-on-save'. -;; - New command `ggtags-explain-tags' to explain how each file is -;; indexed in current project. -;; - New user option `ggtags-sort-by-nearness' that sorts matched tags -;; by nearness to current directory. +;; - `ggtags-highlight-tag-delay' is renamed to `ggtags-highlight-tag' +;; - Tag highlighting can be disabled by setting +;; `ggtags-highlight-tag' to nil. ;; ;; See full NEWS on https://github.com/leoliu/ggtags#news @@ -332,13 +330,17 @@ Nil means using the value of `completing-read-function'." function) :group 'ggtags) -(defcustom ggtags-highlight-tag-delay 0.25 - "Time in seconds before highlighting tag at point." +(define-obsolete-variable-alias 'ggtags-highlight-tag-delay 'ggtags-highlight-tag + "0.8.11") + +(defcustom ggtags-highlight-tag 0.25 + "If non-nil time in seconds before highlighting tag at point. +Set to `nil' to disable tag highlighting." :set (lambda (sym value) - (when (bound-and-true-p ggtags-highlight-tag-timer) - (timer-set-idle-time ggtags-highlight-tag-timer value t)) + (when (fboundp 'ggtags-setup-highlight-tag-at-point) + (ggtags-setup-highlight-tag-at-point value)) (set-default sym value)) - :type 'number + :type '(choice (const :tag "Disable" nil) number) :group 'ggtags) (defcustom ggtags-bounds-of-tag-function (lambda () @@ -1630,7 +1632,7 @@ commands `next-error' and `previous-error'. (let ((compilation-auto-jump-to-first-error t)) (compilation-auto-jump (current-buffer) (point))) (error (message "\ -ggtags: history match invalid, jump to first error instead") +ggtags: history match invalid, jump to first match instead") (first-error))))) ;; `compilation-filter' restores point and as a result commands ;; dependent on point such as `ggtags-navigation-next-file' and @@ -2205,10 +2207,7 @@ to nil disables displaying this information.") ;;;###autoload (define-minor-mode ggtags-mode nil :lighter (:eval (if ggtags-navigation-mode "" " GG")) - (unless (timerp ggtags-highlight-tag-timer) - (setq ggtags-highlight-tag-timer - (run-with-idle-timer - ggtags-highlight-tag-delay t #'ggtags-highlight-tag-at-point))) + (ggtags-setup-highlight-tag-at-point ggtags-highlight-tag) (if ggtags-mode (progn (add-hook 'after-save-hook 'ggtags-after-save-function nil t) @@ -2231,9 +2230,7 @@ to nil disables displaying this information.") (remove-function (local 'eldoc-documentation-function) 'ggtags-eldoc-function) (setq mode-line-buffer-identification (delq 'ggtags-mode-line-project-name mode-line-buffer-identification)) - (and (overlayp ggtags-highlight-tag-overlay) - (delete-overlay ggtags-highlight-tag-overlay)) - (setq ggtags-highlight-tag-overlay nil))) + (ggtags-cancel-highlight-tag-at-point 'keep-timer))) (defvar ggtags-highlight-tag-map (let ((map (make-sparse-keymap))) @@ -2253,6 +2250,22 @@ to nil disables displaying this information.") (put 'ggtags-active-tag 'help-echo "S-mouse-1 for definitions\nS-mouse-3 for references") +(defun ggtags-setup-highlight-tag-at-point (flag) + (cond ((null flag) (ggtags-cancel-highlight-tag-at-point)) + ((not (timerp ggtags-highlight-tag-timer)) + (setq ggtags-highlight-tag-timer + (run-with-idle-timer flag t #'ggtags-highlight-tag-at-point))) + (t (timer-set-idle-time ggtags-highlight-tag-timer flag t)))) + +(defun ggtags-cancel-highlight-tag-at-point (&optional keep-timer) + (when (and (not keep-timer) + (timerp ggtags-highlight-tag-timer)) + (cancel-timer ggtags-highlight-tag-timer) + (setq ggtags-highlight-tag-timer nil)) + (when ggtags-highlight-tag-overlay + (delete-overlay ggtags-highlight-tag-overlay) + (setq ggtags-highlight-tag-overlay nil))) + (defun ggtags-highlight-tag-at-point () (when (and ggtags-mode ggtags-project-root (ggtags-find-project)) (unless (overlayp ggtags-highlight-tag-overlay) diff --git a/elpa/ggtags-readme.txt b/elpa/ggtags-readme.txt index 9b0edca5..bd017ab2 100644 --- a/elpa/ggtags-readme.txt +++ b/elpa/ggtags-readme.txt @@ -10,12 +10,10 @@ for more details. All commands are available from the `Ggtags' menu in `ggtags-mode'. -NEWS 0.8.10 (2015-06-12): +NEWS 0.8.11 (2015-12-15): -- Tags update on save is configurable by `ggtags-update-on-save'. -- New command `ggtags-explain-tags' to explain how each file is - indexed in current project. -- New user option `ggtags-sort-by-nearness' that sorts matched tags - by nearness to current directory. +- `ggtags-highlight-tag-delay' is renamed to `ggtags-highlight-tag' +- Tag highlighting can be disabled by setting + `ggtags-highlight-tag' to nil. See full NEWS on https://github.com/leoliu/ggtags#news diff --git a/elpa/helm-gtags-20151016.201/helm-gtags-pkg.el b/elpa/helm-gtags-20151016.201/helm-gtags-pkg.el deleted file mode 100644 index f4ff00cc..00000000 --- a/elpa/helm-gtags-20151016.201/helm-gtags-pkg.el +++ /dev/null @@ -1 +0,0 @@ -(define-package "helm-gtags" "20151016.201" "GNU GLOBAL helm interface" '((helm "1.5.6") (cl-lib "0.5")) :url "https://github.com/syohex/emacs-helm-gtags") diff --git a/elpa/helm-gtags-20151016.201/helm-gtags-autoloads.el b/elpa/helm-gtags-20160202.503/helm-gtags-autoloads.el similarity index 98% rename from elpa/helm-gtags-20151016.201/helm-gtags-autoloads.el rename to elpa/helm-gtags-20160202.503/helm-gtags-autoloads.el index 9aed4d92..7d07abfa 100644 --- a/elpa/helm-gtags-20151016.201/helm-gtags-autoloads.el +++ b/elpa/helm-gtags-20160202.503/helm-gtags-autoloads.el @@ -3,7 +3,7 @@ ;;; Code: (add-to-list 'load-path (or (file-name-directory #$) (car load-path))) -;;;### (autoloads nil "helm-gtags" "helm-gtags.el" (22057 58110 0 +;;;### (autoloads nil "helm-gtags" "helm-gtags.el" (22215 7814 0 ;;;;;; 0)) ;;; Generated autoloads from helm-gtags.el diff --git a/elpa/helm-gtags-20160202.503/helm-gtags-pkg.el b/elpa/helm-gtags-20160202.503/helm-gtags-pkg.el new file mode 100644 index 00000000..ecfc74d8 --- /dev/null +++ b/elpa/helm-gtags-20160202.503/helm-gtags-pkg.el @@ -0,0 +1 @@ +(define-package "helm-gtags" "20160202.503" "GNU GLOBAL helm interface" '((emacs "24.3") (helm "1.7.7")) :url "https://github.com/syohex/emacs-helm-gtags") diff --git a/elpa/helm-gtags-20151016.201/helm-gtags.el b/elpa/helm-gtags-20160202.503/helm-gtags.el similarity index 92% rename from elpa/helm-gtags-20151016.201/helm-gtags.el rename to elpa/helm-gtags-20160202.503/helm-gtags.el index f86b1fdb..637cef15 100644 --- a/elpa/helm-gtags-20151016.201/helm-gtags.el +++ b/elpa/helm-gtags-20160202.503/helm-gtags.el @@ -1,12 +1,12 @@ -;;; helm-gtags.el --- GNU GLOBAL helm interface -*- lexical-binding: t; -*- +;;; helm-gtags.el --- GNU GLOBAL helm interface -*- lexical-binding: t; -*- -;; Copyright (C) 2015 by Syohei YOSHIDA +;; Copyright (C) 2016 by Syohei YOSHIDA ;; Author: Syohei YOSHIDA ;; URL: https://github.com/syohex/emacs-helm-gtags -;; Package-Version: 20151016.201 -;; Version: 1.4.9 -;; Package-Requires: ((helm "1.5.6") (cl-lib "0.5")) +;; Package-Version: 20160202.503 +;; Version: 1.5.4 +;; Package-Requires: ((emacs "24.3") (helm "1.7.7")) ;; This program is free software; you can redistribute it and/or modify ;; it under the terms of the GNU General Public License as published by @@ -60,113 +60,93 @@ (declare-function cygwin-convert-file-name-to-windows "cygw32.c") (defgroup helm-gtags nil - "GNU GLOBAL for helm" + "GNU GLOBAL for helm." :group 'helm) (defcustom helm-gtags-path-style 'root "Style of file path" :type '(choice (const :tag "Root of the current project" root) (const :tag "Relative from the current directory" relative) - (const :tag "Absolute Path" absolute)) - :group 'helm-gtags) + (const :tag "Absolute Path" absolute))) (defcustom helm-gtags-ignore-case nil "Ignore case in each search." - :type 'boolean - :group 'helm-gtags) + :type 'boolean) (defcustom helm-gtags-read-only nil "Gtags read only mode." - :type 'boolean - :group 'helm-gtags) + :type 'boolean) (defcustom helm-gtags-auto-update nil "*If non-nil, tag files are updated whenever a file is saved." - :type 'boolean - :group 'helm-gtags) + :type 'boolean) (defcustom helm-gtags-pulse-at-cursor t "If non-nil, pulse at point after jumping" - :type 'boolean - :group 'helm-gtags) + :type 'boolean) (defcustom helm-gtags-cache-select-result nil "*If non-nil, results of helm-gtags-select and helm-gtags-select-path are cached." - :type 'boolean - :group 'helm-gtags) + :type 'boolean) (defcustom helm-gtags-cache-max-result-size (* 10 1024 1024) ;10M "Max size(bytes) to cache for each select result." - :type 'integer - :group 'helm-gtags) + :type 'integer) (defcustom helm-gtags-update-interval-second 60 "Tags are updated in `after-save-hook' if this seconds is passed from last update. Always update if value of this variable is nil." :type '(choice (integer :tag "Update interval seconds") - (boolean :tag "Update every time" nil)) - :group 'helm-gtags) + (boolean :tag "Update every time" nil))) (defcustom helm-gtags-highlight-candidate t "Highlight candidate or not" - :type 'boolean - :group 'helm-gtags) + :type 'boolean) (defcustom helm-gtags-use-input-at-cursor nil "Use input at cursor" - :type 'boolean - :group 'helm-gtags) + :type 'boolean) (defcustom helm-gtags-prefix-key "\C-c" "If non-nil, it is used for the prefix key of gtags-xxx command." - :type 'string - :group 'helm-gtags) + :type 'string) (defcustom helm-gtags-suggested-key-mapping nil "If non-nil, suggested key mapping is enabled." - :type 'boolean - :group 'helm-gtags) + :type 'boolean) (defcustom helm-gtags-preselect nil "If non-nil, preselect current file and line." - :type 'boolean - :group 'helm-gtags) + :type 'boolean) (defcustom helm-gtags-display-style nil "Style of display result." :type '(choice (const :tag "Show in detail" detail) - (const :tag "Normal style" nil)) - :group 'helm-gtags) + (const :tag "Normal style" nil))) (defcustom helm-gtags-fuzzy-match nil "Enable fuzzy match" - :type 'boolean - :group 'helm-gtags) + :type 'boolean) (defcustom helm-gtags-maximum-candidates (if helm-gtags-fuzzy-match 100 9999) "Maximum number of helm candidates" - :type 'integer - :group 'helm-gtags) + :type 'integer) (defcustom helm-gtags-direct-helm-completing nil "Use helm mode directly." - :type 'boolean - :group 'helm-gtags) + :type 'boolean) (defface helm-gtags-file '((t :inherit font-lock-keyword-face)) - "Face for line numbers in the error list." - :group 'helm-gtags) + "Face for line numbers in the error list.") (defface helm-gtags-lineno '((t :inherit font-lock-doc-face)) - "Face for line numbers in the error list." - :group 'helm-gtags) + "Face for line numbers in the error list.") (defface helm-gtags-match '((t :inherit helm-match)) - "Face for word matched against tagname" - :group 'helm-gtags) + "Face for word matched against tagname") (defvar helm-gtags--tag-location nil) (defvar helm-gtags--last-update-time 0) @@ -181,6 +161,7 @@ Always update if value of this variable is nil." (defvar helm-gtags--real-tag-location nil) (defvar helm-gtags--last-input nil) (defvar helm-gtags--query nil) +(defvar helm-gtags--last-default-directory nil) (defconst helm-gtags--buffer "*helm gtags*") @@ -227,6 +208,13 @@ Always update if value of this variable is nil." (defsubst helm-gtags--windows-p () (memq system-type '(windows-nt ms-dos))) +(defun helm-gtags--remove-carrige-returns () + (when (helm-gtags--windows-p) + (save-excursion + (goto-char (point-min)) + (while (re-search-forward "\xd" nil t) + (replace-match ""))))) + ;; Work around for GNU global Windows issue (defsubst helm-gtags--use-abs-path-p (gtagslibpath) (and (helm-gtags--windows-p) gtagslibpath)) @@ -257,7 +245,7 @@ Always update if value of this variable is nil." (args (reverse (cons string options))) candidates) (with-temp-buffer - (apply 'process-file "global" nil t nil args) + (apply #'process-file "global" nil t nil args) (goto-char (point-min)) (while (re-search-forward "^\\(.+\\)$" nil t) (push (match-string-no-properties 1) candidates))) @@ -291,7 +279,7 @@ Always update if value of this variable is nil." (setq prompt (format "%s(default \"%s\") " prompt tagname))) (let ((completion-ignore-case helm-gtags-ignore-case) (completing-read-function 'completing-read-default)) - (if helm-gtags-direct-helm-completing + (if (and helm-gtags-direct-helm-completing (memq type '(tag rtag symbol find-file))) (helm-comp-read prompt comp-func :history 'helm-gtags--completing-history :exec-when-only-one t @@ -329,7 +317,8 @@ Always update if value of this variable is nil." (setq helm-gtags--tag-location tagroot)))) (defun helm-gtags--base-directory () - (let ((dir (or helm-gtags--local-directory + (let ((dir (or helm-gtags--last-default-directory + helm-gtags--local-directory (cl-case helm-gtags-path-style (root (or helm-gtags--real-tag-location helm-gtags--tag-location)) @@ -493,7 +482,7 @@ Always update if value of this variable is nil." (when libpath (dolist (path (parse-colon-path libpath)) (let ((default-directory (file-name-as-directory path))) - (apply 'process-file "global" nil t nil "-Poa" args)))))) + (apply #'process-file "global" nil t nil "-Poa" args)))))) (defun helm-gtags--exec-global-command (type input &optional detail) (let ((args (helm-gtags--construct-command type input))) @@ -505,11 +494,12 @@ Always update if value of this variable is nil." (input (car (last args))) (coding-system-for-read buf-coding) (coding-system-for-write buf-coding)) - (unless (zerop (apply 'process-file "global" nil '(t nil) nil args)) + (unless (zerop (apply #'process-file "global" nil '(t nil) nil args)) (error (format "%s: not found" input))) ;; --path options does not support searching under GTAGSLIBPATH (when (eq type 'find-file) (helm-gtags--print-path-in-gtagslibpath args)) + (helm-gtags--remove-carrige-returns) (when detail (helm-gtags--show-detail))))))) @@ -565,6 +555,7 @@ Always update if value of this variable is nil." (let* ((default-directory (helm-gtags--base-directory)) (status (process-file "global" nil '(t nil) nil "--result=grep" from-here-opt token))) + (helm-gtags--remove-carrige-returns) (unless (zerop status) (cond ((= status 1) (error "Error: %s%s" (buffer-string) filename)) @@ -576,7 +567,8 @@ Always update if value of this variable is nil." (with-current-buffer (helm-candidate-buffer 'global) (unless (zerop (process-file "global" nil t nil "--result=cscope" "-f" helm-gtags--parsed-file)) - (error "Failed: 'global --result=cscope -f %s" helm-gtags--parsed-file)))) + (error "Failed: 'global --result=cscope -f %s" helm-gtags--parsed-file)) + (helm-gtags--remove-carrige-returns))) (defun helm-gtags--push-context (context) (let* ((context-info (helm-gtags--get-or-create-context-info)) @@ -590,8 +582,8 @@ Always update if value of this variable is nil." (defsubst helm-gtags--select-find-file-func () (if helm-gtags--use-otherwin - 'helm-gtags--open-file-other-window - 'helm-gtags--open-file)) + #'helm-gtags--open-file-other-window + #'helm-gtags--open-file)) (defun helm-gtags--do-open-file (open-func file line) (funcall open-func file helm-gtags-read-only) @@ -646,8 +638,10 @@ Always update if value of this variable is nil." (helm-current-line-contents))))) (defun helm-gtags--files-candidate-transformer (file) - (let ((removed-regexp (concat "\\`" helm-gtags--tag-location))) - (replace-regexp-in-string removed-regexp "" file))) + (if (eq helm-gtags-path-style 'absolute) + file + (let ((removed-regexp (concat "\\`" helm-gtags--tag-location))) + (replace-regexp-in-string removed-regexp "" file)))) (defun helm-gtags--show-stack-init () (cl-loop with context-stack = (plist-get (helm-gtags--get-context-info) :stack) @@ -665,14 +659,22 @@ Always update if value of this variable is nil." (filename (car file-and-line)) (line (cdr file-and-line)) (default-directory (helm-gtags--base-directory))) + (when (eq helm-gtags-path-style 'relative) + (setq helm-gtags--last-default-directory default-directory)) (find-file filename) (goto-char (point-min)) (forward-line (1- line)) (helm-highlight-current-line))) +(defun helm-gtags--file-persistent-action (cand) + (let ((default-directory (with-helm-current-buffer + default-directory))) + (helm-ff-kill-or-find-buffer-fname cand))) + (defvar helm-gtags--find-file-action - '(("Open file" . helm-gtags--action-openfile) - ("Open file other window" . helm-gtags--action-openfile-other-window))) + (helm-make-actions + "Open file" #'helm-gtags--action-openfile + "Open file other window" #'helm-gtags--action-openfile-other-window)) (defvar helm-source-gtags-tags (helm-build-in-buffer-source "Jump to definitions" @@ -803,13 +805,13 @@ Always update if value of this variable is nil." (cl-case major-mode ((c-mode c++-mode java-mode) 'c-beginning-of-defun) (php-mode 'php-beginning-of-defun) - (otherwise 'beginning-of-defun))) + (otherwise #'beginning-of-defun))) (defsubst helm-gtags--end-of-defun () (cl-case major-mode ((c-mode c++-mode java-mode malabar-mode) 'c-end-of-defun) (php-mode 'php-end-of-defun) - (otherwise 'end-of-defun))) + (otherwise #'end-of-defun))) (defun helm-gtags--current-funcion-bound () (save-excursion @@ -895,7 +897,7 @@ Always update if value of this variable is nil." (let ((cache (helm-gtags--get-result-cache tagfile))) (if cache (insert cache) - (apply 'process-file "global" nil t nil args) + (apply #'process-file "global" nil t nil args) (let* ((cache (buffer-string)) (cache-size (length cache))) (when (<= cache-size helm-gtags-cache-max-result-size) @@ -904,34 +906,41 @@ Always update if value of this variable is nil." (defun helm-gtags--source-select-init () (with-current-buffer (helm-candidate-buffer 'global) (if (not helm-gtags-cache-select-result) - (process-file "global" nil t nil "-c") + (progn + (process-file "global" nil t nil "-c") + (helm-gtags--remove-carrige-returns)) (helm-gtags--select-cache-init-common '("-c") "GTAGS")))) (defvar helm-source-gtags-select (helm-build-in-buffer-source "Find tag from here" :init 'helm-gtags--source-select-init :candidate-number-limit helm-gtags-maximum-candidates - :persistent-action 'helm-gtags--persistent-action + :persistent-action #'ignore :fuzzy-match helm-gtags-fuzzy-match - :action '(("Goto the location" . helm-gtags--select-tag-action) - ("Goto the location(other buffer)" . - (lambda (c) - (setq helm-gtags--use-otherwin t) - (helm-gtags--select-tag-action c))) - ("Move to the referenced point" . helm-gtags--select-rtag-action)))) + :action (helm-make-actions + "Goto the location" #'helm-gtags--select-tag-action + "Goto the location(other buffer)" + (lambda (c) + (setq helm-gtags--use-otherwin t) + (helm-gtags--select-tag-action c)) + "Move to the referenced point" #'helm-gtags--select-rtag-action))) (defun helm-gtags--select-path-init () + (helm-gtags--find-tag-directory) (with-current-buffer (helm-candidate-buffer 'global) - (if (not helm-gtags-cache-select-result) - (process-file "global" nil t nil "-Poa") - (helm-gtags--select-cache-init-common '("-Poa") "GPATH")))) + (let ((options (if (eq helm-gtags-path-style 'relative) "-Po" "-Poa"))) + (if (not helm-gtags-cache-select-result) + (progn + (process-file "global" nil t nil options) + (helm-gtags--remove-carrige-returns)) + (helm-gtags--select-cache-init-common options "GPATH"))))) (defvar helm-source-gtags-select-path (helm-build-in-buffer-source "Select path" :init 'helm-gtags--select-path-init :candidate-number-limit helm-gtags-maximum-candidates :real-to-display 'helm-gtags--files-candidate-transformer - :persistent-action 'helm-gtags--persistent-action + :persistent-action #'helm-gtags--file-persistent-action :fuzzy-match helm-gtags-fuzzy-match :action (helm-actions-from-type-file))) @@ -993,7 +1002,11 @@ Always update if value of this variable is nil." (file-relative-name buffile (helm-gtags--base-directory)))))) (format "%s:%d" path (line-number-at-pos)))) +(defsubst helm-gtags--clear-variables () + (setq helm-gtags--last-default-directory nil)) + (defun helm-gtags--common (srcs tagname) + (helm-gtags--clear-variables) (let ((helm-quit-if-no-candidate t) (helm-execute-action-at-once-if-one t) (dir (helm-gtags--searched-directory)) @@ -1008,7 +1021,7 @@ Always update if value of this variable is nil." (setq helm-gtags--query tagname)) (let ((tagroot (helm-gtags--find-tag-simple))) (helm-attrset 'helm-gtags-base-directory dir src) - (helm-attrset 'name (concat "GNU Global at " (or dir tagroot)) src) + (helm-attrset 'name (format "%s in %s" tagname (or dir tagroot)) src) (helm :sources srcs :buffer helm-gtags--buffer :preselect preselect-regexp)))) @@ -1195,7 +1208,7 @@ Generate new TAG file in selected directory with `C-u C-u'" (current-time (float-time (current-time)))) (when (helm-gtags--update-tags-p how-to interactive-p current-time) (let* ((cmds (helm-gtags--update-tags-command how-to)) - (proc (apply 'start-file-process "helm-gtags-update-tag" nil cmds))) + (proc (apply #'start-file-process "helm-gtags-update-tag" nil cmds))) (if (not proc) (message "Failed: %s" (mapconcat 'identity cmds " ")) (set-process-sentinel proc (helm-gtags--make-gtags-sentinel 'update)) @@ -1229,7 +1242,7 @@ Generate new TAG file in selected directory with `C-u C-u'" (when browser (setq args (append (list "-b" browser) args))) ;; `gozilla' commend never returns error status if command is failed. - (apply 'process-file "gozilla" nil nil nil args))))) + (apply #'process-file "gozilla" nil nil nil args))))) (defvar helm-gtags-mode-name " HelmGtags") (defvar helm-gtags-mode-map (make-sparse-keymap)) @@ -1237,7 +1250,6 @@ Generate new TAG file in selected directory with `C-u C-u'" ;;;###autoload (define-minor-mode helm-gtags-mode () "Enable helm-gtags" - :group 'helm-gtags :init-value nil :global nil :keymap helm-gtags-mode-map -- 2.47.3