From 3bfb6a0f12f020ed869400c6bcae90fec2c448da Mon Sep 17 00:00:00 2001 From: Dmitry Gutov Date: Sat, 2 May 2015 13:11:07 +0300 Subject: [PATCH] Fix etags-xref-find for references * lisp/progmodes/elisp-mode.el (elisp--xref-find-references): Use `cl-mapcan'. * lisp/progmodes/etags.el (etags-xref-find): Ditto. Prompt for directory if no tags tables are loaded (bug#19468). --- lisp/progmodes/elisp-mode.el | 2 +- lisp/progmodes/etags.el | 13 +++++++++---- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/lisp/progmodes/elisp-mode.el b/lisp/progmodes/elisp-mode.el index ef477d64fcc..2bb661a59c8 100644 --- a/lisp/progmodes/elisp-mode.el +++ b/lisp/progmodes/elisp-mode.el @@ -650,7 +650,7 @@ It can be quoted, or be inside a quoted form." (if (string-prefix-p (car ref) (cadr ref)) (setcdr ref (cddr ref)) (setq ref (cdr ref)))) - (mapcan + (cl-mapcan (lambda (dir) (and (file-exists-p dir) (xref-collect-references symbol dir))) diff --git a/lisp/progmodes/etags.el b/lisp/progmodes/etags.el index 9a57d8ad886..4e923aac197 100644 --- a/lisp/progmodes/etags.el +++ b/lisp/progmodes/etags.el @@ -2082,10 +2082,15 @@ for \\[find-tag] (which see)." (defun etags-xref-find (action id) (pcase action (`definitions (etags--xref-find-definitions id)) - (`references (mapcan - (lambda (file) - (xref-collect-references id (file-name-directory file))) - tags-table-list)) + (`references + (let ((dirs (if tags-table-list + (mapcar #'file-name-directory tags-table-list) + ;; If no tags files are loaded, prompt for the dir. + (list (read-directory-name "In directory: " nil nil t))))) + (cl-mapcan + (lambda (dir) + (xref-collect-references id dir)) + dirs))) (`apropos (etags--xref-find-definitions id t)))) (defun etags--xref-find-definitions (pattern &optional regexp?) -- 2.39.2