Created
January 11, 2016 23:28
-
-
Save kenoss/365b6a12b3fe61164ebe to your computer and use it in GitHub Desktop.
helm-occur for org headers
This file contains hidden or 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
;;; helm in org | |
(defclass keu-helm-source-multi-occur-org-headers (helm-source-multi-occur) | |
((search :initform '(keu-helm-occur-org-headers-search)) | |
; (search-strict :initform t) | |
(matchplugin :initform nil))) | |
;; Mimic of helm-occur. IT IS A MIMIC! | |
(defun keu-helm-occur-org-headers () | |
"helm-occur for org headers." | |
(interactive) | |
(helm-occur-init-source) | |
;; Terrible! | |
(let1 helm-source-occur (helm-make-source "Occur org headers" 'keu-helm-source-multi-occur-org-headers) | |
(let ((bufs (list (buffer-name (current-buffer))))) | |
(helm-attrset 'moccur-buffers bufs helm-source-occur) | |
(helm-set-local-variable 'helm-multi-occur-buffer-list bufs) | |
(helm-set-local-variable | |
'helm-multi-occur-buffer-tick | |
(cl-loop for b in bufs | |
collect (buffer-chars-modified-tick (get-buffer b))))) | |
(helm :sources (list helm-source-occur) | |
:buffer "*helm occur*" | |
:history 'helm-grep-history | |
:preselect (and (memq 'helm-source-occur helm-sources-using-default-as-input) | |
(format "%s:%d:\t" (buffer-name) (line-number-at-pos (point)))) | |
:truncate-lines t))) | |
(defun keu-helm-occur-org-headers-search (pattern) | |
(helm-candidates-in-buffer-search-default-fn (concat "^\\*+ .*" pattern))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment