emacs-pretest-bug
[Top][All Lists]
Advanced

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

Reftex syntax table entry for "-"


From: Lawrence Mitchell
Subject: Reftex syntax table entry for "-"
Date: Tue, 06 Feb 2007 16:54:54 +0000
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (gnu/linux)

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:

@article{test,
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 22.0.50.1 (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''

Cheers,

Lawrence
-- 
Lawrence Mitchell <address@hidden>




reply via email to

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