alphapapa / org-bookmark-heading

Emacs bookmark support for Org-mode
GNU General Public License v3.0
93 stars 8 forks source link

Do not create ID when bookmarking entire org file #25

Closed schwurg closed 11 months ago

schwurg commented 11 months ago

Hi Adam,

when bookmarking while org-bookmark-heading-make-ids is set to t and point is on the #+TITLE line (i.e. before the first heading), currently an ID is created and the PROPERTIES folder is inserted before the #+TITLE line. I think, in this case it would be better not to create an ID, wouldn't it? If you agree, I could provide a pull request for the (rather trivial) change.

BTW: Thanks for this package! I came across it just some days ago by reading Sasha's emacs news and I am using it already exhaustively. And, a little off-topic: Thanks for the great org-ql package as well!

Best regards, Tim.

alphapapa commented 11 months ago

Hi Tim,

Well, I'm not sure, actually. Theoretically, using the ID property might allow Org to find the file even if it were renamed in the future, but I haven't tested that with document-level properties. If so, that could be a useful benefit. Of course, I can understand one's not wanting to have a document-level properties drawer created where one didn't exist before (I actually argued against such a feature in Org, but I lost that argument).

Anyway, if we were to add an option for this, it would probably need to allow the user to distinguish between whether the document-level drawer exists or not.

Also, I plan to try to upstream this library into Org, so in order to accept more than 15 lines of changes, you'd need to sign the FSF copyright assignment for Emacs. Have you done that?

BTW: Thanks for this package! I came across it just some days ago by reading Sasha's emacs news and I am using it already exhaustively. And, a little off-topic: Thanks for the great org-ql package as well!

Thanks, I'm glad to hear it. I'm working on some more improvements for org-ql also (like searching subtrees, which I think is going to be very useful), and I just pushed some fixes to master. Feel free to test. :)

schwurg commented 11 months ago

Dear Adam,

I get your point. I was not aware that document-level property drawers are supported by org. Your use case to have a working bookmark even if the file was renamed sounds reasonable. And it seems to work at least when calling org-id-update-id-locations after changing the filename.

I just realized that I can achieve my desired behavior of never adding a document-level property drawer simply by setting org-bookmark-heading-make-ids to a function like this:

(lambda () (not (org-before-first-heading-p)))

Thus, no code change of your library is needed at all. Sorry that I did not come across this solution earlier.

Regarding FSF copyright assignment: Unfortunately I did not yet sign the assignment.

alphapapa commented 11 months ago

Ok, thanks, I'll close the issue then. If it comes up again, we can revisit the decision to add an option.