Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

emacs: replace git-emacs with egg

The git-emacs plugin code was not actually being tracked in hg...
Egg is fork of magit with some UI improvements, and a nice minor mode
which by default maps typical emacs vc-mode shortcuts. Using this fork
that is more active than the original:

https://github.com/byplayer/egg
Current tip SHA: abdcad15f4f03ede3ef6
  • Loading branch information...
commit d44d81c3c7a9820554fe7f56536bdbed023e1a42 1 parent b140c0a
@ches authored
View
5 .emacs
@@ -24,8 +24,9 @@
(vendor 'yasnippet-bundle)
;; Fancier git functionality than the standard vc-git lib provides
-; (add-to-list 'load-path "~/.emacs.d/site-lisp/git-emacs")
-(vendor 'git-emacs)
+;; http://bogolisk.blogspot.com/
+;; https://github.com/bogolisk/egg/wiki/Manual
+(vendor 'egg)
;; Enable a backtrace if customizations make emacs shit the bed
; (setq debug-on-error t)
View
46 .emacs.d/vendor/egg/CHANGELOG.markdown
@@ -0,0 +1,46 @@
+# Egg (Emacs Got Git).
+
+## v1.0.0
+- add option comment for egg-mode-key-prefix
+- update indent .
+- add feature for diff other repository .
+
+## v0.96
+- fix bug of View File History .
+
+## v 0.95
+- change egg-goto-block-filename function to bypte-compile some environments .
+ Thanks for Antoine Levitt .
+
+## v 0.94
+- add const of egg-version .
+
+## v 0.93
+- fixed magit path . Thanks for SebastianRose .
+- added egg-log-msg-cancel for quit from buffer commit message . Thanks for Alexander Prusov .
+- use vc-git for showing vs-mode-line . Thanks for Alexander Prusov .
+- hide HEAD for log . Thanks for Alexander Prusov .
+- remove long long message in define-egg-buffer . Thanks for Alexander Prusov .
+- fix bug in egg-decorate-log (substring args out of range) . Thanks for Alexander Prusov .
+- add changelog to fix magit path. Thanks for Alexander Prusov .
+
+## v 0.92
+- fixed details of egg log buffer show escape charactors
+- fixed log search error
+- fixed egg-log-buffer-reflog-ref message no escap
+- fixed history search to log-buffer unescaped
+- change egg-auto-update default off
+- add egg-switch-to-buffer option . Thank for Q.P.Liu .
+- fixed that history page is not unescape .
+- reverting change which broke IDing of refs (breaking push) . Thanks for A. Amar .
+- remove debugging code from log decorator . Thanks for A. Amar .
+
+## v 0.91
+
+- support git 1.7.x from strav/master
+- fixed log output
+- status auto-update merge from bandresen/master
+- Fixed bug in egg-hunk-section-cmd-visit-file-other-window. from eostrom/master
+- Merge branch 'blamefix' of git://github.com/mkleehammer/egg into mkleehammer-master
+- fork git://github.com/bogolisk/egg.git
+
View
53 .emacs.d/vendor/egg/README.markdown
@@ -0,0 +1,53 @@
+# Egg (Emacs Got Git).
+
+## Intro
+
+Egg is an Emacs interface to git. It's a suite composed of a
+minor-mode and various special-buffers presenting different UIs to
+help the user performing many git operations.
+
+- egg-minor-mode: providing git-specific vc-look-alike interface
+ including similar key-bindings, a minor-mode menu and history
+ annotations (blame).
+- egg's status-buffer:
+ - index manipulation/commit preparation
+ - interactive rebase stepping
+ - merge conflict resolution
+ - stashing work-in-progress
+ - adding ignore pattern
+ - staging new files
+ - ediff or ediff3 launching. (e.g. 3-way ediff of
+ work-dir/INDEX/HEAD, 3-way ediff of work-dir/theirs/ours)
+- egg's log-buffer
+ - browse repo's history
+ - ref (tag, branch, etc) creation and deletion
+ - push and fetch
+ - start merge/rebase/interactive-rebase session
+ - attach/detach HEAD
+ - search history (pickaxe)
+ - compare revisions
+- egg's file-log-buffer: restricted version of the log-buffer, used to
+ browse history of a single file.
+- egg's reflog-buffer: restricted variation of the log-buffer, used to
+ browse the git's reflog and re-attach HEAD.
+- egg's query:commit-buffer: restricted variation of the log-buffer,
+ used to browse history-search's results (pickaxe)
+- egg's stash-buffer: a log-buffer look-a-like, used to browse and
+ apply stash entries to work-dir
+- egg-grep: a compile-mode which can grep files in non-checkout git
+ revisions.
+- egg's commit-log-edit buffer: used to compose the commit-message for
+ the upcoming commit. it can do some minor index manipulation.
+- egg's tag:msg-buffer: used to compose the message of an annotated tag
+- egg's diff-buffer: used to view the delta between file or repo revisions.
+
+## History
+
+The design and most ideas in Egg was borrowed/stolen from
+Magit. However, egg has grown with many functionalities not present in
+magit and should be considered based its own merits.
+
+## MAGIT
+
+Magit is an interface to the version control system Git, implemented
+by Marius Voller. His code at: http://philjackson.github.com/magit/
View
403 .emacs.d/vendor/egg/doc/wiki.txt
@@ -0,0 +1,403 @@
+This will eventually become the main ([[Home]]) page for Egg.
+
+h1. Egg: Emacs Got Git
+
+Egg is **not** a "git":http://git.or.cz/ _porcelain_. It shares the
+same goals with _git aliases_: make common git operations more
+convenient to perform.
+
+Egg will not provide binding for many git commands because:
+
+* In the author's humble opinion, some commands (such as
+ @git init@) are better invoked in a regular shell.
+* The author is a git _newbie_, and don't know how to use some
+ advanced git commands (such as @git repack@.)
+* The author is not familiar with some git commands because they
+ were never used by the author.
+
+To use egg, simply compile the @egg.el@ file then load the
+@egg.elc@ file. You can put the @egg.elc@ file
+somewhere in your emacs @load-path@ and add @(require
+'egg)@ in your @.emacs@ file.
+
+Once activated, egg will turn on @egg-minor-mode@ when a
+file was opened in a git repository. However, the first thing should
+be done after loading the first time is to to _customize_ egg.
+
+h2. Customizations
+
+<pre>
+M-x customize-group egg
+</pre>
+
+Some (possibly) important customizations before using egg:
+
+* @egg-git-command@ : this variable's default value is
+ @"git"@. It must be set to the appropriate incantation if
+ @git@ is not in @exec-path@.
+* @egg-patch-command@ : same issue as with @egg-git-command@.
+* @egg-git-rebase-subdir@ : git's DOTEST directory keep changing from
+ one version of git to another. one must set this to the appropriate value for
+ the version of git currently used.
+* @egg-mode-key-prefix@ : key prefix for the
+ @egg-minor-mode@'s commands. By default this was set to
+ the VC's prefix @C-x v@, and thus, @C-x v =@
+ would invoke the command @egg-file-diff@.
+* @egg-refresh-index-in-background@: if enabled, egg will try
+ to refresh the index of the visited repositories when emacs has been
+ idle for @egg-background-idle-period@ seconds in order to
+ improve git commands's responsiveness.
+* @egg-background-idle-period@ : the Emacs's idle threshold
+ before egg start invoking background jobs.
+* @egg-confirm-next-action@ : if disabled, egg will not prompt
+ for confirmation in @egg-next-action@.
+* @egg-buffer-hide-section-type-on-start@ : this option let the
+ user customize the initial display of the deltas in many egg special
+ buffers. E.g. one can use this option to initially only show the
+ file-names and hide the details of the files in a delta.
+
+h2. Minor mode key-bindings
+
+When @egg-minor-mode@ is enabled in a file buffer, egg
+provides many bindings for common git commands as well as egg specific
+commands. The key-prefix shown in the below section assume that
+@egg-mode-key-prefix@ is @C-x v@.
+
+{background:#ddd}. |\2(#egg-next-action). *perform the next logical (DWIM style) action*|
+| key | @C-x v v@ |
+| lisp | @egg-next-action@ |
+| see | @egg-confirm-next-action@ customization option |
+| note | with prefix (i.e. @C-u C-x v v@), _ask_ for confirmation|
+{background:#ddd}. |\2(#egg-commit-log-edit). *edit the message and commit the staged changes*|
+| key | @C-x v c@ or @C-x v w@|
+| lisp | @egg-commit-log-edit@ |
+| git | similar to @git commit -e @ or @git commit -e --amend@ |
+| note | with prefix (i.e. @C-u C-x v c@), this the upcoming commit will amend the tip commit.|
+{background:#ddd}. |\2(#egg-status). *launch the egg's status-buffer for the current repo*|
+| key | @C-x v d@ or @C-x v s@ |
+| lisp | @egg-status@ |
+| git | similar to @git status@ |
+{background:#ddd}. |\2(#egg-log). *show the branch's history*|
+| key | @C-x v l@ |
+| lisp | @egg-log@ |
+| git | similar to @git log@ |
+| note | with prefix (i.e. @C-u C-x v l@), show history of all refs|
+{background:#ddd}. |\2(#egg-reflog). *show the reflog*|
+| key | @C-x v L@ |
+| lisp | @egg-reflog@ |
+| git | similar to @git reflog@ |
+| note | by default, show the reflog of HEAD. with prefix (i.e. @C-u C-x v L@), prompt for a ref|
+{background:#ddd}. |\2. *show the file's history*|
+| key | @C-x v h@ |
+| lisp | @egg-file-log@ |
+| git | similar to @git log -- $file @ |
+| note | by default, show the file history in the current branch. with prefix (i.e. @C-u C-x v h@), show the repo-wide file's history|
+{background:#ddd}. |\2. *search file's history for a string*|
+| key | @C-x v /@ |
+| lisp | @egg-file-log-pickaxe@ |
+| git | similar to @git log -S$string -- $file @ |
+{background:#ddd}. |\2. *add the contents of the file into the index*|
+| key | @C-x v i@ |
+| lisp | @egg-file-stage-current-file@ |
+| git | @git add $file@ |
+{background:#ddd}. |\2. *checkout other version of the file*|
+| key | @C-x v o@ |
+| lisp | @egg-file-checkout-other-version@ |
+| git | similar to @git checkout $sha1 -- $file @ |
+| note | with prefix (i.e. @C-u C-x v o@), do _not_ prompt for confirmation|
+{background:#ddd}. |\2. *cancel file's modifications*|
+| key | @C-x v u@ |
+| lisp | @egg-file-cancel-modifications@ |
+| git | similar to @git checkout -- $file @ |
+| note | with prefix (i.e. @C-u C-x v u@), do _not_ prompt for confirmation|
+| note | @egg-file-diff@ or @egg-status@ provide a finer-grain (hunk by hunk) way to achieve the the same goal. However this command is quicker when no hunk-by-hunk editing was needed.|
+{background:#ddd}. |\2. *compare the file with the index or other versions*|
+| key | @C-x v =@ |
+| lisp | @egg-file-diff@ |
+| git | similar to @git diff -- $file @ |
+| see | @egg-file-ediff@ |
+| note | with prefix (i.e. @C-u C-x v =@), _prompt_ for base version|
+| note | @egg-status@ gives a repo-wide view of the work-dir vs the index|
+{background:#ddd}. |\2. *compare the file with the index or other versions using _ediff_*|
+| key | @C-x v e@ |
+| lisp | @egg-file-ediff@ |
+| note | with prefix (i.e. @C-u C-x v e@), _prompt_ for _newer_ version|
+| note | unlike @egg-file-diff@ the current implementation of this command _cannot_ edit the index|
+{background:#ddd}. |\2. *open file's other version (read-only mode)*|
+| key | @C-x v ~@ |
+| lisp | @egg-file-version-other-window@ |
+| git | @git show@ |
+| note | by default, show the file's contents in the index. with prefix (i.e. @C-u C-x v =@), _prompt_ for a specific version|
+{background:#ddd}. |\2. *start a new branch from HEAD*|
+| key | @C-x v b@ |
+| lisp | @egg-start-new-branch@ |
+| git | @git checkout -b@ |
+{background:#ddd}. |\2. *show/hide history annotations*|
+| key | @C-x v a@ |
+| lisp | @egg-file-toggle-blame-mode@ |
+| git | @git blame@ |
+| note | the current implementation of this command force the file into read-only mode when showing annotations.|
+{background:#ddd}. |\2. *grep current or older contents of tracked files*|
+| key | @C-x v g@ |
+| lisp | @egg-grep@ |
+| git | @git grep@ |
+| note | need to load @egg-grep.elc@.|
+| note | with single prefix (i.e. @C-u C-x v g@), use the symbol at point as the default grep term|
+| note | with double prefix (i.e. @C-u C-u C-x v g@), prompt for a version|
+
+Egg also provides a file-mode menu in the menubar which provides
+access to the above commands.
+
+!http://i41.tinypic.com/waoj75.jpg!
+
+h3. History Annotations/Blame mode
+
+@egg-file-toggle-blame-mode@
+
+When blame-mode is on, the buffer is marked read-only. Disabling
+blame-mode will restore the original read-only mode of the buffer.
+
+!http://img110.mytextgraphics.com/photolava/2008/09/11/eggblame-4bto5s5de.png!
+
+h2. Special Buffers
+
+Egg creates various special-buffers for each repositories. Each buffer,
+using different UI, provides different functionalities to the users.
+
+* The delta manipulation buffers
+** the status buffer
+** the diff buffer
+* The log editing buffers
+** the commit buffer
+** the tag buffer
+* The commit browsing buffers
+** the log buffer
+** the file log buffer
+** the reflog buffer
+** the query or pickax buffer
+** The stash buffer
+
+h3. The delta editor
+
+Many special buffers embeds one or multiple diffs, i.e. one more
+multiple sequence of file deltas. The local keymap of those text
+blocks provide a delta-editor that let user maniuplate those diffs
+hunk-by-hunk or file-by-file. E.g.
+
+* If a delta sequence was a diff between the work-dir and the index
+ then the delta-editor would let the user moving hunk or file's
+ contents from the work-dir to the index or remove the hunk or the
+ entire file delta from the work-dir.
+* If a delta sequence was a diff between the index and HEAD, then the
+ delta edtor would let the user moving hunk or file contents from the
+ index to the work-dir.
+* If a delta sequence was a diff between commits then the delta-editor
+ is in read-only mode. While it cannot move text in read-only mode,
+ the local keymap (implementing the delta editor) provide:
+** a convenient way to nagivate the delta sequence.
+** the ability to hide or show a block of text to help the user
+ visualizing the global difference
+
+The delta sequence (diff output) is treated as a hierarchical layout
+by the local-keymap:
+
+# A top-level section (unstaged, unmerged, staged, etc.) contains a
+ sequence of file deltas or diffs
+# A file delta (difference between a file in the work-dir and in the
+ index) contains a sequence of hunks
+# A hunks is the smallest unit that can be moved or removed by the
+ delta editor.
+
+The key-bindings in the delta-editor are context-dependent base on the
+position of the cursor in the delta sequence. By example:
+
+| *the cursor was in* | *the @s@ key will* |
+| a diff header in the unstaged (or unmerged) section | stage the contents of the _file_ |
+| a diff header in the staged section | unstage the contents of the _file_ in the index |
+| a hunk header in the unstaged section | apply the hunk to the index |
+| a hunk header in the staged section | reverse-apply the hunk to the index |
+
+h4(#hide-show-keymap). The common key bindings in a sequence of deltas
+
+These bindings are available anywhere in a sequence of delta.
+
+{background:#ddd}. |\2. *move to the next _block_*|
+| key | @n@ |
+| lisp | @egg-buffer-cmd-navigate-next@ |
+{background:#ddd}. |\2. *move to the previous _block_*|
+| key | @p@ |
+| lisp | @egg-buffer-cmd-navigate-prev@ |
+{background:#ddd}. |\2. *hide/show current block's details*|
+| key | @h@ or @[mouse-2]@|
+| lisp | @egg-section-cmd-toggle-hide-show@ |
+{background:#ddd}. |\2. *hide/show details of the current block's sub-blocks*|
+| key | @H@ |
+| lisp | @egg-section-cmd-toggle-hide-show-children@ |
+
+!>http://img902.mytextgraphics.com/photolava/2008/09/08/diffheader-4bss2gy89.png!
+
+h4(#diff-keymap). The common key bindings in a diff section (staged, unstaged or unmerged)
+
+In addition to the previous bindings, the following bindings are
+available anywhere in a diff header.
+
+{background:#ddd}. |\2. *open the file of this delta in Emacs's _other window_*|
+| key | @RET@ |
+| lisp | @egg-diff-section-cmd-visit-file-other-window@ |
+{background:#ddd}. |\2. *open the file of this delta*|
+| key | @f@ |
+| lisp | @egg-diff-section-cmd-visit-file@ |
+{background:#ddd}. |\2. *show this delta in ediff*|
+| key | @=@ |
+| lisp | @egg-diff-section-cmd-ediff@ |
+{background:#ddd}. |\2. *popup menu for the delta*|
+| key | @[C-mouse-2]@ |
+| note | the menu is context dependent |
+
+h4(#staged-diff-keymap). The key bindings in a staged diff section
+
+In addition to the _two_ previous bindings, the following bindings are
+available anywhere in a diff header of a _staged changes_ section.
+
+{background:#ddd}. |\2. *show a 3-way diff of wdir,index and HEAD for the file in ediff3*|
+| key | @=@ |
+| lisp | @egg-staged-section-cmd-ediff3@ |
+{background:#ddd}. |\2. *unstage the file delta*|
+| key | @s@ |
+| lisp | @egg-diff-section-cmd-unstage@ |
+| git | @git reset -- $file@ |
+
+h4(#unstaged-diff-keymap). The key bindings in an unstaged diff section
+
+In addition to the "common delta's bindings":#hide-show-keymap and the
+"diff's bindings":#diff-keymap, the following bindings are available anywhere in a
+diff header of a _unstaged changes_ section.
+
+{background:#ddd}. |\2. *show the file delta in ediff*|
+| key | @=@ |
+| lisp | @egg-unstaged-section-cmd-ediff@ |
+{background:#ddd}. |\2. *stage the file delta*|
+| key | @s@ |
+| lisp | @egg-diff-section-cmd-stage@ |
+| git | @git add $file@ |
+{background:#ddd}. |\2. *remove the file delta*|
+| key | @s@ |
+| lisp | @egg-diff-section-cmd-undo@ |
+| git | @git checkout -- $file@ |
+
+!>http://img109.mytextgraphics.com/photolava/2008/09/09/unmergeddiffheader-4bsuia2i7.png!
+
+h4(#unmerged-diff-key-map). The key bindings in an unmerged diff section
+
+In addition to the "common delta's bindings":#hide-show-keymap and the
+"diff's bindings":#diff-keymap, the following bindings are available anywhere in a
+diff header of a _unmerged changes_ section.
+
+{background:#ddd}. |\2. *show a 3-way diff (ours, theirs and work-dir) of the file delta in ediff3*|
+| key | @=@ |
+| lisp | @egg-unmerged-section-cmd-ediff3@ |
+{background:#ddd}. |\2. *stage the file delta*|
+| key | @s@ |
+| lisp | @egg-diff-section-cmd-stage@ |
+| git | @git add $file@ |
+{background:#ddd}. |\2. *remove the file delta*|
+| key | @s@ |
+| lisp | @egg-diff-section-cmd-undo@ |
+| git | @git checkout -- $file@ |
+
+
+h2. The Status Buffer.
+
+The status buffer is launched via @C-x v s@ keys from a
+file-buffer when @egg-minor-mode@ is enabled or via the
+@s@ key from most egg special buffers.
+
+!http://i42.tinypic.com/2rz5b9u.png!
+
+h4. The primary usage for the status buffer:
+
+* file-by-file or hunk-by-hunk index manipulation.
+** stage a single unstaged hunk: add a single hunk from the a file to the index
+** remove a single unstaged hunk: remove hunk of delta between the index and the file.
+** unstage a single staged hunk: move a hunk from the index to the file.
+** update the index with the (new) contents of a file.
+** revert the contents of a file to match the index
+** revert the contents of a file in the index to match the contents of the file in HEAD.
+* resolve merge
+** locate conflict marks in a file
+** resolve merge using ediff3
+* resolve/continue/skip/abort rebase
+** locate conflict marks in a file
+** resolve rebase using ediff3
+* stash work-in-progress
+* resolve conflict's in stash applications
+
+h4. Status Buffer Screenshot during rebase
+
+!http://img701.mytextgraphics.com/photolava/2008/09/08/eggstatus-4bshkw5ak.png!
+
+h4. Status Buffer Organization
+
+The status-buffer is organized in a hierarchical layout:
+* *General section*
+* Help block
+* *Unstaged Changes*
+* File 1
+* _File 1 Hunk 1_
+* _File 1 Hunk 2_
+* ...
+* File 2
+* ...
+* *Staged Changes*
+* File 1
+* _File 1 Hunk 1_
+* _File 1 Hunk 2_
+* ...
+* File...
+* *Untracked Files*
+* File 1
+* ...
+
+h3. Status Buffer's key-bindings
+
+
+h4. The common key bindings in the _egg status-buffer_
+
+{background:#ddd}. |\2. *edit the message and commit staged changes*|
+| key | @c@ |
+| lisp | @egg-commit-log-edit@ |
+| see | "description":#egg-commit-log-edit |
+{background:#ddd}. |\2(#egg-log). *show the branch's history*|
+| key | @l@ |
+| lisp | @egg-log@ |
+| see | "description":#egg-log |
+{background:#ddd}. |\2(#egg-log). *show the reflog*|
+| key | @L@ |
+| lisp | @egg-reflog@ |
+| see | "description":#egg-reflog |
+{background:#ddd}. |\2(#egg-stage-all-files). *add contents of all modified (tracked) files to the index*|
+| key | @S@ |
+| lisp | @egg-stage-all-files@ |
+| git | @git add -u@ |
+| note | by default, show the file's contents in the index. with prefix (i.e. @C-u C-x v =@), _prompt_ for a specific version|
+{background:#ddd}. |\2(#egg-buffer-stash-wip). *stash work-in-progress*|
+| key | @w@ |
+| lisp | @egg-buffer-stash-wip@ |
+| git | @git stash save@ |
+{background:#ddd}. |\2. *show all blocks/sub-blocks*|
+| key | TBD |
+| lisp | @egg-buffer-show-all@ |
+{background:#ddd}. |\2. *hide all blocks/sub-blocks*|
+| key | TBD |
+| lisp | @egg-buffer-hide-all@ |
+{background:#ddd}. |\2. *quit window*|
+| key | @q@ |
+| lisp | @quit-window@ |
+| note | this command is _not_ part of egg |
+| note | this key-binding is common for many egg special buffers |
+{background:#ddd}. |\2. *redisplay buffer*|
+| key | @g@ |
+| lisp | @egg-buffer-cmd-refresh@ |
+| note | this key-binding is common for many egg special buffers |
+
+
View
132 .emacs.d/vendor/egg/egg-grep.el
@@ -0,0 +1,132 @@
+;;; egg -- Emacs Got Git
+;;; A magit fork
+
+;; Copyright (C) 2008 Linh Dang
+;;
+;; Egg is free software; you can redistribute it and/or modify it
+;; under the terms of the GNU General Public License as published by
+;; the Free Software Foundation; either version 3, or (at your option)
+;; any later version.
+;;
+;; Egg is distributed in the hope that it will be useful, but WITHOUT
+;; ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+;; or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
+;; License for more details.
+;;
+;; You should have received a copy of the GNU General Public License
+;; along with GNU Emacs; see the file COPYING. If not, write to
+;; the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+;; Boston, MA 02111-1307, USA.
+
+;;; Commentary
+;;; This is my fork of Marius's excellent magit. his work is at:
+;;; http://zagadka.vm.bytemark.co.uk/magit
+;;;
+(require 'egg)
+(require 'compile)
+(require 'grep)
+(require 'cl)
+
+(defvar egg-grep-saved-find-file-func nil)
+
+(defun egg-grep-find-file (marker rev:name dir formats)
+ (save-match-data
+ (let* ((rev-name-lst (split-string rev:name ":" t))
+ (rev (car rev-name-lst))
+ (file (cadr rev-name-lst)))
+ (unless file
+ (setq file rev)
+ (setq rev nil))
+ (if rev
+ (egg-file-get-other-version file rev nil t)
+ (apply egg-grep-saved-find-file-func marker file dir formats)))))
+
+(defun egg-grep-next-error-function (n &optional reset)
+ (interactive "P")
+ (let ((egg-grep-saved-find-file-func
+ (symbol-function 'compilation-find-file)))
+ (flet ((compilation-find-file (marker file-name dir &rest formats)
+ (egg-grep-find-file marker
+ file-name
+ dir formats)))
+ (compilation-next-error-function n reset))))
+
+;;;###autoload
+(defun egg-grep-process-setup ()
+ "Setup compilation variables and buffer for `egg-grep'.
+Set up `compilation-exit-message-function' and run `egg-grep-setup-hook'."
+ (set (make-local-variable 'compilation-exit-message-function)
+ (lambda (status code msg)
+ (if (eq status 'exit)
+ (cond ((zerop code)
+ '("finished (matches found)\n" . "matched"))
+ ((= code 1)
+ '("finished with no matches found\n" . "no match"))
+ (t
+ (cons msg code)))
+ (cons msg code))))
+
+ (run-hooks 'egg-grep-setup-hook))
+
+
+
+(defvar egg-grep-mode-map
+ (let ((map (make-sparse-keymap "Egg:Grep")))
+ (set-keymap-parent map compilation-minor-mode-map)
+ (define-key map (kbd "SPC") 'scroll-up)
+ (define-key map (kbd "DEL") 'scroll-down)
+
+ (define-key map (kbd "RET") 'compile-goto-error)
+ (define-key map "n" 'next-error-no-select)
+ (define-key map "p" 'previous-error-no-select)
+ (define-key map "{" 'compilation-previous-file)
+ (define-key map "}" 'compilation-next-file)
+ (define-key map (kbd "TAB") 'compilation-next-error)
+ map)
+ "Keymap for git-grep buffers.
+`compilation-minor-mode-map' is the parent keymap.")
+
+;;;###autoload
+(define-compilation-mode egg-grep-mode "Git-Grep"
+ "Sets `compilation-last-buffer' and `compilation-window-height'."
+ (setq compilation-last-buffer (current-buffer))
+ (set (make-local-variable 'compilation-error-face)
+ grep-hit-face)
+ (set (make-local-variable 'compilation-error-regexp-alist)
+ grep-regexp-alist)
+ (set (make-local-variable 'compilation-process-setup-function)
+ 'egg-grep-process-setup)
+ (set (make-local-variable 'compilation-disable-input) t)
+ (set (make-local-variable 'next-error-function)
+ 'egg-grep-next-error-function))
+
+;;;###autoload
+(defun egg-grep (level)
+ (interactive "p")
+ (let ((git-dir (or (egg-git-dir)
+ (error "Dir NOT in a git repo: %s"
+ default-directory)))
+ (cmd "git --no-pager grep -n ")
+ rev term)
+
+ (when (> level 15)
+ (setq rev (egg-read-rev "grep in revision: " "HEAD"))
+ (when (= (aref rev 0) ?:)
+ (setq cmd (concat cmd "--cached "))
+ (setq rev nil)))
+
+ (when (and (> level 3) (setq term (symbol-at-point)))
+ (when term
+ (setq term (symbol-name term))
+ (setq cmd (concat cmd term " "))))
+
+ (when rev
+ (setq cmd (concat cmd " " rev)))
+
+ (setq cmd
+ (read-string "run git grep (like this) : " cmd))
+
+ (compilation-start cmd 'egg-grep-mode
+ `(lambda (name)
+ (format "*git-grep@%s*" ,git-dir)))))
+
View
6,154 .emacs.d/vendor/egg/egg.el
6,154 additions, 0 deletions not shown
View
BIN  .emacs.d/vendor/egg/egg.elc
Binary file not shown
Please sign in to comment.
Something went wrong with that request. Please try again.