emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] /srv/bzr/emacs/trunk r110728: * lisp/vc/diff-mode.el (diff


From: Stefan Monnier
Subject: [Emacs-diffs] /srv/bzr/emacs/trunk r110728: * lisp/vc/diff-mode.el (diff-context->unified): Don't get confused by "hunk
Date: Mon, 29 Oct 2012 11:14:10 -0400
User-agent: Bazaar (2.5.0)

------------------------------------------------------------
revno: 110728
committer: Stefan Monnier <address@hidden>
branch nick: trunk
timestamp: Mon 2012-10-29 11:14:10 -0400
message:
  * lisp/vc/diff-mode.el (diff-context->unified): Don't get confused by "hunk
  header comments".
  (diff-unified->context, diff-context->unified)
  (diff-reverse-direction, diff-fixup-modifs): Use `use-region-p'.
modified:
  lisp/ChangeLog
  lisp/vc/diff-mode.el
  test/indent/shell.sh
=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog    2012-10-29 13:50:05 +0000
+++ b/lisp/ChangeLog    2012-10-29 15:14:10 +0000
@@ -1,5 +1,10 @@
 2012-10-29  Stefan Monnier  <address@hidden>
 
+       * vc/diff-mode.el (diff-context->unified): Don't get confused by "hunk
+       header comments".
+       (diff-unified->context, diff-context->unified)
+       (diff-reverse-direction, diff-fixup-modifs): Use `use-region-p'.
+
        * emacs-lisp/cl.el (letf): Add missing indent rules (bug#12759).
 
        * files.el (find-alternate-file): Only ask one question (bug#12487).

=== modified file 'lisp/vc/diff-mode.el'
--- a/lisp/vc/diff-mode.el      2012-10-26 15:51:42 +0000
+++ b/lisp/vc/diff-mode.el      2012-10-29 15:14:10 +0000
@@ -911,7 +911,7 @@
   "Convert unified diffs to context diffs.
 START and END are either taken from the region (if a prefix arg is given) or
 else cover the whole buffer."
-  (interactive (if (or current-prefix-arg (and transient-mark-mode 
mark-active))
+  (interactive (if (or current-prefix-arg (use-region-p))
                   (list (region-beginning) (region-end))
                 (list (point-min) (point-max))))
   (unless (markerp end) (setq end (copy-marker end t)))
@@ -1035,7 +1035,7 @@
 START and END are either taken from the region
 \(when it is highlighted) or else cover the whole buffer.
 With a prefix argument, convert unified format to context format."
-  (interactive (if (and transient-mark-mode mark-active)
+  (interactive (if (use-region-p)
                   (list (region-beginning) (region-end) current-prefix-arg)
                 (list (point-min) (point-max) current-prefix-arg)))
   (if to-context
@@ -1045,7 +1045,7 @@
           (inhibit-read-only t))
       (save-excursion
         (goto-char start)
-        (while (and (re-search-forward "^\\(\\(\\*\\*\\*\\) .+\n\\(---\\) 
.+\\|\\*\\{15\\}.*\n\\*\\*\\* \\([0-9]+\\),\\(-?[0-9]+\\) \\*\\*\\*\\*\\)$" nil 
t)
+        (while (and (re-search-forward "^\\(\\(\\*\\*\\*\\) .+\n\\(---\\) 
.+\\|\\*\\{15\\}.*\n\\*\\*\\* \\([0-9]+\\),\\(-?[0-9]+\\) \\*\\*\\*\\*\\)\\(?: 
\\(.*\\)\\|$\\)" nil t)
                     (< (point) end))
           (combine-after-change-calls
             (if (match-beginning 2)
@@ -1061,7 +1061,9 @@
                     ;; Variables to use the special undo function.
                     (old-undo buffer-undo-list)
                     (old-end (marker-position end))
-                    (reversible t))
+                    ;; We currently throw away the comment that can follow
+                    ;; the hunk header.  FIXME: Preserve it instead!
+                    (reversible (not (match-end 6))))
                 (replace-match "")
                 (unless (re-search-forward
                          diff-context-mid-hunk-header-re nil t)
@@ -1131,7 +1133,7 @@
   "Reverse the direction of the diffs.
 START and END are either taken from the region (if a prefix arg is given) or
 else cover the whole buffer."
-  (interactive (if (or current-prefix-arg (and transient-mark-mode 
mark-active))
+  (interactive (if (or current-prefix-arg (use-region-p))
                   (list (region-beginning) (region-end))
                 (list (point-min) (point-max))))
   (unless (markerp end) (setq end (copy-marker end t)))
@@ -1197,7 +1199,7 @@
   "Fixup the hunk headers (in case the buffer was modified).
 START and END are either taken from the region (if a prefix arg is given) or
 else cover the whole buffer."
-  (interactive (if (or current-prefix-arg (and transient-mark-mode 
mark-active))
+  (interactive (if (or current-prefix-arg (use-region-p))
                   (list (region-beginning) (region-end))
                 (list (point-min) (point-max))))
   (let ((inhibit-read-only t))

=== modified file 'test/indent/shell.sh'
--- a/test/indent/shell.sh      2012-07-17 08:38:12 +0000
+++ b/test/indent/shell.sh      2012-10-29 15:14:10 +0000
@@ -26,7 +26,10 @@
 
     case $toto in
         a) echo 1;; b) echo 2;;
-        c) echo 3;;
+        (c)
+            echo 3;;
+        d)
+            echo 3;;
     esac
     
     case $as_nl`(ac_space=' '; set) 2>&1` in #(


reply via email to

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