From: Anders Lindgren <andlind@gmail.com>
To: 16426@debbugs.gnu.org
Subject: bug#16426: 24.3.50; Follow-mode broken when window is selected from another buffer, like compile-goto-error (worked in 24.2, broken in 24.3)
Date: Sun, 12 Jan 2014 21:46:56 +0100 [thread overview]
Message-ID: <CABr8ebZ8yFUrk45GkAS81G-kRAKEzRFUny9HfJMZrt=-NSTb5A@mail.gmail.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 6975 bytes --]
When a window is selected by a command like `compile-goto-error', and the
buffer of that window have follow-mode enabled, the wrong location is
displayed.
Steps to repeat:
emacs -Q src/alloc.c
Make the window wide enough for three columns.
C-x 3
C-x 3
M-x balance-windows RET
M-x follow-mode RET
C-x o
C-x o
M-x grep RET for *.c RET
C-x o
Go to a match of a line number a couple of pages into alloc.c, say line
1001
RET
Here, alloc.c is selected, but the wrong line is displayed.
This worked in Emacs 24.2 but is broken in Emacs 24.3 and on the bzr trunk.
The cause of the error seems to be a major rewrite of follow-mode. In the
24.2 version, the function `follow-post-command-hook' picked up the point
to work on, "dest", from the buffer associated with the window. In 24.3, is
simply use `(point)' of the current buffer.
I guess that this is a mistake introduced when the new function
`follow-adjust-window' was broken out from `follow-post-command-hook'.
"dest" is now a parameter of the new function, unfortunately, in the call
"(point)" is passed, which is located outside of the `(with-current-buffer
(window-buffer win) ...)' construct. Hence, it uses the point of the
current buffer rather than of the buffer of the selected window, which it
should.
(defun follow-post-command-hook ()
"Ensure that the windows in Follow mode are adjacent after each command."
(unless (input-pending-p)
(let ((follow-inside-post-command-hook t)
(win (selected-window)))
;; Work in the selected window, not in the current buffer.
(with-current-buffer (window-buffer win)
(unless (and (symbolp this-command)
(get this-command 'follow-mode-use-cache))
(setq follow-windows-start-end-cache nil)))
(follow-adjust-window win (point))))) <----- **** Outside
`with-current-buffer'.
(defun follow-adjust-window (win dest)
;; Adjust the window WIN and its followers.
...)
Clearly, the parameter `dest' gets its value from (point). However, as this
is outside the `with-current-buffer' construct it get it's value from
current buffer, not the buffer of the selected window (as before).
It should be trivial to fix, e.g. by adding `dest' to the `let', and
setting in the `with-current-construct' of `follow-post-command-hook', and
pass it, rather than (point) -- but I leave it to you to do the actual
implementation.
Sincerely,
Anders Lindgren
Ps. I'm the original author of Follow mode.
In GNU Emacs 24.3.50.1 (x86_64-apple-darwin13.0.0, NS apple-appkit-1265.00)
of 2014-01-09 on macpro.lan
Repository revision: 115931
monnier@iro.umontreal.ca-20140109015919-e2odlbm4kphig5ya
Windowing system distributor `Apple', version 10.3.1265
Configured using:
`configure --with-ns'
Important settings:
value of $LC_CTYPE: UTF-8
locale-coding-system: utf-8-unix
Major mode: Help
Minor modes in effect:
shell-dirtrack-mode: t
tooltip-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 input:
<backspace> <backspace> <backspace> <backspace> <backspace>
<backspace> <backspace> <backspace> <backspace> <backspace>
<backspace> <backspace> <backspace> <backspace> <backspace>
<backspace> <backspace> <backspace> <backspace> <backspace>
<backspace> <backspace> <backspace> <backspace> F o
l l o w SPC m o d e SPC v b <backspace> <backspace>
b r o k n SPC <backspace> <backspace> e n SPC w h e
n SPC s t a r t e d SPC <backspace> <backspace> <backspace>
<backspace> <backspace> <backspace> <backspace> <backspace>
w i n d o w SPC s e l e c t e d SPC f r o m <backspace>
<backspace> <backspace> <backspace> b u t SPC c u <backspace>
<backspace> <backspace> <backspace> <backspace> <backspace>
b u r SPC <backspace> <backspace> t SPC c u r r e n
t SPC b u f f e r SPC s <backspace> i s <backspace>
<backspace> <backspace> <backspace> <backspace> <backspace>
<backspace> <backspace> <backspace> <backspace> <backspace>
<backspace> <backspace> <backspace> <backspace> <backspace>
<backspace> <backspace> <backspace> <backspace> <backspace>
<backspace> <backspace> <backspace> <backspace> <backspace>
<backspace> <backspace> <backspace> <backspace> <backspace>
<backspace> <backspace> <backspace> <backspace> <backspace>
<backspace> s e l e c t e d SPC <backspace> <backspace>
<backspace> <backspace> <backspace> <backspace> <backspace>
<backspace> <backspace> <backspace> <backspace> <backspace>
<backspace> <backspace> w <backspace> w h e n SPC <left>
<left> <left> <left> <left> <left> <left> <left> <left>
<left> <left> <left> <left> <left> <left> <left> <left>
<left> <right> <backspace> . <backspace> - C-e <backspace>
<backspace> <backspace> <backspace> h e n SPC <backspace>
<backspace> <backspace> <backspace> <backspace> <backspace>
<backspace> <backspace> <backspace> <backspace> <backspace>
<backspace> <backspace> <backspace> <backspace> <backspace>
<backspace> <backspace> <backspace> <backspace> <backspace>
<backspace> <backspace> <backspace> C o m p i l e <backspace>
<backspace> <backspace> <backspace> <backspace> <backspace>
<backspace> C-x p C-x p C-x o C-x o C-x o C-x o C-h
k <return> <down> <down> <down> C-x o C-x o C-x o <escape>
x <up> <return>
Recent messages:
follow-post-command-hook
follow-adjust-window
C-x p is undefined [3 times]
Making completion list...
Undo! [5 times]
Quit
C-x p is undefined
Quit
C-x p is undefined
Type "q" to restore previous buffer.
Load-path shadows:
None found.
Features:
(shadow sort gnus-util mail-extr emacsbug message format-spec rfc822 mml
mml-sec mm-decode mm-bodies mm-encode mail-parse rfc2231 mailabbrev
gmm-utils mailheader sendmail rfc2047 rfc2045 ietf-drums mm-util
mail-prsvr mail-utils misearch multi-isearch jka-compr find-func
help-mode shell pcomplete grep compile comint ansi-color ring follow
advice help-fns easy-mmode cl-macs gv vc-bzr cc-langs cl cl-loaddefs
cl-lib cc-mode cc-fonts easymenu cc-guess cc-menus cc-cmds cc-styles
cc-align cc-engine cc-vars cc-defs time-date tooltip electric uniquify
ediff-hook vc-hooks lisp-float-type mwheel ns-win tool-bar dnd fontset
image regexp-opt fringe tabulated-list newcomment lisp-mode prog-mode
register page menu-bar rfn-eshadow timer select scroll-bar mouse
jit-lock font-lock syntax facemenu 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 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
cocoa ns multi-tty emacs)
[-- Attachment #2: Type: text/html, Size: 10121 bytes --]
next reply other threads:[~2014-01-12 20:46 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-01-12 20:46 Anders Lindgren [this message]
[not found] ` <handler.16426.B.138955963327365.ack@debbugs.gnu.org>
2014-01-15 21:54 ` bug#16426: Acknowledgement (24.3.50; Follow-mode broken when window is selected from another buffer, like compile-goto-error (worked in 24.2, broken in 24.3)) Anders Lindgren
2014-01-16 0:28 ` Stefan Monnier
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='CABr8ebZ8yFUrk45GkAS81G-kRAKEzRFUny9HfJMZrt=-NSTb5A@mail.gmail.com' \
--to=andlind@gmail.com \
--cc=16426@debbugs.gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.