comparison lisp/textmodes/bibtex.el @ 90180:62afea0771d8

Revision: miles@gnu.org--gnu-2005/emacs--unicode--0--patch-51 Merge from emacs--cvs-trunk--0 Patches applied: * emacs--cvs-trunk--0 (patch 289-301) - Update from CVS - Merge from gnus--rel--5.10 * gnus--rel--5.10 (patch 68) - Update from CVS
author Miles Bader <miles@gnu.org>
date Thu, 12 May 2005 03:41:19 +0000
parents 146c086df160 e233a73cbf79
children a1b34dec1104
comparison
equal deleted inserted replaced
90179:b745036dab36 90180:62afea0771d8
774 "Automatically fill fields if possible for those BibTeX entry types." 774 "Automatically fill fields if possible for those BibTeX entry types."
775 :group 'bibtex 775 :group 'bibtex
776 :type '(repeat string)) 776 :type '(repeat string))
777 777
778 (defcustom bibtex-summary-function 'bibtex-summary 778 (defcustom bibtex-summary-function 'bibtex-summary
779 "Function to call for generating a one-line summary of a BibTeX entry. 779 "Function to call for generating a summary of current BibTeX entry.
780 It takes one argument, the key of the entry. 780 It takes no arguments. Point must be at beginning of entry.
781 Used by `bibtex-complete-crossref-cleanup' and `bibtex-copy-summary-as-kill'." 781 Used by `bibtex-complete-crossref-cleanup' and `bibtex-copy-summary-as-kill'."
782 :group 'bibtex 782 :group 'bibtex
783 :type '(choice (const :tag "Default" bibtex-summary) 783 :type '(choice (const :tag "Default" bibtex-summary)
784 (function :tag "Personalized function"))) 784 (function :tag "Personalized function")))
785 785
2548 "Display summary message on entry KEY after completion of a crossref key. 2548 "Display summary message on entry KEY after completion of a crossref key.
2549 Use `bibtex-summary-function' to generate summary." 2549 Use `bibtex-summary-function' to generate summary."
2550 (save-excursion 2550 (save-excursion
2551 (if (and (stringp key) 2551 (if (and (stringp key)
2552 (bibtex-find-entry key t)) 2552 (bibtex-find-entry key t))
2553 (message "Ref: %s" (funcall bibtex-summary-function key))))) 2553 (message "Ref: %s" (funcall bibtex-summary-function)))))
2554 2554
2555 (defun bibtex-copy-summary-as-kill () 2555 (defun bibtex-copy-summary-as-kill ()
2556 "Push summery of current BibTeX entry to kill ring. 2556 "Push summery of current BibTeX entry to kill ring.
2557 Use `bibtex-summary-function' to generate summary." 2557 Use `bibtex-summary-function' to generate summary."
2558 (interactive) 2558 (interactive)
2559 (let ((key (save-excursion 2559 (save-excursion
2560 (bibtex-beginning-of-entry) 2560 (bibtex-beginning-of-entry)
2561 (if (looking-at bibtex-entry-maybe-empty-head) 2561 (if (looking-at bibtex-entry-maybe-empty-head)
2562 (bibtex-key-in-head) 2562 (kill-new (message "%s" (funcall bibtex-summary-function)))
2563 (error "No key found"))))) 2563 (error "No entry found"))))
2564 (kill-new (message "%s" (funcall bibtex-summary-function key))))) 2564
2565 2565 (defun bibtex-summary ()
2566 (defun bibtex-summary (key) 2566 "Return summary of current BibTeX entry.
2567 "Return summary of BibTeX entry KEY.
2568 Used as default value of `bibtex-summary-function'." 2567 Used as default value of `bibtex-summary-function'."
2569 ;; It would be neat to customize this function. How? 2568 ;; It would be neat to customize this function. How?
2570 (save-excursion 2569 (save-excursion
2571 (if (bibtex-find-entry key t) 2570 (if (looking-at bibtex-entry-maybe-empty-head)
2572 (let* ((bibtex-autokey-name-case-convert 'identity) 2571 (let* ((bibtex-autokey-name-case-convert 'identity)
2573 (bibtex-autokey-name-length 'infty) 2572 (bibtex-autokey-name-length 'infty)
2574 (bibtex-autokey-names 1) 2573 (bibtex-autokey-names 1)
2575 (bibtex-autokey-names-stretch 0) 2574 (bibtex-autokey-names-stretch 0)
2576 (bibtex-autokey-name-separator " ") 2575 (bibtex-autokey-name-separator " ")
2592 (if (not (string= "" (cdr arg))) 2591 (if (not (string= "" (cdr arg)))
2593 (concat (car arg) (cdr arg)))) 2592 (concat (car arg) (cdr arg))))
2594 `((" " . ,names) (" " . ,year) (": " . ,title) 2593 `((" " . ,names) (" " . ,year) (": " . ,title)
2595 (", " . ,journal) (" " . ,volume) (":" . ,pages)) 2594 (", " . ,journal) (" " . ,volume) (":" . ,pages))
2596 "")) 2595 ""))
2597 (error "Key `%s' not found" key)))) 2596 (error "Entry not found"))))
2598 2597
2599 (defun bibtex-pop (arg direction) 2598 (defun bibtex-pop (arg direction)
2600 "Fill current field from the ARGth same field's text in DIRECTION. 2599 "Fill current field from the ARGth same field's text in DIRECTION.
2601 Generic function used by `bibtex-pop-previous' and `bibtex-pop-next'." 2600 Generic function used by `bibtex-pop-previous' and `bibtex-pop-next'."
2602 (let (bibtex-help-message) 2601 (let (bibtex-help-message)
2741 `bibtex-maintain-sorted-entries' to non-nil. However, then BibTeX mode 2740 `bibtex-maintain-sorted-entries' to non-nil. However, then BibTeX mode
2742 works only with buffers containing valid (syntactical correct) and sorted 2741 works only with buffers containing valid (syntactical correct) and sorted
2743 entries. This is usually the case, if you have created a buffer completely 2742 entries. This is usually the case, if you have created a buffer completely
2744 with BibTeX mode and finished every new entry with \\[bibtex-clean-entry]. 2743 with BibTeX mode and finished every new entry with \\[bibtex-clean-entry].
2745 2744
2746 For third party BibTeX files, call the function `bibtex-convert-alien' 2745 For third party BibTeX files, call the command \\[bibtex-convert-alien]
2747 to fully take advantage of all features of BibTeX mode. 2746 to fully take advantage of all features of BibTeX mode.
2748 2747
2749 2748
2750 Special information: 2749 Special information:
2751 2750
3344 "Prepare a new BibTeX entry with index INDEX. 3343 "Prepare a new BibTeX entry with index INDEX.
3345 INDEX is a list (KEY CROSSREF-KEY ENTRY-NAME). 3344 INDEX is a list (KEY CROSSREF-KEY ENTRY-NAME).
3346 Move point where the entry KEY should be placed. 3345 Move point where the entry KEY should be placed.
3347 If `bibtex-maintain-sorted-entries' is non-nil, perform a binary 3346 If `bibtex-maintain-sorted-entries' is non-nil, perform a binary
3348 search to look for place for KEY. This requires that buffer is sorted, 3347 search to look for place for KEY. This requires that buffer is sorted,
3349 see \\[bibtex-validate].) 3348 see `bibtex-validate'.
3350 Return t if preparation was successful or nil if entry KEY already exists." 3349 Return t if preparation was successful or nil if entry KEY already exists."
3351 (let ((key (nth 0 index)) 3350 (let ((key (nth 0 index))
3352 key-exist) 3351 key-exist)
3353 (cond ((or (null key) 3352 (cond ((or (null key)
3354 (and (stringp key) 3353 (and (stringp key)
3768 3767
3769 (defun bibtex-yank (&optional n) 3768 (defun bibtex-yank (&optional n)
3770 "Reinsert the last BibTeX item. 3769 "Reinsert the last BibTeX item.
3771 More precisely, reinsert the field or entry killed or yanked most recently. 3770 More precisely, reinsert the field or entry killed or yanked most recently.
3772 With argument N, reinsert the Nth most recently killed BibTeX item. 3771 With argument N, reinsert the Nth most recently killed BibTeX item.
3773 See also the command \\[bibtex-yank-pop]]." 3772 See also the command \\[bibtex-yank-pop]."
3774 (interactive "*p") 3773 (interactive "*p")
3775 (bibtex-insert-kill (1- n)) 3774 (bibtex-insert-kill (1- n))
3776 (setq this-command 'bibtex-yank)) 3775 (setq this-command 'bibtex-yank))
3777 3776
3778 (defun bibtex-yank-pop (n) 3777 (defun bibtex-yank-pop (n)