From mboxrd@z Thu Jan 1 00:00:00 1970 From: Carsten Dominik Subject: Re: [PATCH] respect org-link-file-path-type when inserting docview: links Date: Wed, 9 Dec 2009 11:44:57 +0100 Message-ID: References: <87bpig5bvo.fsf@fastmail.fm> <4B18F110.1020708@jboecker.de> Mime-Version: 1.0 (Apple Message framework v936) Content-Type: text/plain; charset=ISO-8859-1; format=flowed; delsp=yes Content-Transfer-Encoding: quoted-printable Return-path: Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NIK2k-0002Ro-Ax for emacs-orgmode@gnu.org; Wed, 09 Dec 2009 05:45:14 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1NIK2e-0002Lo-L4 for emacs-orgmode@gnu.org; Wed, 09 Dec 2009 05:45:13 -0500 Received: from [199.232.76.173] (port=39621 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NIK2e-0002Le-E1 for emacs-orgmode@gnu.org; Wed, 09 Dec 2009 05:45:08 -0500 Received: from mail-ew0-f209.google.com ([209.85.219.209]:64306) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1NIK2d-0000he-V2 for emacs-orgmode@gnu.org; Wed, 09 Dec 2009 05:45:08 -0500 Received: by ewy1 with SMTP id 1so3858407ewy.8 for ; Wed, 09 Dec 2009 02:45:06 -0800 (PST) In-Reply-To: <4B18F110.1020708@jboecker.de> List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: =?ISO-8859-1?Q?Jan_B=F6cker?= Cc: Matthew Lundin , Org Mode Hi Jan, thanks for the fix, I have applied it. - Carsten On Dec 4, 2009, at 12:22 PM, Jan B=F6cker wrote: > This patch is also in the docview branch at: > http://github.com/jboecker/org-docview > > The function org-insert-link checks if it is inserting a "file:" link. > If this is the case, the path is manipulated according to the current > buffer file name and the variable 'org-link-file-path-type'. > > I changed the regex to also match "docview:" links, and added a =20 > variable > to store the link type which is later re-attached to the path. > > I do not know if there is a more elegant way, but this works. > > Matthew: docview.el was missing from the Makefile because of my > inexperience with Org development, but I see that Carsten has already > fixed that one :) > > --- > lisp/ChangeLog | 5 +++++ > lisp/org.el | 7 ++++--- > 2 files changed, 9 insertions(+), 3 deletions(-) > > diff --git a/lisp/ChangeLog b/lisp/ChangeLog > index f385b7c..a716042 100755 > --- a/lisp/ChangeLog > +++ b/lisp/ChangeLog > @@ -1,3 +1,8 @@ > +2009-12-04 Jan B=F6cker > + > + * org.el (org-insert-link): respect org-link-file-path-type for > + docview: links in addition to file: links. > + > 2009-12-03 Carsten Dominik > > * org-exp.el (org-export-format-source-code-or-example): Avoid > diff --git a/lisp/org.el b/lisp/org.el > index 664bafc..4f699c9 100644 > --- a/lisp/org.el > +++ b/lisp/org.el > @@ -7976,8 +7976,9 @@ Use TAB to complete link prefixes, then RET for > type-specific completion support > (setq link search))))) > > ;; Check if we can/should use a relative path. If yes, simplify > the link > - (when (string-match "^file:\\(.*\\)" link) > - (let* ((path (match-string 1 link)) > + (when (string-match "^\\(file:\\|docview:\\)\\(.*\\)" link) > + (let* ((type (match-string 1 link)) > + (path (match-string 2 link)) > (origpath path) > (case-fold-search nil)) > (cond > @@ -7998,7 +7999,7 @@ Use TAB to complete link prefixes, then RET for > type-specific completion support > (setq path (substring (expand-file-name path) > (match-end 0))) > (setq path (abbreviate-file-name (expand-file-name = path))))))) > - (setq link (concat "file:" path)) > + (setq link (concat type path)) > (if (equal desc origpath) > (setq desc path)))) > > --=20 > 1.6.5.2 > > > > _______________________________________________ > Emacs-orgmode mailing list > Please use `Reply All' to send replies to the list. > Emacs-orgmode@gnu.org > http://lists.gnu.org/mailman/listinfo/emacs-orgmode - Carsten