Skip to content

Instantly share code, notes, and snippets.

@hchbaw
Created July 6, 2009 11:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hchbaw/141387 to your computer and use it in GitHub Desktop.
Save hchbaw/141387 to your computer and use it in GitHub Desktop.
(require 'cl)
(defun* azs-make-source
(arg &optional name (skipp #'(lambda (s)
(equal
anything-zsh-screen-zle-line-source-name
(anything-attr 'name s)))))
(let* ((arg (concat (replace-regexp-in-string "[[:space:]]+$" "" arg) " "))
(name (or name (concat arg "(zsh screen)")))
(anything-source-name name))
(with-current-buffer (anything-candidate-buffer 'global)
(let ((anything-zsh-screen-run-awaits 99999)
(anything-zsh-screen-scrollback 99999))
(loop for (_ . x) in
(anything-attr 'candidates
(find-if-not skipp
(azs-get-sources arg)))
do (insert x "\n"))))
`((name . ,name)
(candidates-in-buffer)
(action . insert))))
(defun azs-zsh-glob->path (zg)
(shell-command-to-string (concat "echo -n "
"${(j.:.)${(f)\""
"$(print -l " zg ")"
"\"}}")))
;; (azs-zsh-glob->path "{/dev/input/,/etc/rc*.d/}")
(defvar azs-jcp-glob
(funcall (lambda (&rest x)
(let ((fmt (if (cdr x) "{%s}" "%s")))
(format fmt (mapconcat #'identity x ","))))
"/usr/lib/jvm/java-6-sun/jre/lib/rt.jar"
))
(defvar anything-c-zsh-screen-java-class
(azs-make-source (concat "java -cp "
(mapconcat #'identity
swank-clojure-extra-classpaths
":")
":"
(azs-zsh-glob->path azs-jcp-glob)
" ")
"java -cp class (zsh screen)"))
;; (anything '(anything-c-zsh-screen-java-class))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment