From mboxrd@z Thu Jan 1 00:00:00 1970 From: Bastien Subject: Re: open file link in dired? Date: Fri, 04 Jan 2013 17:33:53 +0100 Message-ID: <87ehi0lxfy.fsf@bzg.ath.cx> References: <87vcbdlz75.fsf@bzg.ath.cx> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Return-path: Received: from eggs.gnu.org ([208.118.235.92]:39202) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TrADU-0007CG-Uo for emacs-orgmode@gnu.org; Fri, 04 Jan 2013 11:33:57 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TrADU-0004hV-1U for emacs-orgmode@gnu.org; Fri, 04 Jan 2013 11:33:56 -0500 Received: from mail-wg0-f46.google.com ([74.125.82.46]:34078) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TrADT-0004hI-QS for emacs-orgmode@gnu.org; Fri, 04 Jan 2013 11:33:55 -0500 Received: by mail-wg0-f46.google.com with SMTP id dr13so7507262wgb.13 for ; Fri, 04 Jan 2013 08:33:55 -0800 (PST) In-Reply-To: (Alan Schmitt's message of "Fri, 04 Jan 2013 17:12:32 +0100") 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: Alan Schmitt Cc: "emacs-orgmode@gnu.org" --=-=-= Content-Type: text/plain Hi Alan, Alan Schmitt writes: > 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? Trying loading the attached .el file to get a new "dired" type. Very crude but should work. --=-=-= Content-Type: application/emacs-lisp Content-Disposition: attachment; filename=dired-link-type.el Content-Transfer-Encoding: 8bit (org-add-link-type "file+emacs+dired" 'org-open-file-with-emacs-dired) (add-hook 'org-store-link-functions 'org-dired-store-link) (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))) (defun org-dired-store-link () "Store link to files/directories from dired." (require 'dired-x) (when (eq major-mode 'dired-mode) (let ((f (dired-filename-at-point))) (setq link (concat "file+emacs+dired" ":" f) desc (concat f " (dired)")) (org-add-link-props :link link :description desc) link))) --=-=-= Content-Type: text/plain -- Bastien --=-=-=--