emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [O] open file link in dired?


From: Bastien
Subject: Re: [O] open file link in dired?
Date: Fri, 04 Jan 2013 16:55:58 +0100
User-agent: Gnus/5.130006 (Ma Gnus v0.6) Emacs/24.3.50 (gnu/linux)

Hi Alan,

Alan Schmitt <address@hidden> 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

[Prev in Thread] Current Thread [Next in Thread]