Fix #2992: wrong-type-arg stringp on switch-to-buffer

(switch-to-buffer nil) should switch to other-buffer, as per its
documentation, which was not respected by our switch-buffer hook
mechanism.
This commit is contained in:
Henrik Lissner 2020-04-28 15:10:59 -04:00
parent d34633cb0a
commit 6e8487e1d4
No known key found for this signature in database
GPG key ID: 5F6C0EA160557395

View file

@ -105,7 +105,10 @@ size.")
(defun doom-run-switch-buffer-hooks-a (orig-fn buffer-or-name &rest args) (defun doom-run-switch-buffer-hooks-a (orig-fn buffer-or-name &rest args)
(let ((gc-cons-threshold most-positive-fixnum)) (let ((gc-cons-threshold most-positive-fixnum))
(if (or doom-inhibit-switch-buffer-hooks (if (or doom-inhibit-switch-buffer-hooks
(eq (current-buffer) (get-buffer buffer-or-name)) (eq (current-buffer)
(get-buffer (or buffer-or-name
(if (eq orig-fn #'switch-to-buffer)
(other-buffer)))))
(and (eq orig-fn #'switch-to-buffer) (car args))) (and (eq orig-fn #'switch-to-buffer) (car args)))
(apply orig-fn buffer-or-name args) (apply orig-fn buffer-or-name args)
(let ((doom-inhibit-switch-buffer-hooks t) (let ((doom-inhibit-switch-buffer-hooks t)