Hi Alan,

Alan Schmitt <alan.schm...@polytechnique.org> writes:

> My google-fu has failed me, and
> http://orgmode.org/manual/Handling-links.html does not seem to have the
> answer: is it possible to open a file link in dired (i.e., a dired
> buffer in the enclosing directory with the cursor on the file)?

I'd do something like this:

(org-add-link-type "file+emacs+dired" 'org-open-file-with-emacs-dired)

(defun org-open-file-with-emacs-dired (path)
  "Open in dired."
  (let ((d (file-name-directory path))
        (f (file-name-nondirectory path)))
    (dired d)
    (goto-char (point-min))
    (search-forward f nil t)))

which will work for a new link type file+emacs+dired.

But you can also setup `org-link-frame-setup' so that the function
associated to the file entry does the right thing for you.

HTH,

-- 
 Bastien

Reply via email to