Commit a51cfa58 authored by Roland Winkler's avatar Roland Winkler
Browse files

(bibtex-format-entry): For updating field delimiters, allow

fields that are composed of strings and string constants.
(bibtex-mode): Doc fix.
parent 034dc2a3
2009-01-16 Agustín Martín <agustin.martin@hispalinux.es> 2009-01-16 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
* textmodes/bibtex.el (bibtex-format-entry): For updating field
delimiters, allow fields that are composed of strings and string
constants.
(bibtex-mode): Doc fix.
2009-01-16 Agustín Martín <agustin.martin@hispalinux.es>
   
* textmodes/ispell.el: Protect against declare-function undefined * textmodes/ispell.el: Protect against declare-function undefined
in xemacs. in xemacs.
......
...@@ -1892,6 +1892,8 @@ Formats current entry according to variable `bibtex-entry-format'." ...@@ -1892,6 +1892,8 @@ Formats current entry according to variable `bibtex-entry-format'."
last-comma delimiters unify-case braces last-comma delimiters unify-case braces
strings) strings)
bibtex-entry-format)) bibtex-entry-format))
(left-delim-re (regexp-quote (bibtex-field-left-delimiter)))
(right-delim-re (regexp-quote (bibtex-field-right-delimiter)))
bounds crossref-key req-field-list default-field-list field-list bounds crossref-key req-field-list default-field-list field-list
alt-fields error-field-name) alt-fields error-field-name)
(unwind-protect (unwind-protect
...@@ -1998,13 +2000,22 @@ Formats current entry according to variable `bibtex-entry-format'." ...@@ -1998,13 +2000,22 @@ Formats current entry according to variable `bibtex-entry-format'."
;; update delimiters ;; update delimiters
(when (memq 'delimiters format) (when (memq 'delimiters format)
(goto-char beg-text) (goto-char beg-text)
(when (looking-at "[{\"]") ;; simplified from `bibtex-parse-field-text', as we
(delete-char 1) ;; already checked that the field format is correct
(insert (bibtex-field-left-delimiter))) (while (< (point) end-text)
(goto-char (1- (marker-position end-text))) (if (looking-at bibtex-field-const)
(when (looking-at "[}\"]") (goto-char (match-end 0))
(delete-char 1) (let ((boundaries (bibtex-parse-field-string)))
(insert (bibtex-field-right-delimiter)))) (unless (looking-at right-delim-re)
(delete-char 1)
(insert (bibtex-field-left-delimiter)))
(goto-char (1- (cdr boundaries)))
(if (looking-at left-delim-re)
(forward-char)
(delete-char 1)
(insert (bibtex-field-right-delimiter)))))
(if (looking-at "[ \t\n]*#[ \t\n]*")
(goto-char (match-end 0)))))
;; update page dashes ;; update page dashes
(if (and (memq 'page-dashes format) (if (and (memq 'page-dashes format)
...@@ -2014,7 +2025,9 @@ Formats current entry according to variable `bibtex-entry-format'." ...@@ -2014,7 +2025,9 @@ Formats current entry according to variable `bibtex-entry-format'."
"\\([\"{][0-9]+\\)[ \t\n]*--?[ \t\n]*\\([0-9]+[\"}]\\)"))) "\\([\"{][0-9]+\\)[ \t\n]*--?[ \t\n]*\\([0-9]+[\"}]\\)")))
(replace-match "\\1-\\2")) (replace-match "\\1-\\2"))
;; remove whitespace at beginning and end of field ;; Remove whitespace at beginning and end of field.
;; We do not look at individual parts of the field
;; as {foo } # bar # { baz} is a fine field.
(when (memq 'whitespace format) (when (memq 'whitespace format)
(goto-char beg-text) (goto-char beg-text)
(if (looking-at "\\([{\"]\\)[ \t\n]+") (if (looking-at "\\([{\"]\\)[ \t\n]+")
...@@ -2932,7 +2945,7 @@ BOUND limits the search." ...@@ -2932,7 +2945,7 @@ BOUND limits the search."
General information on working with BibTeX mode: General information on working with BibTeX mode:
Use commands such as \\[bibtex-Book] to get a template for a specific entry. Use commands such as \\<bibtex-mode-map>\\[bibtex-Book] to get a template for a specific entry.
Then fill in all desired fields using \\[bibtex-next-field] to jump from field Then fill in all desired fields using \\[bibtex-next-field] to jump from field
to field. After having filled in all desired fields in the entry, clean the to field. After having filled in all desired fields in the entry, clean the
new entry with the command \\[bibtex-clean-entry]. new entry with the command \\[bibtex-clean-entry].
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment