* bug#20353: M-. sometimes jumps in another window
@ 2015-04-17 5:03 Stefan Monnier
2015-04-18 0:51 ` Dmitry Gutov
0 siblings, 1 reply; 16+ messages in thread
From: Stefan Monnier @ 2015-04-17 5:03 UTC (permalink / raw)
To: 20353
Package: Emacs
Version: 25.0.50
I tend to use many frames. When I hit M-. I sometimes get a new popup
frame asking me to choose a destination. All good so far.
But sometimes once I choose my destination, xref choose the wrong window
to display that destination. More specifically I get the following scenario:
- Window 1 (in frame 1) showing buffer B.
- Window 2 (in frame 2) showing buffer B as well.
- In window 1 I do M-.
- Get a popup to choose the destination.
- Choose some destination D which is also in buffer B.
- And here's the downer: sometimes Emacs decides to then select window
2 to jump to D, instead of using the window 1 for that.
Stefan
In GNU Emacs 25.0.50.1 (x86_64-unknown-linux-gnu, X toolkit, Xaw3d scroll bars)
of 2015-04-14 on pastel
Repository revision: 12f00667ebea0fe4c1e173f9d15192c75471d9d3
Windowing system distributor `The X.Org Foundation', version 11.0.11604000
System Description: Debian GNU/Linux 8.0 (jessie)
Configured using:
`configure -C --enable-checking --enable-check-lisp-object-type
'CFLAGS=-Wall -g3 -Og -Wno-pointer-sign'
PKG_CONFIG_PATH=/home/monnier/lib/pkgconfig'
Configured features:
XAW3D XPM JPEG TIFF GIF PNG SOUND GPM DBUS NOTIFY GNUTLS LIBXML2
FREETYPE M17N_FLT LIBOTF XFT ZLIB
Important settings:
value of $LANG: fr_CH.UTF-8
locale-coding-system: utf-8-unix
Major mode: InactiveMinibuffer
Minor modes in effect:
erc-list-mode: t
erc-menu-mode: t
erc-autojoin-mode: t
erc-ring-mode: t
erc-networks-mode: t
erc-pcomplete-mode: t
erc-track-mode: t
erc-match-mode: t
erc-button-mode: t
erc-fill-mode: t
erc-stamp-mode: t
erc-netsplit-mode: t
erc-irccontrols-mode: t
erc-noncommands-mode: t
erc-move-to-prompt-mode: t
erc-readonly-mode: t
csv-field-index-mode: t
shell-dirtrack-mode: t
c-electric-flag: t
diff-auto-refine-mode: t
server-mode: t
electric-pair-mode: t
url-handler-mode: t
global-reveal-mode: t
reveal-mode: t
auto-insert-mode: t
savehist-mode: t
minibuffer-electric-default-mode: t
global-eldoc-mode: t
electric-indent-mode: t
mouse-wheel-mode: t
global-prettify-symbols-mode: t
menu-bar-mode: t
file-name-shadow-mode: t
global-font-lock-mode: t
auto-composition-mode: t
auto-encryption-mode: t
auto-compression-mode: t
line-number-mode: t
Recent messages:
Saving file /home/monnier/src/emacs/trunk/lisp/eshell/em-cmpl.el...
Wrote /home/monnier/src/emacs/trunk/lisp/eshell/em-cmpl.el
Mark saved where search started
Saving file /home/monnier/src/emacs/trunk/lisp/eshell/em-cmpl.el...
Wrote /home/monnier/src/emacs/trunk/lisp/eshell/em-cmpl.el
Quit
Warning: turn-on-eldoc-mode is obsolete!
Warning: hide-sublevels is obsolete!
Saving file /home/monnier/src/emacs/trunk/lisp/pcomplete.el...
Wrote /home/monnier/src/emacs/trunk/lisp/pcomplete.el
Load-path shadows:
/home/monnier/src/emacs/elpa/packages/ada-mode/ada-ref-man hides /home/monnier/src/emacs/elpa/packages/ada-ref-man/ada-ref-man
/home/monnier/src/emacs/elpa/packages/ada-mode/ada-prj hides /home/monnier/src/emacs/work/lisp/progmodes/ada-prj
/home/monnier/src/emacs/elpa/packages/ada-mode/ada-stmt hides /home/monnier/src/emacs/work/lisp/progmodes/ada-stmt
/home/monnier/src/emacs/elpa/packages/ada-mode/ada-mode hides /home/monnier/src/emacs/work/lisp/progmodes/ada-mode
/home/monnier/src/emacs/elpa/packages/ada-mode/ada-xref hides /home/monnier/src/emacs/work/lisp/progmodes/ada-xref
/home/monnier/src/emacs/elpa/packages/crisp/crisp hides /home/monnier/src/emacs/work/lisp/obsolete/crisp
Features:
(erc-list erc-menu erc-join erc-ring erc-networks erc-pcomplete
erc-track erc-match erc-button erc-fill erc-stamp erc-netsplit
erc-goodies erc erc-backend erc-compat dabbrev conf-mode autorevert
filenotify reftex-dcr reftex reftex-vars tex-mode latexenc rect
cal-french diary-lib diary-loaddefs cal-move org-timer org-table
org-colview org-clock org-attach org-id org-archive org-agenda org-rmail
org-mhe org-irc org-info org-gnus org-docview doc-view jka-compr
image-mode org-bibtex bibtex org-bbdb org-w3m reporter org org-macro
org-footnote org-pcomplete org-list org-faces org-entities org-version
ob-emacs-lisp ob ob-tangle ob-ref ob-lob ob-table ob-exp org-src ob-keys
ob-comint ob-core ob-eval org-compat org-macs org-loaddefs cal-menu
calendar cal-loaddefs derived csv-mode mule-util network-stream nsm
starttls tls mpc vc-annotate log-view vc-bzr vc-src vc-sccs vc-svn
vc-cvs vc-rcs vc-dir reposition shell pcomplete grep etags xref sort
mail-extr emacsbug semantic/bovine/c semantic/db-mode
semantic/decorate/include semantic/decorate/mode semantic/decorate pulse
semantic/bovine/c-by semantic/lex-spp semantic/idle semantic/bovine/gcc
semantic/dep semantic/bovine semantic/analyze/refs semantic/db-find
semantic/db-ref semantic/analyze semantic/sort semantic/scope
semantic/analyze/fcn semantic/db eieio-base semantic/ctxt
semantic/format semantic/tag-ls semantic/find semantic/util-modes
semantic/util semantic semantic/tag semantic/lex semantic/fw mode-local
cedet hideif cpp cmacexp cc-mode cc-fonts cc-guess cc-menus cc-cmds
cc-styles cc-align cc-engine cc-langs cc-vars cc-defs compile log-edit
message sendmail dired format-spec rfc822 mml mml-sec mm-decode
mm-bodies mm-encode mail-parse rfc2231 rfc2047 rfc2045 ietf-drums
mailabbrev mail-utils mailheader pcvs-util bug-reference add-log ffap
misearch multi-isearch smerge-mode whitespace executable copyright
xscheme unsafep trace testcover shadow scheme re-builder profiler
inf-lisp ielm pp comint ansi-color ring gmm-utils ert ewoc debug elp
edebug cl-indent cus-edit cus-start cus-load wid-edit vc vc-dispatcher
vc-git diff-mode filecache eieio-opt speedbar sb-image ezimage dframe
find-func server noutline outline easy-mmode flyspell ispell checkdoc
thingatpt help-mode load-dir elec-pair url-handlers url-parse
auth-source eieio warnings eieio-core cl-generic byte-opt bytecomp
byte-compile cl-extra seq cconv gnus-util time-date mm-util mail-prsvr
password-cache url-vars reveal autoinsert proof-site proof-autoloads
cl-macs cl gv pg-vars savehist minibuf-eldef disp-table edmacro kmacro
cl-loaddefs pcase cl-lib advice help-fns info easymenu finder-inf
package epg-config bbdb-autoloads agda2 vm-autoloads tooltip eldoc
electric uniquify ediff-hook vc-hooks lisp-float-type mwheel x-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 font-core frame cham
georgian utf-8-lang misc-lang vietnamese tibetan thai tai-viet lao
korean japanese hebrew greek romanian slovak czech european ethiopic
indian cyrillic chinese 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
make-network-process dbusbind inotify dynamic-setting
font-render-setting x-toolkit x multi-tty emacs)
Memory information:
((conses 8 628619 145706)
(symbols 24 41806 3) (miscs 20 15658 2825) (strings 16 129418 20270)
(string-bytes 1 3708997)
(vectors 8 77697) (vector-slots 4 2432223 117318) (floats 8 792 990)
(intervals 28 50798 4135)
(buffers 520 91) (heap 1024 595874 13811))
^ permalink raw reply [flat|nested] 16+ messages in thread
* bug#20353: M-. sometimes jumps in another window
2015-04-17 5:03 bug#20353: M-. sometimes jumps in another window Stefan Monnier
@ 2015-04-18 0:51 ` Dmitry Gutov
2015-04-18 4:46 ` Stefan Monnier
0 siblings, 1 reply; 16+ messages in thread
From: Dmitry Gutov @ 2015-04-18 0:51 UTC (permalink / raw)
To: Stefan Monnier, 20353
On 04/17/2015 08:03 AM, Stefan Monnier wrote:
> I tend to use many frames. When I hit M-. I sometimes get a new popup
> frame asking me to choose a destination. All good so far.
>
> But sometimes once I choose my destination, xref choose the wrong window
> to display that destination. More specifically I get the following scenario:
Is the scenario reliable? I haven't seen the result you're describing
after trying it.
> - Window 1 (in frame 1) showing buffer B.
> - Window 2 (in frame 2) showing buffer B as well.
> - In window 1 I do M-.
> - Get a popup to choose the destination.
Are there some particular settings that make the xref buffer appear in a
new frame? It always uses the current frame here.
> - Choose some destination D which is also in buffer B.
> - And here's the downer: sometimes Emacs decides to then select window
> 2 to jump to D, instead of using the window 1 for that.
The command that's called in the end is `xref-goto-xref'. Might it be
that `xref-quit' ends up selecting the wrong frame?
^ permalink raw reply [flat|nested] 16+ messages in thread
* bug#20353: M-. sometimes jumps in another window
2015-04-18 0:51 ` Dmitry Gutov
@ 2015-04-18 4:46 ` Stefan Monnier
2015-04-18 23:21 ` Dmitry Gutov
0 siblings, 1 reply; 16+ messages in thread
From: Stefan Monnier @ 2015-04-18 4:46 UTC (permalink / raw)
To: Dmitry Gutov; +Cc: 20353
> Are there some particular settings that make the xref buffer appear in a new
> frame?
Yes, I have some display-buffer-alist settings for that.
I just reproduced the problem with:
src/emacs -Q --eval '(setq special-display-regexps (list "^\\*"))'
C-x C-f src/emacs.c
C-x 5 2
C-s pthread_sigmask
M-. RET
<click on one of the entries>
It seems always the same of the 2 frames is used for the jump, so
depending on which one is used for the M-. the behavior is either the
expected one or not.
Stefan
^ permalink raw reply [flat|nested] 16+ messages in thread
* bug#20353: M-. sometimes jumps in another window
2015-04-18 4:46 ` Stefan Monnier
@ 2015-04-18 23:21 ` Dmitry Gutov
2015-04-20 14:17 ` Stefan Monnier
0 siblings, 1 reply; 16+ messages in thread
From: Dmitry Gutov @ 2015-04-18 23:21 UTC (permalink / raw)
To: Stefan Monnier; +Cc: 20353
On 04/18/2015 07:46 AM, Stefan Monnier wrote:
> It seems always the same of the 2 frames is used for the jump, so
> depending on which one is used for the M-. the behavior is either the
> expected one or not.
What I'm seeing here is, when you click on one of the entries (or press
RET), `xref-goto-xref' doesn't delete the frame displaying the xref
window (nor does the window get deleted, naturally).
That screws things up the subsequent times the xref buffer, and its
window, are used. The frame that's always "used for the jump", is the
one *xref* was popped from originally.
Isn't this a bug in `quit-window'? I can reproduce it this way:
(setq special-display-regexps (list "^\\*"))
C-h f quit-window --> that creates a new frame
q --> the frame is simply buried
'C-u q' does the trick, though.
^ permalink raw reply [flat|nested] 16+ messages in thread
* bug#20353: M-. sometimes jumps in another window
2015-04-18 23:21 ` Dmitry Gutov
@ 2015-04-20 14:17 ` Stefan Monnier
2015-04-20 15:17 ` Dmitry Gutov
0 siblings, 1 reply; 16+ messages in thread
From: Stefan Monnier @ 2015-04-20 14:17 UTC (permalink / raw)
To: Dmitry Gutov; +Cc: 20353
> q --> the frame is simply buried
That is correct for my use-case (mostly because it preserves the frame
placement).
Stefan
^ permalink raw reply [flat|nested] 16+ messages in thread
* bug#20353: M-. sometimes jumps in another window
2015-04-20 14:17 ` Stefan Monnier
@ 2015-04-20 15:17 ` Dmitry Gutov
2015-04-20 19:28 ` Stefan Monnier
0 siblings, 1 reply; 16+ messages in thread
From: Dmitry Gutov @ 2015-04-20 15:17 UTC (permalink / raw)
To: Stefan Monnier; +Cc: 20353
On 04/20/2015 05:17 PM, Stefan Monnier wrote:
>> q --> the frame is simply buried
>
> That is correct for my use-case (mostly because it preserves the frame
> placement).
(setq special-display-regexps (list "^\\*"))
Split the window (into A and B).
Type `C-h f quit-window' in window A. See the new frame pop up, and the
windowing system switch to it.
Press `q', the new frame is buried, focus returns to A.
Switch to B. Type `C-h f car' there. In my desktop environment (Ubuntu,
Unity), the help frame stays in the background. If I explicitly switch
to it (with `C-~') and press `q' in the Help window, the frame is buried
again, but again, the focus returns to A.
Which mirrors the problem you've described in this report.
Maybe not deleting the frames is not the real problem, but them the
problem is in some other window-related functionality.
^ permalink raw reply [flat|nested] 16+ messages in thread
* bug#20353: M-. sometimes jumps in another window
2015-04-20 15:17 ` Dmitry Gutov
@ 2015-04-20 19:28 ` Stefan Monnier
2015-04-20 19:37 ` Dmitry Gutov
0 siblings, 1 reply; 16+ messages in thread
From: Stefan Monnier @ 2015-04-20 19:28 UTC (permalink / raw)
To: Dmitry Gutov; +Cc: 20353
> Maybe not deleting the frames is not the real problem, but them the problem
> is in some other window-related functionality.
I think the issue is much simpler: xref should explicitly remember the
window from which *xref* comes, so that it can explicitly go back to it
(if it still exists) when we select an entry.
Stefan
^ permalink raw reply [flat|nested] 16+ messages in thread
* bug#20353: M-. sometimes jumps in another window
2015-04-20 19:28 ` Stefan Monnier
@ 2015-04-20 19:37 ` Dmitry Gutov
2015-04-21 1:09 ` Stefan Monnier
0 siblings, 1 reply; 16+ messages in thread
From: Dmitry Gutov @ 2015-04-20 19:37 UTC (permalink / raw)
To: Stefan Monnier; +Cc: 20353
On 04/20/2015 10:28 PM, Stefan Monnier wrote:
> I think the issue is much simpler: xref should explicitly remember the
> window from which *xref* comes, so that it can explicitly go back to it
> (if it still exists) when we select an entry.
Why remember more things, if we can do with less?
We *do* want pressing `q' to return to the window *xref* buffer was
opened from, right? The natural way to do that is with `quit-window'.
And when `xref-quit' works as intended, `xref-goto-xref' should be able
to reuse it successfully.
^ permalink raw reply [flat|nested] 16+ messages in thread
* bug#20353: M-. sometimes jumps in another window
2015-04-20 19:37 ` Dmitry Gutov
@ 2015-04-21 1:09 ` Stefan Monnier
2015-04-21 10:34 ` martin rudalics
0 siblings, 1 reply; 16+ messages in thread
From: Stefan Monnier @ 2015-04-21 1:09 UTC (permalink / raw)
To: Dmitry Gutov; +Cc: 20353
> We *do* want pressing `q' to return to the window *xref* buffer was opened
> from, right? The natural way to do that is with `quit-window'.
Right, the remembering might be part of pop-to-buffer and quit-window
rather than part of xref. Either way is fine by me.
Stefan
^ permalink raw reply [flat|nested] 16+ messages in thread
* bug#20353: M-. sometimes jumps in another window
2015-04-21 1:09 ` Stefan Monnier
@ 2015-04-21 10:34 ` martin rudalics
2015-04-21 13:42 ` Dmitry Gutov
2015-04-21 14:51 ` Stefan Monnier
0 siblings, 2 replies; 16+ messages in thread
From: martin rudalics @ 2015-04-21 10:34 UTC (permalink / raw)
To: Stefan Monnier, Dmitry Gutov; +Cc: 20353
[-- Attachment #1: Type: text/plain, Size: 171 bytes --]
> Right, the remembering might be part of pop-to-buffer and quit-window
> rather than part of xref. Either way is fine by me.
Would the attached patch fix it?
martin
[-- Attachment #2: quit-window.diff --]
[-- Type: text/plain, Size: 857 bytes --]
--- a/lisp/window.el
+++ b/lisp/window.el
@@ -5474,10 +5474,15 @@ element is BUFFER."
(cond
((eq type 'reuse)
(if (eq (window-buffer window) buffer)
- ;; WINDOW shows BUFFER already.
- (when (consp (window-parameter window 'quit-restore))
- ;; If WINDOW has a quit-restore parameter, reset its car.
- (setcar (window-parameter window 'quit-restore) 'same))
+ ;; WINDOW shows BUFFER already. Update WINDOW's quit-restore
+ ;; parameter, if any.
+ (let ((old (window-parameter window 'quit-restore)))
+ (when (consp old)
+ (set-window-parameter
+ window 'quit-restore
+ ;; The selected-window might have changed in between
+ ;; (Bug#20353).
+ (list 'same (nth 1 old) (selected-window) (nth 3 old)))))
;; WINDOW shows another buffer.
(with-current-buffer (window-buffer window)
(set-window-parameter
^ permalink raw reply [flat|nested] 16+ messages in thread
end of thread, other threads:[~2015-05-20 9:46 UTC | newest]
Thread overview: 16+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-04-17 5:03 bug#20353: M-. sometimes jumps in another window Stefan Monnier
2015-04-18 0:51 ` Dmitry Gutov
2015-04-18 4:46 ` Stefan Monnier
2015-04-18 23:21 ` Dmitry Gutov
2015-04-20 14:17 ` Stefan Monnier
2015-04-20 15:17 ` Dmitry Gutov
2015-04-20 19:28 ` Stefan Monnier
2015-04-20 19:37 ` Dmitry Gutov
2015-04-21 1:09 ` Stefan Monnier
2015-04-21 10:34 ` martin rudalics
2015-04-21 13:42 ` Dmitry Gutov
2015-04-22 9:33 ` martin rudalics
2015-04-22 12:28 ` Dmitry Gutov
2015-04-22 13:07 ` martin rudalics
2015-05-20 9:46 ` martin rudalics
2015-04-21 14:51 ` Stefan Monnier
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).