Fix issue with ~dirvish-ignore-display-buffer~

When ~dirvish-ignore-display-buffer~ was called with a buffer name which does not exists (why?) it would throw an
error. This broke ~lv-message~ among other things.

Signed-off-by: Magic_RB <magic_rb@redalder.org>
This commit is contained in:
Magic_RB 2023-09-16 20:11:39 +02:00
parent ed8afe1e86
commit 56e3bafd57
No known key found for this signature in database
GPG key ID: 08D5287CC5DDCA0E

View file

@ -99,11 +99,12 @@ Dirvish has an issue with ~switch-to-buffer-obey-display-actions~, so advise ~sw
#+begin_src emacs-lisp :tangle no #+begin_src emacs-lisp :tangle no
(defun dirvish-side-buffer-p (buffer-or-name) (defun dirvish-side-buffer-p (buffer-or-name)
"Return t if BUFFER-OR-NAME is a dirvish buffer and a side buffer." "Return t if BUFFER-OR-NAME is a dirvish buffer and a side buffer."
(with-current-buffer buffer-or-name (when (get-buffer buffer-or-name)
(let ((dv (dirvish-curr))) (with-current-buffer buffer-or-name
(let ((dv (dirvish-curr)))
(if (and dv (member 'side (dv-type dv))) (if (and dv (member 'side (dv-type dv)))
t t
nil)))) nil)))))
(defun dirvish-ignore-display-buffer (original-function buffer-or-name &rest original-arguments) (defun dirvish-ignore-display-buffer (original-function buffer-or-name &rest original-arguments)
(let ((switch-to-buffer-obey-display-actions (not (dirvish-side-buffer-p buffer-or-name)))) (let ((switch-to-buffer-obey-display-actions (not (dirvish-side-buffer-p buffer-or-name))))