fix(lib): doom/delete-this-file nil path handling
Fix the handling of a nil path within doom/delete-this-file. If path is nil (e.g. called interactively when buffer is not visiting a file), avoid calling abbreviate-file-name on nil, otherwise an error will be signaled: (wrong-type-argument stringp nil) Additionally, fix the subsequent path checks. These were treating two distinct scenarios as a "Buffer is not visiting any file" user-error: - nil path - non-existent path - Only the first should result in that error. The second should proceed to the next path check (which was previously unreachable), to signal the appropriate error, "File doesn't exist: %s".
This commit is contained in:
parent
3a19152787
commit
850907ed9a
1 changed files with 2 additions and 2 deletions
|
@ -405,8 +405,8 @@ If FORCE-P, delete without confirmation."
|
|||
(list (buffer-file-name (buffer-base-buffer))
|
||||
current-prefix-arg))
|
||||
(let* ((path (or path (buffer-file-name (buffer-base-buffer))))
|
||||
(short-path (abbreviate-file-name path)))
|
||||
(unless (and path (file-exists-p path))
|
||||
(short-path (and path (abbreviate-file-name path))))
|
||||
(unless path
|
||||
(user-error "Buffer is not visiting any file"))
|
||||
(unless (file-exists-p path)
|
||||
(error "File doesn't exist: %s" path))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue