[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
BibTeX-mode: bibtex-user-optional-fields: INIT without {}
From: |
Christian Schlauer |
Subject: |
BibTeX-mode: bibtex-user-optional-fields: INIT without {} |
Date: |
Thu, 12 Apr 2007 22:28:24 +0200 |
User-agent: |
Gnus/5.11 (Gnus v5.11) Emacs/22.0.97 (gnu/linux) |
Hello!
It is possible to define additional fields for BibTeX entries. This is
done with the variable `bibtex-user-optional-fields':
,----[ From C-h v bibtex-user-optional-fields RET ]
| Documentation:
| List of optional fields the user wants to have always present.
| Entries should be of the same form as the OPTIONAL and
| CROSSREF-OPTIONAL lists in `bibtex-entry-field-alist' (which see).
`----
,----[ From C-h v bibtex-entry-field-alist RET ]
| Each element of these lists is a list of the form
| (FIELD-NAME COMMENT-STRING INIT ALTERNATIVE-FLAG).
| COMMENT-STRING, INIT, and ALTERNATIVE-FLAG are optional.
| FIELD-NAME is the name of the field, COMMENT-STRING is the comment that
| appears in the echo area, INIT is either the initial content of the
| field or a function, which is called to determine the initial content
| of the field, and ALTERNATIVE-FLAG (either nil or t) marks if the
| field is an alternative. ALTERNATIVE-FLAG may be t only in the
| REQUIRED or CROSSREF-REQUIRED lists.
`----
The problem is with INIT: in Emacs 21.3, setting INIT of an additional
field (here called "chrsc") to "Summary: " created this:
OPTchrsc = {Summary: },
But in Emacs 22.0.97, I get this:
OPTchrsc = Summary: ,
So the curly braces are missing. This is a problem when pressing C-c
C-c (`bibtex-clean-entry'), see below.
Recipe to reproduce the bug:
1. emacs -q --no-site-file
2. Evaluate the following in the *scratch* buffer:
--8<---------------cut here---------------start------------->8---
(add-hook 'bibtex-mode-hook
(lambda ()
(add-to-list 'bibtex-user-optional-fields
'("chrsc" "Personal summary (ignored)"
"Summary: "))))
--8<---------------cut here---------------end--------------->8---
(Alternatively, use M-x customize-variable bibtex-user-optional-fields
RET.)
3. C-x C-f foo.bib RET C-c C-e M gives a buffer containing:
@Misc{,
OPTkey = {},
OPTauthor = {},
OPTtitle = {},
OPThowpublished = {},
OPTmonth = {},
OPTyear = {},
OPTnote = {},
OPTchrsc = Summary: ,
OPTannote = {}
}
Write `long long text.' behind `Summary: ' and press C-c C-c. You get
`Syntactically incorrect BibTeX entry starts here.'
A `Misc' entry has no required fields, so nothing is missing *except*
the curly braces around the `Summary: long long text.' entry. Add
these curly braces, and C-c C-c works.
This worked as expected in Emacs 21.3 -- the curly braces were still
inserted in that version of BibTeX mode:
OPTchrsc = {Summary: },
In GNU Emacs 22.0.97.1 (i686-pc-linux-gnu, GTK+ Version 2.10.6)
of 2007-04-08 on whisker
Windowing system distributor `The X.Org Foundation', version 11.0.70101000
configured using `configure '--prefix=/home/cschl/sw/emacs-22' '--with-gtk''
Important settings:
value of $LC_ALL: nil
value of $LC_COLLATE: nil
value of $LC_CTYPE: nil
value of $LC_MESSAGES: nil
value of $LC_MONETARY: nil
value of $LC_NUMERIC: nil
value of $LC_TIME: nil
value of $LANG: en_GB.UTF-8
locale-coding-system: utf-8
default-enable-multibyte-characters: t
Major mode: BibTeX
Minor modes in effect:
tooltip-mode: t
tool-bar-mode: t
mouse-wheel-mode: t
menu-bar-mode: t
file-name-shadow-mode: t
global-font-lock-mode: t
font-lock-mode: t
blink-cursor-mode: t
unify-8859-on-encoding-mode: t
utf-translate-cjk-mode: t
auto-compression-mode: t
line-number-mode: t
Recent input:
C-l C-y C-x C-e C-x C-f f o o . b i b <return> C-c
C-e M M-x r e p o r t <tab> <return>
Recent messages:
For information about the GNU Project and its goals, type C-h C-p. [2 times]
Mark set
((lambda nil (add-to-list (quote bibtex-user-optional-fields) (quote ...))))
(New file)
Loading bibtex...
Loading easymenu...done
Loading regexp-opt...done
Loading bibtex...done
Used for reference key creation if author and editor fields are missing
Loading emacsbug...done
- BibTeX-mode: bibtex-user-optional-fields: INIT without {},
Christian Schlauer <=