unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Stefan Monnier <monnier@iro.umontreal.ca>
To: Markus Triska <markus.triska@gmx.at>
Cc: 1237@emacsbugs.donarmstrong.com
Subject: bug#1237: 23.0.60; `switch-to-buffer-other-window' sometimes uses selected window
Date: Sat, 25 Oct 2008 15:08:10 -0400	[thread overview]
Message-ID: <jwvabcsfqo6.fsf-monnier+emacsbugreports@gnu.org> (raw)
In-Reply-To: <m1bpxaroch.fsf@gmx.at> (Markus Triska's message of "Fri, 24 Oct 2008 17:42:54 +0200")

> I constructed the following self-contained case that I hope helps you:

>    (defun my-walk () (walk-windows 'identity))
>    (add-hook 'window-configuration-change-hook 'my-walk nil t)
>    (split-window)
>    (switch-to-buffer-other-window "test")

In Emacs-22, window-configuration-change-hook did not work correctly
with buffer-local hooks, but in some cases you could make it work
somewhat by using `walk-window' in your hook to try and cover all the
affected windows.

With the code I installed to properly support buffer-local hooks on
window-configuration-change-hook, the walk-window should be unnecessary,
so the patch below should not break linum and might remove the problem.

This said, walk-windows should probably use `norecord', what do
people think?


        Stefan


=== modified file 'lisp/linum.el'
--- lisp/linum.el	2008-08-31 19:46:54 +0000
+++ lisp/linum.el	2008-10-25 19:06:30 +0000
@@ -82,17 +82,22 @@
                                            'linum-update-current) nil t)
           (add-hook 'after-change-functions 'linum-after-change nil t))
         (add-hook 'window-scroll-functions 'linum-after-scroll nil t)
+        ;; FIXME: using both window-size-change-functions and
+        ;; window-configuration-change-hook seems redundant.
         (add-hook 'window-size-change-functions 'linum-after-size nil t)
         (add-hook 'change-major-mode-hook 'linum-delete-overlays nil t)
         (add-hook 'window-configuration-change-hook
-                  'linum-after-config nil t)
+                  ;; FIXME: If the buffer is shows in N windows, this
+                  ;; will be called N times rather than once.  We should use
+                  ;; something like linum-update-window instead.
+                  'linum-update-current nil t)
         (linum-update-current))
     (remove-hook 'post-command-hook 'linum-update-current t)
     (remove-hook 'post-command-hook 'linum-schedule t)
     (remove-hook 'window-size-change-functions 'linum-after-size t)
     (remove-hook 'window-scroll-functions 'linum-after-scroll t)
     (remove-hook 'after-change-functions 'linum-after-change t)
-    (remove-hook 'window-configuration-change-hook 'linum-after-config t)
+    (remove-hook 'window-configuration-change-hook 'linum-update-current t)
     (remove-hook 'change-major-mode-hook 'linum-delete-overlays t)
     (linum-delete-overlays)))
 







  parent reply	other threads:[~2008-10-25 19:08 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <490D8B7D.3020008@gmx.at>
2008-10-24 10:27 ` bug#1237: 23.0.60; `switch-to-buffer-other-window' sometimes uses selected window Markus Triska
2008-10-24 12:28   ` martin rudalics
2008-10-24 14:06     ` Markus Triska
2008-10-24 14:45       ` martin rudalics
2008-10-24 15:42         ` Markus Triska
2008-10-24 17:37           ` martin rudalics
2008-10-25 13:28             ` martin rudalics
2008-10-25 16:09               ` Markus Triska
2008-10-25 17:00                 ` martin rudalics
2008-10-25 19:08           ` Stefan Monnier [this message]
     [not found]           ` <mailman.2085.1224963020.25473.bug-gnu-emacs@gnu.org>
2008-10-29 13:25             ` Markus Triska
2008-10-29 22:15               ` Lennart Borgman
2008-11-01 18:06                 ` martin rudalics
2008-11-02  2:16                   ` Stefan Monnier
2008-11-02 23:19                     ` Richard M. Stallman
2008-11-03  7:17                       ` martin rudalics
2008-11-03 19:40                         ` Richard M. Stallman
2008-11-03 20:49                           ` Stefan Monnier
2008-11-04  7:35                             ` martin rudalics
2008-11-02 11:25   ` bug#1237: marked as done (23.0.60; `switch-to-buffer-other-window' sometimes uses selected window) Emacs bug Tracking System

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

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=jwvabcsfqo6.fsf-monnier+emacsbugreports@gnu.org \
    --to=monnier@iro.umontreal.ca \
    --cc=1237@emacsbugs.donarmstrong.com \
    --cc=markus.triska@gmx.at \
    /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 public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).