2

The following is a very common workflow for me

  1. Open a dired buffer, and place cursor on a file.
  2. Invoke M-x org-store-link.
  3. Visit an org file (that's usually in the same directory), and type C-c C-l RET to insert the link.

This way, org-mode inserts a link like the following:

[[file:some-file.org][file:~/Dropbox/Work/some-file.org]]

which displays on the buffer like this:

file:~/Dropbox/Work/some-file.org

It seems silly that org would use a relative file name for the link's address, but use a long absolute file name for the human-readable description.

I would like to change this automatically created description, so that it always shows just the file name (no directories). In the example above it would look like some-file.org or perhaps file:some-file.org.

How can I customize the automatic description of links inserted with C-c C-l RET?

2

The recommended workflow is the use C-u C-c C-l to insert a file link. That one will be relative to the current directory if possible.

  • I'm sorry, my question was a little misleading. I mean I only want to see the file name, not the relative path. Even if the file is faraway. – Malabarba Jun 25 '15 at 13:52
  • 1
    Still, upvoting because the C-u prefix is helpful here (even if it isn't perfect), and I didn't know about it. – Malabarba Jun 25 '15 at 13:53

Not the answer you're looking for? Browse other questions tagged or ask your own question.