diff options
| author | Eli Zaretskii | 2024-05-25 10:33:07 +0300 |
|---|---|---|
| committer | Eli Zaretskii | 2024-05-25 10:33:07 +0300 |
| commit | 5f3f461cd0c76b1b171bb9eda3db1f561bc22b80 (patch) | |
| tree | 2b0f997ec47d2bee815c2209ee175e600a9638f0 | |
| parent | d50e3226b1a6234830e7946518f31c99669915cb (diff) | |
| download | emacs-5f3f461cd0c76b1b171bb9eda3db1f561bc22b80.tar.gz emacs-5f3f461cd0c76b1b171bb9eda3db1f561bc22b80.zip | |
Avoid rare errors in dabbrev.el
* lisp/dabbrev.el (dabbrev-expand, dabbrev--find-expansion): Make
sure 'dabbrev--last-buffer' is a live buffer before using its
value. (Bug#70824)
| -rw-r--r-- | lisp/dabbrev.el | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/lisp/dabbrev.el b/lisp/dabbrev.el index 853c0f4b290..7b6cbb78cef 100644 --- a/lisp/dabbrev.el +++ b/lisp/dabbrev.el | |||
| @@ -495,7 +495,7 @@ See also `dabbrev-abbrev-char-regexp' and \\[dabbrev-completion]." | |||
| 495 | (save-excursion | 495 | (save-excursion |
| 496 | (save-restriction | 496 | (save-restriction |
| 497 | (widen) | 497 | (widen) |
| 498 | (if dabbrev--last-buffer | 498 | (if (buffer-live-p dabbrev--last-buffer) |
| 499 | (set-buffer dabbrev--last-buffer)) | 499 | (set-buffer dabbrev--last-buffer)) |
| 500 | ;; Find the end of the last "expansion" word. | 500 | ;; Find the end of the last "expansion" word. |
| 501 | (if (or (eq dabbrev--last-direction 1) | 501 | (if (or (eq dabbrev--last-direction 1) |
| @@ -557,7 +557,8 @@ See also `dabbrev-abbrev-char-regexp' and \\[dabbrev-completion]." | |||
| 557 | (setq dabbrev--last-buffer-found dabbrev--last-buffer)) | 557 | (setq dabbrev--last-buffer-found dabbrev--last-buffer)) |
| 558 | (message nil)) | 558 | (message nil)) |
| 559 | (if (and (or (eq (current-buffer) dabbrev--last-buffer) | 559 | (if (and (or (eq (current-buffer) dabbrev--last-buffer) |
| 560 | (null dabbrev--last-buffer)) | 560 | (null dabbrev--last-buffer) |
| 561 | (buffer-live-p dabbrev--last-buffer)) | ||
| 561 | (numberp dabbrev--last-expansion-location) | 562 | (numberp dabbrev--last-expansion-location) |
| 562 | (and (> dabbrev--last-expansion-location (point)))) | 563 | (and (> dabbrev--last-expansion-location (point)))) |
| 563 | (setq dabbrev--last-expansion-location | 564 | (setq dabbrev--last-expansion-location |
| @@ -731,7 +732,7 @@ of the start of the occurrence." | |||
| 731 | (save-excursion | 732 | (save-excursion |
| 732 | ;; If we were scanning something other than the current buffer, | 733 | ;; If we were scanning something other than the current buffer, |
| 733 | ;; continue scanning there. | 734 | ;; continue scanning there. |
| 734 | (when dabbrev--last-buffer | 735 | (when (buffer-live-p dabbrev--last-buffer) |
| 735 | (set-buffer dabbrev--last-buffer)) | 736 | (set-buffer dabbrev--last-buffer)) |
| 736 | (or | 737 | (or |
| 737 | ;; ------------------------------------------ | 738 | ;; ------------------------------------------ |
| @@ -748,7 +749,7 @@ of the start of the occurrence." | |||
| 748 | ;; or whatever buffer we were last scanning. | 749 | ;; or whatever buffer we were last scanning. |
| 749 | ;; ------------------------------------------ | 750 | ;; ------------------------------------------ |
| 750 | (and (or (not dabbrev-search-these-buffers-only) | 751 | (and (or (not dabbrev-search-these-buffers-only) |
| 751 | dabbrev--last-buffer) | 752 | (buffer-live-p dabbrev--last-buffer)) |
| 752 | (<= direction 0) | 753 | (<= direction 0) |
| 753 | (setq dabbrev--last-direction -1) | 754 | (setq dabbrev--last-direction -1) |
| 754 | (dabbrev--try-find abbrev nil | 755 | (dabbrev--try-find abbrev nil |
| @@ -760,7 +761,7 @@ of the start of the occurrence." | |||
| 760 | ;; ------------------------------------------ | 761 | ;; ------------------------------------------ |
| 761 | (progn | 762 | (progn |
| 762 | (setq dabbrev--last-direction -1) | 763 | (setq dabbrev--last-direction -1) |
| 763 | (unless dabbrev--last-buffer | 764 | (unless (buffer-live-p dabbrev--last-buffer) |
| 764 | ;; If we have just now begun to search other buffers, | 765 | ;; If we have just now begun to search other buffers, |
| 765 | ;; determine which other buffers we should check. | 766 | ;; determine which other buffers we should check. |
| 766 | ;; Put that list in dabbrev--friend-buffer-list. | 767 | ;; Put that list in dabbrev--friend-buffer-list. |