From: Lars Ingebrigtsen Date: Sun, 13 Dec 2020 13:17:55 +0000 (+0100) Subject: Make dired-toggle-read-only query on read-only directories X-Git-Tag: emacs-28.0.90~4734 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=f7133be7ae4eda5b3688728f19cac39de7e862a3;p=emacs.git Make dired-toggle-read-only query on read-only directories * lisp/dired.el (dired-toggle-read-only): Query instead of erroring out immediately (bug#29412). --- diff --git a/lisp/dired.el b/lisp/dired.el index baf99da7b48..c68c4a52bd4 100644 --- a/lisp/dired.el +++ b/lisp/dired.el @@ -2419,8 +2419,10 @@ 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-writable-p default-directory) - (user-error "Directory %s isn't writeable" default-directory)) + (when (and (not (file-writable-p default-directory)) + (not (y-or-n-p + "Directory isn't writable; edit anyway? "))) + (user-error "Directory %s isn't writable" default-directory)) (if (derived-mode-p 'dired-mode) (wdired-change-to-wdired-mode) (read-only-mode 'toggle)))