1
0
mirror of https://git.savannah.gnu.org/git/emacs.git synced 2024-12-03 08:30:09 +00:00

Allow undoing in read-only diff-mode buffers.

* lisp/vc/diff-mode.el (diff-undo): New command.
(diff-mode-shared-map): Bind it to / and [remap undo].

Fixes: debbugs:5302
This commit is contained in:
Chong Yidong 2012-04-26 11:43:32 +08:00
parent 0d42eb3e96
commit 8b71081d30
2 changed files with 14 additions and 17 deletions

View File

@ -14,6 +14,9 @@
2012-04-26 Chong Yidong <cyd@gnu.org>
* vc/diff-mode.el (diff-undo): New command (Bug#5302).
(diff-mode-shared-map): Bind it to / and [remap undo].
* vc/ediff-wind.el (ediff-setup-windows-default): New function.
(ediff-window-setup-function): Use it as the default, to set up
windows based on whether the current frame is graphical (Bug#2138).

View File

@ -107,8 +107,7 @@ when editing big diffs)."
;;;;
(easy-mmode-defmap diff-mode-shared-map
'(;; From Pavel Machek's patch-mode.
("n" . diff-hunk-next)
'(("n" . diff-hunk-next)
("N" . diff-file-next)
("p" . diff-hunk-prev)
("P" . diff-file-prev)
@ -116,27 +115,17 @@ when editing big diffs)."
([backtab] . diff-hunk-prev)
("k" . diff-hunk-kill)
("K" . diff-file-kill)
;; From compilation-minor-mode.
("}" . diff-file-next)
("}" . diff-file-next) ; From compilation-minor-mode.
("{" . diff-file-prev)
("\C-m" . diff-goto-source)
([mouse-2] . diff-goto-source)
;; From XEmacs's diff-mode.
("W" . widen)
;;("." . diff-goto-source) ;display-buffer
;;("f" . diff-goto-source) ;find-file
("o" . diff-goto-source) ;other-window
;;("w" . diff-goto-source) ;other-frame
;;("N" . diff-narrow)
;;("h" . diff-show-header)
;;("j" . diff-show-difference) ;jump to Nth diff
;;("q" . diff-quit)
;; Not useful if you have to metafy them.
;;(" " . scroll-up)
;;("\177" . scroll-down)
("o" . diff-goto-source) ; other-window
("A" . diff-ediff-patch)
("r" . diff-restrict-view)
("R" . diff-reverse-direction))
("R" . diff-reverse-direction)
("/" . diff-undo)
([remap undo] . diff-undo))
"Basic keymap for `diff-mode', bound to various prefix keys."
:inherit special-mode-map)
@ -1904,6 +1893,11 @@ For use in `add-log-current-defun-function'."
(match-end 0) end
props 'diff-refine-preproc))))))))
(defun diff-undo (&optional arg)
"Perform `undo', ignoring the buffer's read-only status."
(interactive "P")
(let ((inhibit-read-only t))
(undo arg)))
(defun diff-add-change-log-entries-other-window ()
"Iterate through the current diff and create ChangeLog entries.