From: Dmitry Gutov Date: Sat, 2 May 2015 10:11:07 +0000 (+0300) Subject: Fix etags-xref-find for references X-Git-Tag: emacs-25.0.90~2229^2~1 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=3bfb6a0f12f020ed869400c6bcae90fec2c448da;p=emacs.git 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). --- 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?)