diff options
| author | Roland Winkler | 2009-01-16 14:24:24 +0000 |
|---|---|---|
| committer | Roland Winkler | 2009-01-16 14:24:24 +0000 |
| commit | a51cfa58fc2d3ba973aa68b83e7227bc6b949dae (patch) | |
| tree | 5cb657ad1dbc376828531286de3bf04396d8e386 | |
| parent | 034dc2a3e804d283319e12f110bd5715c2909f68 (diff) | |
| download | emacs-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.
| -rw-r--r-- | lisp/ChangeLog | 9 | ||||
| -rw-r--r-- | lisp/textmodes/bibtex.el | 31 |
2 files changed, 30 insertions, 10 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 4699cd0fd92..ed94ce2b602 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,4 +1,11 @@ | |||
| 1 | 2009-01-16 Agustín Martín <agustin.martin@hispalinux.es> | 1 | 2009-01-16 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de> |
| 2 | |||
| 3 | * textmodes/bibtex.el (bibtex-format-entry): For updating field | ||
| 4 | delimiters, allow fields that are composed of strings and string | ||
| 5 | constants. | ||
| 6 | (bibtex-mode): Doc fix. | ||
| 7 | |||
| 8 | 2009-01-16 Agustín Martín <agustin.martin@hispalinux.es> | ||
| 2 | 9 | ||
| 3 | * textmodes/ispell.el: Protect against declare-function undefined | 10 | * textmodes/ispell.el: Protect against declare-function undefined |
| 4 | in xemacs. | 11 | in xemacs. |
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 | ||
| 2933 | General information on working with BibTeX mode: | 2946 | General information on working with BibTeX mode: |
| 2934 | 2947 | ||
| 2935 | Use commands such as \\[bibtex-Book] to get a template for a specific entry. | 2948 | Use commands such as \\<bibtex-mode-map>\\[bibtex-Book] to get a template for a specific entry. |
| 2936 | Then fill in all desired fields using \\[bibtex-next-field] to jump from field | 2949 | Then fill in all desired fields using \\[bibtex-next-field] to jump from field |
| 2937 | to field. After having filled in all desired fields in the entry, clean the | 2950 | to field. After having filled in all desired fields in the entry, clean the |
| 2938 | new entry with the command \\[bibtex-clean-entry]. | 2951 | new entry with the command \\[bibtex-clean-entry]. |