From 862382df3db08238c471025bfdd26ec33fd7a387 Mon Sep 17 00:00:00 2001 From: Martin Rudalics Date: Fri, 31 Aug 2012 18:51:49 +0200 Subject: [PATCH] Consider frame's buffer predicate in switch-to-prev-/next-buffer. * window.el (switch-to-prev-buffer, switch-to-next-buffer): Consider frame's buffer predicate when choosing the buffer. (Bug#12081) --- lisp/ChangeLog | 6 ++++++ lisp/window.el | 8 ++++++++ 2 files changed, 14 insertions(+) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 3034d7f6adf..ce4493d4c76 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,9 @@ +2012-08-31 Alp Aker + + * window.el (switch-to-prev-buffer, switch-to-next-buffer): + Consider frame's buffer predicate when choosing the buffer. + (Bug#12081) + 2012-08-30 Richard Stallman * simple.el (special-mode-map): Delete binding for `z'. diff --git a/lisp/window.el b/lisp/window.el index 8f410ea3d4d..c72093334d8 100644 --- a/lisp/window.el +++ b/lisp/window.el @@ -2979,6 +2979,7 @@ shall not be switched to in future invocations of this command." (old-buffer (window-buffer window)) ;; Save this since it's destroyed by `set-window-buffer'. (next-buffers (window-next-buffers window)) + (pred (frame-parameter frame 'buffer-predicate)) entry buffer new-buffer killed-buffers visible) (when (window-dedicated-p window) (error "Window %s is dedicated to buffer %s" window old-buffer)) @@ -2991,6 +2992,7 @@ shall not be switched to in future invocations of this command." (or (buffer-live-p buffer) (not (setq killed-buffers (cons buffer killed-buffers)))) + (or (null pred) (funcall pred buffer)) (not (eq buffer old-buffer)) (or bury-or-kill (not (memq buffer next-buffers)))) (if (and (not switch-to-visible-buffer) @@ -3013,6 +3015,7 @@ shall not be switched to in future invocations of this command." (when (and (buffer-live-p buffer) (not (eq buffer old-buffer)) (not (eq (aref (buffer-name buffer) 0) ?\s)) + (or (null pred) (funcall pred buffer)) (or bury-or-kill (not (memq buffer next-buffers)))) (if (get-buffer-window buffer frame) ;; Try to avoid showing a buffer visible in some other window. @@ -3031,6 +3034,7 @@ shall not be switched to in future invocations of this command." (not (setq killed-buffers (cons buffer killed-buffers)))) (not (eq buffer old-buffer)) + (or (null pred) (funcall pred buffer)) (setq entry (assq buffer (window-prev-buffers window)))) (setq new-buffer buffer) (set-window-buffer-start-and-point @@ -3075,6 +3079,7 @@ found." (frame (window-frame window)) (old-buffer (window-buffer window)) (next-buffers (window-next-buffers window)) + (pred (frame-parameter frame 'buffer-predicate)) buffer new-buffer entry killed-buffers visible) (when (window-dedicated-p window) (error "Window %s is dedicated to buffer %s" window old-buffer)) @@ -3086,6 +3091,7 @@ found." (not (setq killed-buffers (cons buffer killed-buffers)))) (not (eq buffer old-buffer)) + (or (null pred) (funcall pred buffer)) (setq entry (assq buffer (window-prev-buffers window)))) (setq new-buffer buffer) (set-window-buffer-start-and-point @@ -3096,6 +3102,7 @@ found." (dolist (buffer (buffer-list frame)) (when (and (buffer-live-p buffer) (not (eq buffer old-buffer)) (not (eq (aref (buffer-name buffer) 0) ?\s)) + (or (null pred) (funcall pred buffer)) (not (assq buffer (window-prev-buffers window)))) (if (get-buffer-window buffer frame) ;; Try to avoid showing a buffer visible in some other window. @@ -3110,6 +3117,7 @@ found." (or (buffer-live-p buffer) (not (setq killed-buffers (cons buffer killed-buffers)))) + (or (null pred) (funcall pred buffer)) (not (eq buffer old-buffer))) (if (and (not switch-to-visible-buffer) (get-buffer-window buffer frame)) -- 2.11.4.GIT