pawel_winzig
pawel_winzig

Reputation: 912

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?

Upvotes: 3

Views: 1534

Answers (1)

sk8ingdom
sk8ingdom

Reputation: 251

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

Upvotes: 6

Related Questions