do not filter for alternating buffers

This commit is contained in:
deb0ch 2017-03-15 17:25:02 +01:00 committed by bmag
parent 7b707537a1
commit 8226f0070f
3 changed files with 6 additions and 20 deletions

View file

@ -306,19 +306,13 @@ buffer."
"Switch back and forth between current and last buffer in the "Switch back and forth between current and last buffer in the
current window." current window."
(interactive) (interactive)
(let ((current-buffer (window-buffer window)) (let ((current-buffer (window-buffer window)))
(buffer-predicate ;; if no window is found in the windows history, `switch-to-buffer' will
(frame-parameter (window-frame window) 'buffer-predicate))) ;; default to calling `other-buffer'.
;; switch to first buffer previously shown in this window that matches
;; frame-parameter `buffer-predicate'
(switch-to-buffer (switch-to-buffer
(or (cl-find-if (lambda (buffer) (cl-find-if (lambda (buffer)
(and (not (eq buffer current-buffer)) (not (eq buffer current-buffer)))
(or (null buffer-predicate) (mapcar #'car (window-prev-buffers window))))))
(funcall buffer-predicate buffer))))
(mapcar #'car (window-prev-buffers window)))
;; `other-buffer' honors `buffer-predicate' so no need to filter
(other-buffer current-buffer t)))))
(defun spacemacs/alternate-window () (defun spacemacs/alternate-window ()
"Switch back and forth between current and last window in the "Switch back and forth between current and last window in the

View file

@ -46,13 +46,6 @@ Cancels autosave on exiting perspectives mode."
*persp-hash* 'non-existent)) *persp-hash* 'non-existent))
(persp-switch spacemacs--last-selected-layout))) (persp-switch spacemacs--last-selected-layout)))
(defun spacemacs/alternate-buffer-in-persp ()
"Switch back and forth between current and last buffer in the
current perspective."
(interactive)
(with-persp-buffer-list ()
(switch-to-buffer (other-buffer (current-buffer) t))))
(defun spacemacs-layouts/non-restricted-buffer-list-helm () (defun spacemacs-layouts/non-restricted-buffer-list-helm ()
(interactive) (interactive)
(let ((ido-make-buffer-list-hook (remove #'persp-restrict-ido-buffers ido-make-buffer-list-hook))) (let ((ido-make-buffer-list-hook (remove #'persp-restrict-ido-buffers ido-make-buffer-list-hook)))

View file

@ -210,7 +210,6 @@
(spacemacs/declare-prefix "B" "global-buffers") (spacemacs/declare-prefix "B" "global-buffers")
;; Override SPC TAB to only change buffers in perspective ;; Override SPC TAB to only change buffers in perspective
(spacemacs/set-leader-keys (spacemacs/set-leader-keys
"TAB" 'spacemacs/alternate-buffer-in-persp
"ba" 'persp-add-buffer "ba" 'persp-add-buffer
"br" 'persp-remove-buffer)))) "br" 'persp-remove-buffer))))