简体   繁体   中英

emacs org-mode: folder alias for links in org-files

I'm using org-files in emacs for documentation. Is there a possibility to define an alias for a folder inside an org-file? Motivation: Say I have several file-links which belong to the same folder. If I move the files I have to change all this links. It would be easier to change only one folder-alias. Is this possible?

In your init.el or .emacs file, you can define the variable org-link-abbrev-alist by doing the following:

(setq org-link-abbrev-alist
   '(("directory1"  . "c:/Path/") ;; Windows
     ("directory2"  . "~/Path/"))) ;; Linux/OSX

Alternatively, if you don't want these settings to apply to all your files, you can just put the following in the header of the org-mode files you DO want the settings to apply to:

#+LINK: directory1 c:/Path/
#+LINK: directory2 ~/Path/

To then link to these files from within your file(s), use the following:

[[directory1:file1.txt][file1.txt]]

If / when you move the directory, just change the abbreviations. Additional information in the Org-mode Manual: Link abbreviations

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM