开发者

How can I make a singleton bookmark in my org file?

开发者 https://www.devze.com 2023-04-09 06:49 出处:网络
I have an org-mode task list that I keep in version control. I would like to press a key and turn the current position into a bookmark target that I will be able to access anywhere I have the list che

I have an org-mode task list that I keep in version control. I would like to press a key and turn the current position into a bookmark target that I will be able to access anywhere I have the list checked out, regardless of other changes that have been made to the document. This is why (bookmark-set) will not work.

开发者_如何学CAdditionally I would like to ensure that this target only occurs once in the file. If I put the target at a different position I want the original target to go away.

Essentially, I want to combine features of Emacs bookmarks (the singleton aspect), and org-mode links (more robust persistence). What's the best way to do this?


You want to read up about Markers:

M-: (info "(elisp) Markers") RET

This feature is what allows the mark ring to retain its relative locations regardless of buffer changes, for example.

If you want the marker to be stored within the file itself, then you might want to include it as a local variable in the file itself, and use before-save-hook to update that to the current value.

The local variable may need to be an integer, in which case you would need to translate it on loading and saving.

(This is a little speculative, but I suspect it will do the trick.)


The best solution I've been able to come up with is to use the text <<<BOOKMARK>>>, and to search for it when necessary. At some point I might write some functions that place this bookmark and delete it from elsewhere.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号