From 30339f7070b156596ca777750fa863394d5b0824 Mon Sep 17 00:00:00 2001 From: 10sr <8slashes+git@gmail.com> Date: Thu, 26 Apr 2012 03:07:31 +0900 Subject: [PATCH] update git-command so that minibuffer shows branch name --- emacs.el | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/emacs.el b/emacs.el index 80c1e4e..b3dcd97 100644 --- a/emacs.el +++ b/emacs.el @@ -1557,14 +1557,22 @@ when SEC is nil, stop auto save if enabled." (defalias 'qcalc 'quick-calc) -;; (when (require 'ansi-color nil t) -;; (ansi-color-for-comint-mode-on)) (defvar git-command-history nil "History list for git command.") +(defun my-git-branch-name () + "" + (interactive) + (with-temp-buffer + (shell-command "git branch --no-color" t) + (when (search-forward "*" nil t) + (forward-char 1) + (buffer-substring-no-properties (point) + (point-at-eol))))) (defun my-git-shell-command (cmd) "" - (interactive (list (read-shell-command (format "[%s] $ git : " - (abbreviate-file-name default-directory)) + (interactive (list (read-shell-command (format "[%s][GIT:%s] $ git : " + (abbreviate-file-name default-directory) + (my-git-branch-name)) nil 'git-command-history))) (let ((dir default-directory)