diff --git a/emacs.el b/emacs.el index ad4e6eb..d294104 100644 --- a/emacs.el +++ b/emacs.el @@ -729,6 +729,12 @@ return nil if LIB unfound and downloading failed, otherwise the path of LIB." (require 'gtkbm nil t) (global-set-key (kbd "C-x C-d") 'gtkbm)) +(and (dllib-if-unfound "git-command" + "https://raw.github.com/10sr/emacs-lisp/master/git-command.el" + t) + (require 'git-command nil t) + (define-key ctl-x-map "g" 'git-command)) + ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; term mode @@ -1561,48 +1567,6 @@ when SEC is nil, stop auto save if enabled." (defalias 'qcalc 'quick-calc) -(defvar git-command-history nil - "History list for git command.") -(defun my-git-ps1 (str) - (let ((gcmpl "/etc/bash_completion.d/git")) - (if (file-readable-p gcmpl) - (with-temp-buffer - (insert ". " gcmpl - "; __git_ps1 " - (shell-quote-argument str) - ";") - (shell-command-on-region (point-min) - (point-max) - "bash -s" - nil - t) - (buffer-substring-no-properties (point-min) - (point-max))) - ""))) -(defun my-git-shell-command (cmd) - "Shell like git command interface." - (interactive (list (read-shell-command (format "[%s]%s $ git : " - (abbreviate-file-name default-directory) - (my-git-ps1 "[GIT:%s]")) - nil - 'git-command-history))) - (let ((dir default-directory) - (bf (get-buffer-create "*Git Output*")) - ) - (delete-windows-on bf t) - (shell-command (concat "git " - cmd) - bf) - (with-current-buffer bf - (cd dir) - (and (require 'ansi-color nil t) - (ansi-color-apply-on-region (point-min) - (point-max))) - (setq buffer-read-only t) - (view-mode 1) - ))) -(define-key ctl-x-map "g" 'my-git-shell-command) - (defun my-kill-buffers () "" (interactive)