Like helm-swoop, but faster (bare-bones featurewise, so not a replacement)
| ;;; Code: | |
| ;;;; Requirements | |
| (require 'helm) | |
| ;;;; Commands | |
| ;;;###autoload | |
| (defun helm-swish () | |
| (interactive) | |
| (helm :sources (helm-make-source | |
| (buffer-name (current-buffer)) 'helm-source-swish | |
| :action (helm-make-actions | |
| "Go to line" #'helm-swish-goto-line) | |
| :get-line #'helm-swish-get-line) | |
| :input (thing-at-point 'symbol))) | |
| ;;;; Functions | |
| (defun helm-swish-get-line (beg end) | |
| (let ((line (buffer-substring beg end))) | |
| (add-text-properties 0 (length line) | |
| (list :line-begin beg) | |
| line) | |
| line)) | |
| (defun helm-swish-goto-line (&rest args) | |
| "Sigh" | |
| (goto-char (get-text-property 0 :line-begin (helm-get-selection nil 'withprop)))) | |
| (defun helm-swish-init () | |
| "okay okay" | |
| (helm-init-candidates-in-buffer 'global | |
| (with-helm-current-buffer | |
| (buffer-string)))) | |
| ;;;; Classes | |
| (defclass helm-source-swish (helm-source-in-buffer) | |
| ((init :initform #'helm-swish-init) | |
| (get-line :initform #'buffer-substring) | |
| (allow-dups :initform t) | |
| (follow :initform 1) | |
| (nomark :initform t) | |
| (requires-pattern :initform 1))) | |
| ;;;; Footer | |
| (provide 'helm-swish) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment