Skip to main content
2 of 4
Clarifying intent of my question with an example
Arjay-El
  • 101
  • 1
  • 3

How to create a file link in EMACs that accepts spaces in the text

Revised Question: I want to use file links in org that have spaces in the file names. The 'file://' hyperlink format does not allow spaces in the link. Is there a way to work around this?

Application: I have a directory with several thousand pdf files. All the file names have spaces. Using total Commander I can export a text file have full path information for all the files. I open this in org and use a renamer to add 'file://' to the front of the path information. If there are no spaces in the name, the file link is perfect and I can open the document directly from emacs. I can also add notes I the org file about what is in that document.

For example, I have a path listing like this that I open in an org file:

\Library\March 2015\Gamma Ray Radiation Fundamentals.pdf

I add the file link preface (using a renamer utility):

file://Library\March 2015\Gamma Ray Radiation Fundamentals.pdf

My org file looks something like this:

  • Space Radiation ** Gamma Ray Info
    • file://Library\March 2015\Gamma Ray Radiation Fundamentals.pdf
    • some notes

However the title has spaces so the link stops at the first space. As I have literally thousands of collected papers and books that spaces in the name, adding %20 or even '+' to fill the space is a major task and also makes the linked document title difficult to read especially if you have several lines of such links.

Is there a way to work around this without having to change all the file names to convert or delete the spaces in the file name?

If so, org mode makes a great organizer for large collections of files like I have. It works really well, opening the file for reading.

(Note: I have looked at cliplink.el but I cannot see how I can apply that to a large number of files easily.)

Arjay-El
  • 101
  • 1
  • 3