HACK: Fix search in folded sections in org-mode

This commit is contained in:
coolneng 2022-11-30 15:02:19 +01:00
parent 68f5d3c8ab
commit 148afa2091
Signed by: coolneng
GPG Key ID: 9893DA236405AF57
1 changed files with 24 additions and 0 deletions

24
+org.el
View File

@ -183,3 +183,27 @@
(setq org-goto-interface 'outline-path-completion (setq org-goto-interface 'outline-path-completion
org-goto-max-level 1) org-goto-max-level 1)
(use-package! org-capture-ref) (use-package! org-capture-ref)
;; HACK Fix search folded sections
(after! org-fold-core
(defun org-show-current-heading-tidily ()
(interactive) ;Inteactive
"Show next entry, keeping other entries closed."
(if (save-excursion (end-of-line) (outline-invisible-p))
(progn (org-show-entry) (show-children))
(setq-local my:current_line (line-number-at-pos))
(outline-back-to-heading)
(unless (and (bolp) (org-on-heading-p))
(org-up-heading-safe)
(hide-subtree)
(error "Boundary reached"))
(org-overview)
(org-reveal t)
(org-show-entry)
(show-children)
(goto-line my:current_line)))
(defun qw/search-buffer ()
(interactive)
(org-fold-show-all)
(+default/search-buffer)
(org-show-current-heading-tidily)))
(map! :leader :n "s s" #'qw/search-buffer)