I need to represent absolute paths to several directories by some constant names to use them as prefixes in org mode for a number of files contained in each of these directories. For instance they could be declared somewhere (in .emacs ?) as :

DIR1 : /path/to/directory_name1
DIR2 : /path/to/directory_name2

etc, and then use these abbreviations in org files as :


and so on. I have try to declare these paths in some org file as :

#+LINK: DIR1 /path/to/directory_name1

and try to use it as :


but this does not work. If the org file currently used is located in, for instance, /path/to/directory9, emacs tries to open the file /path/to/directory9/DIR1/some_file.pdf which is not what I wanted (i.e., /path/to/directory_name1/some_file.pdf) !

Maybe the preceding was not sufficient clear. I give below another example in another context, using 'bibtex' syntax, where it is possible to define a global path to some directory using, in a file some.bib :

@STRING{PDFS = "/some/path/to/pdfs/"}

Then, it is easy to use 'PDFS' in the file some.bib as a prefix for a large number of file.pdf (thousands). For instance :

user = PDFS # "some_author/2011.00910.pdf"

But, if, for some reason, the directory pdfs is moved somewhere else or if the file some.bib is used in another machine where the pdfs directory must be different, it is simple to adjust the new path by editing the global definition, in only one place :

@STRING{PDFS = "/another/path/to/pdfs/"}

This will be very useful if a similar coding scheme can be used in org files. Thus, I will be very astonished if a similar syntax does not exist in emacs !

Hope somebody knows a solution.

  • Try #+LINK: DIR1 file:/path/to/direectory_name1 and [[DIR1/some_file.pdf]]- does that work? – NickD May 17 at 1:15
  • That does not seem to work :-( – NickD May 17 at 12:58
  • @NickD. No, that does not work. – P. Daegelen May 18 at 7:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.