From 13d6081b6aad61660d4a300ba1574a9da131c95d Mon Sep 17 00:00:00 2001 From: coolneng Date: Wed, 30 Nov 2022 15:02:19 +0100 Subject: [PATCH] HACK: Fix search in folded sections in org-mode --- +org.el | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/+org.el b/+org.el index 92d15da..acd0e5f 100644 --- a/+org.el +++ b/+org.el @@ -183,3 +183,27 @@ (setq org-goto-interface 'outline-path-completion org-goto-max-level 1) (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)