emacs-wiki-discuss
[Top][All Lists]
Advanced

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

Re: [emacs-wiki-discuss] bibtex url under Windows


From: Angus Lees
Subject: Re: [emacs-wiki-discuss] bibtex url under Windows
Date: Mon, 07 Feb 2005 09:59:27 +1100
User-agent: Wanderlust/2.10.1 (Watching The Wheels) XEmacs/21.4 (Corporate Culture)

At Sat, 05 Feb 2005 00:00:11 -0500, Wei-Hao Lin wrote:
> The bibtex url under Windows cannot be correctly parsed by
> planner-bibtex-browse-url in planner-bibtex.el,
> 
> ,----
> | (defun planner-bibtex-browse-url (url)
> |   "If this is a Bibtex URL, jump to it."
> |   (when (string-match "^bibtex:\\([^:]+\\):\\(.+\\)" url)
> |     (let ((file (match-string 1 url))
> |       (label (match-string 2 url)))
> `----
> 
> For example, "bibtex:c:/foo/bar.bib:reference:key" will be wrongly
> parsed as "file"="c", "label"="/foo/bar.bib:reference:key", while the
> correct result should be "file"="c:/foo/bar.bib",
> "label"="reference:key".  I can replace the regular expression with the
> following one,
> 
> "^bibtex:\\([a-z]+:[^:]+\\):\\(.+\\)"
> 
> where "[a-z]+" catches a Windows drive, but the better solution should
> have the regular expression set according to operation systems, but
> I'm not sure how to do that.

How about anchoring at the end of the string:

-  (when (string-match "^bibtex:\\([^:]+\\):\\(.+\\)" url)
+  (when (string-match "^bibtex:\\(.+\\):\\([^:]+:[^:]+\\)$" url)

Or is the label not always "reference:key"?  (I have never really used
bibtex properly)

-- 
 - Gus




reply via email to

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