Created
July 9, 2015 17:41
-
-
Save juxtin/191c455f31da40ba0d0f to your computer and use it in GitHub Desktop.
helm-clojure-headlines
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defun helm-clojure-headlines () | |
"Display headlines for the current Clojure file." | |
(interactive) | |
(setq helm-current-buffer (current-buffer)) ;; Fixes bug where the current buffer sometimes isn't used | |
(jit-lock-fontify-now) ;; https://groups.google.com/forum/#!topic/emacs-helm/YwqsyRRHjY4 | |
(helm :sources (helm-build-in-buffer-source "Clojure Headlines" | |
:data (with-helm-current-buffer | |
(goto-char (point-min)) | |
(cl-loop while (re-search-forward "^(\\|testing\\|^;.*[a-zA-Z]+" nil t) | |
for line = (buffer-substring (point-at-bol) (point-at-eol)) | |
for pos = (line-number-at-pos) | |
collect (propertize line 'helm-realvalue pos))) | |
:get-line 'buffer-substring | |
:action (lambda (c) (helm-goto-line c))) | |
:buffer "helm-clojure-headlines")) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment