Created
December 1, 2017 08:47
-
-
Save alphapapa/ce6cf8a85d8a28c3a2f146057772ec8d to your computer and use it in GitHub Desktop.
Like helm-swoop, but faster (bare-bones featurewise, so not a replacement)
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
;;; 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