]> code.delx.au - gnu-emacs/blobdiff - lisp/progmodes/etags.el
Buttonize the whole line, including the number at the beginning
[gnu-emacs] / lisp / progmodes / etags.el
index 626855ecdd42cbf8749e5becc243fde23e45048e..6acafdbaba0bb88c38ca1acfcb4259ef18936f76 100644 (file)
@@ -308,7 +308,7 @@ file the tag was in."
     (save-excursion
       (or (visit-tags-table-buffer file)
          (signal 'file-error (list "Visiting tags table"
-                                   "file does not exist"
+                                   "No such file or directory"
                                    file)))
       ;; Set FILE to the expanded name.
       (setq file tags-file-name)))
@@ -2073,10 +2073,24 @@ for \\[find-tag] (which see)."
 ;; we hit the limit rarely.
 (defconst etags--xref-limit 1000)
 
+(defvar etags-xref-find-definitions-tag-order '(tag-exact-match-p
+                                                tag-implicit-name-match-p
+                                                tag-symbol-match-p)
+  "Tag order used in `etags-xref-find' to look for definitions.")
+
 ;;;###autoload
 (defun etags-xref-find (action id)
   (pcase action
     (`definitions (etags--xref-find-definitions id))
+    (`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?)
@@ -2094,7 +2108,7 @@ for \\[find-tag] (which see)."
       (while (visit-tags-table-buffer (not first-time))
         (setq first-time nil)
         (dolist (order-fun (cond (regexp? find-tag-regexp-tag-order)
-                                 (t find-tag-tag-order)))
+                                 (t etags-xref-find-definitions-tag-order)))
           (goto-char (point-min))
           (while (and (funcall search-fun pattern nil t)
                       (< (hash-table-count marks) etags--xref-limit))
@@ -2129,6 +2143,10 @@ for \\[find-tag] (which see)."
         (etags-goto-tag-location tag-info)
         (point-marker)))))
 
+(cl-defmethod xref-location-line ((l xref-etags-location))
+  (with-slots (tag-info) l
+    (nth 1 tag-info)))
+
 \f
 (provide 'etags)