aboutsummaryrefslogtreecommitdiffstats
path: root/lisp/textmodes
diff options
context:
space:
mode:
authorRoland Winkler2009-01-16 14:24:24 +0000
committerRoland Winkler2009-01-16 14:24:24 +0000
commita51cfa58fc2d3ba973aa68b83e7227bc6b949dae (patch)
tree5cb657ad1dbc376828531286de3bf04396d8e386 /lisp/textmodes
parent034dc2a3e804d283319e12f110bd5715c2909f68 (diff)
downloademacs-a51cfa58fc2d3ba973aa68b83e7227bc6b949dae.tar.gz
emacs-a51cfa58fc2d3ba973aa68b83e7227bc6b949dae.zip
(bibtex-format-entry): For updating field delimiters, allow
fields that are composed of strings and string constants. (bibtex-mode): Doc fix.
Diffstat (limited to 'lisp/textmodes')
-rw-r--r--lisp/textmodes/bibtex.el31
1 files changed, 22 insertions, 9 deletions
diff --git a/lisp/textmodes/bibtex.el b/lisp/textmodes/bibtex.el
index 2b15c4b64b3..80265071347 100644
--- a/lisp/textmodes/bibtex.el
+++ b/lisp/textmodes/bibtex.el
@@ -1892,6 +1892,8 @@ Formats current entry according to variable `bibtex-entry-format'."
1892 last-comma delimiters unify-case braces 1892 last-comma delimiters unify-case braces
1893 strings) 1893 strings)
1894 bibtex-entry-format)) 1894 bibtex-entry-format))
1895 (left-delim-re (regexp-quote (bibtex-field-left-delimiter)))
1896 (right-delim-re (regexp-quote (bibtex-field-right-delimiter)))
1895 bounds crossref-key req-field-list default-field-list field-list 1897 bounds crossref-key req-field-list default-field-list field-list
1896 alt-fields error-field-name) 1898 alt-fields error-field-name)
1897 (unwind-protect 1899 (unwind-protect
@@ -1998,13 +2000,22 @@ Formats current entry according to variable `bibtex-entry-format'."
1998 ;; update delimiters 2000 ;; update delimiters
1999 (when (memq 'delimiters format) 2001 (when (memq 'delimiters format)
2000 (goto-char beg-text) 2002 (goto-char beg-text)
2001 (when (looking-at "[{\"]") 2003 ;; simplified from `bibtex-parse-field-text', as we
2002 (delete-char 1) 2004 ;; already checked that the field format is correct
2003 (insert (bibtex-field-left-delimiter))) 2005 (while (< (point) end-text)
2004 (goto-char (1- (marker-position end-text))) 2006 (if (looking-at bibtex-field-const)
2005 (when (looking-at "[}\"]") 2007 (goto-char (match-end 0))
2006 (delete-char 1) 2008 (let ((boundaries (bibtex-parse-field-string)))
2007 (insert (bibtex-field-right-delimiter)))) 2009 (unless (looking-at right-delim-re)
2010 (delete-char 1)
2011 (insert (bibtex-field-left-delimiter)))
2012 (goto-char (1- (cdr boundaries)))
2013 (if (looking-at left-delim-re)
2014 (forward-char)
2015 (delete-char 1)
2016 (insert (bibtex-field-right-delimiter)))))
2017 (if (looking-at "[ \t\n]*#[ \t\n]*")
2018 (goto-char (match-end 0)))))
2008 2019
2009 ;; update page dashes 2020 ;; update page dashes
2010 (if (and (memq 'page-dashes format) 2021 (if (and (memq 'page-dashes format)
@@ -2014,7 +2025,9 @@ Formats current entry according to variable `bibtex-entry-format'."
2014 "\\([\"{][0-9]+\\)[ \t\n]*--?[ \t\n]*\\([0-9]+[\"}]\\)"))) 2025 "\\([\"{][0-9]+\\)[ \t\n]*--?[ \t\n]*\\([0-9]+[\"}]\\)")))
2015 (replace-match "\\1-\\2")) 2026 (replace-match "\\1-\\2"))
2016 2027
2017 ;; remove whitespace at beginning and end of field 2028 ;; Remove whitespace at beginning and end of field.
2029 ;; We do not look at individual parts of the field
2030 ;; as {foo } # bar # { baz} is a fine field.
2018 (when (memq 'whitespace format) 2031 (when (memq 'whitespace format)
2019 (goto-char beg-text) 2032 (goto-char beg-text)
2020 (if (looking-at "\\([{\"]\\)[ \t\n]+") 2033 (if (looking-at "\\([{\"]\\)[ \t\n]+")
@@ -2932,7 +2945,7 @@ BOUND limits the search."
2932 2945
2933General information on working with BibTeX mode: 2946General information on working with BibTeX mode:
2934 2947
2935Use commands such as \\[bibtex-Book] to get a template for a specific entry. 2948Use commands such as \\<bibtex-mode-map>\\[bibtex-Book] to get a template for a specific entry.
2936Then fill in all desired fields using \\[bibtex-next-field] to jump from field 2949Then fill in all desired fields using \\[bibtex-next-field] to jump from field
2937to field. After having filled in all desired fields in the entry, clean the 2950to field. After having filled in all desired fields in the entry, clean the
2938new entry with the command \\[bibtex-clean-entry]. 2951new entry with the command \\[bibtex-clean-entry].