如何在我的组织文件中创建单一书签?

发布于 2024-12-06 21:44:56 字数 251 浏览 0 评论 0原文

我有一个保存在版本控制中的 org-mode 任务列表。我想按一个键并将当前位置转换为书签目标,无论对文档进行其他更改如何,我都可以在签出列表的任何位置访问该书签目标。这就是 (bookmark-set) 不起作用的原因。

此外,我想确保该目标仅在文件中出现一次。如果我将目标放在不同的位置,我希望原始目标消失。

本质上,我想结合 Emacs 书签的功能(单例方面)和 org-mode 链接(更强大的持久性)。最好的方法是什么?

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.

Additionally 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?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

逆蝶 2024-12-13 21:44:56

您想阅读有关标记的信息:

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

此功能允许标记环例如,无论缓冲区如何变化,都保留其相对位置。

如果您希望标记存储在文件本身中,那么您可能希望将其作为本地变量包含在文件本身中,并使用 before-save-hook 将其更新为当前值。

局部变量可能需要是整数,在这种情况下,您需要在加载和保存时对其进行转换。

(这有点推测,但我怀疑它会起作用。)

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.)

旧人哭 2024-12-13 21:44:56

我能想到的最佳解决方案是使用文本 <<>>,并在必要时搜索它。在某些时候,我可能会编写一些函数来放置此书签并从其他地方删除它。

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文