diff options
| author | Sean Whitton | 2025-12-31 18:10:48 +0000 |
|---|---|---|
| committer | Sean Whitton | 2025-12-31 18:10:48 +0000 |
| commit | a03419b52c9b87ac2e9fea1d0ccf584ae77debe8 (patch) | |
| tree | 3f830fd188b8add869da3d38ca482ea7e7983f32 | |
| parent | 466627ffebf05173b1aba18b185aaed85e39ab20 (diff) | |
| download | emacs-a03419b52c9b87ac2e9fea1d0ccf584ae77debe8.tar.gz emacs-a03419b52c9b87ac2e9fea1d0ccf584ae77debe8.zip | |
Factor out undo-ignore-read-only (bug#80049)
* lisp/vc/diff-mode.el (diff-undo): Rename to
undo-ignore-read-only.
(diff-mode-shared-map): Update "<remap> <undo>" binding.
* lisp/simple.el (undo-ignore-read-only): Rename from diff-undo.
* lisp/dired.el (dired-undo):
* lisp/proced.el (proced-undo): Call it. New numeric prefix
argument to specify a repeat count.
* doc/emacs/dired.texi (Marks vs Flags):
* etc/NEWS: Document the change.
| -rw-r--r-- | doc/emacs/dired.texi | 3 | ||||
| -rw-r--r-- | etc/NEWS | 8 | ||||
| -rw-r--r-- | lisp/dired.el | 8 | ||||
| -rw-r--r-- | lisp/proced.el | 8 | ||||
| -rw-r--r-- | lisp/simple.el | 7 | ||||
| -rw-r--r-- | lisp/vc/diff-mode.el | 8 |
6 files changed, 26 insertions, 16 deletions
diff --git a/doc/emacs/dired.texi b/doc/emacs/dired.texi index 599c0308cec..a70a0444d12 100644 --- a/doc/emacs/dired.texi +++ b/doc/emacs/dired.texi | |||
| @@ -733,7 +733,8 @@ Auto-Revert mode, you might want to set | |||
| 733 | Undo changes in the Dired buffer, such as adding or removing | 733 | Undo changes in the Dired buffer, such as adding or removing |
| 734 | marks (@code{dired-undo}). @emph{This command does not revert the | 734 | marks (@code{dired-undo}). @emph{This command does not revert the |
| 735 | actual file operations, nor recover lost files!} It just undoes | 735 | actual file operations, nor recover lost files!} It just undoes |
| 736 | changes in the buffer itself. | 736 | changes in the buffer itself. Like with @code{undo}, a numeric prefix |
| 737 | argument specifies a repeat count. | ||
| 737 | 738 | ||
| 738 | In some cases, using this after commands that operate on files can | 739 | In some cases, using this after commands that operate on files can |
| 739 | cause trouble. For example, after renaming one or more files, | 740 | cause trouble. For example, after renaming one or more files, |
| @@ -888,6 +888,14 @@ failed. | |||
| 888 | You can now use 'C-u C-x .' to clear the fill prefix, similarly to how | 888 | You can now use 'C-u C-x .' to clear the fill prefix, similarly to how |
| 889 | you could already use 'C-u C-x C-n' to clear the goal column. | 889 | you could already use 'C-u C-x C-n' to clear the goal column. |
| 890 | 890 | ||
| 891 | +++ | ||
| 892 | ** New prefix argument for 'C-/' in Dired and Proced modes. | ||
| 893 | The Dired and Proced major modes bind mode-specific undo commands to the | ||
| 894 | same keys to which 'undo' is globally bound, 'C-/', 'C-_' and 'C-x u'. | ||
| 895 | These commands did not previously accept a prefix argument. | ||
| 896 | Now a numeric prefix argument specifies a repeat count, just like it | ||
| 897 | already did for 'undo'. | ||
| 898 | |||
| 891 | 899 | ||
| 892 | * Changes in Specialized Modes and Packages in Emacs 31.1 | 900 | * Changes in Specialized Modes and Packages in Emacs 31.1 |
| 893 | 901 | ||
diff --git a/lisp/dired.el b/lisp/dired.el index 2a8b23b69b6..450b408975e 100644 --- a/lisp/dired.el +++ b/lisp/dired.el | |||
| @@ -2893,13 +2893,13 @@ Keybindings: | |||
| 2893 | (concat "\\`d'-elete, \\`u'-ndelete, \\`x'-punge, \\`f'-ind, " | 2893 | (concat "\\`d'-elete, \\`u'-ndelete, \\`x'-punge, \\`f'-ind, " |
| 2894 | "\\`o'-ther window, \\`R'-ename, \\`C'-opy, \\`h'-elp")))) | 2894 | "\\`o'-ther window, \\`R'-ename, \\`C'-opy, \\`h'-elp")))) |
| 2895 | 2895 | ||
| 2896 | (defun dired-undo () | 2896 | (defun dired-undo (&optional arg) |
| 2897 | "Undo in a Dired buffer. | 2897 | "Undo in a Dired buffer. |
| 2898 | A numeric ARG serves as a repeat count. | ||
| 2898 | This doesn't recover lost files, it just undoes changes in the buffer itself. | 2899 | This doesn't recover lost files, it just undoes changes in the buffer itself. |
| 2899 | You can use it to recover marks, killed lines or subdirs." | 2900 | You can use it to recover marks, killed lines or subdirs." |
| 2900 | (interactive nil dired-mode) | 2901 | (interactive "P" dired-mode) |
| 2901 | (let ((inhibit-read-only t)) | 2902 | (undo-ignore-read-only arg) |
| 2902 | (undo)) | ||
| 2903 | (dired-build-subdir-alist) | 2903 | (dired-build-subdir-alist) |
| 2904 | (message "Change in Dired buffer undone. | 2904 | (message "Change in Dired buffer undone. |
| 2905 | Actual changes in files cannot be undone by Emacs.")) | 2905 | Actual changes in files cannot be undone by Emacs.")) |
diff --git a/lisp/proced.el b/lisp/proced.el index ca2fa694665..90b4e1445ce 100644 --- a/lisp/proced.el +++ b/lisp/proced.el | |||
| @@ -2311,13 +2311,13 @@ STRING is an overall summary of the failures." | |||
| 2311 | (describe-mode) | 2311 | (describe-mode) |
| 2312 | (message (substitute-command-keys proced-help-string)))) | 2312 | (message (substitute-command-keys proced-help-string)))) |
| 2313 | 2313 | ||
| 2314 | (defun proced-undo () | 2314 | (defun proced-undo (&optional arg) |
| 2315 | "Undo in a Proced buffer. | 2315 | "Undo in a Proced buffer. |
| 2316 | A numeric ARG serves as a repeat count. | ||
| 2316 | This doesn't recover killed processes, it just undoes changes in the Proced | 2317 | This doesn't recover killed processes, it just undoes changes in the Proced |
| 2317 | buffer. You can use it to recover marks." | 2318 | buffer. You can use it to recover marks." |
| 2318 | (interactive nil proced-mode) | 2319 | (interactive "P" proced-mode) |
| 2319 | (let (buffer-read-only) | 2320 | (undo-ignore-read-only arg) |
| 2320 | (undo)) | ||
| 2321 | (message "Change in Proced buffer undone. | 2321 | (message "Change in Proced buffer undone. |
| 2322 | Killed processes cannot be recovered by Emacs.")) | 2322 | Killed processes cannot be recovered by Emacs.")) |
| 2323 | 2323 | ||
diff --git a/lisp/simple.el b/lisp/simple.el index 63c2a665b64..2f9d24812a9 100644 --- a/lisp/simple.el +++ b/lisp/simple.el | |||
| @@ -3577,6 +3577,13 @@ as an argument limits undo to changes within the current region." | |||
| 3577 | (if message | 3577 | (if message |
| 3578 | (message "%s" message)))) | 3578 | (message "%s" message)))) |
| 3579 | 3579 | ||
| 3580 | (defun undo-ignore-read-only (&optional arg) | ||
| 3581 | "Perform `undo', ignoring the buffer's read-only status. | ||
| 3582 | A numeric ARG serves as a repeat count." | ||
| 3583 | (interactive "P") | ||
| 3584 | (let ((inhibit-read-only t)) | ||
| 3585 | (undo arg))) | ||
| 3586 | |||
| 3580 | (defun buffer-disable-undo (&optional buffer) | 3587 | (defun buffer-disable-undo (&optional buffer) |
| 3581 | "Make BUFFER stop keeping undo information. | 3588 | "Make BUFFER stop keeping undo information. |
| 3582 | No argument or nil as argument means do this for the current buffer." | 3589 | No argument or nil as argument means do this for the current buffer." |
diff --git a/lisp/vc/diff-mode.el b/lisp/vc/diff-mode.el index 5e219bd1d68..bc05ce2c7fc 100644 --- a/lisp/vc/diff-mode.el +++ b/lisp/vc/diff-mode.el | |||
| @@ -217,7 +217,7 @@ See also `diff-mode-read-only-map'." | |||
| 217 | "RET" #'diff-goto-source | 217 | "RET" #'diff-goto-source |
| 218 | "<mouse-2>" #'diff-goto-source | 218 | "<mouse-2>" #'diff-goto-source |
| 219 | "o" #'diff-goto-source ; other-window | 219 | "o" #'diff-goto-source ; other-window |
| 220 | "<remap> <undo>" #'diff-undo | 220 | "<remap> <undo>" #'undo-ignore-read-only |
| 221 | 221 | ||
| 222 | ;; The foregoing commands don't affect buffers beyond this one. | 222 | ;; The foregoing commands don't affect buffers beyond this one. |
| 223 | ;; The following command is the only one that has a single-letter | 223 | ;; The following command is the only one that has a single-letter |
| @@ -2815,12 +2815,6 @@ Call FUN with two args (BEG and END) for each hunk." | |||
| 2815 | (defun diff--overlay-auto-delete (ol _after _beg _end &optional _len) | 2815 | (defun diff--overlay-auto-delete (ol _after _beg _end &optional _len) |
| 2816 | (delete-overlay ol)) | 2816 | (delete-overlay ol)) |
| 2817 | 2817 | ||
| 2818 | (defun diff-undo (&optional arg) | ||
| 2819 | "Perform `undo', ignoring the buffer's read-only status." | ||
| 2820 | (interactive "P") | ||
| 2821 | (let ((inhibit-read-only t)) | ||
| 2822 | (undo arg))) | ||
| 2823 | |||
| 2824 | ;;;###autoload | 2818 | ;;;###autoload |
| 2825 | (defcustom diff-add-log-use-relative-names nil | 2819 | (defcustom diff-add-log-use-relative-names nil |
| 2826 | "Use relative file names when generating ChangeLog skeletons. | 2820 | "Use relative file names when generating ChangeLog skeletons. |