* 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)
@ 2014-01-12 20:46 Anders Lindgren
[not found] ` <handler.16426.B.138955963327365.ack@debbugs.gnu.org>
0 siblings, 1 reply; 3+ messages in thread
From: Anders Lindgren @ 2014-01-12 20:46 UTC (permalink / raw
To: 16426
[-- 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 --]
^ permalink raw reply [flat|nested] 3+ messages in thread
* 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))
[not found] ` <handler.16426.B.138955963327365.ack@debbugs.gnu.org>
@ 2014-01-15 21:54 ` Anders Lindgren
2014-01-16 0:28 ` Stefan Monnier
0 siblings, 1 reply; 3+ messages in thread
From: Anders Lindgren @ 2014-01-15 21:54 UTC (permalink / raw
To: 16426
[-- Attachment #1: Type: text/plain, Size: 1698 bytes --]
Hi,
Below is a patch to correct the problem described in the bug report.
-- Anders
=== modified file 'lisp/follow.el'
--- lisp/follow.el 2014-01-10 09:30:43 +0000
+++ lisp/follow.el 2014-01-15 21:49:56 +0000
@@ -1119,13 +1119,15 @@
"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)))
+ (win (selected-window))
+ dest)
;; Work in the selected window, not in the current buffer.
(with-current-buffer (window-buffer win)
+ (setq dest (point))
(unless (and (symbolp this-command)
(get this-command 'follow-mode-use-cache))
(setq follow-windows-start-end-cache nil)))
- (follow-adjust-window win (point)))))
+ (follow-adjust-window win dest))))
On Sun, Jan 12, 2014 at 9:48 PM, GNU bug Tracking System <
help-debbugs@gnu.org> wrote:
> Thank you for filing a new bug report with debbugs.gnu.org.
>
> This is an automatically generated reply to let you know your message
> has been received.
>
> Your message is being forwarded to the package maintainers and other
> interested parties for their attention; they will reply in due course.
>
> Your message has been sent to the package maintainer(s):
> bug-gnu-emacs@gnu.org
>
> If you wish to submit further information on this problem, please
> send it to 16426@debbugs.gnu.org.
>
> Please do not send mail to help-debbugs@gnu.org unless you wish
> to report a problem with the Bug-tracking system.
>
> --
> 16426: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=16426
> GNU Bug Tracking System
> Contact help-debbugs@gnu.org with problems
>
[-- Attachment #2: Type: text/html, Size: 3036 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
* 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))
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
0 siblings, 0 replies; 3+ messages in thread
From: Stefan Monnier @ 2014-01-16 0:28 UTC (permalink / raw
To: Anders Lindgren; +Cc: 16426-done
> Below is a patch to correct the problem described in the bug report.
I installed a patch which is based on yours (but simply removes the
`dest' arg since it's always equal to (point) anyway).
Stefan
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2014-01-16 0:28 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-01-12 20:46 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) Anders Lindgren
[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
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.