gpt4 book ai didi

emacs - 如何在组织模式下使用更简单的链接语法?

转载 作者:行者123 更新时间:2023-12-03 00:09:31 24 4
gpt4 key购买 nike

我希望使用语法 [[foo bar]] 链接到名为 foo bar.org 的文件。这将使使用组织模式更像使用个人本地维基。

这是否可以在不破坏现有链接功能的情况下实现?理想情况下,我仍然能够使用标准组织模式工具导出为 html 等。

我能做的最好的事情是:(setq org-link-abbrev-alist '(("o". "file:%s.org")))

这让我可以使用语法[[o:foo bar]],但它更加冗长,并且内联看起来丑陋得令人分心。例如:快速的棕色 o:fox 跳过 o:lazy_dog。而且 [[o:foo bar][foo bar]] 的输入和编辑更加冗长(尽管在组织模式下读起来很好)。

最佳答案

我没有现成的解决方案,也不是程序员,但这部分在org.el中是 self 记录的,您可以编写专门的链接搜索功能。我引用:

"List of functions to execute a file search triggered by a link.

Functions added to this hook must accept a single argument, the searchstring that was part of the file link, the part after the doublecolon. The function must first check if it would like to handle thissearch, for example by checking the `major-mode' or the fileextension. If it decides not to handle this search, it should justreturn nil to give other functions a chance. If it does handle thesearch, it must return a non-nil value to keep other functions fromtrying.

Each function can access the current prefix argument through thevariable `current-prefix-arg'. Note that a single prefix is used toforce opening a link in Emacs, so it may be good to only use a numericor double prefix to guide the search function.

In case this is needed, a function in this hook can also restore thewindow configuration before `org-open-at-point' was called using:

(set-window-configuration org-window-config-before-follow-link)")

另请参阅Hyperlinks :: Custom Searches @ gnu.org

关于emacs - 如何在组织模式下使用更简单的链接语法?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21085720/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com