]> code.delx.au - gnu-emacs/commitdiff
* lisp/vc/diff-mode.el (diff-kill-applied-hunks): New command.
authorStefan Monnier <monnier@iro.umontreal.ca>
Mon, 1 Dec 2014 18:12:37 +0000 (13:12 -0500)
committerStefan Monnier <monnier@iro.umontreal.ca>
Mon, 1 Dec 2014 18:16:53 +0000 (13:16 -0500)
* lisp/vc/smerge-mode.el (smerge-swap): New command.

lisp/ChangeLog
lisp/vc/diff-mode.el
lisp/vc/smerge-mode.el

index 9f233cdaadf921dbece5cec33a370723add6ffa5..ec95af9441fed7bbdef107cfe5d023f05bf9ca49 100644 (file)
@@ -1,7 +1,13 @@
+2014-12-01  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+       * vc/smerge-mode.el (smerge-swap): New command.
+
+       * vc/diff-mode.el (diff-kill-applied-hunks): New command.
+
 2014-12-01  Ulf Jasper  <ulf.jasper@web.de>
 
-       * net/newst-treeview.el (newsticker--treeview-item-show): Check
-       window liveliness before measuring its width.
+       * net/newst-treeview.el (newsticker--treeview-item-show):
+       Check window liveliness before measuring its width.
 
        * net/newst-backend.el (newsticker--get-news-by-url-callback):
        Pass correct status to `newsticker--sentinel-work'.
 
        * vc/vc.el, vc/vc-cvs.el, vc/vc-rcs.el, vc/vc-svn.el: The 'merge'
        backend method of RCS/CVS/SVN is now 'merge-file', to contrast with
-       'merge-branch'. Prompting for merge revisions is pushed down to
+       'merge-branch'.  Prompting for merge revisions is pushed down to
        the back ends; this fixes a layering violation that caused bad
        behavior with SVN.
 
        * vc/vc.el, vc-hooks.el, and all backends: API simplification;
        vc-stay-local-p and repository-hostname are no longer public
-       methods. Only the CVS and SVN backends used these, and the SVN
+       methods.  Only the CVS and SVN backends used these, and the SVN
        support was conditioned out because svn status -v is too slow.
        The CVS back end retains this machibery and the vc-stay-local
        configuration variable now only affects it.
index 9afb9f47e9124230bb201eda5ec32bc19c2652c4..f3455efb29453f10a3398839c5cf680f95b4257c 100644 (file)
@@ -1817,6 +1817,16 @@ With a prefix argument, try to REVERSE the hunk."
     (diff-hunk-status-msg line-offset (diff-xor reverse switched) t)))
 
 
+(defun diff-kill-applied-hunks ()
+  "Kill all hunks that have already been applied starting at point."
+  (interactive)
+  (while (not (eobp))
+    (pcase-let ((`(,buf ,line-offset ,pos ,src ,_dst ,switched)
+                 (diff-find-source-location nil nil)))
+      (if (and line-offset switched)
+          (diff-hunk-kill)
+        (diff-hunk-next)))))
+
 (defalias 'diff-mouse-goto-source 'diff-goto-source)
 
 (defun diff-goto-source (&optional other-file event)
index 771281555ab054b81bbc12c4d70597a03467b8ba..0b7b70219c0a0788cf685948fcb4e5d8bd56946e 100644 (file)
@@ -1132,6 +1132,19 @@ repeating the command will highlight other two parts."
                         (unless smerge-use-changed-face
                           '((smerge . refine) (face . smerge-refined-added))))))
 
+(defun smerge-swap ()
+  "Swap the \"Mine\" and the \"Other\" chunks.
+Can be used before things like `smerge-keep-all' or `smerge-resolve' where the
+ordering can have some subtle influence on the result, such as preferring the
+spacing of the \"Other\" chunk."
+  (interactive)
+  (smerge-match-conflict)
+  (goto-char (match-beginning 3))
+  (let ((txt3 (delete-and-extract-region (point) (match-end 3))))
+    (insert (delete-and-extract-region (match-beginning 1) (match-end 1)))
+    (goto-char (match-beginning 1))
+    (insert txt3)))
+
 (defun smerge-diff (n1 n2)
   (smerge-match-conflict)
   (smerge-ensure-match n1)