diff options
| author | Glenn Morris | 2007-04-14 19:12:59 +0000 |
|---|---|---|
| committer | Glenn Morris | 2007-04-14 19:12:59 +0000 |
| commit | 84aa4fc6ee7c4602cbb712c30fc2ecef21c56f8b (patch) | |
| tree | 02d7f0d7bb4ca9ee751f7f7451f7ddd0290f84f9 | |
| parent | c810a796389d675f08ebac6f39ac4e43470e1350 (diff) | |
| download | emacs-84aa4fc6ee7c4602cbb712c30fc2ecef21c56f8b.tar.gz emacs-84aa4fc6ee7c4602cbb712c30fc2ecef21c56f8b.zip | |
(bibtex-insert-kill): Pass non-nil NODELIM arg to bibtex-make-field.
(bibtex-make-field): Add optional fourth arg NODELIM. Insert
delimiters around INIT unless this arg is non-nil.
| -rw-r--r-- | lisp/textmodes/bibtex.el | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/lisp/textmodes/bibtex.el b/lisp/textmodes/bibtex.el index 06fa3a01186..e9c52ecb8d6 100644 --- a/lisp/textmodes/bibtex.el +++ b/lisp/textmodes/bibtex.el | |||
| @@ -1785,7 +1785,7 @@ Optional arg COMMA is as in `bibtex-enclosing-field'." | |||
| 1785 | (set-mark (point)) | 1785 | (set-mark (point)) |
| 1786 | (message "Mark set") | 1786 | (message "Mark set") |
| 1787 | (bibtex-make-field (funcall fun 'bibtex-field-kill-ring-yank-pointer | 1787 | (bibtex-make-field (funcall fun 'bibtex-field-kill-ring-yank-pointer |
| 1788 | bibtex-field-kill-ring) t)) | 1788 | bibtex-field-kill-ring) t nil t)) |
| 1789 | ;; insert past the current entry | 1789 | ;; insert past the current entry |
| 1790 | (bibtex-skip-to-valid-entry) | 1790 | (bibtex-skip-to-valid-entry) |
| 1791 | (set-mark (point)) | 1791 | (set-mark (point)) |
| @@ -3020,7 +3020,7 @@ interactive calls." | |||
| 3020 | (if comment (message "%s" (nth 1 comment)) | 3020 | (if comment (message "%s" (nth 1 comment)) |
| 3021 | (message "No comment available"))))) | 3021 | (message "No comment available"))))) |
| 3022 | 3022 | ||
| 3023 | (defun bibtex-make-field (field &optional move interactive) | 3023 | (defun bibtex-make-field (field &optional move interactive nodelim) |
| 3024 | "Make a field named FIELD in current BibTeX entry. | 3024 | "Make a field named FIELD in current BibTeX entry. |
| 3025 | FIELD is either a string or a list of the form | 3025 | FIELD is either a string or a list of the form |
| 3026 | \(FIELD-NAME COMMENT-STRING INIT ALTERNATIVE-FLAG) as in | 3026 | \(FIELD-NAME COMMENT-STRING INIT ALTERNATIVE-FLAG) as in |
| @@ -3028,7 +3028,8 @@ FIELD is either a string or a list of the form | |||
| 3028 | If MOVE is non-nil, move point past the present field before making | 3028 | If MOVE is non-nil, move point past the present field before making |
| 3029 | the new field. If INTERACTIVE is non-nil, move point to the end of | 3029 | the new field. If INTERACTIVE is non-nil, move point to the end of |
| 3030 | the new field. Otherwise move point past the new field. | 3030 | the new field. Otherwise move point past the new field. |
| 3031 | MOVE and INTERACTIVE are t when called interactively." | 3031 | MOVE and INTERACTIVE are t when called interactively. |
| 3032 | INIT is surrounded by delimiters, unless NODELIM is non-nil." | ||
| 3032 | (interactive | 3033 | (interactive |
| 3033 | (list (let ((completion-ignore-case t) | 3034 | (list (let ((completion-ignore-case t) |
| 3034 | (field-list (bibtex-field-list | 3035 | (field-list (bibtex-field-list |
| @@ -3058,10 +3059,15 @@ MOVE and INTERACTIVE are t when called interactively." | |||
| 3058 | (indent-to-column (+ bibtex-entry-offset | 3059 | (indent-to-column (+ bibtex-entry-offset |
| 3059 | bibtex-text-indentation))) | 3060 | bibtex-text-indentation))) |
| 3060 | (let ((init (nth 2 field))) | 3061 | (let ((init (nth 2 field))) |
| 3061 | (insert (cond ((stringp init) init) | 3062 | (insert (if nodelim |
| 3063 | "" | ||
| 3064 | (bibtex-field-left-delimiter)) | ||
| 3065 | (cond ((stringp init) init) | ||
| 3062 | ((fboundp init) (funcall init)) | 3066 | ((fboundp init) (funcall init)) |
| 3063 | (t (concat (bibtex-field-left-delimiter) | 3067 | (t "")) |
| 3064 | (bibtex-field-right-delimiter)))))) | 3068 | (if nodelim |
| 3069 | "" | ||
| 3070 | (bibtex-field-right-delimiter)))) | ||
| 3065 | (when interactive | 3071 | (when interactive |
| 3066 | ;; (bibtex-find-text nil nil bibtex-help-message) | 3072 | ;; (bibtex-find-text nil nil bibtex-help-message) |
| 3067 | (if (memq (preceding-char) '(?} ?\")) (forward-char -1)) | 3073 | (if (memq (preceding-char) '(?} ?\")) (forward-char -1)) |