Ihor Radchenko <yanta...@gmail.com> writes:

> "Christopher M. Miles" <numbch...@gmail.com> writes:
>
>> I'm using package "consult" which has command "consult-org-heading" to 
>> search org headlines. It will
>> auto jump to the selected headline and expand the jumped headline. After 
>> using org-fold, it does not
>> auto jump to the headline now.
>>
>> The previous discussion here as reference 
>> https://github.com/minad/consult/issues/563.
>>
>> As @minad mentioned we need to wait for org-fold provide an official API to 
>> reveal content. Hope
>> this can be added to org-fold plan.
>
> I reviewed the available API and realized that Org actually does provide
> sufficient functionality to reveal search matches temporarily. (there
> was a bug in that area, but I already fixed it)
>
> The basic idea is demonstrated in a simple function below:
>
> (defun test (pos)
>   (interactive "nEnter point to be revealed: ")
>   (read-char "Revealing point temporarily. Press any key...")
>   (save-excursion
>     (org-fold-save-outline-visibility nil
>       (goto-char pos)
>       (org-fold-show-set-visibility 'local)
>       (read-char "About to restore the previous fold state. Press any 
> key...")))
>   (read-char "Now, reveal the point permanently. Press any key...")
>   (goto-char pos)
>   (org-fold-show-set-visibility 'local))
>
> Hope it helps.
>
> Best,
> Ihor

Interesting, I tested and confirmed this works good. Thanks for demonstrating. 
I will figure out
consult-org-heading command part.

-- 
[ stardiviner ]
       I try to make every word tell the meaning that I want to express.

       Blog: https://stardiviner.github.io/
       IRC(freenode): stardiviner, Matrix: stardiviner
       GPG: F09F650D7D674819892591401B5DF1C95AE89AC3

Attachment: signature.asc
Description: PGP signature

Reply via email to