Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also compare across forks.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also compare across forks.
base fork: eentzel/emacs.d
base: 686412beaf
...
head fork: eentzel/emacs.d
compare: a9a12120c7
  • 3 commits
  • 3 files changed
  • 0 commit comments
  • 1 contributor
Showing with 38 additions and 44 deletions.
  1. +30 −40 anything-epe.el
  2. +1 −1  find-file-in-home-dir.el
  3. +7 −3 jsp-mode.el
View
70 anything-epe.el
@@ -1,53 +1,43 @@
(add-to-list 'load-path "~/.emacs.d/anything-config")
-(require 'epe-utils)
(require 'anything-config)
+(require 'magit)
-(defmacro create-anything-source (name path title)
- "Define an anything source called NAME that searches
-recursively for matching files in PATH."
- `(defvar ,name
- '((name . ,title)
- (candidates . (lambda ()
- (let* ((excludes
- (mapconcat 'identity '("*/classes" "*/target" "*/.svn" "*/reaDS" "*/casaDS" "*/build")
- " \\) -prune -o \\( -path \\"))
- (args
- (format "-H '%s' \\( -path %s \\) -prune -o -%s '.*%s.*' -print"
- ,path
- excludes
- (if (all-lowercase-p anything-pattern) "iregex" "regex")
- anything-pattern)))
- (start-process-shell-command "file-search-process" nil
- "find" args))))
- (type . file)
- (requires-pattern . 4)
- (delayed))
- (concat "Source for searching matching files in " ,path " recursively.")))
-(create-anything-source
- anything-current-project-file-search
- (guess-project-root anything-buffer-file-name)
- "Current Project Search")
+;; from http://mikerowecode.com/2012/03/anything-find-files-in-git-project.html
+(defvar anything-c-source-git-project-files-cache nil "(path signature cached-buffer)")
+(defvar anything-c-source-git-project-files
+ '((name . "Files from current project")
+ (init . (lambda ()
+ (let* ((top-dir (file-truename (magit-get-top-dir (if (buffer-file-name)
+ (file-name-directory (buffer-file-name))
+ default-directory))))
+ (default-directory top-dir)
+ (signature (magit-rev-parse "HEAD")))
-(create-anything-source
- anything-other-project-file-search
- other-project
- "Other Project Search")
+ (unless (and anything-c-source-git-project-files-cache
+ (third anything-c-source-git-project-files-cache)
+ (equal (first anything-c-source-git-project-files-cache) top-dir)
+ (equal (second anything-c-source-git-project-files-cache) signature))
+ (if (third anything-c-source-git-project-files-cache)
+ (kill-buffer (third anything-c-source-git-project-files-cache)))
+ (setq anything-c-source-git-project-files-cache
+ (list top-dir
+ signature
+ (anything-candidate-buffer 'global)))
+ (with-current-buffer (third anything-c-source-git-project-files-cache)
+ (dolist (filename (mapcar (lambda (file) (concat default-directory file))
+ (magit-git-lines "ls-files")))
+ (insert filename)
+ (newline))))
+ (anything-candidate-buffer (third anything-c-source-git-project-files-cache)))))
-(defun anything-other-project (project)
- (interactive (list (expand-file-name
- (read-directory-name "Project name: "
- (concat (getenv "WORKSPACE") "/")))))
- (setq other-project project)
- (anything 'anything-other-project-file-search))
+ (type . file)
+ (candidates-in-buffer)))
-(global-set-key "\C-cJ" 'anything-other-project)
(global-set-key "\C-cj" 'anything)
(setq anything-sources '(anything-c-source-buffers+
- anything-current-project-file-search
- ;; anything-parent-project-file-search
anything-c-source-recentf
- anything-c-source-org-headline
+ anything-c-source-git-project-files
anything-c-source-buffer-not-found))
View
2  find-file-in-home-dir.el
@@ -4,4 +4,4 @@
(let ((default-directory "~/"))
(call-interactively 'find-file)))
-(global-set-key "\C-x\C-f" 'find-file-in-home-dir)
+(define-key (current-global-map) [remap find-file] 'find-file-in-home-dir)
View
10 jsp-mode.el
@@ -22,16 +22,20 @@
-;; Two useful functions (that depend on the jsptree command and graphviz and X11)
+;; Two useful functions (that depend on the jsptree command and graphviz and OSX's 'open' command)
(defun jsp-parents ()
"Use the jsptree tool to show parents of the current buffer's file"
(interactive)
(when buffer-file-name
- (save-window-excursion (shell-command (concat "~/bin/jsptree parents " buffer-file-name " | /usr/local/bin/dot -Tpng | /usr/local/bin/display &") nil))))
+ (let ((tmp (concat (file-name-as-directory temporary-file-directory) "parents-of-" (file-name-nondirectory buffer-file-name) ".png")))
+ (save-window-excursion (async-shell-command
+ (concat "~/bin/jsptree parents " buffer-file-name " | /usr/local/bin/dot -Tpng > " tmp " && open " tmp) nil)))))
(defun jsp-children ()
"Use the jsptree tool to show children of the current buffer's file"
(interactive)
(when buffer-file-name
- (save-window-excursion (shell-command (concat "~/bin/jsptree children " buffer-file-name " | /usr/local/bin/dot -Tpng | /usr/local/bin/display &") nil))))
+ (let ((tmp (concat (file-name-as-directory temporary-file-directory) "children-of-" (file-name-nondirectory buffer-file-name) ".png")))
+ (save-window-excursion (async-shell-command
+ (concat "~/bin/jsptree children " buffer-file-name " | /usr/local/bin/dot -Tpng > " tmp " && open " tmp) nil)))))

No commit comments for this range

Something went wrong with that request. Please try again.