git.el: Added a function to open the current file in another window.
Bound to 'o' by default, compatible with pcl-cvs and buffer-mode. Suggested by Han-Wen Nienhuys. 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
b8ee51815ad0520b0340c2a594dee1f8de9c7c8a
1 file changed
+10
contrib/emacs/git.el
+10
@@ -910,6 +910,15 @@ and returns the process output as a string."
910
(when (eq 'unmerged (git-fileinfo->state info))
911
(smerge-mode))))
912
913
+(defun git-find-file-other-window ()
914
+ "Visit the current file in its own buffer in another window."
915
+ (interactive)
916
+ (unless git-status (error "Not in git-status buffer."))
917
+ (let ((info (ewoc-data (ewoc-locate git-status))))
918
+ (find-file-other-window (git-fileinfo->name info))
919
+ (when (eq 'unmerged (git-fileinfo->state info))
920
+ (smerge-mode))))
921
+
922
(defun git-find-file-imerge ()
923
"Visit the current file in interactive merge mode."
924
(interactive)
@@ -994,6 +1003,7 @@ and returns the process output as a string."
1003
(define-key map "M" 'git-mark-all)
1004
(define-key map "n" 'git-next-file)
1005
(define-key map "N" 'git-next-unmerged-file)
1006
+ (define-key map "o" 'git-find-file-other-window)
1007
(define-key map "p" 'git-prev-file)
1008
(define-key map "P" 'git-prev-unmerged-file)
1009
(define-key map "q" 'git-status-quit)