Permalink
Browse files

Fix up git-find-file.

  • Loading branch information...
1 parent 7abb291 commit f79e5699ed96bcf903999db78073bcce1a2aaabf @nelhage committed Sep 18, 2012
Showing with 19 additions and 19 deletions.
  1. +19 −19 dot-emacs
View
38 dot-emacs
@@ -256,16 +256,6 @@ unable to perform symbol completion.")
str)
(setq str (replace-match "" t t str)))
str)
-
-(defun git-wc-root ()
- (expand-file-name
- (chomp (shell-command-to-string "git rev-parse --show-cdup"))))
-
-(defun git-grep ()
- (interactive)
- (let ((grep-command "git grep -nH -e"))
- (cd (git-wc-root))
- (call-interactively 'grep)))
(eval-after-load 'calc
'(progn
@@ -430,11 +420,6 @@ unable to perform symbol completion.")
("\C-p" . ido-prev-match))))
(add-hook 'ido-minibuffer-setup-hook 'my-ido-keys)
-
-(defun my-find-file (arg)
- (interactive "P")
- (call-interactively (if arg 'git-find-file 'ido-find-file)))
-
; (require 'iswitchb)
; (iswitchb-mode nil)
@@ -455,6 +440,22 @@ unable to perform symbol completion.")
; ("\C-p" . iswitchb-prev-match))))
;
; (add-hook 'iswitchb-minibuffer-setup-hook 'iswitchb-local-keys)
+
+(defun my-find-file (arg)
+ (interactive "P")
+ (call-interactively (if arg 'git-find-file 'ido-find-file)))
+
+(global-set-key (kbd "C-x C-f") 'my-find-file)
+
+(defun git-wc-root ()
+ (expand-file-name
+ (chomp (shell-command-to-string "git rev-parse --show-cdup"))))
+
+(defun git-grep ()
+ (interactive)
+ (let ((grep-command "git grep -nH -e"))
+ (cd (git-wc-root))
+ (call-interactively 'grep)))
(defun git-find-file ()
"Use ido to select a file from the git repo"
@@ -465,7 +466,7 @@ unable to perform symbol completion.")
(split-string
(shell-command-to-string
(concat "git --git-dir "
- (shell-quote-argument git-dir)
+ (shell-quote-argument git-dir)
" ls-files -c -o"))
"\n")))
;; populate hash table (display repr => path)
@@ -477,9 +478,8 @@ unable to perform symbol completion.")
;; strip project root
(setq key (replace-regexp-in-string my-project-root "" key))
;; remove trailing | or /
- (setq key (replace-regexp-in-string "\\(|\\|/\\)$" "" key))
- (puthash key path tbl)
- (push key ido-list)
+ (setq key (replace-regexp-in-string "\\(|\\|/\\)$" "" key))
+ (puthash key (expand-file-name (concat my-project-root "/" path)) tbl)
(push key ido-list))
project-files)
(let ((ido-decorations (quote ("\n-> " "" "\n " "\n ..." "[" "]" " [No match]" " [Matched]" " [Not readable]" " [Too big]" " [Confirm]")))

0 comments on commit f79e569

Please sign in to comment.