mirror of
https://github.com/doomemacs/doomemacs
synced 2025-08-01 12:17:25 -05:00
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:
@ -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))
|
||||
|
Reference in New Issue
Block a user