Subject: bug#32510: acknowledged by developer (control message for bug #32510)

From: Eli Zaretskii <[email-masked]>
Date: Sun, 14 Jul 2019 08:21:23 +0300

> From: Ludovic Brenta <[email-masked]>
> Date: Sat, 13 Jul 2019 21:34:26 +0200
> 
> This bug report states that a useful functionality of find-tag is *not*
> provided by its official replacement, xref-find-definitions.  This is a
> regression.  Just because you think this missing functionality should be
> provided elsewhere is not a good reason to close this bug without
> providing any solution.

With the patch below, you should be able to have what you want if you
add tag-partial-file-name-match-p to the list in
etags-xref-find-definitions-tag-order.  Please try this patch and see
if it works for you.

Thanks.

diff --git a/lisp/progmodes/etags.el b/lisp/progmodes/etags.el
index 7bf5753..b092c63 100644
--- a/lisp/progmodes/etags.el
+++ b/lisp/progmodes/etags.el
@@ -2070,13 +2070,16 @@ etags--xref-find-definitions
               (beginning-of-line)
               (pcase-let* ((tag-info (etags-snarf-tag))
                            (`(,hint ,line . _) tag-info))
-                (unless (eq hint t) ; hint==t if we are in a filename line
+                (unless (and (eq hint t) ; we are in a filename line
+                             (not (eq order-fun
+                                      'tag-partial-file-name-match-p)))
                   (let* ((file (file-of-tag))
                          (mark-key (cons file line)))
                     (unless (gethash mark-key marks)
                       (let ((loc (xref-make-etags-location
                                   tag-info (expand-file-name file))))
-                        (push (xref-make hint loc) xrefs)
+                        (push (xref-make (if (eq hint t) pattern hint) loc)
+                               xrefs)
                         (puthash mark-key t marks)))))))))))
     (nreverse xrefs)))