From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Milan Zamazal Newsgroups: gmane.emacs.bugs Subject: bug#21304: 24.5; follow-switch-to-buffer changes positions Date: Thu, 20 Aug 2015 20:09:33 +0200 Message-ID: <87egix96hu.fsf@blackbird.zamazal.org> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1440105150 12332 80.91.229.3 (20 Aug 2015 21:12:30 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 20 Aug 2015 21:12:30 +0000 (UTC) To: 21304@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Thu Aug 20 23:12:16 2015 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 1ZSX8A-0000CU-0r for geb-bug-gnu-emacs@m.gmane.org; Thu, 20 Aug 2015 23:12:14 +0200 Original-Received: from localhost ([::1]:37102 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZSX89-0005Fa-4F for geb-bug-gnu-emacs@m.gmane.org; Thu, 20 Aug 2015 17:12:13 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:40025) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZSX81-0005EB-Hj for bug-gnu-emacs@gnu.org; Thu, 20 Aug 2015 17:12:06 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZSX7y-0006Nr-6j for bug-gnu-emacs@gnu.org; Thu, 20 Aug 2015 17:12:05 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:41667) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZSX7y-0006Nn-4F for bug-gnu-emacs@gnu.org; Thu, 20 Aug 2015 17:12:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.80) (envelope-from ) id 1ZSX7x-0008AL-QE for bug-gnu-emacs@gnu.org; Thu, 20 Aug 2015 17:12:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Milan Zamazal Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 20 Aug 2015 21:12:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 21304 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.144010510831365 (code B ref -1); Thu, 20 Aug 2015 21:12:01 +0000 Original-Received: (at submit) by debbugs.gnu.org; 20 Aug 2015 21:11:48 +0000 Original-Received: from localhost ([127.0.0.1]:33877 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1ZSX7j-00089p-JG for submit@debbugs.gnu.org; Thu, 20 Aug 2015 17:11:48 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:58131) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1ZSX7f-00089f-T8 for submit@debbugs.gnu.org; Thu, 20 Aug 2015 17:11:46 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZSX7c-0006CV-Kj for submit@debbugs.gnu.org; Thu, 20 Aug 2015 17:11:43 -0400 Original-Received: from lists.gnu.org ([2001:4830:134:3::11]:52925) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZSX7c-0006CP-Ia for submit@debbugs.gnu.org; Thu, 20 Aug 2015 17:11:40 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:35688) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZSUHZ-0005Bv-6s for bug-gnu-emacs@gnu.org; Thu, 20 Aug 2015 14:09:46 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZSUHW-00075F-16 for bug-gnu-emacs@gnu.org; Thu, 20 Aug 2015 14:09:45 -0400 Original-Received: from condor.zamazal.org ([83.240.26.148]:41963 helo=zamazal.org) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZSUHV-000758-Mq for bug-gnu-emacs@gnu.org; Thu, 20 Aug 2015 14:09:41 -0400 Original-Received: from blackbird ([192.168.136.2] helo=blackbird.zamazal.org) by zamazal.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.84) (envelope-from ) id 1ZSUHE-0001bD-Gg; Thu, 20 Aug 2015 20:09:24 +0200 Original-Received: from pdm by blackbird.zamazal.org with local (Exim 4.84) (envelope-from ) id 1ZSUHN-0003gX-2n; Thu, 20 Aug 2015 20:09:33 +0200 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] 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: 208.118.235.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:105609 Archived-At: `follow-switch-to-buffer' doesn't retain cursor position nor buffer position within the windows. How to reproduce the bug: - Start Emacs. - Type `C-h n' (NEWS gets displayed) - Type `C-h C-c' (COPYING gets displayed) - Type `C-x 3' (the window gets split) - Type `M-x follow-mode RET' (follow mode gets enabled) - Type `C-v' (the buffer gets scrolled -- note the cursor position) - Type `M-x follow-switch-to-buffer RET RET' (NEWS gets displayed) - Type `M-x follow-switch-to-buffer RET RET' (COPYING gets displayed again) I'd expect the window contents and cursor position would be the same as after typing `C-v'; there is no reason why they should be changed just after switching to another buffer and back. But they are changed. I think the problem is in the order of window selection and buffer switching in follow-switch-to-buffer. When I change the function body to something like (let ((orig-window (selected-window))) (dolist (w (follow-all-followers)) (unless (eq w orig-window) (select-window w) (switch-to-buffer buffer))) (select-window orig-window) (switch-to-buffer buffer))) then it works as expected. In GNU Emacs 24.5.1 (x86_64-pc-linux-gnu, GTK+ Version 3.14.5) of 2015-06-29 on blackbird, modified by Debian Windowing system distributor `The X.Org Foundation', version 11.0.11604000 System Description: Debian GNU/Linux 8.1 (jessie) Configured using: `configure --build x86_64-linux-gnu --prefix=/usr --sharedstatedir=/var/lib --libexecdir=/usr/lib --localstatedir=/var/lib --infodir=/usr/share/info --mandir=/usr/share/man --with-pop=yes --enable-locallisppath=/etc/emacs24:/etc/emacs:/usr/local/share/emacs/24.5/site-lisp:/usr/local/share/emacs/site-lisp:/usr/share/emacs/24.5/site-lisp:/usr/share/emacs/site-lisp --build x86_64-linux-gnu --prefix=/usr --sharedstatedir=/var/lib --libexecdir=/usr/lib --localstatedir=/var/lib --infodir=/usr/share/info --mandir=/usr/share/man --with-pop=yes --enable-locallisppath=/etc/emacs24:/etc/emacs:/usr/local/share/emacs/24.5/site-lisp:/usr/local/share/emacs/site-lisp:/usr/share/emacs/24.5/site-lisp:/usr/share/emacs/site-lisp --with-x=yes --with-x-toolkit=gtk3 --with-toolkit-scroll-bars 'CFLAGS=-g -O2 -fstack-protector-strong -Wformat -Werror=format-security -Wall' CPPFLAGS=-D_FORTIFY_SOURCE=2 LDFLAGS=-Wl,-z,relro' Important settings: value of $LC_CTYPE: cs_CZ.UTF-8 value of $LANG: C locale-coding-system: utf-8-unix Major mode: Fundamental Minor modes in effect: follow-mode: t goto-address-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 view-mode: t Recent messages: Loading /usr/share/emacs/site-lisp/slime/slime-autoloads.el (source)...done Loading /etc/emacs/site-start.d/50slime.el (source)...done Loading /etc/emacs/site-start.d/51debian-el.el (source)...done For information about GNU Emacs and the GNU system, type C-h C-a. Note: file is write protected View mode: type C-h for help, h for commands, q to quit. Note: file is write protected View mode: type C-h for help, h for commands, q to quit. Follow mode enabled You can run the command `follow-switch-to-buffer' with C-c . b Load-path shadows: /usr/share/emacs/24.5/site-lisp/debian-startup hides /usr/share/emacs/site-lisp/debian-startup /usr/share/emacs24/site-lisp/cmake-data/cmake-mode hides /usr/share/emacs/site-lisp/cmake-mode /usr/share/emacs/site-lisp/rst hides /usr/share/emacs/24.5/lisp/textmodes/rst /usr/share/emacs24/site-lisp/dictionaries-common/flyspell hides /usr/share/emacs/24.5/lisp/textmodes/flyspell /usr/share/emacs24/site-lisp/dictionaries-common/ispell hides /usr/share/emacs/24.5/lisp/textmodes/ispell /usr/share/emacs/24.5/site-lisp/slime/lib/ert-x hides /usr/share/emacs/24.5/lisp/emacs-lisp/ert-x /usr/share/emacs/24.5/site-lisp/slime/lib/ert hides /usr/share/emacs/24.5/lisp/emacs-lisp/ert 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 help-fns mail-prsvr mail-utils follow easymenu goto-addr thingatpt noutline outline easy-mmode view debian-el debian-el-loaddefs slime-autoloads dpkg-dev-el dpkg-dev-el-loaddefs time-date tooltip 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 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 dbusbind gfilenotify dynamic-setting system-font-setting font-render-setting move-toolbar gtk x-toolkit x multi-tty emacs) Memory information: ((conses 16 81114 6398) (symbols 48 19487 0) (miscs 40 115 136) (strings 32 12653 4707) (string-bytes 1 307717) (vectors 16 9684) (vector-slots 8 401376 6969) (floats 8 67 289) (intervals 56 329 0) (buffers 960 15) (heap 1024 46481 988))