Browse Source

add git-command lib prefs

pull/1/head
10sr 12 years ago
parent
commit
30f6489825
1 changed files with 6 additions and 42 deletions
  1. +6
    -42
      emacs.el

+ 6
- 42
emacs.el View File

@@ -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)


Loading…
Cancel
Save