zoukankan      html  css  js  c++  java
  • How to create relative hyperlinks in Org mode?

    Relative hyperlinks are indispensable for maintaining a bunch of inter-connected documents that have a fixed relative folder structure, when the whole folder tree is to be mounted at different locations on different computers. In Emacs Org mode, the fast key to insert a hyperlink is C-c C-l, which is bound to the function org-insert-link. However, according to its documentation below, we can only input a relative path at the prompt in the mini-buffer by pressing the key combination C-u C-c C-l, while the internal representation of the hyperlink still adopts an absolute path. This is not what I want.

    With a C-u prefix, prompts for a file to link to. The file name can be selected using completion. The path to the file will be relative to the current directory if the file is in the current directory or a subdirectory. Otherwise, the link will be the absolute path as completed in the minibuffer (i.e. normally ~/path/to/file). You can configure this behavior using the option `org-link-file-path-type'.

    By further checking the documentation of the variable org-link-file-path-type mentioned above, we know that it is this variable that actually controls the internal hyperlink format. Valid values of this variable are:

    • relative: the path name in file links is stored relative to the current directory;
    • absolute: absolute path name is adopted, while the home directory is still represented as ~/;
    • noabbrev: same as absolute but there is no abbreviation for the home directory;
    • adaptive: use relative path for files in the current directory and subdirectories of it, while for other files, use an absolute path.

    Then, the configuration added to ~/.emacs for enabling relative hyperlinks in Org mode is as below.

    (setq org-link-file-path-type 'relative)
      子曰:“君子食无求饱,居无求安,敏于事而慎于言,就有道而正焉,可谓好学也已。”
  • 相关阅读:
    阿里云磁盘扩容
    【Vue】WebPack 忽略指定文件或目录
    MySQL 全文索引 (FullText)
    产品设计
    13-Java面向对象-抽象类与接口
    06-数据存储
    07-网络与通信-02-Android中基于HTTP的通信技术
    10-Android 广播接收器 BroadcastReceiver
    09-Android 中 AIDL 的理解与使用
    09-Android 中 AIDL 的理解与使用
  • 原文地址:https://www.cnblogs.com/quantumman/p/14459997.html
Copyright © 2011-2022 走看看