org-roam / org-roam-bibtex

Org Roam integration with bibliography management software
GNU General Public License v3.0
565 stars 47 forks source link

org-capure-finish did not close capture buffer, but maximized it. #271

Closed wztdream closed 1 year ago

wztdream commented 1 year ago

Describe the bug Suppose I add a node through orb-edit-note, what I expected is that:

  1. pop up a window, let me choose which template to use. [correct]
  2. enter a buffer based on the chosen template. [correct]
  3. C-c C-c to finish the capture, close the capture window [wrong]

But at step3, it actually will maximize the node window.

To Reproduce Steps to reproduce the behavior: suppose we are going to add a new node that did not exist.

  1. org-edit-note
  2. chose the template
  3. C-c C-c to finish the capture, the new node is maximize, instead of closed

Expected behavior The new added node should be closed, as this is the normal org-capture setting to avoid disturbing the user.

This should due this this line of hard coding: https://github.com/org-roam/org-roam-bibtex/blob/c87acc2d5685ba2608e2bd1f128e723f1de9d837/org-roam-bibtex.el#L591-L592

I think it is better to to setting the behavior of finalize to return to original buffer before the capture, just like normal org-capture did. Or at list allow user to customize the behavior.

myshevchuk commented 1 year ago

Hi @wztdream,

sorry for a late response: I've just seen an email notification of your request.

Thank you to pointing out to the unwanted behavior of finalize. The thing is, it is not native to Org-capture but is rather an Org-roam addition, which was also adopted into ORB. In any case, I fully agree with you that the user should be free to choose the behaviour they want, especially since the original Org-capture allows to fine tune this. I've now fixed this to stay in the current buffer. Please excuse me once again for such a long wait.

For those used to jumping to the newly created note, please set the :jump-to-captured property to t, e.g.

(setq org-roam-capture-templates
  '(("r" "Literature reference" plain
           ...
           :target ...
           :jump-to-captured t
   ...

and see org-capture-templates for details.