[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [O] open file link in dired?
From: |
Alan Schmitt |
Subject: |
Re: [O] open file link in dired? |
Date: |
Fri, 04 Jan 2013 17:12:32 +0100 |
User-agent: |
mu4e 0.9.9.5-dev6; emacs 24.2.1 |
Bastien writes:
> 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.
Thank you, this would work nicely. However I don't know how to specify,
when I open the file, which link-type to use. Would I need to modify the
link itself from "file" to "file+emacs+dired" before opening it?
Alan