@matheusbsbs / matheus-bagliano / commits / 8a078c3f72
Fork 0

git.el: Added functions for moving to the next/prev unmerged file.

This is useful when doing a merge that changes many files with only a few conflicts here and there. Signed-off-by: Alexandre Julliard <julliard@winehq.org> Signed-off-by: Junio C Hamano <junkio@cox.net>

Alexandre Julliard committed Nov 3, 2006 at 17:41 UTC 8a078c3f72002af9bf79dc884fe321e3e48930fc
1 file changed +28
contrib/emacs/git.el
+28
@@ -670,6 +670,32 @@ and returns the process output as a string."
670 (unless git-status (error "Not in git-status buffer."))
671 (ewoc-goto-prev git-status n))
672
673 +(defun git-next-unmerged-file (&optional n)
674 + "Move the selection down N unmerged files."
675 + (interactive "p")
676 + (unless git-status (error "Not in git-status buffer."))
677 + (let* ((last (ewoc-locate git-status))
678 + (node (ewoc-next git-status last)))
679 + (while (and node (> n 0))
680 + (when (eq 'unmerged (git-fileinfo->state (ewoc-data node)))
681 + (setq n (1- n))
682 + (setq last node))
683 + (setq node (ewoc-next git-status node)))
684 + (ewoc-goto-node git-status last)))
685 +
686 +(defun git-prev-unmerged-file (&optional n)
687 + "Move the selection up N unmerged files."
688 + (interactive "p")
689 + (unless git-status (error "Not in git-status buffer."))
690 + (let* ((last (ewoc-locate git-status))
691 + (node (ewoc-prev git-status last)))
692 + (while (and node (> n 0))
693 + (when (eq 'unmerged (git-fileinfo->state (ewoc-data node)))
694 + (setq n (1- n))
695 + (setq last node))
696 + (setq node (ewoc-prev git-status node)))
697 + (ewoc-goto-node git-status last)))
698 +
699 (defun git-add-file ()
700 "Add marked file(s) to the index cache."
701 (interactive)
@@ -967,7 +993,9 @@ and returns the process output as a string."
993 (define-key map "m" 'git-mark-file)
994 (define-key map "M" 'git-mark-all)
995 (define-key map "n" 'git-next-file)
996 + (define-key map "N" 'git-next-unmerged-file)
997 (define-key map "p" 'git-prev-file)
998 + (define-key map "P" 'git-prev-unmerged-file)
999 (define-key map "q" 'git-status-quit)
1000 (define-key map "r" 'git-remove-file)
1001 (define-key map "R" 'git-resolve-file)