From unknown Tue Aug 19 14:22:25 2025 X-Loop: help-debbugs@gnu.org Subject: bug#28995: xref next-error breaks with with-selected-window in next-error-hook Resent-From: Jonathan Kotta Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 25 Oct 2017 16:19:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 28995 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: 28995@debbugs.gnu.org X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.150894828417018 (code B ref -1); Wed, 25 Oct 2017 16:19:02 +0000 Received: (at submit) by debbugs.gnu.org; 25 Oct 2017 16:18:04 +0000 Received: from localhost ([127.0.0.1]:33544 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1e7ONX-0004QP-Bq for submit@debbugs.gnu.org; Wed, 25 Oct 2017 12:18:03 -0400 Received: from eggs.gnu.org ([208.118.235.92]:58850) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1e7ONU-0004Pi-Sn for submit@debbugs.gnu.org; Wed, 25 Oct 2017 12:18:01 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1e7ONK-0004xK-JG for submit@debbugs.gnu.org; Wed, 25 Oct 2017 12:17:55 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=0.8 required=5.0 tests=BAYES_50,FREEMAIL_FROM, HTML_MESSAGE,T_DKIM_INVALID autolearn=disabled version=3.3.2 Received: from lists.gnu.org ([2001:4830:134:3::11]:60947) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1e7ONK-0004x6-FJ for submit@debbugs.gnu.org; Wed, 25 Oct 2017 12:17:50 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:49789) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1e7ONI-0006Ei-Mx for bug-gnu-emacs@gnu.org; Wed, 25 Oct 2017 12:17:50 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1e7ONG-0004qz-PK for bug-gnu-emacs@gnu.org; Wed, 25 Oct 2017 12:17:48 -0400 Received: from mail-it0-x231.google.com ([2607:f8b0:4001:c0b::231]:51629) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1e7ONG-0004pb-Ha for bug-gnu-emacs@gnu.org; Wed, 25 Oct 2017 12:17:46 -0400 Received: by mail-it0-x231.google.com with SMTP id o135so1688800itb.0 for ; Wed, 25 Oct 2017 09:17:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:from:date:message-id:subject:to; bh=wLLG6V79ShnZwKvGeXHqyKsDWaW24l1qNPrBx8gyDQ4=; b=GMtlpwFRsbQBU4sAqn7IX0uwAmMWoOBTi2o+54+g4TGRSeezEcfrFz+8HTyk3+IqsN LkwRptNc9yYc7SmyHYD+N0yyVCAi8qZmvXeVU0+LgdWuipmvIcJqSNW3jNFHqsW5yusQ tYk3UwDiasmmK0x1SSkSBo9Sdn6qm0mf9kTxzAIXS3uJG/qf07fxWbXWd3HWi5prfDj8 6Dr0PKZVQvO7bLJ9cu2+TfiV+Q1zp4OF7ZwXUUTIlExlNrencCxI7fvZNbfKEnLrWzPX VCjwzvddCW28hZRBhbAGWoKbH62+jjFSUhnixJaX2M6B9JI+WBxPGC0pGSks59de3L01 cOtw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=wLLG6V79ShnZwKvGeXHqyKsDWaW24l1qNPrBx8gyDQ4=; b=O4jnFBCSFvL3y0Lu40J2LEgtsmETRlJxerIQ3TLk19etC4F3rSbMGcgi0GGTAj+o9Q wWn/A/E4NXJdoBNrkvIkw0Avj2fstCvUOaI1jZ6XG1t9+ySqncqKSgWI/kwPGUOqMqAk tzwjndkWasYaI/RIwSG/3VVwKYpKUzTwfS5aAPFug2Nuja+kyhA0eJ0Um3BTkndpFT5B BN78dYaJNx3TfleCk5fkZSJhbh396tQoId8Gbn0UYAIyuDtAKqWarFK8RbQNR57cI29/ pOuHI3t3eEH6DI+akMJ7rLYgyThv5WOdMn+dbKfobtj2TofD6S5hgkT9P+bgIYTSA+SD r0Dg== X-Gm-Message-State: AMCzsaUCPB+sIDjDledfamojI3NooFnYSZagGAwzuzhiUPAIx+pz2/tq UO43n1CFacRFI0uNyrKyrO8P4ZxGCmduZblPdYDPit0q X-Google-Smtp-Source: ABhQp+TqMFROQdynO4DIGUWrV+aLXMl0aECLQ4E78LVdse1vmefY4LzRvVDQ9hO9KpFgGlKgflbRSlBW5K9v8BAQhwU= X-Received: by 10.36.198.196 with SMTP id j187mr2714887itg.149.1508948265255; Wed, 25 Oct 2017 09:17:45 -0700 (PDT) MIME-Version: 1.0 Received: by 10.2.13.9 with HTTP; Wed, 25 Oct 2017 09:17:04 -0700 (PDT) From: Jonathan Kotta Date: Wed, 25 Oct 2017 11:17:04 -0500 Message-ID: Content-Type: multipart/alternative; boundary="94eb2c088be255ca05055c616521" X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 2001:4830:134:3::11 X-Spam-Score: -4.0 (----) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -4.0 (----) --94eb2c088be255ca05055c616521 Content-Type: text/plain; charset="UTF-8" Evaluate: (defun jpk/next-error-hook () (let ((win (get-buffer-window next-error-last-buffer))) (when (window-live-p win) (with-selected-window win ;; breaks with xref (message "window: %s" win))))) (add-hook 'next-error-hook #'jpk/next-error-hook) Run xref-find-references on e.g. add-hook Run next-error or previous-error at least twice. Repeating next-error doesn't find the next match after the 2nd invocation. Running previous-error behaves similarly. I can use a mouse to click on an any match, but next/previous-error will still only move between the clicked match and the next. I can only cycle between two matches. For reference, this is my original hook: (defun jpk/next-error-hook () (let ((win (get-buffer-window next-error-last-buffer)) (buf (buffer-name next-error-last-buffer)) (recenter-redisplay nil)) (when (window-live-p win) (with-selected-window win (recenter))))) The question on Stack Exchange: https://emacs.stackexchange.com/q/36260/651 In GNU Emacs 25.3.1 (x86_64-pc-linux-gnu, X toolkit, Xaw scroll bars) of 2017-09-12 built on shannon Windowing system distributor 'The X.Org Foundation', version 11.0.11905000 Configured using: 'configure --prefix=/usr --sysconfdir=/etc --libexecdir=/usr/lib --localstatedir=/var --with-x-toolkit=lucid --with-xft --without-gconf --without-gsettings --with-modules --with-gameuser=:games '--program-transform-name=s/^ctags$/ctags.emacs/' 'CFLAGS=-march=x86-64 -mtune=generic -O2 -pipe -fstack-protector-strong -fno-plt' CPPFLAGS=-D_FORTIFY_SOURCE=2 LDFLAGS=-Wl,-O1,--sort-common,--as-needed,-z,relro,-z,now' Configured features: XPM JPEG TIFF GIF PNG RSVG IMAGEMAGICK SOUND GPM DBUS NOTIFY ACL GNUTLS LIBXML2 FREETYPE M17N_FLT LIBOTF XFT ZLIB TOOLKIT_SCROLL_BARS LUCID X11 MODULES Important settings: value of $LANG: en_US.UTF-8 locale-coding-system: utf-8-unix Major mode: Emacs-Lisp Minor modes in effect: diff-auto-refine-mode: t tooltip-mode: t global-eldoc-mode: t electric-indent-mode: t mouse-wheel-mode: t tool-bar-mode: t menu-bar-mode: t file-name-shadow-mode: t global-font-lock-mode: t font-lock-mode: t blink-cursor-mode: t auto-composition-mode: t auto-encryption-mode: t auto-compression-mode: t buffer-read-only: t line-number-mode: t transient-mark-mode: t Recent messages: For information about GNU Emacs and the GNU system, type C-h C-a. Mark set jpk/next-error-hook (jpk/next-error-hook) Quit [2 times] Mark set Note: file is write protected window: # [11 times] Load-path shadows: None found. Features: (shadow sort mail-extr emacsbug message dired format-spec rfc822 mml mml-sec password-cache epg epg-config gnus-util mm-decode mm-bodies mm-encode mail-parse rfc2231 mailabbrev gmm-utils mailheader sendmail rfc2047 rfc2045 ietf-drums mm-util help-fns mail-prsvr mail-utils pulse semantic/symref/grep grep compile comint ansi-color semantic/symref semantic/util-modes semantic/util semantic semantic/tag semantic/lex semantic/fw mode-local find-func cedet vc-hg vc-git diff-mode easy-mmode vc-bzr vc-src vc-sccs vc-svn vc-cvs vc-rcs vc vc-dispatcher thingatpt xref cl-seq project ring eieio byte-opt bytecomp byte-compile cl-extra help-mode easymenu cconv eieio-core cl-macs gv cl-loaddefs pcase cl-lib time-date mule-util tooltip eldoc electric uniquify ediff-hook vc-hooks lisp-float-type mwheel x-win term/common-win x-dnd tool-bar dnd fontset image regexp-opt fringe tabulated-list newcomment elisp-mode lisp-mode prog-mode register page menu-bar rfn-eshadow timer select scroll-bar mouse jit-lock font-lock syntax facemenu font-core frame cl-generic 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 charscript case-table epa-hook jka-cmpr-hook help simple abbrev minibuffer cl-preloaded nadvice loaddefs button faces cus-face macroexp files text-properties overlay sha1 md5 base64 format env code-pages mule custom widget hashtable-print-readable backquote dbusbind inotify dynamic-setting font-render-setting x-toolkit x multi-tty make-network-process emacs) Memory information: ((conses 16 121559 6089) (symbols 48 23516 0) (miscs 40 80 140) (strings 32 27164 5634) (string-bytes 1 818145) (vectors 16 17422) (vector-slots 8 491703 4664) (floats 8 264 116) (intervals 56 628 18) (buffers 976 21)) -- Thanks, Jonathan Kotta Hofstadter's Law: It always takes longer than you expect, even when you take into account Hofstadter's Law. --94eb2c088be255ca05055c616521 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Evaluate:

(defun jpk/next-er= ror-hook ()
=C2=A0 (let ((win (get-buffer-window next-error-last-= buffer)))
=C2=A0 =C2=A0 (when (window-live-p win)
=C2= =A0 =C2=A0 =C2=A0 (with-selected-window win ;; breaks with xref
= =C2=A0 =C2=A0 =C2=A0 =C2=A0 (message "window: %s" win)))))
<= div>(add-hook 'next-error-hook #'jpk/next-error-hook)

Run xref-find-references on e.g. add-hook
Run nex= t-error or previous-error at least twice.=C2=A0=C2=A0

<= div>Repeating next-error doesn't find the next match after the 2nd invo= cation.=C2=A0 Running previous-error behaves similarly.=C2=A0 I can use a m= ouse to click on an any match, but next/previous-error will still only move= between the clicked match and the next.=C2=A0 I can only cycle between two= matches.

For reference, this is my original hook:=

(defun jpk/next-error-hook ()
=C2=A0 (l= et ((win (get-buffer-window next-error-last-buffer))
=C2=A0 =C2= =A0 =C2=A0 =C2=A0 (buf (buffer-name next-error-last-buffer))
=C2= =A0 =C2=A0 =C2=A0 =C2=A0 (recenter-redisplay nil))
=C2=A0 =C2=A0 = (when (window-live-p win)
=C2=A0 =C2=A0 =C2=A0 (with-selected-win= dow win
=C2=A0 =C2=A0 =C2=A0 =C2=A0 (recenter)))))

=
The question on Stack Exchange: https://emacs.stackexchange.com/q/36260/651

In GNU Emacs 25.3.1 (x86_64-pc-linux-gnu, X tool= kit, Xaw scroll bars)
=C2=A0of 2017-09-12 built on shannon
Windowing system distributor 'The X.Org Foundation', versio= n 11.0.11905000
Configured using:
=C2=A0'configure = --prefix=3D/usr --sysconfdir=3D/etc --libexecdir=3D/usr/lib
=C2= =A0--localstatedir=3D/var --with-x-toolkit=3Dlucid --with-xft --without-gco= nf
=C2=A0--without-gsettings --with-modules --with-gameuser=3D:ga= mes
=C2=A0'--program-transform-name=3Ds/^ctags$/ctags.emacs/&= #39; 'CFLAGS=3D-march=3Dx86-64
=C2=A0-mtune=3Dgeneric -O2 -pi= pe -fstack-protector-strong -fno-plt'
=C2=A0CPPFLAGS=3D-D_FOR= TIFY_SOURCE=3D2
=C2=A0LDFLAGS=3D-Wl,-O1,--sort-common,--as-needed= ,-z,relro,-z,now'

Configured features:
XPM JPEG TIFF GIF PNG RSVG IMAGEMAGICK SOUND GPM DBUS NOTIFY ACL GNUTLS<= /div>
LIBXML2 FREETYPE M17N_FLT LIBOTF XFT ZLIB TOOLKIT_SCROLL_BARS LUC= ID X11
MODULES

Important settings:
=
=C2=A0 value of $LANG: en_US.UTF-8
=C2=A0 locale-coding-syst= em: utf-8-unix

Major mode: Emacs-Lisp
Minor modes in effect:
=C2=A0 diff-auto-refine-mode:= t
=C2=A0 tooltip-mode: t
=C2=A0 global-eldoc-mode: t
=C2=A0 electric-indent-mode: t
=C2=A0 mouse-wheel-mode: = t
=C2=A0 tool-bar-mode: t
=C2=A0 menu-bar-mode: t
=
=C2=A0 file-name-shadow-mode: t
=C2=A0 global-font-lock-mode= : t
=C2=A0 font-lock-mode: t
=C2=A0 blink-cursor-mode: = t
=C2=A0 auto-composition-mode: t
=C2=A0 auto-encryptio= n-mode: t
=C2=A0 auto-compression-mode: t
=C2=A0 buffer= -read-only: t
=C2=A0 line-number-mode: t
=C2=A0 transie= nt-mark-mode: t

Recent messages:
For inf= ormation about GNU Emacs and the GNU system, type C-h C-a.
Mark s= et
jpk/next-error-hook
(jpk/next-error-hook)
= Quit [2 times]
Mark set
Note: file is write protected
window: #<window 7 on *xref*> [11 times]

Load-path shadows:
None found.

Fea= tures:
(shadow sort mail-extr emacsbug message dired format-spec = rfc822 mml
mml-sec password-cache epg epg-config gnus-util mm-dec= ode mm-bodies
mm-encode mail-parse rfc2231 mailabbrev gmm-utils m= ailheader sendmail
rfc2047 rfc2045 ietf-drums mm-util help-fns ma= il-prsvr mail-utils pulse
semantic/symref/grep grep compile comin= t ansi-color semantic/symref
semantic/util-modes semantic/util se= mantic semantic/tag semantic/lex
semantic/fw mode-local find-func= cedet vc-hg vc-git diff-mode easy-mmode
vc-bzr vc-src vc-sccs vc= -svn vc-cvs vc-rcs vc vc-dispatcher thingatpt
xref cl-seq project= ring eieio byte-opt bytecomp byte-compile cl-extra
help-mode eas= ymenu cconv eieio-core cl-macs gv cl-loaddefs pcase cl-lib
time-d= ate mule-util tooltip eldoc electric uniquify ediff-hook vc-hooks
lisp-float-type mwheel x-win term/common-win x-dnd tool-bar dnd fontset
image regexp-opt fringe tabulated-list newcomment elisp-mode lisp-m= ode
prog-mode register page menu-bar rfn-eshadow timer select scr= oll-bar
mouse jit-lock font-lock syntax facemenu font-core frame = cl-generic cham
georgian utf-8-lang misc-lang vietnamese tibetan = thai tai-viet lao
korean japanese eucjp-ms cp51932 hebrew greek r= omanian slovak czech
european ethiopic indian cyrillic chinese ch= arscript case-table epa-hook
jka-cmpr-hook help simple abbrev min= ibuffer cl-preloaded nadvice
loaddefs button faces cus-face macro= exp files text-properties overlay
sha1 md5 base64 format env code= -pages mule custom widget
hashtable-print-readable backquote dbus= bind inotify dynamic-setting
font-render-setting x-toolkit x mult= i-tty make-network-process emacs)

Memory informati= on:
((conses 16 121559 6089)
=C2=A0(symbols 48 23516 0)=
=C2=A0(miscs 40 80 140)
=C2=A0(strings 32 27164 5634)<= /div>
=C2=A0(string-bytes 1 818145)
=C2=A0(vectors 16 17422)<= /div>
=C2=A0(vector-slots 8 491703 4664)
=C2=A0(floats 8 264 = 116)
=C2=A0(intervals 56 628 18)
=C2=A0(buffers 976 21)= )

--
Thanks,

Jonathan Kotta

Hofstadter's Law:
=C2= =A0 =C2=A0 It always takes longer than you expect, even
=C2=A0 =C2=A0 wh= en you take into account Hofstadter's Law.
--94eb2c088be255ca05055c616521-- From unknown Tue Aug 19 14:22:25 2025 X-Loop: help-debbugs@gnu.org Subject: bug#28995: xref next-error breaks with with-selected-window in next-error-hook Resent-From: Dmitry Gutov Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 25 Oct 2017 20:18:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 28995 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Jonathan Kotta , 28995@debbugs.gnu.org Received: via spool by 28995-submit@debbugs.gnu.org id=B28995.150896267114843 (code B ref 28995); Wed, 25 Oct 2017 20:18:02 +0000 Received: (at 28995) by debbugs.gnu.org; 25 Oct 2017 20:17:51 +0000 Received: from localhost ([127.0.0.1]:33677 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1e7S7b-0003rL-AY for submit@debbugs.gnu.org; Wed, 25 Oct 2017 16:17:51 -0400 Received: from mail-wm0-f44.google.com ([74.125.82.44]:54677) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1e7S7a-0003r6-AT for 28995@debbugs.gnu.org; Wed, 25 Oct 2017 16:17:50 -0400 Received: by mail-wm0-f44.google.com with SMTP id r68so4218410wmr.3 for <28995@debbugs.gnu.org>; Wed, 25 Oct 2017 13:17:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:subject:to:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=eaShI3QY/7JvM36UiqSV+X8Eh7P26YAfMBpVUcpFkGw=; b=mBrGoK+VkxGOQhq6z24hAx/yRcgIgDyWEz6vkVxFnCA1y8i9hkhWCZWrpxUsA2lm3e z2pYnbCDuUiPcySNifbHo2pkwGHO0nAx3Q0xD8R/9uMeC0zUX6ldcLWFzoc1FfCGljSR eqlfbkT37u7Cvt+Cl/5R8od2dPnAcZVm30qWLhGM+LPT20bSPecGudkg6qGVuv4AFhHj USnQdpG+Jbr3EkToWOCC+6nIXEvL4b2D8j3YqwEmIXFtvUtDlYMsxRgOEcnCUG6gUKo+ PY2zlr3SCVGBXdTdFrXKImqliyQP68Ohmh2kUNZe+QvI7VETp3tz/syXRCZhqnMXL8Ac jSMA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:subject:to:references:from:message-id :date:user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=eaShI3QY/7JvM36UiqSV+X8Eh7P26YAfMBpVUcpFkGw=; b=KA4DC80i5BtmiU3tWdasqyPd5X2IMqGSbBFLvV9Y3TJwTab410OMoaZ4X9eCCVUOJ6 GuPcHwkcEqiUIYYDoDxx85ZZb728ZUpRSPrt+OSpddShedPW10Tjyhoniutn+dZGdFcQ wYjdoMkBHnu3JVKYFomGela+WUKdY8/KRrqfVtH90Oexe5lcXpi2qb4cWnaP6K3D79yB twJhy5ve5blP/i77lPfHdIwiAKOEIFwagsFHZuSUXw0B0OCczp5s6xvtw5Qis4vZXot2 jzlLoqphVxSFyYdtSsrV9c09vdwqXQPdO3rObnpglD9wU7H3D/yXs2whUpKtEQ8d1cyk pY7Q== X-Gm-Message-State: AMCzsaUxh3ru2AekxVuKsU5iXiNAgKQEyQ8N5S++FjE/Yn6h09TUoWEI /LONrq8G6RsiRzbnDlj0LYc0Hiq+ X-Google-Smtp-Source: ABhQp+Qnk2hp2x/xIcrs4FMbMG9jFkxDf4/vHbGTMRbT1PDJHHH3LKPIk+zdwkiA8bRRKJzQ9mMHdw== X-Received: by 10.28.100.3 with SMTP id y3mr2797482wmb.69.1508962664108; Wed, 25 Oct 2017 13:17:44 -0700 (PDT) Received: from [192.168.1.3] ([185.105.174.193]) by smtp.googlemail.com with ESMTPSA id r68sm3686793wmd.4.2017.10.25.13.17.41 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 25 Oct 2017 13:17:43 -0700 (PDT) References: From: Dmitry Gutov Message-ID: <9c993b4f-b3b0-a14b-2336-48c282abbd42@yandex.ru> Date: Wed, 25 Oct 2017 23:17:40 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:56.0) Gecko/20100101 Thunderbird/56.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit X-Spam-Score: 0.7 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 0.7 (/) On 10/25/17 7:17 PM, Jonathan Kotta wrote: > Evaluate: > > (defun jpk/next-error-hook () >   (let ((win (get-buffer-window next-error-last-buffer))) >     (when (window-live-p win) >       (with-selected-window win ;; breaks with xref >         (message "window: %s" win))))) > (add-hook 'next-error-hook #'jpk/next-error-hook) > > Run xref-find-references on e.g. add-hook > Run next-error or previous-error at least twice. > > Repeating next-error doesn't find the next match after the 2nd > invocation. Running previous-error behaves similarly.  I can use a mouse > to click on an any match, but next/previous-error will still only move > between the clicked match and the next.  I can only cycle between two > matches. Can you reproduce this starting with 'emacs -Q'? I can't. From unknown Tue Aug 19 14:22:25 2025 MIME-Version: 1.0 X-Mailer: MIME-tools 5.505 (Entity 5.505) X-Loop: help-debbugs@gnu.org From: help-debbugs@gnu.org (GNU bug Tracking System) To: Jonathan Kotta Subject: bug#28995: closed (Re: bug#28995: xref next-error breaks with with-selected-window in next-error-hook) Message-ID: References: <87y3hleftk.fsf@mail.linkov.net> X-Gnu-PR-Message: they-closed 28995 X-Gnu-PR-Package: emacs Reply-To: 28995@debbugs.gnu.org Date: Tue, 17 Apr 2018 20:34:03 +0000 Content-Type: multipart/mixed; boundary="----------=_1523997243-10931-1" This is a multi-part message in MIME format... ------------=_1523997243-10931-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Your bug report #28995: xref next-error breaks with with-selected-window in next-error-hook 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 28995@debbugs.gnu.org. --=20 28995: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D28995 GNU Bug Tracking System Contact help-debbugs@gnu.org with problems ------------=_1523997243-10931-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at 28995-done) by debbugs.gnu.org; 17 Apr 2018 20:33:06 +0000 Received: from localhost ([127.0.0.1]:57985 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1f8XHm-0002oz-0V for submit@debbugs.gnu.org; Tue, 17 Apr 2018 16:33:06 -0400 Received: from sub3.mail.dreamhost.com ([69.163.253.7]:49924 helo=homiemail-a21.g.dreamhost.com) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1f8XHk-0002oq-5a for 28995-done@debbugs.gnu.org; Tue, 17 Apr 2018 16:33:04 -0400 Received: from homiemail-a21.g.dreamhost.com (localhost [127.0.0.1]) by homiemail-a21.g.dreamhost.com (Postfix) with ESMTP id F0BD81C0069; Tue, 17 Apr 2018 13:33:02 -0700 (PDT) Received: from localhost.linkov.net (m91-129-110-22.cust.tele2.ee [91.129.110.22]) (using TLSv1 with cipher DHE-RSA-AES128-SHA (128/128 bits)) (No client certificate requested) (Authenticated sender: jurta@jurta.org) by homiemail-a21.g.dreamhost.com (Postfix) with ESMTPSA id 181971C0064; Tue, 17 Apr 2018 13:33:01 -0700 (PDT) From: Juri Linkov To: Jonathan Kotta Subject: Re: bug#28995: xref next-error breaks with with-selected-window in next-error-hook Organization: LINKOV.NET References: Date: Tue, 17 Apr 2018 23:30:31 +0300 In-Reply-To: (Jonathan Kotta's message of "Wed, 25 Oct 2017 11:17:04 -0500") Message-ID: <87y3hleftk.fsf@mail.linkov.net> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 28995-done Cc: 28995-done@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) It seems this is already fixed together with bug#27362. If not, then please reopen. ------------=_1523997243-10931-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at submit) by debbugs.gnu.org; 25 Oct 2017 16:18:04 +0000 Received: from localhost ([127.0.0.1]:33544 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1e7ONX-0004QP-Bq for submit@debbugs.gnu.org; Wed, 25 Oct 2017 12:18:03 -0400 Received: from eggs.gnu.org ([208.118.235.92]:58850) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1e7ONU-0004Pi-Sn for submit@debbugs.gnu.org; Wed, 25 Oct 2017 12:18:01 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1e7ONK-0004xK-JG for submit@debbugs.gnu.org; Wed, 25 Oct 2017 12:17:55 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=0.8 required=5.0 tests=BAYES_50,FREEMAIL_FROM, HTML_MESSAGE,T_DKIM_INVALID autolearn=disabled version=3.3.2 Received: from lists.gnu.org ([2001:4830:134:3::11]:60947) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1e7ONK-0004x6-FJ for submit@debbugs.gnu.org; Wed, 25 Oct 2017 12:17:50 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:49789) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1e7ONI-0006Ei-Mx for bug-gnu-emacs@gnu.org; Wed, 25 Oct 2017 12:17:50 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1e7ONG-0004qz-PK for bug-gnu-emacs@gnu.org; Wed, 25 Oct 2017 12:17:48 -0400 Received: from mail-it0-x231.google.com ([2607:f8b0:4001:c0b::231]:51629) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1e7ONG-0004pb-Ha for bug-gnu-emacs@gnu.org; Wed, 25 Oct 2017 12:17:46 -0400 Received: by mail-it0-x231.google.com with SMTP id o135so1688800itb.0 for ; Wed, 25 Oct 2017 09:17:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:from:date:message-id:subject:to; bh=wLLG6V79ShnZwKvGeXHqyKsDWaW24l1qNPrBx8gyDQ4=; b=GMtlpwFRsbQBU4sAqn7IX0uwAmMWoOBTi2o+54+g4TGRSeezEcfrFz+8HTyk3+IqsN LkwRptNc9yYc7SmyHYD+N0yyVCAi8qZmvXeVU0+LgdWuipmvIcJqSNW3jNFHqsW5yusQ tYk3UwDiasmmK0x1SSkSBo9Sdn6qm0mf9kTxzAIXS3uJG/qf07fxWbXWd3HWi5prfDj8 6Dr0PKZVQvO7bLJ9cu2+TfiV+Q1zp4OF7ZwXUUTIlExlNrencCxI7fvZNbfKEnLrWzPX VCjwzvddCW28hZRBhbAGWoKbH62+jjFSUhnixJaX2M6B9JI+WBxPGC0pGSks59de3L01 cOtw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=wLLG6V79ShnZwKvGeXHqyKsDWaW24l1qNPrBx8gyDQ4=; b=O4jnFBCSFvL3y0Lu40J2LEgtsmETRlJxerIQ3TLk19etC4F3rSbMGcgi0GGTAj+o9Q wWn/A/E4NXJdoBNrkvIkw0Avj2fstCvUOaI1jZ6XG1t9+ySqncqKSgWI/kwPGUOqMqAk tzwjndkWasYaI/RIwSG/3VVwKYpKUzTwfS5aAPFug2Nuja+kyhA0eJ0Um3BTkndpFT5B BN78dYaJNx3TfleCk5fkZSJhbh396tQoId8Gbn0UYAIyuDtAKqWarFK8RbQNR57cI29/ pOuHI3t3eEH6DI+akMJ7rLYgyThv5WOdMn+dbKfobtj2TofD6S5hgkT9P+bgIYTSA+SD r0Dg== X-Gm-Message-State: AMCzsaUCPB+sIDjDledfamojI3NooFnYSZagGAwzuzhiUPAIx+pz2/tq UO43n1CFacRFI0uNyrKyrO8P4ZxGCmduZblPdYDPit0q X-Google-Smtp-Source: ABhQp+TqMFROQdynO4DIGUWrV+aLXMl0aECLQ4E78LVdse1vmefY4LzRvVDQ9hO9KpFgGlKgflbRSlBW5K9v8BAQhwU= X-Received: by 10.36.198.196 with SMTP id j187mr2714887itg.149.1508948265255; Wed, 25 Oct 2017 09:17:45 -0700 (PDT) MIME-Version: 1.0 Received: by 10.2.13.9 with HTTP; Wed, 25 Oct 2017 09:17:04 -0700 (PDT) From: Jonathan Kotta Date: Wed, 25 Oct 2017 11:17:04 -0500 Message-ID: Subject: xref next-error breaks with with-selected-window in next-error-hook To: bug-gnu-emacs@gnu.org Content-Type: multipart/alternative; boundary="94eb2c088be255ca05055c616521" X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 2001:4830:134:3::11 X-Spam-Score: -4.0 (----) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -4.0 (----) --94eb2c088be255ca05055c616521 Content-Type: text/plain; charset="UTF-8" Evaluate: (defun jpk/next-error-hook () (let ((win (get-buffer-window next-error-last-buffer))) (when (window-live-p win) (with-selected-window win ;; breaks with xref (message "window: %s" win))))) (add-hook 'next-error-hook #'jpk/next-error-hook) Run xref-find-references on e.g. add-hook Run next-error or previous-error at least twice. Repeating next-error doesn't find the next match after the 2nd invocation. Running previous-error behaves similarly. I can use a mouse to click on an any match, but next/previous-error will still only move between the clicked match and the next. I can only cycle between two matches. For reference, this is my original hook: (defun jpk/next-error-hook () (let ((win (get-buffer-window next-error-last-buffer)) (buf (buffer-name next-error-last-buffer)) (recenter-redisplay nil)) (when (window-live-p win) (with-selected-window win (recenter))))) The question on Stack Exchange: https://emacs.stackexchange.com/q/36260/651 In GNU Emacs 25.3.1 (x86_64-pc-linux-gnu, X toolkit, Xaw scroll bars) of 2017-09-12 built on shannon Windowing system distributor 'The X.Org Foundation', version 11.0.11905000 Configured using: 'configure --prefix=/usr --sysconfdir=/etc --libexecdir=/usr/lib --localstatedir=/var --with-x-toolkit=lucid --with-xft --without-gconf --without-gsettings --with-modules --with-gameuser=:games '--program-transform-name=s/^ctags$/ctags.emacs/' 'CFLAGS=-march=x86-64 -mtune=generic -O2 -pipe -fstack-protector-strong -fno-plt' CPPFLAGS=-D_FORTIFY_SOURCE=2 LDFLAGS=-Wl,-O1,--sort-common,--as-needed,-z,relro,-z,now' Configured features: XPM JPEG TIFF GIF PNG RSVG IMAGEMAGICK SOUND GPM DBUS NOTIFY ACL GNUTLS LIBXML2 FREETYPE M17N_FLT LIBOTF XFT ZLIB TOOLKIT_SCROLL_BARS LUCID X11 MODULES Important settings: value of $LANG: en_US.UTF-8 locale-coding-system: utf-8-unix Major mode: Emacs-Lisp Minor modes in effect: diff-auto-refine-mode: t tooltip-mode: t global-eldoc-mode: t electric-indent-mode: t mouse-wheel-mode: t tool-bar-mode: t menu-bar-mode: t file-name-shadow-mode: t global-font-lock-mode: t font-lock-mode: t blink-cursor-mode: t auto-composition-mode: t auto-encryption-mode: t auto-compression-mode: t buffer-read-only: t line-number-mode: t transient-mark-mode: t Recent messages: For information about GNU Emacs and the GNU system, type C-h C-a. Mark set jpk/next-error-hook (jpk/next-error-hook) Quit [2 times] Mark set Note: file is write protected window: # [11 times] Load-path shadows: None found. Features: (shadow sort mail-extr emacsbug message dired format-spec rfc822 mml mml-sec password-cache epg epg-config gnus-util mm-decode mm-bodies mm-encode mail-parse rfc2231 mailabbrev gmm-utils mailheader sendmail rfc2047 rfc2045 ietf-drums mm-util help-fns mail-prsvr mail-utils pulse semantic/symref/grep grep compile comint ansi-color semantic/symref semantic/util-modes semantic/util semantic semantic/tag semantic/lex semantic/fw mode-local find-func cedet vc-hg vc-git diff-mode easy-mmode vc-bzr vc-src vc-sccs vc-svn vc-cvs vc-rcs vc vc-dispatcher thingatpt xref cl-seq project ring eieio byte-opt bytecomp byte-compile cl-extra help-mode easymenu cconv eieio-core cl-macs gv cl-loaddefs pcase cl-lib time-date mule-util tooltip eldoc electric uniquify ediff-hook vc-hooks lisp-float-type mwheel x-win term/common-win x-dnd tool-bar dnd fontset image regexp-opt fringe tabulated-list newcomment elisp-mode lisp-mode prog-mode register page menu-bar rfn-eshadow timer select scroll-bar mouse jit-lock font-lock syntax facemenu font-core frame cl-generic 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 charscript case-table epa-hook jka-cmpr-hook help simple abbrev minibuffer cl-preloaded nadvice loaddefs button faces cus-face macroexp files text-properties overlay sha1 md5 base64 format env code-pages mule custom widget hashtable-print-readable backquote dbusbind inotify dynamic-setting font-render-setting x-toolkit x multi-tty make-network-process emacs) Memory information: ((conses 16 121559 6089) (symbols 48 23516 0) (miscs 40 80 140) (strings 32 27164 5634) (string-bytes 1 818145) (vectors 16 17422) (vector-slots 8 491703 4664) (floats 8 264 116) (intervals 56 628 18) (buffers 976 21)) -- Thanks, Jonathan Kotta Hofstadter's Law: It always takes longer than you expect, even when you take into account Hofstadter's Law. --94eb2c088be255ca05055c616521 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Evaluate:

(defun jpk/next-er= ror-hook ()
=C2=A0 (let ((win (get-buffer-window next-error-last-= buffer)))
=C2=A0 =C2=A0 (when (window-live-p win)
=C2= =A0 =C2=A0 =C2=A0 (with-selected-window win ;; breaks with xref
= =C2=A0 =C2=A0 =C2=A0 =C2=A0 (message "window: %s" win)))))
<= div>(add-hook 'next-error-hook #'jpk/next-error-hook)

Run xref-find-references on e.g. add-hook
Run nex= t-error or previous-error at least twice.=C2=A0=C2=A0

<= div>Repeating next-error doesn't find the next match after the 2nd invo= cation.=C2=A0 Running previous-error behaves similarly.=C2=A0 I can use a m= ouse to click on an any match, but next/previous-error will still only move= between the clicked match and the next.=C2=A0 I can only cycle between two= matches.

For reference, this is my original hook:=

(defun jpk/next-error-hook ()
=C2=A0 (l= et ((win (get-buffer-window next-error-last-buffer))
=C2=A0 =C2= =A0 =C2=A0 =C2=A0 (buf (buffer-name next-error-last-buffer))
=C2= =A0 =C2=A0 =C2=A0 =C2=A0 (recenter-redisplay nil))
=C2=A0 =C2=A0 = (when (window-live-p win)
=C2=A0 =C2=A0 =C2=A0 (with-selected-win= dow win
=C2=A0 =C2=A0 =C2=A0 =C2=A0 (recenter)))))

=
The question on Stack Exchange: https://emacs.stackexchange.com/q/36260/651

In GNU Emacs 25.3.1 (x86_64-pc-linux-gnu, X tool= kit, Xaw scroll bars)
=C2=A0of 2017-09-12 built on shannon
Windowing system distributor 'The X.Org Foundation', versio= n 11.0.11905000
Configured using:
=C2=A0'configure = --prefix=3D/usr --sysconfdir=3D/etc --libexecdir=3D/usr/lib
=C2= =A0--localstatedir=3D/var --with-x-toolkit=3Dlucid --with-xft --without-gco= nf
=C2=A0--without-gsettings --with-modules --with-gameuser=3D:ga= mes
=C2=A0'--program-transform-name=3Ds/^ctags$/ctags.emacs/&= #39; 'CFLAGS=3D-march=3Dx86-64
=C2=A0-mtune=3Dgeneric -O2 -pi= pe -fstack-protector-strong -fno-plt'
=C2=A0CPPFLAGS=3D-D_FOR= TIFY_SOURCE=3D2
=C2=A0LDFLAGS=3D-Wl,-O1,--sort-common,--as-needed= ,-z,relro,-z,now'

Configured features:
XPM JPEG TIFF GIF PNG RSVG IMAGEMAGICK SOUND GPM DBUS NOTIFY ACL GNUTLS<= /div>
LIBXML2 FREETYPE M17N_FLT LIBOTF XFT ZLIB TOOLKIT_SCROLL_BARS LUC= ID X11
MODULES

Important settings:
=
=C2=A0 value of $LANG: en_US.UTF-8
=C2=A0 locale-coding-syst= em: utf-8-unix

Major mode: Emacs-Lisp
Minor modes in effect:
=C2=A0 diff-auto-refine-mode:= t
=C2=A0 tooltip-mode: t
=C2=A0 global-eldoc-mode: t
=C2=A0 electric-indent-mode: t
=C2=A0 mouse-wheel-mode: = t
=C2=A0 tool-bar-mode: t
=C2=A0 menu-bar-mode: t
=
=C2=A0 file-name-shadow-mode: t
=C2=A0 global-font-lock-mode= : t
=C2=A0 font-lock-mode: t
=C2=A0 blink-cursor-mode: = t
=C2=A0 auto-composition-mode: t
=C2=A0 auto-encryptio= n-mode: t
=C2=A0 auto-compression-mode: t
=C2=A0 buffer= -read-only: t
=C2=A0 line-number-mode: t
=C2=A0 transie= nt-mark-mode: t

Recent messages:
For inf= ormation about GNU Emacs and the GNU system, type C-h C-a.
Mark s= et
jpk/next-error-hook
(jpk/next-error-hook)
= Quit [2 times]
Mark set
Note: file is write protected
window: #<window 7 on *xref*> [11 times]

Load-path shadows:
None found.

Fea= tures:
(shadow sort mail-extr emacsbug message dired format-spec = rfc822 mml
mml-sec password-cache epg epg-config gnus-util mm-dec= ode mm-bodies
mm-encode mail-parse rfc2231 mailabbrev gmm-utils m= ailheader sendmail
rfc2047 rfc2045 ietf-drums mm-util help-fns ma= il-prsvr mail-utils pulse
semantic/symref/grep grep compile comin= t ansi-color semantic/symref
semantic/util-modes semantic/util se= mantic semantic/tag semantic/lex
semantic/fw mode-local find-func= cedet vc-hg vc-git diff-mode easy-mmode
vc-bzr vc-src vc-sccs vc= -svn vc-cvs vc-rcs vc vc-dispatcher thingatpt
xref cl-seq project= ring eieio byte-opt bytecomp byte-compile cl-extra
help-mode eas= ymenu cconv eieio-core cl-macs gv cl-loaddefs pcase cl-lib
time-d= ate mule-util tooltip eldoc electric uniquify ediff-hook vc-hooks
lisp-float-type mwheel x-win term/common-win x-dnd tool-bar dnd fontset
image regexp-opt fringe tabulated-list newcomment elisp-mode lisp-m= ode
prog-mode register page menu-bar rfn-eshadow timer select scr= oll-bar
mouse jit-lock font-lock syntax facemenu font-core frame = cl-generic cham
georgian utf-8-lang misc-lang vietnamese tibetan = thai tai-viet lao
korean japanese eucjp-ms cp51932 hebrew greek r= omanian slovak czech
european ethiopic indian cyrillic chinese ch= arscript case-table epa-hook
jka-cmpr-hook help simple abbrev min= ibuffer cl-preloaded nadvice
loaddefs button faces cus-face macro= exp files text-properties overlay
sha1 md5 base64 format env code= -pages mule custom widget
hashtable-print-readable backquote dbus= bind inotify dynamic-setting
font-render-setting x-toolkit x mult= i-tty make-network-process emacs)

Memory informati= on:
((conses 16 121559 6089)
=C2=A0(symbols 48 23516 0)=
=C2=A0(miscs 40 80 140)
=C2=A0(strings 32 27164 5634)<= /div>
=C2=A0(string-bytes 1 818145)
=C2=A0(vectors 16 17422)<= /div>
=C2=A0(vector-slots 8 491703 4664)
=C2=A0(floats 8 264 = 116)
=C2=A0(intervals 56 628 18)
=C2=A0(buffers 976 21)= )

--
Thanks,

Jonathan Kotta

Hofstadter's Law:
=C2= =A0 =C2=A0 It always takes longer than you expect, even
=C2=A0 =C2=A0 wh= en you take into account Hofstadter's Law.
--94eb2c088be255ca05055c616521-- ------------=_1523997243-10931-1--