Avoid errors in 'dabbrev-expand'

* lisp/dabbrev.el (dabbrev-expand): Fix use of
'dabbrev--last-buffer-found': it could be a killed buffer.
(Bug#81452)

(cherry picked from commit 0e8fbd63e9)
This commit is contained in:
Eli Zaretskii 2026-07-24 13:54:51 +03:00
parent 7b0f33cb74
commit 99a9307235

View file

@ -601,7 +601,7 @@ See also `dabbrev-abbrev-char-regexp' and \\[dabbrev-completion]."
(message nil))
;; To get correct further expansions we have to be sure to use the
;; buffer containing the already found expansions.
(when dabbrev--last-buffer-found
(when (buffer-live-p dabbrev--last-buffer-found)
(setq buf dabbrev--last-buffer-found))
;; If the buffer where we called dabbrev-expand differs from the
;; buffer containing the expansion, make sure copy-marker is