mirror of https://github.com/djcb/mu.git
mu4e-window: add mu4e--buffer-local-boundp
buffer-local-boundp was introduced in emacs 28. Fixes #2456.
This commit is contained in:
parent
d96a3c946c
commit
eedc4d34e1
|
@ -172,6 +172,17 @@ Checks are performed using `derived-mode-p' and the current
|
|||
buffer's major mode."
|
||||
(eq (mu4e--get-current-buffer-type) type))
|
||||
|
||||
|
||||
;; backward-compat; buffer-local-boundp was introduced in emacs 28.
|
||||
(defun mu4e--buffer-local-boundp (symbol buffer)
|
||||
"Return non-nil if SYMBOL is bound in BUFFER.
|
||||
Also see `local-variable-p'."
|
||||
(condition-case nil
|
||||
(buffer-local-value symbol buffer)
|
||||
(:success t)
|
||||
(void-variable nil)))
|
||||
|
||||
|
||||
(defun mu4e-get-view-buffer (&optional headers-buffer create)
|
||||
"Return a view buffer belonging optionally to HEADERS-BUFFER.
|
||||
|
||||
|
@ -197,8 +208,9 @@ being created if CREATE is non-nil."
|
|||
;; Search all view buffers and return those that are linked to
|
||||
;; `headers-buffer'.
|
||||
(linked-buffer (mu4e-get-view-buffers
|
||||
(lambda (buf) (and (buffer-local-boundp 'mu4e-linked-headers-buffer buf)
|
||||
(eq mu4e-linked-headers-buffer headers-buffer))))))
|
||||
(lambda (buf)
|
||||
(and (mu4e--buffer-local-boundp 'mu4e-linked-headers-buffer buf)
|
||||
(eq mu4e-linked-headers-buffer headers-buffer))))))
|
||||
;; If such a linked buffer exists and its buffer is live, we use that buffer.
|
||||
(if (and linked-buffer (buffer-live-p (car linked-buffer)))
|
||||
;; NOTE: It's possible for there to be more than one linked view buffer.
|
||||
|
|
Loading…
Reference in New Issue