1
0
mirror of https://git.savannah.gnu.org/git/emacs.git synced 2024-11-25 07:28:20 +00:00

Give better error message in dired-toggle-read-only on nonexisting dirs

* lisp/dired.el (dired-toggle-read-only): Refuse to edit
non-existent directories (bug#23276).
This commit is contained in:
Lars Ingebrigtsen 2022-04-27 16:09:38 +02:00
parent 0beb8fd663
commit 82fa112e8a

View File

@ -2533,6 +2533,8 @@ If the current buffer can be edited with Wdired, (i.e. the major
mode is `dired-mode'), call `wdired-change-to-wdired-mode'.
Otherwise, toggle `read-only-mode'."
(interactive)
(unless (file-exists-p default-directory)
(user-error "The current directory no longer exists"))
(when (and (not (file-writable-p default-directory))
(not (y-or-n-p
"Directory isn't writable; edit anyway? ")))