From unknown Sun Jun 22 08:08:36 2025 X-Loop: help-debbugs@gnu.org Subject: bug#21304: 24.5; follow-switch-to-buffer changes positions 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: To: 21304@debbugs.gnu.org X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.144010510831365 (code B ref -1); Thu, 20 Aug 2015 21:12:01 +0000 Received: (at submit) by debbugs.gnu.org; 20 Aug 2015 21:11:48 +0000 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 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 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 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=0.8 required=5.0 tests=BAYES_50 autolearn=disabled version=3.3.2 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 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 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 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 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 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 From: Milan Zamazal Date: Thu, 20 Aug 2015 20:09:33 +0200 Message-ID: <87egix96hu.fsf@blackbird.zamazal.org> MIME-Version: 1.0 Content-Type: text/plain 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-Received-From: 2001:4830:134:3::11 X-Spam-Score: -4.1 (----) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -4.1 (----) `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)) From unknown Sun Jun 22 08:08:36 2025 X-Loop: help-debbugs@gnu.org Subject: bug#21304: 24.5; follow-switch-to-buffer changes positions Resent-From: martin rudalics Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 10 Oct 2017 09:16:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 21304 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Milan Zamazal , 21304@debbugs.gnu.org Received: via spool by 21304-submit@debbugs.gnu.org id=B21304.15076269376433 (code B ref 21304); Tue, 10 Oct 2017 09:16:01 +0000 Received: (at 21304) by debbugs.gnu.org; 10 Oct 2017 09:15:37 +0000 Received: from localhost ([127.0.0.1]:59201 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1e1qdV-0001fh-Cr for submit@debbugs.gnu.org; Tue, 10 Oct 2017 05:15:37 -0400 Received: from mout.gmx.net ([212.227.15.19]:54424) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1e1qdU-0001fO-3g for 21304@debbugs.gnu.org; Tue, 10 Oct 2017 05:15:36 -0400 Received: from [192.168.1.100] ([46.125.249.32]) by mail.gmx.com (mrgmx001 [212.227.17.190]) with ESMTPSA (Nemesis) id 0MBmvH-1eAOoA0l9z-00AqBl; Tue, 10 Oct 2017 11:15:29 +0200 Message-ID: <59DC8FA6.6090506@gmx.at> Date: Tue, 10 Oct 2017 11:15:18 +0200 From: martin rudalics MIME-Version: 1.0 References: <87egix96hu.fsf@blackbird.zamazal.org> In-Reply-To: <87egix96hu.fsf@blackbird.zamazal.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Provags-ID: V03:K0:495DE0amNQlBb+4vXT4LjmgLmGdBlCH72XwPBCDDvOz+xFtxp9R +t3C3+nKcxm++/2sV7aZ1vwRmisreNvJxXlQYI9RA8J8IfiXN0tCA0AGfIplQJRMnXjUU57 pS/aTKDN5xHHzwW5ynRitaIf1mdCDnRR6uyg9SJIxkh8PGD8oyJjYd1+Gf8nXZZ9jX5oBYx RqasbuD8NQYWgcbBtsv8A== X-UI-Out-Filterresults: notjunk:1;V01:K0:uwMokY+yo64=:0SEW5aVTEbfCEhsCLGbfJM Nod6x2NQ6olglDFjMM4XW1vvZD27B42CUYzuZXvaf0uhhEuLXculTHYiOl02q8fzlrnhpAi3F hhdY9p/WlkT5LqOgfHBUkccWzHMe64IzbAwMeNTS91eL38ftHWAT/Qfw1Dldd+7STkIil3697 EibCaAjsf95aAKZUm6rGfUwof4BMDMRJTBnIEb5XGB9Zq49cryOwlAOByk1xZmyNKm0Hd3u2o symPpgRihbxTXeSKJW0Xvq5N5/7fWUgO+U3b1dDrp3b5O5+srEgz5OguYTLlVu/wPn5wUxF2s Bf0zIDGcZiduXqIbvNKIefmbobIjKjjIsebjT7d9/GufZamIfJDLrgq0WwsUtk7reIdC/UGTt ifajYsKcm4A8VCHKlleRLGL3uscyHd4SJqV+ocoLpe77QjsBe+gQJFibkDc+W42VyNtN1BT33 EO5ZACADN/kFF6J6iLO7yj+G+wfN+aNEQDV+iyMQ1X3kEmtK8MaeHyiFyI4GiN8BJcXPAhSnU 1tmcxuxEWKo+S4oK4jVXX45ZOgjq8aDE+zz75MlMeMDi4AxFy9hkPRi19sgAwn9p9e5S+4RXD yuENBKpuekJhS2V/sdFeKedvEttVmtYJCJuUVTEAktEOSQOG0w+zhMc0kZvcZ3iNgeEAg6Qep DZ2mhTcXVmLY6nyDV1wGJ8GHfLoG7c3m0BFj1RA+Q35Qb6qY8s0jYdWc0XOhRPc3FuCPLabpE P1vnGVj7y6yhZovejaJJOdHdPObC2neoMSJVbxuMWO7JmzC3PF8LDN7t0HCaWpKqakexWpaLQ 0QFjHDTa0PcefMCVRlGyKxpMRv+EpQ1pEiH1puHSe/F14HfwlY= X-Spam-Score: -3.0 (---) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.0 (---) > `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 see the behavior you describe with Emacs 25 but do not see it with the upcoming release version. Can you try with Emacs 26? Thanks, martin From unknown Sun Jun 22 08:08:36 2025 MIME-Version: 1.0 X-Mailer: MIME-tools 5.505 (Entity 5.505) X-Loop: help-debbugs@gnu.org From: help-debbugs@gnu.org (GNU bug Tracking System) To: Milan Zamazal Subject: bug#21304: closed (Re: bug#21304: 24.5; follow-switch-to-buffer changes positions) Message-ID: References: <87egix96hu.fsf@blackbird.zamazal.org> X-Gnu-PR-Message: they-closed 21304 X-Gnu-PR-Package: emacs Reply-To: 21304@debbugs.gnu.org Date: Sun, 29 Sep 2019 22:30:02 +0000 Content-Type: multipart/mixed; boundary="----------=_1569796202-2906-1" This is a multi-part message in MIME format... ------------=_1569796202-2906-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Your bug report #21304: 24.5; follow-switch-to-buffer changes positions which was filed against the emacs package, has been closed. The explanation is attached below, along with your original report. If you require more details, please reply to 21304@debbugs.gnu.org. --=20 21304: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D21304 GNU Bug Tracking System Contact help-debbugs@gnu.org with problems ------------=_1569796202-2906-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at 21304-done) by debbugs.gnu.org; 29 Sep 2019 22:29:47 +0000 Received: from localhost ([127.0.0.1]:56033 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1iEhhK-0000k0-LI for submit@debbugs.gnu.org; Sun, 29 Sep 2019 18:29:46 -0400 Received: from mail-pl1-f174.google.com ([209.85.214.174]:44097) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1iEhhI-0000jh-V7 for 21304-done@debbugs.gnu.org; Sun, 29 Sep 2019 18:29:45 -0400 Received: by mail-pl1-f174.google.com with SMTP id q15so3104761pll.11 for <21304-done@debbugs.gnu.org>; Sun, 29 Sep 2019 15:29:44 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:from:date:message-id:subject:to:cc; bh=UbASVMlIcwDQWnLxC/+qmtAtlULV7U924z2YRDJ0x5k=; b=PQRUuxQjPdIaSfJXnSN29tjYRSsS18uLPPekzi0+NkgvqqoyQCjk/B2kk+ugbAM0aC MMNofxSStORoiswyEYhmQZSluY4Ywd+Xjq1NdWxDzwpbO/1U4791obWQjEWmVMCaQr4X wF9T7a0GbaqtgygZRzSO+QeUo/9aAk/KCjPSXdO9kpobwFfZlvM4lMGZas5Eib3ClMSg 5sbnjSBH/Sosb8ba5QnsQfInm60rHsxYBuguyD14PpqQ1GuXCF3mZZ/jPhtlF+J9GOHf 8IDQgHp3Z9BW3F2KB3IHSGCA3QLMP/bkkgmaZ7OcvXdY5MW0et/2dGrDyRsq+vWPjDm8 72sQ== X-Gm-Message-State: APjAAAVDAgmUNkOY5eJHgK90x83arQ4LjnvFu/mFXhinHLyhabvl9EsB NeQBMmI0o54+hkYq44h0puCK9+l8pqplN7ymvhg= X-Google-Smtp-Source: APXvYqwNvSplDBuc4H5W5BsTPsddNpz+OuHV0dB/ZvH56Tz9QkQ9LIRpeVl4YTpmwSjY1wWHlkZZrEGrFBEXjjMY30Y= X-Received: by 2002:a17:902:326:: with SMTP id 35mr17484827pld.128.1569796179103; Sun, 29 Sep 2019 15:29:39 -0700 (PDT) MIME-Version: 1.0 From: Stefan Kangas Date: Mon, 30 Sep 2019 00:29:28 +0200 Message-ID: Subject: Re: bug#21304: 24.5; follow-switch-to-buffer changes positions To: martin rudalics Content-Type: text/plain; charset="UTF-8" X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 21304-done Cc: Milan Zamazal , 21304-done@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) martin rudalics writes: >> `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 see the behavior you describe with Emacs 25 but do not see it with the > upcoming release version. Can you try with Emacs 26? More information was requested, but none was given within 2 years. The last person to write in the thread cannot reproduce this bug. I'm therefore going to assume that this has been fixed, and close this bug report. If this is still an issue in Emacs 26 or later, please reopen the bug. Best regards, Stefan Kangas ------------=_1569796202-2906-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at submit) by debbugs.gnu.org; 20 Aug 2015 21:11:48 +0000 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 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 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 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=0.8 required=5.0 tests=BAYES_50 autolearn=disabled version=3.3.2 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 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 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 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 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 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 From: Milan Zamazal To: bug-gnu-emacs@gnu.org Subject: 24.5; follow-switch-to-buffer changes positions Date: Thu, 20 Aug 2015 20:09:33 +0200 Message-ID: <87egix96hu.fsf@blackbird.zamazal.org> MIME-Version: 1.0 Content-Type: text/plain 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-Received-From: 2001:4830:134:3::11 X-Spam-Score: -4.1 (----) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -4.1 (----) `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)) ------------=_1569796202-2906-1--