[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: BibTeX-mode: bibtex-user-optional-fields: INIT without {}
From: |
Glenn Morris |
Subject: |
Re: BibTeX-mode: bibtex-user-optional-fields: INIT without {} |
Date: |
Thu, 12 Apr 2007 18:48:23 -0400 |
User-agent: |
Gnus (www.gnus.org), GNU Emacs (www.gnu.org/software/emacs/) |
Christian Schlauer wrote:
> So the curly braces are missing.
I think this patch fixes it.
*** bibtex.el 21 Jan 2007 13:45:48 -0000 1.124
--- bibtex.el 12 Apr 2007 22:49:20 -0000
***************
*** 1785,1791 ****
(set-mark (point))
(message "Mark set")
(bibtex-make-field (funcall fun 'bibtex-field-kill-ring-yank-pointer
! bibtex-field-kill-ring) t))
;; insert past the current entry
(bibtex-skip-to-valid-entry)
(set-mark (point))
--- 1785,1791 ----
(set-mark (point))
(message "Mark set")
(bibtex-make-field (funcall fun 'bibtex-field-kill-ring-yank-pointer
! bibtex-field-kill-ring) t nil t))
;; insert past the current entry
(bibtex-skip-to-valid-entry)
(set-mark (point))
***************
*** 3020,3026 ****
(if comment (message "%s" (nth 1 comment))
(message "No comment available")))))
! (defun bibtex-make-field (field &optional move interactive)
"Make a field named FIELD in current BibTeX entry.
FIELD is either a string or a list of the form
\(FIELD-NAME COMMENT-STRING INIT ALTERNATIVE-FLAG) as in
--- 3020,3026 ----
(if comment (message "%s" (nth 1 comment))
(message "No comment available")))))
! (defun bibtex-make-field (field &optional move interactive nodelim)
"Make a field named FIELD in current BibTeX entry.
FIELD is either a string or a list of the form
\(FIELD-NAME COMMENT-STRING INIT ALTERNATIVE-FLAG) as in
***************
*** 3028,3034 ****
If MOVE is non-nil, move point past the present field before making
the new field. If INTERACTIVE is non-nil, move point to the end of
the new field. Otherwise move point past the new field.
! MOVE and INTERACTIVE are t when called interactively."
(interactive
(list (let ((completion-ignore-case t)
(field-list (bibtex-field-list
--- 3028,3035 ----
If MOVE is non-nil, move point past the present field before making
the new field. If INTERACTIVE is non-nil, move point to the end of
the new field. Otherwise move point past the new field.
! MOVE and INTERACTIVE are t when called interactively.
! INIT is surrounded by delimiters, unless NODELIM is non-nil."
(interactive
(list (let ((completion-ignore-case t)
(field-list (bibtex-field-list
***************
*** 3058,3067 ****
(indent-to-column (+ bibtex-entry-offset
bibtex-text-indentation)))
(let ((init (nth 2 field)))
! (insert (cond ((stringp init) init)
((fboundp init) (funcall init))
! (t (concat (bibtex-field-left-delimiter)
! (bibtex-field-right-delimiter))))))
(when interactive
;; (bibtex-find-text nil nil bibtex-help-message)
(if (memq (preceding-char) '(?} ?\")) (forward-char -1))
--- 3059,3073 ----
(indent-to-column (+ bibtex-entry-offset
bibtex-text-indentation)))
(let ((init (nth 2 field)))
! (insert (if nodelim
! ""
! (bibtex-field-left-delimiter))
! (cond ((stringp init) init)
((fboundp init) (funcall init))
! (t ""))
! (if nodelim
! ""
! (bibtex-field-right-delimiter))))
(when interactive
;; (bibtex-find-text nil nil bibtex-help-message)
(if (memq (preceding-char) '(?} ?\")) (forward-char -1))