Subject: bug#66683: closed (Re: bug#66683: 30.0.50; xref-find-references returns duplicates)

From: [email-masked] (GNU bug Tracking System)
Date: Mon, 23 Oct 2023 20:56:02 +0000

Your bug report

#66683: 30.0.50; xref-find-references returns duplicates

which was filed against the emacs package, has been closed.

The explanation is attached below, along with your original report.
If you require more details, please reply to [email-masked].

-- 
66683: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=66683
GNU Bug Tracking System
Contact [email-masked] with problems

Subject: Re: bug#66683: 30.0.50; xref-find-references returns duplicates
From: Dmitry Gutov <[email-masked]>
To: Petteri Hintsanen <[email-masked]>
Cc: [email-masked]
Date: Mon, 23 Oct 2023 23:54:46 +0300
List-Id: <debbugs-submit.debbugs.gnu.org>

Version: 30.1

On 23/10/2023 23:02, Petteri Hintsanen wrote:
> Dmitry Gutov<[email-masked]>  writes:
> 
>> Could you try this little patch below?
> Happy to report it fixes the issue: both the toy example in the recipe
> and my original problem.
> 
> Thanks for your time,

Thanks for checking!

Now pushed to master for the next Emacs release.

But the next version of Xref on GNU ELPA will also include it the fix 
(will probably tag it in 1-2 weeks).

Subject: 30.0.50; xref-find-references returns duplicates
From: Petteri Hintsanen <[email-masked]>
To: [email-masked]
Date: Sun, 22 Oct 2023 18:29:58 +0300
List-Id: <debbugs-submit.debbugs.gnu.org>

[This is a bug report from an old issue discussed in
[email-masked] (dated 19 Dec 2022, Message-ID
<[email-masked]>).  Dmitry Gutov asked me
to file a bug, which I unfortunately forgot to do that time.  Hence
filing now.]

I discovered a somewhat peculiar case where xref-find-references returns
duplicate references for elisp symbols.

Recipe:

1. Create a file ~/foo/bar/bar.el with contents:

  (defun bar-f ())

  (defun bar-g ()
    (bar-f))

  (provide 'bar)

2. Create a git repo in ~/foo/bar and commit bar.el.  This is just to
set up a project that Emacs can recognize.

3. Start emacs -Q and eval

  (add-to-list 'load-path "~/foo")
  (add-to-list 'load-path "~/foo/bar")
  (require 'bar)

4. C-x C-f ~/foo/bar/bar.el

5. M-x xref-find-references RET bar-f RET

On my machine I get

  bar.el
  1: (defun bar-f ())
  4:   (bar-f))
  1: (defun bar-f ())
  4:   (bar-f))

i.e. references are duplicated.  The issue seems to be in load-path: if
I remove (add-to-list 'load-path "~/foo") from step (3) above, then I
don't see any duplicates.

In GNU Emacs 30.0.50 (build 1, x86_64-pc-linux-gnu, GTK+ Version
 2.24.33, cairo version 1.16.0) of 2023-10-22 built on romeo
Repository revision: ae337884107c4d5f66aaceef0e8b548565317412
Repository branch: master
Windowing system distributor 'The X.Org Foundation', version 11.0.12101007
System Description: Debian GNU/Linux 12 (bookworm)

Configured features:
CAIRO DBUS FREETYPE GIF GLIB GMP GNUTLS GPM GSETTINGS HARFBUZZ JPEG JSON
LCMS2 LIBOTF LIBSELINUX LIBXML2 MODULES NOTIFY INOTIFY PDUMPER PNG RSVG
SECCOMP SOUND SQLITE3 THREADS TIFF TOOLKIT_SCROLL_BARS TREE_SITTER WEBP
X11 XDBE XIM XINPUT2 XPM GTK2 ZLIB

Important settings:
  value of $LC_MESSAGES: en_US.UTF-8
  value of $LANG: fi_FI.UTF-8
  locale-coding-system: utf-8-unix

Major mode: Lisp Interaction

Minor modes in effect:
  display-fill-column-indicator-mode: t
  bug-reference-prog-mode: t
  jinx-mode: t
  winner-mode: t
  savehist-mode: t
  minibuffer-electric-default-mode: t
  display-time-mode: t
  emms-playing-time-display-mode: t
  emms-playing-time-mode: t
  desktop-save-mode: t
  cwm-mode: t
  windmove-mode: t
  override-global-mode: t
  tooltip-mode: t
  global-eldoc-mode: t
  eldoc-mode: t
  show-paren-mode: t
  electric-indent-mode: t
  mouse-wheel-mode: t
  menu-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  minibuffer-regexp-mode: t
  column-number-mode: t
  line-number-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  hs-minor-mode: t

Load-path shadows:
/home/phintsan/.emacs.d/elpa/transient-0.4.3/transient hides /home/phintsan/src/emacs/lisp/transient

Features:
(shadow mail-extr emacsbug message yank-media puny rfc822 mml mml-sec
epa derived epg rfc6068 epg-config gnus-util text-property-search
mm-decode mm-bodies mm-encode mail-parse rfc2231 mailabbrev gmm-utils
mailheader sendmail rfc2047 rfc2045 ietf-drums mm-util mail-prsvr
mail-utils hideshow display-fill-column-indicator bug-reference jinx
compat ph-simple-theme rx winner ring savehist minibuf-eldef time
emms-mpris pcase dbus emms-librefm-stream xml emms-librefm-scrobbler
emms-playlist-limit emms-i18n emms-history emms-score emms-stream-info
emms-metaplaylist-mode emms-bookmarks emms-cue emms-mode-line-icon
emms-browser sort emms-volume emms-volume-sndioctl emms-volume-mixerctl
emms-volume-pulse emms-volume-amixer emms-playlist-sort emms-last-played
emms-player-xine emms-player-mpd tq emms-lyrics emms-url time-date
emms-streams emms-show-all emms-tag-editor format-spec emms-tag-tracktag
emms-mark emms-mode-line emms-cache emms-info-native
emms-info-native-spc emms-info-native-mp3 emms-info-native-ogg
emms-info-native-opus emms-info-native-flac emms-info-native-vorbis
bindat emms-info-exiftool emms-info-tinytag emms-info-metaflac
emms-info-opusinfo emms-info-ogginfo emms-info-mp3info
emms-playlist-mode emms-player-vlc emms-player-mpv emms-playing-time
emms-info emms-later-do emms-player-mplayer emms-player-simple
emms-source-playlist emms-source-file thingatpt locate dired
dired-loaddefs emms-setup emms emms-compat desktop frameset cwm-mode
windmove edmacro kmacro cl-extra help-mode use-package-bind-key bind-key
easy-mmode finder-inf use-package-core cus-edit pp cus-load icons
wid-edit ack-autoloads jinx-autoloads perl-doc-autoloads
transient-autoloads with-editor-autoloads info compat-autoloads package
browse-url url url-proxy url-privacy url-expand url-methods url-history
url-cookie generate-lisp-file url-domsuf url-util mailcap url-handlers
url-parse auth-source cl-seq eieio eieio-core cl-macs password-cache
json subr-x map byte-opt gv bytecomp byte-compile url-vars cl-loaddefs
cl-lib rmc iso-transl tooltip cconv eldoc paren electric uniquify
ediff-hook vc-hooks lisp-float-type elisp-mode mwheel term/x-win x-win
term/common-win x-dnd touch-screen tool-bar dnd fontset image regexp-opt
fringe tabulated-list replace newcomment text-mode lisp-mode prog-mode
register page tab-bar menu-bar rfn-eshadow isearch easymenu timer select
scroll-bar mouse jit-lock font-lock syntax font-core term/tty-colors
frame minibuffer nadvice seq simple cl-generic indonesian philippine
cham georgian utf-8-lang misc-lang vietnamese tibetan thai tai-viet lao
korean japanese eucjp-ms cp51932 hebrew greek romanian slovak czech
european ethiopic indian cyrillic chinese composite emoji-zwj charscript
charprop case-table epa-hook jka-cmpr-hook help abbrev obarray oclosure
cl-preloaded button loaddefs theme-loaddefs faces cus-face macroexp
files window text-properties overlay sha1 md5 base64 format env
code-pages mule custom widget keymap hashtable-print-readable backquote
threads dbusbind inotify lcms2 dynamic-setting system-font-setting
font-render-setting cairo gtk x-toolkit xinput2 x multi-tty move-toolbar
make-network-process emacs)

Memory information:
((conses 16 274554 22405) (symbols 48 13707 0) (strings 32 99822 3656)
 (string-bytes 1 2414869) (vectors 16 29913)
 (vector-slots 8 1123232 231495) (floats 8 86 55) (intervals 56 853 0)
 (buffers 992 10))