(defcustom ggtags-oversize-limit (* 10 1024 1024)
"The over size limit for the GTAGS file.
-For large source trees, running 'global -u' can be expensive.
-Thus when GTAGS file is larger than this limit, ggtags
-automatically switches to 'global --single-update'."
+When the size of the GTAGS file is below this limit, ggtags
+always maintains up-to-date tags for the whole source tree by
+running `global -u'. For projects with GTAGS larger than this
+limit, only files edited in Ggtags mode are updated (via `global
+--single-update')."
:safe 'numberp
:type '(choice (const :tag "None" nil)
(const :tag "Always" t)
:type 'key-sequence
:group 'ggtags)
+(defcustom ggtags-completing-read-function nil
+ "Ggtags specific `completing-read-function' (which see).
+Nil means using the value of `completing-read-function'."
+ :type '(choice (const :tag "Use completing-read-function" nil)
+ function)
+ :group 'ggtags)
+
(defcustom ggtags-highlight-tag-delay 0.25
"Time in seconds before highlighting tag at point."
:set (lambda (sym value)
(setq ggtags-current-tag-name
(cond (confirm
(ggtags-update-tags)
- (completing-read
- (format (if default "%s (default %s): " "%s: ") prompt default)
- ggtags-completion-table nil require-match nil nil default))
+ (let ((completing-read-function
+ (or ggtags-completing-read-function
+ completing-read-function)))
+ (completing-read
+ (format (if default "%s (default %s): " "%s: ") prompt default)
+ ggtags-completion-table nil require-match nil nil default)))
(default (substring-no-properties default))
(t (ggtags-read-tag type t prompt require-match default))))))
(not buffer-file-name)
(not (ggtags-project-has-refs (ggtags-find-project)))
(not (ggtags-project-file-p buffer-file-name)))
- (ggtags-find-tag 'definition (shell-quote-argument name)))
+ (ggtags-find-definition name))
(t (ggtags-find-tag (format "--from-here=%d:%s"
(line-number-at-pos)
(shell-quote-argument
(goto-char (posn-point (event-start event)))
(call-interactively #'ggtags-find-tag-dwim))))
+;; Another option for `M-.'.
+(defun ggtags-find-definition (name)
+ (interactive (list (ggtags-read-tag 'definition current-prefix-arg)))
+ (ggtags-find-tag 'definition (shell-quote-argument name)))
+
(defun ggtags-setup-libpath-search (type name)
(pcase (and ggtags-global-search-libpath-for-reference
(ggtags-get-libpath))
(funcall cont buf how)))
((string-prefix-p "exited abnormally" how)
;; If exit abnormally display the buffer for inspection.
- (ggtags-global--display-buffer))
+ (ggtags-global--display-buffer)
+ (when (save-excursion
+ (goto-char (point-max))
+ (re-search-backward
+ (eval-when-compile
+ (format "^global: %s not found.$"
+ (regexp-opt '("GTAGS" "GRTAGS" "GSYMS" "GPATH"))))
+ nil t))
+ (ggtags-echo "WARNING: Global tag files missing in `%s'"
+ ggtags-project-root)
+ (remhash ggtags-project-root ggtags-projects)))
(ggtags-auto-jump-to-match
(if (pcase (compilation-next-single-property-change
(point-min) 'compilation-message)
;; Note: Place `ggtags-global-output-format' as first element for
;; `ggtags-abbreviate-files'.
(setq-local compilation-error-regexp-alist (list ggtags-global-output-format))
+ (when (markerp ggtags-global-start-marker)
+ (setq ggtags-project-root
+ (buffer-local-value 'ggtags-project-root
+ (marker-buffer ggtags-global-start-marker))))
(pcase ggtags-auto-jump-to-match
(`history (make-local-variable 'ggtags-auto-jump-to-match-target)
(setq-local compilation-auto-jump-to-first-error