I'm using Emacs and org-mode for a while now to organize my todos and notes, which are often linked to files on my local drive or network drives, so I'm often inserting hyperlinks to files or directories into my org-mode files, which is IMHO quite difficult, because I have to find the file/directory with Windows Explorer, then copy the path with PathCopy and then switch to Emacs and insert the hyperlink there.

I'm working with Windows 7 and Emacs 24.1.1. and I wonder what could be better and easier ways to do the same thing:

Access often used directories:
At the moment I have shortcuts to my mostly used directories in the windows explorer and I have a directory with Windows File shortcuts pointing to the most important directories to access them quickly, as network paths are often very long and difficult to remember.

  • How could I use that in Emacs: access the directory with windows shortcuts to my folders or create a similar list of useful hyperlinks in Emacs?
  • Which tools can be used to navigate Windows file systems (and network drives) with Emacs?

1 Answer 1

  • On the org-mode side, you can insert a link with C-c C-l. At the first prompt, enter file: and press enter, you will get a prompt with auto-completion to select the file you want to link to. If you're not too unfamiliar with emacs completion, that's probably the easiest way, along with org-store-link.

  • You could find emacs Bookmarks of interest. Once these are set (that's straightforward), you could, for instance, open these files in emacs with them, and use org-mode's org-store-link and org-insert-link to easily insert org-links to them.

  • You can launch whatever command requires a path (say, find-file), use emacs completion to enter the whole path without pain, not press RET and get the path from the minibuffer, with whichever cut/copy command suits you (C-w will do) (just cancel the find-file with C-g).

    Now you have the path in the emacs kill ring, which you can paste as you like.

  • At last, for links you really insert often, you could create¹ a few bindings to insert them, like :

    (global-set-key [f6] (lambda () (interactive)
                    (insert "/very/long/path/you/don't/want/to/navigate/to/"))

    With which f6 will insert the path you hard-coded there.

¹ If you want to be fancy, you can go for a prefix key and a menu for all your links, but I guess that's not the kind of amount of time/lisp-coding you want to spare for it.

  • thanks a lot for your explanation! Is there a way to open windows file system shortcuts from within Emacs? I can navigate to the folder where I have stored all my important links, but Emacs does not recognize the Windows shortcut files as hyperlinks, but the directory seems to be empty Nov 26, 2012 at 10:18
  • 1
    I have no idea, sorry. I'm suggesting to recreate the shortcuts within emacs, essentially. With bookmarks, it would be quite easy : from windows, open all these important files in many emacs windows, and for each, bookmark (C-x r m if you don't rebind it) and close it, and voilà, you have all your bookmarks in emacs. Nov 26, 2012 at 12:24

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .