org-rifle icon indicating copy to clipboard operation
org-rifle copied to clipboard

Customizable Reveal

Open dustinlacewell-wk opened this issue 7 years ago • 2 comments

I don't currently like how helm-org-rifle actually reveals the selected entry. Let's say you have something like:

** Tasks
*** TODO Task 1
*** TODO Task 2

If the tree is folded and you rifle to "Tasks" then you get something like

** Tasks
    ...

Eh, I would like to be able to customize this behavior to show the full entry and the collapsed children headings for example.

Great package by the way, very useful.

dustinlacewell-wk avatar Feb 22 '18 21:02 dustinlacewell-wk

Hi Dustin,

That seems like a good idea. The default function for showing entries is helm-org-rifle-show-entry-in-real-buffer, which calls org-show-entry, which says:

"Show the body directly following this heading.
Show the heading too, if it is currently invisible."

So what you probably want to do is call a function other than org-show-entry.

The easiest way to solve this now is for you to clone helm-org-rifle-show-entry-in-real-buffer to a new function with a different name in your config, set that as the helm-org-rifle-show-entry-function, and replace the call to org-show-entry with whatever you need.

Since you've brought this up, it probably makes sense to make the "reveal" function customizable as well, so I'll think about that and maybe do a bit of refactoring there. In the meantime, you should be able to achieve the desired behavior in your config. Let me know if you need any help with that.

Thanks for your feedback.

alphapapa avatar Feb 24 '18 02:02 alphapapa

I had the same issue and adopted your proposed solution @alphapapa . The function I chose is org-show-children (shows the direct children of the entry). It works great!

(use-package helm-org-rifle
  :defer t
  :config
  (defun helm-org-rifle-show-entry-in-real-buffer (candidate)
    "Show CANDIDATE in its real buffer. Modified: see https://github.com/alphapapa/helm-org-rifle/issues/22"
    (helm-attrset 'new-buffer nil)  ; Prevent the buffer from being cleaned up
    (-let (((buffer . pos) candidate))
      (switch-to-buffer buffer)
      (goto-char pos))
    (org-show-children)))

Thanks for the suggestion and for all your work @alphapapa !

sandinmyjoints avatar Mar 24 '19 04:03 sandinmyjoints