mirror of
git://git.sv.gnu.org/emacs.git
synced 2026-02-16 17:24:23 +00:00
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.
This commit is contained in:
parent
466627ffeb
commit
a03419b52c
6 changed files with 26 additions and 16 deletions
|
|
@ -733,7 +733,8 @@ Auto-Revert mode, you might want to set
|
|||
Undo changes in the Dired buffer, such as adding or removing
|
||||
marks (@code{dired-undo}). @emph{This command does not revert the
|
||||
actual file operations, nor recover lost files!} It just undoes
|
||||
changes in the buffer itself.
|
||||
changes in the buffer itself. Like with @code{undo}, a numeric prefix
|
||||
argument specifies a repeat count.
|
||||
|
||||
In some cases, using this after commands that operate on files can
|
||||
cause trouble. For example, after renaming one or more files,
|
||||
|
|
|
|||
8
etc/NEWS
8
etc/NEWS
|
|
@ -888,6 +888,14 @@ failed.
|
|||
You can now use 'C-u C-x .' to clear the fill prefix, similarly to how
|
||||
you could already use 'C-u C-x C-n' to clear the goal column.
|
||||
|
||||
+++
|
||||
** New prefix argument for 'C-/' in Dired and Proced modes.
|
||||
The Dired and Proced major modes bind mode-specific undo commands to the
|
||||
same keys to which 'undo' is globally bound, 'C-/', 'C-_' and 'C-x u'.
|
||||
These commands did not previously accept a prefix argument.
|
||||
Now a numeric prefix argument specifies a repeat count, just like it
|
||||
already did for 'undo'.
|
||||
|
||||
|
||||
* Changes in Specialized Modes and Packages in Emacs 31.1
|
||||
|
||||
|
|
|
|||
|
|
@ -2893,13 +2893,13 @@ Keybindings:
|
|||
(concat "\\`d'-elete, \\`u'-ndelete, \\`x'-punge, \\`f'-ind, "
|
||||
"\\`o'-ther window, \\`R'-ename, \\`C'-opy, \\`h'-elp"))))
|
||||
|
||||
(defun dired-undo ()
|
||||
(defun dired-undo (&optional arg)
|
||||
"Undo in a Dired buffer.
|
||||
A numeric ARG serves as a repeat count.
|
||||
This doesn't recover lost files, it just undoes changes in the buffer itself.
|
||||
You can use it to recover marks, killed lines or subdirs."
|
||||
(interactive nil dired-mode)
|
||||
(let ((inhibit-read-only t))
|
||||
(undo))
|
||||
(interactive "P" dired-mode)
|
||||
(undo-ignore-read-only arg)
|
||||
(dired-build-subdir-alist)
|
||||
(message "Change in Dired buffer undone.
|
||||
Actual changes in files cannot be undone by Emacs."))
|
||||
|
|
|
|||
|
|
@ -2311,13 +2311,13 @@ STRING is an overall summary of the failures."
|
|||
(describe-mode)
|
||||
(message (substitute-command-keys proced-help-string))))
|
||||
|
||||
(defun proced-undo ()
|
||||
(defun proced-undo (&optional arg)
|
||||
"Undo in a Proced buffer.
|
||||
A numeric ARG serves as a repeat count.
|
||||
This doesn't recover killed processes, it just undoes changes in the Proced
|
||||
buffer. You can use it to recover marks."
|
||||
(interactive nil proced-mode)
|
||||
(let (buffer-read-only)
|
||||
(undo))
|
||||
(interactive "P" proced-mode)
|
||||
(undo-ignore-read-only arg)
|
||||
(message "Change in Proced buffer undone.
|
||||
Killed processes cannot be recovered by Emacs."))
|
||||
|
||||
|
|
|
|||
|
|
@ -3577,6 +3577,13 @@ as an argument limits undo to changes within the current region."
|
|||
(if message
|
||||
(message "%s" message))))
|
||||
|
||||
(defun undo-ignore-read-only (&optional arg)
|
||||
"Perform `undo', ignoring the buffer's read-only status.
|
||||
A numeric ARG serves as a repeat count."
|
||||
(interactive "P")
|
||||
(let ((inhibit-read-only t))
|
||||
(undo arg)))
|
||||
|
||||
(defun buffer-disable-undo (&optional buffer)
|
||||
"Make BUFFER stop keeping undo information.
|
||||
No argument or nil as argument means do this for the current buffer."
|
||||
|
|
|
|||
|
|
@ -217,7 +217,7 @@ See also `diff-mode-read-only-map'."
|
|||
"RET" #'diff-goto-source
|
||||
"<mouse-2>" #'diff-goto-source
|
||||
"o" #'diff-goto-source ; other-window
|
||||
"<remap> <undo>" #'diff-undo
|
||||
"<remap> <undo>" #'undo-ignore-read-only
|
||||
|
||||
;; The foregoing commands don't affect buffers beyond this one.
|
||||
;; 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."
|
|||
(defun diff--overlay-auto-delete (ol _after _beg _end &optional _len)
|
||||
(delete-overlay ol))
|
||||
|
||||
(defun diff-undo (&optional arg)
|
||||
"Perform `undo', ignoring the buffer's read-only status."
|
||||
(interactive "P")
|
||||
(let ((inhibit-read-only t))
|
||||
(undo arg)))
|
||||
|
||||
;;;###autoload
|
||||
(defcustom diff-add-log-use-relative-names nil
|
||||
"Use relative file names when generating ChangeLog skeletons.
|
||||
|
|
|
|||
Loading…
Reference in a new issue