emacsorphanage / helm-swoop

Efficiently hopping squeezed lines powered by Emacs helm interface
GNU General Public License v3.0
689 stars 55 forks source link

helm-swoop in org subtree #110

Open talwrii opened 7 years ago

talwrii commented 7 years ago

I found myself really wanting this feature, and imagine many org users would be interested in this. However it may well be beyond the scope of this library

I ended up implementing this myself

(defun hf-helm-swoop-region (&optional start end)
  (interactive (list nil nil))
  (narrow-to-region (or start (region-beginning)) (or end (region-end)))
  (helm-swoop)
  (widen))

(defun hf-helm-swoop-org-subtree ()
  (interactive)
  (apply 'hf-helm-swoop-region (hf-org-region) ))

(defun hf-org-region (&optional point)
  (setq point (point))
  (save-excursion
    (goto-char point)
    (list
     (progn
       (org-back-to-heading)
       (point))
     (org-end-of-subtree))))