aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGerd Moellmann1999-12-05 13:24:44 +0000
committerGerd Moellmann1999-12-05 13:24:44 +0000
commit28f2ee6659fc09d71e21f1e0fe1844a768f3c8e7 (patch)
tree16aba7e60f0e331bf79a811f757ce06554ae4dfa
parent1107d4ca499749fbe800ecd58eba33b701b92317 (diff)
downloademacs-28f2ee6659fc09d71e21f1e0fe1844a768f3c8e7.tar.gz
emacs-28f2ee6659fc09d71e21f1e0fe1844a768f3c8e7.zip
(bibtex-hs-forward-sexp): Added to support
using the hideshow package. (hs-special-modes-alist): Added entry for bibtex to allow the use of the hideshow package. (bibtex-hide-entry-bodies): Deleted as hiding of entry bodies is not longer provided by bibtex.el directly. Instead the hideshow package should be used. (bibtex-mode-map, bibtex-edit-menu, bibtex-mode): Delete references to bibtex-hide-entry-bodies. Copyright notice is up to date. Moved maintainer information closer to the beginning of the bibtex.el file. (bibtex-maintainer-salutation): New constant. bibtex-version): New constant. bibtex-submit-bug-report): Use bibtex-version and bibtex-maintainer-salutation. (bibtex-entry-field-alist): Made booktitle field optional for @inproceedings entries when crossreferenced. (bibtex-entry-field-alist): Added booktitle field to proceedings entry type (for cross referencing). Thanks to Wagner Toledo Correa for the suggestion. (bibtex-string-file-path): Fixed typo. (bibtex-mode-map): Reserved the key `C-c &' for reftex.el. (bibtex-edit-menu): Added `reftex-view-crossref-from-bibtex' to menu.
-rw-r--r--lisp/ChangeLog35
-rw-r--r--lisp/textmodes/bibtex.el90
2 files changed, 86 insertions, 39 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 11b1b6f5180..6af6a1640b6 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,38 @@
11999-12-05 Dirk Herrmann <D.Herrmann@tu-bs.de>
2
3 * textmodes/bibtex.el (bibtex-hs-forward-sexp): Added to support
4 using the hideshow package.
5 (hs-special-modes-alist): Added entry for bibtex to allow the use
6 of the hideshow package.
7 (bibtex-hide-entry-bodies): Deleted as hiding of entry bodies is
8 not longer provided by bibtex.el directly. Instead the hideshow
9 package should be used.
10 (bibtex-mode-map, bibtex-edit-menu, bibtex-mode): Delete
11 references to bibtex-hide-entry-bodies.
12
131999-12-05 Dirk Herrmann <D.Herrmann@tu-bs.de>
14
15 * textmodes/bibtex.el: Copyright notice is up to date. Moved
16 maintainer information closer to the beginning of the bibtex.el
17 file.
18 (bibtex-maintainer-salutation): New constant.
19 (bibtex-version): New constant.
20 (bibtex-submit-bug-report): Use bibtex-version and
21 bibtex-maintainer-salutation.
22 (bibtex-entry-field-alist): Made booktitle field optional for
23 @inproceedings entries when crossreferenced.
24 (bibtex-entry-field-alist): Added booktitle field to proceedings
25 entry type (for cross referencing). Thanks to Wagner Toledo Correa
26 for the suggestion.
27 (bibtex-string-file-path): Fixed typo.
28
291999-12-05 Carsten Dominik <dominik@strw.leidenuniv.nl>
30
31 * textmodes/bibtex.el (bibtex-mode-map): Reserved the key `C-c &'
32 for reftex.el.
33 (bibtex-edit-menu): Added `reftex-view-crossref-from-bibtex'
34 to menu.
35
11999-12-04 Dave Love <fx@gnu.org> 361999-12-04 Dave Love <fx@gnu.org>
2 37
3 * delsel.el: Revert previous change -- region is significant to 38 * delsel.el: Revert previous change -- region is significant to
diff --git a/lisp/textmodes/bibtex.el b/lisp/textmodes/bibtex.el
index d9513f13601..6ae02eded4d 100644
--- a/lisp/textmodes/bibtex.el
+++ b/lisp/textmodes/bibtex.el
@@ -1,6 +1,6 @@
1;;; bibtex.el --- BibTeX mode for GNU Emacs 1;;; bibtex.el --- BibTeX mode for GNU Emacs
2 2
3;; Copyright (C) 1992, 1994, 1995, 1996, 1997 Free Software Foundation, Inc. 3;; Copyright (C) 1992, 1994, 1995, 1996, 1997, 1998, 1999 Free Software Foundation, Inc.
4 4
5;; Author: Stefan Schoef <schoef@offis.uni-oldenburg.de> 5;; Author: Stefan Schoef <schoef@offis.uni-oldenburg.de>
6;; Bengt Martensson <bengt@mathematik.uni-Bremen.de> 6;; Bengt Martensson <bengt@mathematik.uni-Bremen.de>
@@ -43,6 +43,22 @@
43(eval-when-compile 43(eval-when-compile
44 (require 'compile)) 44 (require 'compile))
45 45
46
47;; Bug Reporting
48
49(defconst
50 bibtex-maintainer-address "Dirk Herrmann <D.Herrmann@tu-bs.de>")
51;; current maintainer
52
53(defconst
54 bibtex-maintainer-salutation "Hallo Dirk,")
55;; current maintainer
56
57(defconst
58 bibtex-version "(emacs 20.4)")
59;; current version of the bibtex.el file
60
61
46;; User Options: 62;; User Options:
47 63
48(defgroup bibtex nil 64(defgroup bibtex nil
@@ -318,9 +334,9 @@ after last parsing and which are maintained in sorted order are parsed."
318 ("publisher" "Publishing company, its location") 334 ("publisher" "Publishing company, its location")
319 ("note" "Remarks to be put at the end of the \\bibitem"))) 335 ("note" "Remarks to be put at the end of the \\bibitem")))
320 ((("author" "Author1 [and Author2 ...] [and others]") 336 ((("author" "Author1 [and Author2 ...] [and others]")
321 ("title" "Title of the article in proceedings (BibTeX converts it to lowercase)") 337 ("title" "Title of the article in proceedings (BibTeX converts it to lowercase)"))
322 ("booktitle" "Name of the conference proceedings")) 338 (("booktitle" "Name of the conference proceedings")
323 (("pages" "Pages in the conference proceedings") 339 ("pages" "Pages in the conference proceedings")
324 ("year" "Year of publication") 340 ("year" "Year of publication")
325 ("editor" "Editor1 [and Editor2 ...] [and others]") 341 ("editor" "Editor1 [and Editor2 ...] [and others]")
326 ("volume" "Volume of the conference proceedings in the series") 342 ("volume" "Volume of the conference proceedings in the series")
@@ -364,7 +380,8 @@ after last parsing and which are maintained in sorted order are parsed."
364 ("note" "Remarks to be put at the end of the \\bibitem"))))) 380 ("note" "Remarks to be put at the end of the \\bibitem")))))
365 ("Proceedings" . (((("title" "Title of the conference proceedings") 381 ("Proceedings" . (((("title" "Title of the conference proceedings")
366 ("year" "Year of publication")) 382 ("year" "Year of publication"))
367 (("editor" "Editor1 [and Editor2 ...] [and others]") 383 (("booktitle" "Title of the proceedings for cross references")
384 ("editor" "Editor1 [and Editor2 ...] [and others]")
368 ("volume" "Volume of the conference proceedings in the series") 385 ("volume" "Volume of the conference proceedings in the series")
369 ("number" "Number of the conference proceedings in a small series (overwritten by volume)") 386 ("number" "Number of the conference proceedings in a small series (overwritten by volume)")
370 ("series" "Series in which the conference proceedings appeared") 387 ("series" "Series in which the conference proceedings appeared")
@@ -452,7 +469,7 @@ file)."
452 :type '(repeat file)) 469 :type '(repeat file))
453 470
454(defvar bibtex-string-file-path (getenv "BIBINPUTS") 471(defvar bibtex-string-file-path (getenv "BIBINPUTS")
455 "*Colon separated list of pathes to search for `bibtex-string-files'.") 472 "*Colon separated list of paths to search for `bibtex-string-files'.")
456 473
457(defcustom bibtex-help-message t 474(defcustom bibtex-help-message t
458 "*If not nil print help messages in the echo area on entering a new field." 475 "*If not nil print help messages in the echo area on entering a new field."
@@ -731,6 +748,23 @@ the value of `bibtex-text-indentation', minus 2."
731 (start-itimer "bibtex" function secs (if repeat secs nil) t))) 748 (start-itimer "bibtex" function secs (if repeat secs nil) t)))
732 749
733 750
751;; Support for hideshow minor mode
752(defun bibtex-hs-forward-sexp (arg)
753 "Replacement for `forward-sexp' to be used by `hs-minor-mode'."
754 (if (< arg 0)
755 (backward-sexp 1)
756 (if (looking-at "@\\S(*\\s(")
757 (progn
758 (goto-char (match-end 0))
759 (forward-char -1)
760 (forward-sexp 1))
761 (forward-sexp 1))))
762
763(add-to-list
764 'hs-special-modes-alist
765 '(bibtex-mode "@\\S(*\\s(" "\\s)" nil bibtex-hs-forward-sexp nil))
766
767
734;; Syntax Table, Keybindings and BibTeX Entry List 768;; Syntax Table, Keybindings and BibTeX Entry List
735(defvar bibtex-mode-syntax-table 769(defvar bibtex-mode-syntax-table
736 (let ((st (make-syntax-table))) 770 (let ((st (make-syntax-table)))
@@ -747,6 +781,7 @@ the value of `bibtex-text-indentation', minus 2."
747 781
748(defvar bibtex-mode-map 782(defvar bibtex-mode-map
749 (let ((km (make-sparse-keymap))) 783 (let ((km (make-sparse-keymap)))
784 ;; The Key `C-c&' is reserved for reftex.el
750 (define-key km "\t" 'bibtex-find-text) 785 (define-key km "\t" 'bibtex-find-text)
751 (define-key km "\n" 'bibtex-next-field) 786 (define-key km "\n" 'bibtex-next-field)
752 (define-key km "\M-\t" 'bibtex-complete-string) 787 (define-key km "\M-\t" 'bibtex-complete-string)
@@ -773,7 +808,6 @@ the value of `bibtex-text-indentation', minus 2."
773 (define-key km "\C-\M-l" 'bibtex-reposition-window) 808 (define-key km "\C-\M-l" 'bibtex-reposition-window)
774 (define-key km "\C-\M-h" 'bibtex-mark-entry) 809 (define-key km "\C-\M-h" 'bibtex-mark-entry)
775 (define-key km "\C-c\C-b" 'bibtex-entry) 810 (define-key km "\C-c\C-b" 'bibtex-entry)
776 (define-key km "\C-c\C-t" 'bibtex-hide-entry-bodies)
777 (define-key km "\C-c\C-rn" 'bibtex-narrow-to-entry) 811 (define-key km "\C-c\C-rn" 'bibtex-narrow-to-entry)
778 (define-key km "\C-c\C-rw" 'widen) 812 (define-key km "\C-c\C-rw" 'widen)
779 (define-key km "\C-c\C-o" 'bibtex-remove-OPT-or-ALT) 813 (define-key km "\C-c\C-o" 'bibtex-remove-OPT-or-ALT)
@@ -816,7 +850,10 @@ the value of `bibtex-text-indentation', minus 2."
816 "--" 850 "--"
817 ["Ispell Entry" bibtex-ispell-entry t] 851 ["Ispell Entry" bibtex-ispell-entry t]
818 ["Ispell Entry Abstract" bibtex-ispell-abstract t] 852 ["Ispell Entry Abstract" bibtex-ispell-abstract t]
819 ["Narrow to Entry" bibtex-narrow-to-entry t]) 853 ["Narrow to Entry" bibtex-narrow-to-entry t]
854 "--"
855 ["View Cite Locations (RefTeX)" reftex-view-crossref-from-bibtex
856 (fboundp 'reftex-view-crossref-from-bibtex)])
820 ("Operating on Current Field" 857 ("Operating on Current Field"
821 ["Remove Delimiters" bibtex-remove-delimiters t] 858 ["Remove Delimiters" bibtex-remove-delimiters t]
822 ["Remove OPT or ALT Prefix" bibtex-remove-OPT-or-ALT t] 859 ["Remove OPT or ALT Prefix" bibtex-remove-OPT-or-ALT t]
@@ -840,7 +877,6 @@ the value of `bibtex-text-indentation', minus 2."
840 ["Validate Entries" bibtex-validate t] 877 ["Validate Entries" bibtex-validate t]
841 ["Sort Entries" bibtex-sort-buffer t] 878 ["Sort Entries" bibtex-sort-buffer t]
842 ["Reformat Entries" bibtex-reformat t] 879 ["Reformat Entries" bibtex-reformat t]
843 ["Hide Entry Bodies" bibtex-hide-entry-bodies t]
844 ["Count Entries" bibtex-count-entries t]) 880 ["Count Entries" bibtex-count-entries t])
845 ("Miscellaneous" 881 ("Miscellaneous"
846 ["Convert Alien Buffer" bibtex-convert-alien t] 882 ["Convert Alien Buffer" bibtex-convert-alien t]
@@ -866,13 +902,6 @@ the value of `bibtex-text-indentation', minus 2."
866 ["Preamble" bibtex-Preamble t])) 902 ["Preamble" bibtex-Preamble t]))
867 903
868 904
869;; Bug Reporting
870
871(defconst
872 bibtex-maintainer-address "Dirk Herrmann <D.Herrmann@tu-bs.de>")
873;; current maintainer
874
875
876;; Internal Variables 905;; Internal Variables
877 906
878(defvar bibtex-pop-previous-search-point nil) 907(defvar bibtex-pop-previous-search-point nil)
@@ -964,7 +993,7 @@ the value of `bibtex-text-indentation', minus 2."
964;; Regexp defining the type part of a BibTeX reference entry (almost 993;; Regexp defining the type part of a BibTeX reference entry (almost
965;; the same as bibtex-field-name) 994;; the same as bibtex-field-name)
966 995
967(defconst bibtex-reference-key "[][a-z0-9.:;?!`'/*@+=|()<>&_^$-]+") 996(defconst bibtex-reference-key "[][a-zA-Z0-9.:;?!`'/*@+=|()<>&_^$-]+")
968;; Regexp defining the label part of a BibTeX reference entry 997;; Regexp defining the label part of a BibTeX reference entry
969 998
970(defconst bibtex-field-name "[^\"#%'(),={} \t\n0-9][^\"#%'(),={} \t\n]*") 999(defconst bibtex-field-name "[^\"#%'(),={} \t\n0-9][^\"#%'(),={} \t\n]*")
@@ -1394,7 +1423,7 @@ the value of `bibtex-text-indentation', minus 2."
1394(defun bibtex-move-outside-of-entry () 1423(defun bibtex-move-outside-of-entry ()
1395 ;; Make sure we are outside of a BibTeX entry. 1424 ;; Make sure we are outside of a BibTeX entry.
1396 (let ((orig-point (point))) 1425 (let ((orig-point (point)))
1397 (bibtex-end-of-entry) 1426 (bibtex-end-of-entry)
1398 (if (< (point) orig-point) 1427 (if (< (point) orig-point)
1399 ;; We moved backward, so we weren't inside an entry to begin with. 1428 ;; We moved backward, so we weren't inside an entry to begin with.
1400 ;; Leave point at the beginning of a line, and preferably 1429 ;; Leave point at the beginning of a line, and preferably
@@ -1966,7 +1995,7 @@ the value of `bibtex-text-indentation', minus 2."
1966 titleword 1995 titleword
1967 bibtex-autokey-titleword-ignore) 1996 bibtex-autokey-titleword-ignore)
1968 (setq counter (1- counter)) 1997 (setq counter (1- counter))
1969 (setq 1998 (setq
1970 titleword 1999 titleword
1971 (funcall bibtex-autokey-titleword-case-convert titleword)) 2000 (funcall bibtex-autokey-titleword-case-convert titleword))
1972 (if (or (not (numberp bibtex-autokey-titlewords)) 2001 (if (or (not (numberp bibtex-autokey-titlewords))
@@ -2471,7 +2500,6 @@ The following may be of interest as well:
2471 bibtex-ispell-abstract 2500 bibtex-ispell-abstract
2472 bibtex-ispell-entry 2501 bibtex-ispell-entry
2473 bibtex-narrow-to-entry 2502 bibtex-narrow-to-entry
2474 bibtex-hide-entry-bodies
2475 bibtex-sort-buffer 2503 bibtex-sort-buffer
2476 bibtex-validate 2504 bibtex-validate
2477 bibtex-count 2505 bibtex-count
@@ -2612,7 +2640,7 @@ non-nil.
2612 (let ((reporter-prompt-for-summary-p t)) 2640 (let ((reporter-prompt-for-summary-p t))
2613 (reporter-submit-bug-report 2641 (reporter-submit-bug-report
2614 bibtex-maintainer-address 2642 bibtex-maintainer-address
2615 (concat "bibtex.el " "(emacs 19.35)") 2643 (concat "bibtex.el " bibtex-version)
2616 (list 2644 (list
2617 'system-configuration 2645 'system-configuration
2618 'system-configuration-options 2646 'system-configuration-options
@@ -2678,9 +2706,9 @@ non-nil.
2678 ;; user variables which shouldn't cause any errors 2706 ;; user variables which shouldn't cause any errors
2679 ) 2707 )
2680 nil nil 2708 nil nil
2681 (concat "To the bibtex.el maintainer: 2709 (concat bibtex-maintainer-salutation "
2682 2710
2683I want to report a bug on Emacs BibTeX mode. 2711I want to report a bug on Emacs BibTeX mode " bibtex-version ".
2684I've read the `Bugs' section in the `Emacs' info page, so I know how 2712I've read the `Bugs' section in the `Emacs' info page, so I know how
2685to make a clear and unambiguous report. I have started a fresh Emacs 2713to make a clear and unambiguous report. I have started a fresh Emacs
2686via `"invocation-name " --no-init-file --no-site-file', thereafter (in 2714via `"invocation-name " --no-init-file --no-site-file', thereafter (in
@@ -3003,22 +3031,6 @@ If mark is active it counts entries in region, if not in whole buffer."
3003 (narrow-to-region 3031 (narrow-to-region
3004 (bibtex-beginning-of-entry) (bibtex-end-of-entry)))) 3032 (bibtex-beginning-of-entry) (bibtex-end-of-entry))))
3005 3033
3006(defun bibtex-hide-entry-bodies (&optional arg)
3007 "Hide all lines between first and last BibTeX entries not beginning with @.
3008With prefix argument ARG, show all text."
3009 (interactive "P")
3010 (save-excursion
3011 (let ((buffer-read-only nil))
3012 (if arg
3013 (subst-char-in-region (point-min) (point-max) ?\r ?\n t)
3014 (let ((pos (point-max)))
3015 (goto-char (point-max))
3016 (while (re-search-backward "^@" nil t)
3017 (subst-char-in-region (point) pos ?\n ?\r t)
3018 (if (not (bobp)) (forward-char -1))
3019 (setq pos (point)))))
3020 (setq selective-display (not arg)))))
3021
3022(defun bibtex-sort-buffer () 3034(defun bibtex-sort-buffer ()
3023 "Sort BibTeX buffer alphabetically by key. 3035 "Sort BibTeX buffer alphabetically by key.
3024Text outside of BibTeX entries is not affected. If 3036Text outside of BibTeX entries is not affected. If