From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Anders Lindgren Newsgroups: gmane.emacs.bugs 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 Message-ID: NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/alternative; boundary=e89a8f3ba12d5a842404efcc0f22 X-Trace: ger.gmane.org 1389559687 32041 80.91.229.3 (12 Jan 2014 20:48:07 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sun, 12 Jan 2014 20:48:07 +0000 (UTC) To: 16426@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sun Jan 12 21:48:12 2014 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1W2Rx5-0001qp-KM for geb-bug-gnu-emacs@m.gmane.org; Sun, 12 Jan 2014 21:48:11 +0100 Original-Received: from localhost ([::1]:39411 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1W2Rx5-0000Fs-8w for geb-bug-gnu-emacs@m.gmane.org; Sun, 12 Jan 2014 15:48:11 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:56693) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1W2Rwy-0000Fn-RD for bug-gnu-emacs@gnu.org; Sun, 12 Jan 2014 15:48:06 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1W2Rww-0001he-KY for bug-gnu-emacs@gnu.org; Sun, 12 Jan 2014 15:48:04 -0500 Original-Received: from debbugs.gnu.org ([140.186.70.43]:34082) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1W2Rww-0001ha-GN for bug-gnu-emacs@gnu.org; Sun, 12 Jan 2014 15:48:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.80) (envelope-from ) id 1W2Rww-00078f-5U for bug-gnu-emacs@gnu.org; Sun, 12 Jan 2014 15:48:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Anders Lindgren Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 12 Jan 2014 20:48:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 16426 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.138955963327365 (code B ref -1); Sun, 12 Jan 2014 20:48:01 +0000 Original-Received: (at submit) by debbugs.gnu.org; 12 Jan 2014 20:47:13 +0000 Original-Received: from localhost ([127.0.0.1]:48101 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1W2Rw8-00077H-GE for submit@debbugs.gnu.org; Sun, 12 Jan 2014 15:47:13 -0500 Original-Received: from eggs.gnu.org ([208.118.235.92]:54782) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1W2Rw3-000777-NP for submit@debbugs.gnu.org; Sun, 12 Jan 2014 15:47:10 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1W2Rvz-0001ND-8e for submit@debbugs.gnu.org; Sun, 12 Jan 2014 15:47:07 -0500 Original-Received: from lists.gnu.org ([2001:4830:134:3::11]:54204) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1W2Rvz-0001N3-5S for submit@debbugs.gnu.org; Sun, 12 Jan 2014 15:47:03 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:56453) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1W2Rvw-0008F4-TI for bug-gnu-emacs@gnu.org; Sun, 12 Jan 2014 15:47:03 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1W2Rvu-0001Lo-Ti for bug-gnu-emacs@gnu.org; Sun, 12 Jan 2014 15:47:00 -0500 Original-Received: from mail-wg0-x234.google.com ([2a00:1450:400c:c00::234]:39365) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1W2Rvu-0001LX-Ed for bug-gnu-emacs@gnu.org; Sun, 12 Jan 2014 15:46:58 -0500 Original-Received: by mail-wg0-f52.google.com with SMTP id b13so5658796wgh.19 for ; Sun, 12 Jan 2014 12:46:56 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:date:message-id:subject:from:to:content-type; bh=NRZc22ySsFY8MZfAtSJQrvlAcUrPMb/TE/YfZCH2FUc=; b=p1jnuDaNfQOc0f4O1tIhmG4jERthKP4xTKXcdp/bUD+LAvUM4HA32d8aLX/kOec02a qqhcdINV6Po8ftp+hzON0RoDeLl3sCuckBVWZFiGBzPVQ76zFqeEwaNJLMzSHyNrjynt GFkXYX/0Y1KOb0wmSkMeBiavmy1NjfeIvtPMzUPwgOqM2+H8gZlpA5r9lol+ilAIrtGK oWqd0UrRF6Yh1o1fr3DUuy3hKD8fdITfXEVpa+/vnRbHd8BLKCSWHHr8riFAIwcyGZhK XRb06S6rv6c92ABeby6yji2ENS9rSaAknkYpvqYSovRXl0FGM0rloNJfpmYKRrQXC0/S Jttw== X-Received: by 10.180.109.107 with SMTP id hr11mr12100789wib.56.1389559616798; Sun, 12 Jan 2014 12:46:56 -0800 (PST) Original-Received: by 10.216.187.199 with HTTP; Sun, 12 Jan 2014 12:46:56 -0800 (PST) X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 140.186.70.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:83373 Archived-At: --e89a8f3ba12d5a842404efcc0f22 Content-Type: text/plain; charset=ISO-8859-1 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: F o l l o w SPC m o d e SPC v b b r o k n SPC e n SPC w h e n SPC s t a r t e d SPC w i n d o w SPC s e l e c t e d SPC f r o m b u t SPC c u b u r SPC t SPC c u r r e n t SPC b u f f e r SPC s i s s e l e c t e d SPC w w h e n SPC . - C-e h e n SPC C o m p i l e C-x p C-x p C-x o C-x o C-x o C-x o C-h k C-x o C-x o C-x o x 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) --e89a8f3ba12d5a842404efcc0f22 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable
When a window is selected by a command like `compile-= goto-error', and the buffer of that window have follow-mode enabled, th= e wrong location is displayed.

Steps to repeat:

=A0 =A0 emacs -Q src/alloc.c
=A0 =A0 Make the= window wide enough for three columns.
=A0 =A0 C-x 3
= =A0 =A0 C-x 3
=A0 =A0 M-x balance-windows RET
=A0 =A0 M= -x follow-mode RET
=A0 =A0 C-x o
=A0 =A0 C-x o
=A0 =A0 M-x grep RET f= or *.c RET
=A0 =A0 C-x o
=A0 =A0 Go to a match of a lin= e number a couple of pages into alloc.c, say line 1001
=A0 =A0 RE= T
=A0 =A0 Here, alloc.c is selected, but the wrong line is displa= yed.

This worked in Emacs 24.2 but is broken in Emacs 24.3 a= nd 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 `fo= llow-post-command-hook' picked up the point to work on, "dest"= ;, from the buffer associated with the window. In 24.3, is simply use `(poi= nt)' 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-comman= d-hook'. "dest" is now a parameter of the new function, unfor= tunately, in the call "(point)" is passed, which is located outsi= de of the `(with-current-buffer (window-buffer win) ...)' construct. He= nce, it uses the point of the current buffer rather than of the buffer of t= he selected window, which it should.


(defun follow-post-command-hook ()<= /div>
=A0 "Ensure that the windows in Follow mode are adjacent aft= er each command."
=A0 (unless (input-pending-p)
= =A0 =A0 (let ((follow-inside-post-command-hook t)
=A0(win (selected-= window)))
=A0 =A0 =A0 ;; Work in the selected window, not in the = current buffer.
=A0 =A0 =A0 (with-current-buffer (window-buffer w= in)
(unless (and (symbolp th= is-command)
= =A0 =A0 (get this-command 'follow-mode-use-cache))
=A0(setq follow-windows-start-end= -cache nil)))
=A0 =A0 =A0 (follow-adjust-window win (point))))) =A0 =A0 =A0<-----= =A0 =A0 =A0 =A0**** Outside `with-current-buffer'.

(defun follow-adjust-window (win dest)
=A0 ;; Adjust the wi= ndow WIN and its followers.
=A0 ...)

Clearly, the parameter `dest&#= 39; gets its value from (point). However, as this is outside the `with-curr= ent-buffer' construct it get it's value from current buffer, not th= e 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 `follo= w-post-command-hook', and pass it, rather than (point) -- but I leave i= t to you to do the actual implementation.

Sincerely,
=A0 =A0 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-ap= pkit-1265.00)
=A0of 2014-01-09 on macpro.lan
Repository revision: 115931 monnier@iro.umontreal.ca-20140109015919-e2= odlbm4kphig5ya
Windowing system distributor `Apple', version = 10.3.1265
Configured using:
=A0`configure --with-ns'= ;

Important settings:
=A0 value of $LC_CTYPE: U= TF-8
=A0 locale-coding-system: utf-8-unix

Major mode: Help

Minor modes in effect:
=A0 shell-dirtrack-mode: t
=A0 tooltip-mode: t
=A0 elec= tric-indent-mode: t
=A0 mouse-wheel-mode: t
=A0 tool-ba= r-mode: t
=A0 menu-bar-mode: t
=A0 file-name-shadow-mod= e: t
=A0 global-font-lock-mode: t
=A0 font-lock-mode: t
=A0 blink-cursor-mode: t
=A0 auto-composition-mode: t
= =A0 auto-encryption-mode: t
=A0 auto-compression-mode: t
=A0 buffer-read-only: t
=A0 line-number-mode: t
=A0 transient-mark-mode: t

Recent input:
<backspace> <backspace>= <backspace> <backspace> <backspace>=A0
<bac= kspace> <backspace> <backspace> <backspace> <backsp= ace>=A0
<backspace> <backspace> <backspace> <backspace>= ; <backspace>=A0
<backspace> <backspace> <ba= ckspace> <backspace> <backspace>=A0
<backspace&= gt; <backspace> <backspace> <backspace> F o=A0
l l o w SPC m o d e SPC v b <backspace> <backspace>=A0
b r o k n SPC <backspace> <backspace> e n SPC w h e=A0
n SPC s t a r t e d SPC <backspace> <backspace> <ba= ckspace>=A0
<backspace> <backspace> <backspace> <backspace>= ; <backspace>=A0
w i n d o w SPC s e l e c t e d SPC f r o = m <backspace>=A0
<backspace> <backspace> <ba= ckspace> b u t SPC c u <backspace>=A0
<backspace> <backspace> <backspace> <backspace>= ; <backspace>=A0
b u r SPC <backspace> <backspace&= gt; t SPC c u r r e n=A0
t SPC b u f f e r SPC s <backspace>= ; i s <backspace>=A0
<backspace> <backspace> <backspace> <backspace>= ; <backspace>=A0
<backspace> <backspace> <ba= ckspace> <backspace> <backspace>=A0
<backspace&= gt; <backspace> <backspace> <backspace> <backspace>= =A0
<backspace> <backspace> <backspace> <backspace>= ; <backspace>=A0
<backspace> <backspace> <ba= ckspace> <backspace> <backspace>=A0
<backspace&= gt; <backspace> <backspace> <backspace> <backspace>= =A0
<backspace> <backspace> <backspace> <backspace>= ; <backspace>=A0
<backspace> s e l e c t e d SPC <= backspace> <backspace>=A0
<backspace> <backspac= e> <backspace> <backspace> <backspace>=A0
<backspace> <backspace> <backspace> <backspace>= ; <backspace>=A0
<backspace> <backspace> w <= backspace> w h e n SPC <left>=A0
<left> <left&g= t; <left> <left> <left> <left> <left> <lef= t>=A0
<left> <left> <left> <left> <left> <l= eft> <left> <left>=A0
<left> <right> &= lt;backspace> . <backspace> - C-e <backspace>=A0
<backspace> <backspace> <backspace> h e n SPC <backspa= ce>=A0
<backspace> <backspace> <backspace> <backspace>= ; <backspace>=A0
<backspace> <backspace> <ba= ckspace> <backspace> <backspace>=A0
<backspace&= gt; <backspace> <backspace> <backspace> <backspace>= =A0
<backspace> <backspace> <backspace> <backspace>= ; <backspace>=A0
<backspace> <backspace> <ba= ckspace> C o m p i l e <backspace>=A0
<backspace> = <backspace> <backspace> <backspace> <backspace>=A0<= /div>
<backspace> C-x p C-x p C-x o C-x o C-x o C-x o C-h=A0
k <return> <down> <down> <down> C-x o C-x o C-x o = <escape>=A0
x <up> <return>

Recent messages:
follow-post-command-hook
follow-a= djust-window
C-x p is undefined [3 times]
Making comple= tion list...
Undo! [5 times]
Quit
C-x p is un= defined
Quit
C-x p is undefined
Type "q" to rest= ore 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-loadde= fs
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 f= ontset
image regexp-opt fringe tabulated-list newcomment lisp-mod= e 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 abb= rev
minibuffer nadvice loaddefs button faces cus-face macroexp fi= les
text-properties overlay sha1 md5 base64 format env code-pages mule
custom widget hashtable-print-readable backquote make-network-proces= s
cocoa ns multi-tty emacs)

--e89a8f3ba12d5a842404efcc0f22--