emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] /srv/bzr/emacs/trunk r108042: Allow undoing in read-only d


From: Chong Yidong
Subject: [Emacs-diffs] /srv/bzr/emacs/trunk r108042: Allow undoing in read-only diff-mode buffers.
Date: Thu, 26 Apr 2012 11:43:32 +0800
User-agent: Bazaar (2.3.1)

------------------------------------------------------------
revno: 108042
fixes bug(s): http://debbugs.gnu.org/5302
committer: Chong Yidong <address@hidden>
branch nick: trunk
timestamp: Thu 2012-04-26 11:43:32 +0800
message:
  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].
modified:
  lisp/ChangeLog
  lisp/vc/diff-mode.el
=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog    2012-04-26 03:18:47 +0000
+++ b/lisp/ChangeLog    2012-04-26 03:43:32 +0000
@@ -14,6 +14,9 @@
 
 2012-04-26  Chong Yidong  <address@hidden>
 
+       * 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).

=== modified file 'lisp/vc/diff-mode.el'
--- a/lisp/vc/diff-mode.el      2012-04-25 15:06:51 +0000
+++ b/lisp/vc/diff-mode.el      2012-04-26 03:43:32 +0000
@@ -107,8 +107,7 @@
 ;;;;
 
 (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 @@
     ([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 @@
                                   (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.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]