[Top][All Lists]

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

Re: Reftex syntax table entry for "-"

From: Kevin Rodgers
Subject: Re: Reftex syntax table entry for "-"
Date: Wed, 07 Feb 2007 02:28:44 -0700
User-agent: Thunderbird (Macintosh/20061207)

Lawrence Mitchell wrote:
Please describe exactly what actions triggered the bug
and the precise symptoms of the bug:

reftex-parse-bibtex-entry uses a syntax table in which "-" is not a
word constituent.  This has the consequence that if a bibtex field
name contains a hyphen, the entry will be incorrectly parsed.  For
example, consider the following entry:

Is "-" a symbol constituent in that syntax table?  Can other symbol
constituent characters besides hyphen occur in bibtex field names?
If so, perhaps it'd be better to use "\\s_" instead of "-" below.

author = {A.N. Other},
title = {Some title},
journal = {A Journal},
volume = 1,
pages = {1--10},
year = 2001,
Local-URL = {file://path/to/local/copy/of/paper},
url = {http://url/from/which/paper/was/obtained}

reftex-parse-bibtex-entry on this entry returns:

(("url" . "http://url/from/which/paper/was/obtained";) ("url" . "file://path/to/local/copy/of/paper")
 ("year" . "2001")
 ("pages" . "1--10")
 ("volume" . "1")
 ("journal" . "A Journal")
 ("title" . "Some title")
 ("author" . "A.N. Other")
 ("&type" . "article")
 ("&key" . "test"))

Note that the "Local-URL" field has been turned into a "url" field
which now appears twice (with two different values).

The culprit is this regular expression in reftex-parse-bibtex-entry:

"\\(\\w+\\)[ \t\n\r]*=[ \t\n\r]*"

if this is changed to:

"\\(\\(?:\\w\\|-\\)+\\)[ \t\n\r]*=[ \t\n\r]*"

then "-" is treated as a valid field character and everything works
properly.  Alternately, one can make "-" a word constituent in the
reftex syntax table:

(modify-syntax-entry ?\- "w" reftex-syntax-table-for-bib)

If either of these two strategies are adopted, then
reftex-parse-bibtex-entry performs as expected, producing, for the
above bibtex entry:

(("url" . "http://url/from/which/paper/was/obtained";)
 ("local-url" . "file://path/to/local/copy/of/paper")
 ("year" . "2001")
 ("pages" . "1--10")
 ("volume" . "1")
 ("journal" . "A Journal")
 ("title" . "Some title")
 ("author" . "A.N. Other")
 ("&type" . "article")
 ("&key" . "test"))

In GNU Emacs (i686-pc-linux-gnu, X toolkit)
 of 2006-05-09 on lamacq.ph.ed.ac.uk
X server distributor `The X.Org Foundation', version 11.0.60802000
configured using `configure '--prefix' '/scratch/s0198183/applications/emacs' 
'--with-x' '--without-xim''



Kevin Rodgers
Denver, Colorado, USA

reply via email to

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