1120 |
"Regexp matching the name of a valid BibTeX entry.") |
"Regexp matching the name of a valid BibTeX entry.") |
1121 |
|
|
1122 |
(defvar bibtex-valid-entry-whitespace-re |
(defvar bibtex-valid-entry-whitespace-re |
1123 |
(concat "[ \t\n]*\\(" bibtex-valid-entry-re "\\)") |
(concat "[ \t]*\\(" bibtex-valid-entry-re "\\)") |
1124 |
"Regexp matching the name of a valid BibTeX entry preceded by whitespace.") |
"Regexp matching the name of a valid BibTeX entry preceded by whitespace.") |
1125 |
|
|
1126 |
(defvar bibtex-any-valid-entry-re |
(defvar bibtex-any-valid-entry-re |
2566 |
"Return summary of current BibTeX entry. |
"Return summary of current BibTeX entry. |
2567 |
Used as default value of `bibtex-summary-function'." |
Used as default value of `bibtex-summary-function'." |
2568 |
;; It would be neat to customize this function. How? |
;; It would be neat to customize this function. How? |
2569 |
(save-excursion |
(if (looking-at bibtex-entry-maybe-empty-head) |
2570 |
(if (looking-at bibtex-entry-maybe-empty-head) |
(let* ((bibtex-autokey-name-case-convert 'identity) |
2571 |
(let* ((bibtex-autokey-name-case-convert 'identity) |
(bibtex-autokey-name-length 'infty) |
2572 |
(bibtex-autokey-name-length 'infty) |
(bibtex-autokey-names 1) |
2573 |
(bibtex-autokey-names 1) |
(bibtex-autokey-names-stretch 0) |
2574 |
(bibtex-autokey-names-stretch 0) |
(bibtex-autokey-name-separator " ") |
2575 |
(bibtex-autokey-name-separator " ") |
(bibtex-autokey-additional-names " etal") |
2576 |
(bibtex-autokey-additional-names " etal") |
(names (bibtex-autokey-get-names)) |
2577 |
(names (bibtex-autokey-get-names)) |
(bibtex-autokey-year-length 4) |
2578 |
(bibtex-autokey-year-length 4) |
(year (bibtex-autokey-get-year)) |
2579 |
(year (bibtex-autokey-get-year)) |
(bibtex-autokey-titlewords 5) |
2580 |
(bibtex-autokey-titlewords 5) |
(bibtex-autokey-titlewords-stretch 2) |
2581 |
(bibtex-autokey-titlewords-stretch 2) |
(bibtex-autokey-titleword-case-convert 'identity) |
2582 |
(bibtex-autokey-titleword-case-convert 'identity) |
(bibtex-autokey-titleword-length 5) |
2583 |
(bibtex-autokey-titleword-length 5) |
(bibtex-autokey-titleword-separator " ") |
2584 |
(bibtex-autokey-titleword-separator " ") |
(title (bibtex-autokey-get-title)) |
2585 |
(title (bibtex-autokey-get-title)) |
(journal (bibtex-autokey-get-field |
2586 |
(journal (bibtex-autokey-get-field |
"journal" bibtex-autokey-transcriptions)) |
2587 |
"journal" bibtex-autokey-transcriptions)) |
(volume (bibtex-autokey-get-field "volume")) |
2588 |
(volume (bibtex-autokey-get-field "volume")) |
(pages (bibtex-autokey-get-field "pages" '(("-.*\\'" . ""))))) |
2589 |
(pages (bibtex-autokey-get-field "pages" '(("-.*\\'" . ""))))) |
(mapconcat (lambda (arg) |
2590 |
(mapconcat (lambda (arg) |
(if (not (string= "" (cdr arg))) |
2591 |
(if (not (string= "" (cdr arg))) |
(concat (car arg) (cdr arg)))) |
2592 |
(concat (car arg) (cdr arg)))) |
`((" " . ,names) (" " . ,year) (": " . ,title) |
2593 |
`((" " . ,names) (" " . ,year) (": " . ,title) |
(", " . ,journal) (" " . ,volume) (":" . ,pages)) |
2594 |
(", " . ,journal) (" " . ,volume) (":" . ,pages)) |
"")) |
2595 |
"")) |
(error "Entry not found"))) |
|
(error "Entry not found")))) |
|
2596 |
|
|
2597 |
(defun bibtex-pop (arg direction) |
(defun bibtex-pop (arg direction) |
2598 |
"Fill current field from the ARGth same field's text in DIRECTION. |
"Fill current field from the ARGth same field's text in DIRECTION. |
3949 |
(insert " ") |
(insert " ") |
3950 |
(indent-to-column bibtex-text-indentation))) |
(indent-to-column bibtex-text-indentation))) |
3951 |
(re-search-forward "[ \t\n]*=[ \t\n]*" end-field)) |
(re-search-forward "[ \t\n]*=[ \t\n]*" end-field)) |
3952 |
(while (re-search-forward "[ \t\n]+" end-field 'move) |
;; Paragraphs within fields are not preserved. Bother? |
3953 |
(replace-match " ")) |
(fill-region-as-paragraph (line-beginning-position) end-field |
3954 |
(do-auto-fill) |
default-justification nil (point)) |
3955 |
(if move (goto-char end-field)))) |
(if move (goto-char end-field)))) |
3956 |
|
|
3957 |
(defun bibtex-fill-field (&optional justify) |
(defun bibtex-fill-field (&optional justify) |
3991 |
(defun bibtex-realign () |
(defun bibtex-realign () |
3992 |
"Realign BibTeX entries such that they are separated by one blank line." |
"Realign BibTeX entries such that they are separated by one blank line." |
3993 |
(goto-char (point-min)) |
(goto-char (point-min)) |
3994 |
(let ((case-fold-search t)) |
(let ((case-fold-search t) |
3995 |
|
(valid-entry (concat "[ \t\n]*\\(" bibtex-valid-entry-re "\\)"))) |
3996 |
;; No blank lines prior to the first valid entry if there no |
;; No blank lines prior to the first valid entry if there no |
3997 |
;; non-white characters in front of it. |
;; non-white characters in front of it. |
3998 |
(when (looking-at bibtex-valid-entry-whitespace-re) |
(when (looking-at valid-entry) |
3999 |
(replace-match "\\1")) |
(replace-match "\\1")) |
4000 |
;; Valid entries are separated by one blank line. |
;; Valid entries are separated by one blank line. |
4001 |
(while (re-search-forward bibtex-valid-entry-whitespace-re nil t) |
(while (re-search-forward valid-entry nil t) |
4002 |
(replace-match "\n\n\\1")) |
(replace-match "\n\n\\1")) |
4003 |
;; One blank line past the last valid entry if it is followed by |
;; One blank line past the last valid entry if it is followed by |
4004 |
;; non-white characters, no blank line otherwise. |
;; non-white characters, no blank line otherwise. |