[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#8163: 23.2; Feature request: dabbrev look at filenames or buffer nam
From: |
Juri Linkov |
Subject: |
bug#8163: 23.2; Feature request: dabbrev look at filenames or buffer names |
Date: |
Thu, 12 May 2022 19:42:09 +0300 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (x86_64-pc-linux-gnu) |
>> Start emacs and start editing a file called abcdef:
>>
>> C-x C-f abcdef RET
>>
>> In that buffer type abcde and then press M-/ to run dabbrev-expand.
>>
>> Desired result: dabbrev looks at the buffer name (or the name of the
>> file it is visiting) and uses that to complete the string to 'abcdef'.
>> It could use the names of all open buffers as part of its pool.
>
> Makes sense to me. I've now added this to Emacs 29.
Now dabbrev fails with:
Debugger entered--Lisp error: (error "Selecting deleted buffer")
dabbrev--find-expansion("dabbr" -1 t)
dabbrev-expand(nil)
funcall-interactively(dabbrev-expand nil)
command-execute(dabbrev-expand)
because dabbrev--last-buffer is a killed buffer in dabbrev--find-expansion:
(setq dabbrev--last-buffer
(pop dabbrev--friend-buffer-list))
(set-buffer dabbrev--last-buffer)
I don't see how can it not fail when the temporary buffer
"*abbrev-file*" gets added to dabbrev--friend-buffer-list:
(setq dabbrev--friend-buffer-list
(append dabbrev--friend-buffer-list
(list file-name-buffer))))
and then gets deleted afterwards:
(when (buffer-live-p file-name-buffer)
(kill-buffer file-name-buffer))))))))
So dabbrev--friend-buffer-list always contains '(... #<killed buffer>)
at the end, and at the next call to dabbrev--last-buffer causes the error.