aboutsummaryrefslogtreecommitdiffstats
path: root/lisp
diff options
context:
space:
mode:
authorRichard M. Stallman1997-06-14 17:30:43 +0000
committerRichard M. Stallman1997-06-14 17:30:43 +0000
commit55fe21fc277c52e0c18685a26ba0dbd0621f6d61 (patch)
treebdcd885752b90c18bcdf59f272e6fea18d2baec0 /lisp
parentf80f7bc21f1f95409b425a58b145327bbe6b959b (diff)
downloademacs-55fe21fc277c52e0c18685a26ba0dbd0621f6d61.tar.gz
emacs-55fe21fc277c52e0c18685a26ba0dbd0621f6d61.zip
(bibtex-delete-whitespace, bibtex-current-line)
(bibtex-assoc-of-regexp, bibtex-skip-to-valid-entry) (bibtex-map-entries): Renamed from delete-whitespace, current-line, assoc-of-regexp, skip-to-valid-bibtex-entry, and map-bibtex-entries, respectively.
Diffstat (limited to 'lisp')
-rw-r--r--lisp/textmodes/bibtex.el58
1 files changed, 29 insertions, 29 deletions
diff --git a/lisp/textmodes/bibtex.el b/lisp/textmodes/bibtex.el
index 8972b74dca2..33b32eae752 100644
--- a/lisp/textmodes/bibtex.el
+++ b/lisp/textmodes/bibtex.el
@@ -964,12 +964,12 @@ If non nil, column of equal sign is bibtex-text-indentation - 2.")
964 964
965;; Helper Functions 965;; Helper Functions
966 966
967(defun delete-whitespace () 967(defun bibtex-delete-whitespace ()
968 ;; Delete all whitespace starting at point 968 ;; Delete all whitespace starting at point
969 (if (looking-at "[ \t\n]+") 969 (if (looking-at "[ \t\n]+")
970 (delete-region (point) (match-end 0)))) 970 (delete-region (point) (match-end 0))))
971 971
972(defun current-line () 972(defun bibtex-current-line ()
973 ;; this computes line number of point regardless whether the buffer 973 ;; this computes line number of point regardless whether the buffer
974 ;; is narrowed 974 ;; is narrowed
975 (+ (count-lines 1 (point)) 975 (+ (count-lines 1 (point))
@@ -985,7 +985,7 @@ If non nil, column of equal sign is bibtex-text-indentation - 2.")
985 (setq list (cdr list))) 985 (setq list (cdr list)))
986 list)) 986 list))
987 987
988(defun assoc-of-regexp (string alist) 988(defun bibtex-assoc-of-regexp (string alist)
989 ;; Return non-nil if STRING is exactly matched by the car of an 989 ;; Return non-nil if STRING is exactly matched by the car of an
990 ;; element of LIST (case ignored). The value is actually the element 990 ;; element of LIST (case ignored). The value is actually the element
991 ;; of LIST whose car matches STRING. 991 ;; of LIST whose car matches STRING.
@@ -996,7 +996,7 @@ If non nil, column of equal sign is bibtex-text-indentation - 2.")
996 (setq alist (cdr alist))) 996 (setq alist (cdr alist)))
997 (car alist))) 997 (car alist)))
998 998
999(defun skip-to-valid-bibtex-entry (&optional backward) 999(defun bibtex-skip-to-valid-entry (&optional backward)
1000 ;; If not at beginning of valid BibTeX entry, move to beginning of 1000 ;; If not at beginning of valid BibTeX entry, move to beginning of
1001 ;; the next valid one. With argument backward non-nil, move backward 1001 ;; the next valid one. With argument backward non-nil, move backward
1002 ;; to beginning of previous valid one. A valid entry is a 1002 ;; to beginning of previous valid one. A valid entry is a
@@ -1039,7 +1039,7 @@ If non nil, column of equal sign is bibtex-text-indentation - 2.")
1039 (if (re-search-forward "^[ \t]*@" nil 'move) 1039 (if (re-search-forward "^[ \t]*@" nil 'move)
1040 (forward-char -1)))))))) 1040 (forward-char -1))))))))
1041 1041
1042(defun map-bibtex-entries (fun) 1042(defun bibtex-map-entries (fun)
1043 ;; Call FUN for each BibTeX entry starting with the current. Do this 1043 ;; Call FUN for each BibTeX entry starting with the current. Do this
1044 ;; to the end of the file. FUN is called with one argument, the key 1044 ;; to the end of the file. FUN is called with one argument, the key
1045 ;; of the entry, and with point inside the entry. If 1045 ;; of the entry, and with point inside the entry. If
@@ -1814,7 +1814,7 @@ If non nil, column of equal sign is bibtex-text-indentation - 2.")
1814 (mapcar 1814 (mapcar
1815 (lambda (titleword) 1815 (lambda (titleword)
1816 (let ((abbrev 1816 (let ((abbrev
1817 (assoc-of-regexp 1817 (bibtex-assoc-of-regexp
1818 titleword bibtex-autokey-titleword-abbrevs))) 1818 titleword bibtex-autokey-titleword-abbrevs)))
1819 (if abbrev 1819 (if abbrev
1820 (elt abbrev 1) 1820 (elt abbrev 1)
@@ -1982,7 +1982,7 @@ If non nil, column of equal sign is bibtex-text-indentation - 2.")
1982 (bibtex-progress-message 1982 (bibtex-progress-message
1983 (concat (buffer-name) ": parsing reference keys"))) 1983 (concat (buffer-name) ": parsing reference keys")))
1984 (if (catch 'userkey 1984 (if (catch 'userkey
1985 (skip-to-valid-bibtex-entry) 1985 (bibtex-skip-to-valid-entry)
1986 (while (not (eobp)) 1986 (while (not (eobp))
1987 (if (and 1987 (if (and
1988 abortable 1988 abortable
@@ -2016,7 +2016,7 @@ If non nil, column of equal sign is bibtex-text-indentation - 2.")
2016 (match-beginning bibtex-key-in-string) 2016 (match-beginning bibtex-key-in-string)
2017 (match-end bibtex-key-in-string))))) 2017 (match-end bibtex-key-in-string)))))
2018 (forward-char) 2018 (forward-char)
2019 (skip-to-valid-bibtex-entry) 2019 (bibtex-skip-to-valid-entry)
2020 (if (not (assoc label labels)) 2020 (if (not (assoc label labels))
2021 (setq labels 2021 (setq labels
2022 (cons (list label) labels))) 2022 (cons (list label) labels)))
@@ -2793,7 +2793,7 @@ If mark is active it counts entries in region, if not in whole buffer."
2793 (save-restriction 2793 (save-restriction
2794 (narrow-to-region start-point end-point) 2794 (narrow-to-region start-point end-point)
2795 (goto-char start-point) 2795 (goto-char start-point)
2796 (map-bibtex-entries 2796 (bibtex-map-entries
2797 (lambda (current) 2797 (lambda (current)
2798 (setq number (1+ number))))) 2798 (setq number (1+ number)))))
2799 (message (concat (if mark-active "Region" "Buffer") 2799 (message (concat (if mark-active "Region" "Buffer")
@@ -2857,11 +2857,11 @@ ignored."
2857 (save-excursion 2857 (save-excursion
2858 (goto-char (point-max)) 2858 (goto-char (point-max))
2859 (bibtex-end-of-entry))) 2859 (bibtex-end-of-entry)))
2860 (skip-to-valid-bibtex-entry) 2860 (bibtex-skip-to-valid-entry)
2861 (sort-subr 2861 (sort-subr
2862 nil 2862 nil
2863 ;; NEXTREC function 2863 ;; NEXTREC function
2864 'skip-to-valid-bibtex-entry 2864 'bibtex-skip-to-valid-entry
2865 ;; ENDREC function 2865 ;; ENDREC function
2866 'bibtex-end-of-entry 2866 'bibtex-end-of-entry
2867 ;; STARTKEY function 2867 ;; STARTKEY function
@@ -2886,12 +2886,12 @@ occurred, and t in all other cases."
2886 (left 2886 (left
2887 (progn 2887 (progn
2888 (bibtex-beginning-of-first-entry) 2888 (bibtex-beginning-of-first-entry)
2889 (skip-to-valid-bibtex-entry) 2889 (bibtex-skip-to-valid-entry)
2890 (bibtex-end-of-entry))) 2890 (bibtex-end-of-entry)))
2891 (right 2891 (right
2892 (progn 2892 (progn
2893 (bibtex-beginning-of-last-entry) 2893 (bibtex-beginning-of-last-entry)
2894 (skip-to-valid-bibtex-entry t) 2894 (bibtex-skip-to-valid-entry t)
2895 (point))) 2895 (point)))
2896 actual-point 2896 actual-point
2897 actual-key 2897 actual-key
@@ -2901,7 +2901,7 @@ occurred, and t in all other cases."
2901 (while (not done) 2901 (while (not done)
2902 (setq actual-point (/ (+ left right) 2)) 2902 (setq actual-point (/ (+ left right) 2))
2903 (goto-char actual-point) 2903 (goto-char actual-point)
2904 (skip-to-valid-bibtex-entry t) 2904 (bibtex-skip-to-valid-entry t)
2905 (setq actual-key 2905 (setq actual-key
2906 (progn 2906 (progn
2907 (re-search-forward bibtex-reference-head) 2907 (re-search-forward bibtex-reference-head)
@@ -2993,14 +2993,14 @@ Returns t if test was successful, nil otherwise."
2993 (if (not must-match) 2993 (if (not must-match)
2994 (forward-char) 2994 (forward-char)
2995 (let (bibtex-sort-ignore-string-entries) 2995 (let (bibtex-sort-ignore-string-entries)
2996 (skip-to-valid-bibtex-entry)) 2996 (bibtex-skip-to-valid-entry))
2997 (if (equal (point) p) 2997 (if (equal (point) p)
2998 (forward-char) 2998 (forward-char)
2999 (goto-char p) 2999 (goto-char p)
3000 (setq 3000 (setq
3001 error-list 3001 error-list
3002 (cons (list 3002 (cons (list
3003 (current-line) 3003 (bibtex-current-line)
3004 "Syntax error (check esp. commas, braces, and quotes)") 3004 "Syntax error (check esp. commas, braces, and quotes)")
3005 error-list)) 3005 error-list))
3006 (forward-char))))) 3006 (forward-char)))))
@@ -3013,7 +3013,7 @@ Returns t if test was successful, nil otherwise."
3013 (let (previous) 3013 (let (previous)
3014 (goto-char start-point) 3014 (goto-char start-point)
3015 (bibtex-progress-message "Checking correct sort order") 3015 (bibtex-progress-message "Checking correct sort order")
3016 (map-bibtex-entries 3016 (bibtex-map-entries
3017 (lambda (current) 3017 (lambda (current)
3018 (bibtex-progress-message) 3018 (bibtex-progress-message)
3019 (cond ((or (not previous) 3019 (cond ((or (not previous)
@@ -3022,13 +3022,13 @@ Returns t if test was successful, nil otherwise."
3022 ((string-equal previous current) 3022 ((string-equal previous current)
3023 (setq 3023 (setq
3024 error-list 3024 error-list
3025 (cons (list (current-line) 3025 (cons (list (bibtex-current-line)
3026 "Duplicate key with previous") 3026 "Duplicate key with previous")
3027 error-list))) 3027 error-list)))
3028 (t 3028 (t
3029 (setq previous current 3029 (setq previous current
3030 error-list 3030 error-list
3031 (cons (list (current-line) 3031 (cons (list (bibtex-current-line)
3032 "Entries out of order") 3032 "Entries out of order")
3033 error-list)))))) 3033 error-list))))))
3034 (bibtex-progress-message 'done))) 3034 (bibtex-progress-message 'done)))
@@ -3047,7 +3047,7 @@ Returns t if test was successful, nil otherwise."
3047 bibtex-predefined-month-strings 3047 bibtex-predefined-month-strings
3048 "\\|") 3048 "\\|")
3049 "\\)[}\"]"))) 3049 "\\)[}\"]")))
3050 (map-bibtex-entries 3050 (bibtex-map-entries
3051 (lambda (current) 3051 (lambda (current)
3052 (bibtex-progress-message) 3052 (bibtex-progress-message)
3053 (let* ((beg (bibtex-beginning-of-entry)) 3053 (let* ((beg (bibtex-beginning-of-entry))
@@ -3080,7 +3080,7 @@ Returns t if test was successful, nil otherwise."
3080 error-list 3080 error-list
3081 (cons 3081 (cons
3082 (list 3082 (list
3083 (current-line) 3083 (bibtex-current-line)
3084 "Questionable month field (delimited string)") 3084 "Questionable month field (delimited string)")
3085 error-list))) 3085 error-list)))
3086 (setq 3086 (setq
@@ -3105,7 +3105,7 @@ Returns t if test was successful, nil otherwise."
3105 (cons 3105 (cons
3106 (list (save-excursion 3106 (list (save-excursion
3107 (bibtex-beginning-of-entry) 3107 (bibtex-beginning-of-entry)
3108 (current-line)) 3108 (bibtex-current-line))
3109 (concat 3109 (concat
3110 "Required field \"" 3110 "Required field \""
3111 (car (car req)) 3111 (car (car req))
@@ -3464,7 +3464,7 @@ well."
3464 (let ((pnt (copy-marker (point))) 3464 (let ((pnt (copy-marker (point)))
3465 (end (copy-marker (bibtex-end-of-entry)))) 3465 (end (copy-marker (bibtex-end-of-entry))))
3466 (bibtex-beginning-of-entry) 3466 (bibtex-beginning-of-entry)
3467 (delete-whitespace) 3467 (bibtex-delete-whitespace)
3468 (indent-to-column bibtex-entry-offset) 3468 (indent-to-column bibtex-entry-offset)
3469 (while (re-search-forward bibtex-field end t) 3469 (while (re-search-forward bibtex-field end t)
3470 (let* ((begin-field 3470 (let* ((begin-field
@@ -3477,7 +3477,7 @@ well."
3477 (copy-marker (match-end bibtex-name-in-field)))) 3477 (copy-marker (match-end bibtex-name-in-field))))
3478 (goto-char begin-field) 3478 (goto-char begin-field)
3479 (forward-char) 3479 (forward-char)
3480 (delete-whitespace) 3480 (bibtex-delete-whitespace)
3481 (open-line 1) 3481 (open-line 1)
3482 (forward-char) 3482 (forward-char)
3483 (indent-to-column 3483 (indent-to-column
@@ -3490,7 +3490,7 @@ well."
3490 (+ bibtex-entry-offset (- bibtex-text-indentation 2))) 3490 (+ bibtex-entry-offset (- bibtex-text-indentation 2)))
3491 (insert " ")) 3491 (insert " "))
3492 (forward-char) 3492 (forward-char)
3493 (delete-whitespace) 3493 (bibtex-delete-whitespace)
3494 (if bibtex-align-at-equal-sign 3494 (if bibtex-align-at-equal-sign
3495 (insert " ") 3495 (insert " ")
3496 (indent-to-column bibtex-text-indentation)) 3496 (indent-to-column bibtex-text-indentation))
@@ -3499,7 +3499,7 @@ well."
3499 (bibtex-do-auto-fill))) 3499 (bibtex-do-auto-fill)))
3500 (if (looking-at ",") 3500 (if (looking-at ",")
3501 (forward-char)) 3501 (forward-char))
3502 (delete-whitespace) 3502 (bibtex-delete-whitespace)
3503 (open-line 1) 3503 (open-line 1)
3504 (forward-char) 3504 (forward-char)
3505 (indent-to-column bibtex-entry-offset) 3505 (indent-to-column bibtex-entry-offset)
@@ -3567,7 +3567,7 @@ If mark is active it reformats entries in region, if not in whole buffer."
3567 (region-beginning) 3567 (region-beginning)
3568 (progn 3568 (progn
3569 (bibtex-beginning-of-first-entry) 3569 (bibtex-beginning-of-first-entry)
3570 (skip-to-valid-bibtex-entry) 3570 (bibtex-skip-to-valid-entry)
3571 (point)))) 3571 (point))))
3572 (end-point 3572 (end-point
3573 (if mark-active 3573 (if mark-active
@@ -3591,14 +3591,14 @@ If mark is active it reformats entries in region, if not in whole buffer."
3591 (replace-match "\n\\1")))) 3591 (replace-match "\n\\1"))))
3592 (goto-char start-point) 3592 (goto-char start-point)
3593 (bibtex-progress-message "Formatting" 1) 3593 (bibtex-progress-message "Formatting" 1)
3594 (map-bibtex-entries 3594 (bibtex-map-entries
3595 (lambda (current) 3595 (lambda (current)
3596 (bibtex-progress-message) 3596 (bibtex-progress-message)
3597 (bibtex-clean-entry labels labels) 3597 (bibtex-clean-entry labels labels)
3598 (if (memq 'realign bibtex-entry-format) 3598 (if (memq 'realign bibtex-entry-format)
3599 (progn 3599 (progn
3600 (bibtex-end-of-entry) 3600 (bibtex-end-of-entry)
3601 (delete-whitespace) 3601 (bibtex-delete-whitespace)
3602 (open-line 2))))) 3602 (open-line 2)))))
3603 (bibtex-progress-message 'done)) 3603 (bibtex-progress-message 'done))
3604 (if (and 3604 (if (and