From mboxrd@z Thu Jan 1 00:00:00 1970 From: Alan Schmitt Subject: Re: open file link in dired? Date: Fri, 04 Jan 2013 17:12:32 +0100 Message-ID: References: ,<87vcbdlz75.fsf@bzg.ath.cx> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([208.118.235.92]:35102) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Tr9sz-0007MN-17 for emacs-orgmode@gnu.org; Fri, 04 Jan 2013 11:12:46 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Tr9sx-0006UL-IZ for emacs-orgmode@gnu.org; Fri, 04 Jan 2013 11:12:44 -0500 Received: from mail1-relais-roc.national.inria.fr ([192.134.164.82]:7027) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Tr9sx-0006UF-BY for emacs-orgmode@gnu.org; Fri, 04 Jan 2013 11:12:43 -0500 In-reply-to: <87vcbdlz75.fsf@bzg.ath.cx> List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: Bastien Cc: "emacs-orgmode@gnu.org" Bastien writes: > Hi Alan, > > Alan Schmitt 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