aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGlenn Morris2009-09-01 03:02:25 +0000
committerGlenn Morris2009-09-01 03:02:25 +0000
commitd63eb0e7b460e6072b29fac59d6e743d556ba7fc (patch)
tree87fa122e62fa8fa965825b17c6c6659300d70695
parentd7fbf3f0d37e1a6947d30e82448b79942fe2e9a3 (diff)
downloademacs-d63eb0e7b460e6072b29fac59d6e743d556ba7fc.tar.gz
emacs-d63eb0e7b460e6072b29fac59d6e743d556ba7fc.zip
Remove unnecessary bindings of default-major-mode (all are followed by
major-mode check and possible mode switch).
-rw-r--r--lisp/ChangeLog9
-rw-r--r--lisp/textmodes/reftex-cite.el61
-rw-r--r--lisp/textmodes/reftex-index.el3
-rw-r--r--lisp/textmodes/reftex-ref.el15
-rw-r--r--lisp/textmodes/reftex-toc.el3
5 files changed, 48 insertions, 43 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 6e564d41b32..b31edc129ae 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,12 @@
12009-09-01 Glenn Morris <rgm@gnu.org>
2
3 * textmodes/reftex-cite.el (reftex-offer-bib-menu):
4 * textmodes/reftex-index.el (reftex-display-index):
5 * textmodes/reftex-ref.el (reftex-offer-label-menu):
6 * textmodes/reftex-toc.el (reftex-toc):
7 Remove unnecessary bindings of default-major-mode (all are followed by
8 major-mode check and possible mode switch).
9
12009-08-31 Nick Roberts <nickrob@snap.net.nz> 102009-08-31 Nick Roberts <nickrob@snap.net.nz>
2 11
3 * progmodes/gdb-mi.el (gdb-breakpoints-list-handler-custom): 12 * progmodes/gdb-mi.el (gdb-breakpoints-list-handler-custom):
diff --git a/lisp/textmodes/reftex-cite.el b/lisp/textmodes/reftex-cite.el
index 8f45551c3ab..c81d20fb4e1 100644
--- a/lisp/textmodes/reftex-cite.el
+++ b/lisp/textmodes/reftex-cite.el
@@ -685,7 +685,7 @@ While entering the regexp, completion on knows citation keys is possible.
685 ;; it has to go. If there is only a single arg and empty, it can go 685 ;; it has to go. If there is only a single arg and empty, it can go
686 ;; as well. 686 ;; as well.
687 (when reftex-cite-cleanup-optional-args 687 (when reftex-cite-cleanup-optional-args
688 (cond 688 (cond
689 ((string-match "\\([a-zA-Z0-9]\\)\\[\\]{" string) 689 ((string-match "\\([a-zA-Z0-9]\\)\\[\\]{" string)
690 (setq string (replace-match "\\1{" nil nil string))) 690 (setq string (replace-match "\\1{" nil nil string)))
691 ((string-match "\\[\\]\\(\\[[a-zA-Z0-9., ]+\\]\\)" string) 691 ((string-match "\\[\\]\\(\\[[a-zA-Z0-9., ]+\\]\\)" string)
@@ -724,7 +724,7 @@ While entering the regexp, completion on knows citation keys is possible.
724 (decf arg) 724 (decf arg)
725 (reftex-do-citation arg)) 725 (reftex-do-citation arg))
726 (forward-char 1))) 726 (forward-char 1)))
727 727
728 ;; Return the citation key 728 ;; Return the citation key
729 (car (car selected-entries)))) 729 (car (car selected-entries))))
730 730
@@ -738,7 +738,7 @@ While entering the regexp, completion on knows citation keys is possible.
738 (no-insert 738 (no-insert
739 ;; Format does not really matter because nothing will be inserted. 739 ;; Format does not really matter because nothing will be inserted.
740 (setq format "%l")) 740 (setq format "%l"))
741 741
742 ((and (stringp macro) 742 ((and (stringp macro)
743 (string-match "\\`\\\\cite\\|cite\\'" macro)) 743 (string-match "\\`\\\\cite\\|cite\\'" macro))
744 ;; We are already inside a cite macro 744 ;; We are already inside a cite macro
@@ -759,7 +759,7 @@ While entering the regexp, completion on knows citation keys is possible.
759 (when (listp format) 759 (when (listp format)
760 (setq key 760 (setq key
761 (or format-key 761 (or format-key
762 (reftex-select-with-char 762 (reftex-select-with-char
763 "" (concat "SELECT A CITATION FORMAT\n\n" 763 "" (concat "SELECT A CITATION FORMAT\n\n"
764 (mapconcat 764 (mapconcat
765 (lambda (x) 765 (lambda (x)
@@ -788,8 +788,8 @@ While entering the regexp, completion on knows citation keys is possible.
788 788
789 (let ((bibtype (reftex-bib-or-thebib)) 789 (let ((bibtype (reftex-bib-or-thebib))
790 found-list rtn key data selected-entries) 790 found-list rtn key data selected-entries)
791 (while 791 (while
792 (not 792 (not
793 (catch 'done 793 (catch 'done
794 ;; Scan bibtex files 794 ;; Scan bibtex files
795 (setq found-list 795 (setq found-list
@@ -804,31 +804,30 @@ While entering the regexp, completion on knows citation keys is possible.
804 (reftex-extract-bib-entries-from-thebibliography 804 (reftex-extract-bib-entries-from-thebibliography
805 (reftex-uniquify 805 (reftex-uniquify
806 (mapcar 'cdr 806 (mapcar 'cdr
807 (reftex-all-assq 807 (reftex-all-assq
808 'thebib (symbol-value reftex-docstruct-symbol)))))) 808 'thebib (symbol-value reftex-docstruct-symbol))))))
809 (reftex-default-bibliography 809 (reftex-default-bibliography
810 (message "Using default bibliography") 810 (message "Using default bibliography")
811 (reftex-extract-bib-entries (reftex-default-bibliography))) 811 (reftex-extract-bib-entries (reftex-default-bibliography)))
812 (t (error "No valid bibliography in this document, and no default available")))) 812 (t (error "No valid bibliography in this document, and no default available"))))
813 813
814 (unless found-list 814 (unless found-list
815 (error "Sorry, no matches found")) 815 (error "Sorry, no matches found"))
816 816
817 ;; Remember where we came from 817 ;; Remember where we came from
818 (setq reftex-call-back-to-this-buffer (current-buffer)) 818 (setq reftex-call-back-to-this-buffer (current-buffer))
819 (set-marker reftex-select-return-marker (point)) 819 (set-marker reftex-select-return-marker (point))
820 820
821 ;; Offer selection 821 ;; Offer selection
822 (save-window-excursion 822 (save-window-excursion
823 (delete-other-windows) 823 (delete-other-windows)
824 (let ((default-major-mode 'reftex-select-bib-mode)) 824 (reftex-kill-buffer "*RefTeX Select*")
825 (reftex-kill-buffer "*RefTeX Select*") 825 (switch-to-buffer-other-window "*RefTeX Select*")
826 (switch-to-buffer-other-window "*RefTeX Select*") 826 (unless (eq major-mode 'reftex-select-bib-mode)
827 (unless (eq major-mode 'reftex-select-bib-mode) 827 (reftex-select-bib-mode))
828 (reftex-select-bib-mode)) 828 (let ((buffer-read-only nil))
829 (let ((buffer-read-only nil)) 829 (erase-buffer)
830 (erase-buffer) 830 (reftex-insert-bib-matches found-list))
831 (reftex-insert-bib-matches found-list)))
832 (setq buffer-read-only t) 831 (setq buffer-read-only t)
833 (if (= 0 (buffer-size)) 832 (if (= 0 (buffer-size))
834 (error "No matches found")) 833 (error "No matches found"))
@@ -858,15 +857,15 @@ While entering the regexp, completion on knows citation keys is possible.
858 (goto-char 1)) 857 (goto-char 1))
859 ((eq key ?A) 858 ((eq key ?A)
860 ;; Take all (marked) 859 ;; Take all (marked)
861 (setq selected-entries 860 (setq selected-entries
862 (if reftex-select-marked 861 (if reftex-select-marked
863 (mapcar 'car (nreverse reftex-select-marked)) 862 (mapcar 'car (nreverse reftex-select-marked))
864 found-list)) 863 found-list))
865 (throw 'done t)) 864 (throw 'done t))
866 ((eq key ?a) 865 ((eq key ?a)
867 ;; Take all (marked), and push the symbol 'concat 866 ;; Take all (marked), and push the symbol 'concat
868 (setq selected-entries 867 (setq selected-entries
869 (cons 'concat 868 (cons 'concat
870 (if reftex-select-marked 869 (if reftex-select-marked
871 (mapcar 'car (nreverse reftex-select-marked)) 870 (mapcar 'car (nreverse reftex-select-marked))
872 found-list))) 871 found-list)))
@@ -885,9 +884,9 @@ While entering the regexp, completion on knows citation keys is possible.
885 ((or (eq key ?\C-m) 884 ((or (eq key ?\C-m)
886 (eq key 'return)) 885 (eq key 'return))
887 ;; Take selected 886 ;; Take selected
888 (setq selected-entries 887 (setq selected-entries
889 (if reftex-select-marked 888 (if reftex-select-marked
890 (cons 'concat 889 (cons 'concat
891 (mapcar 'car (nreverse reftex-select-marked))) 890 (mapcar 'car (nreverse reftex-select-marked)))
892 (if data (list data) nil))) 891 (if data (list data) nil)))
893 (throw 'done t)) 892 (throw 'done t))
@@ -927,7 +926,7 @@ While entering the regexp, completion on knows citation keys is possible.
927 (let ((file (read-file-name "File to create: "))) 926 (let ((file (read-file-name "File to create: ")))
928 (find-file-other-window file) 927 (find-file-other-window file)
929 (if (> (buffer-size) 0) 928 (if (> (buffer-size) 0)
930 (unless (yes-or-no-p 929 (unless (yes-or-no-p
931 (format "Overwrite non-empty file %s? " file)) 930 (format "Overwrite non-empty file %s? " file))
932 (error "Abort"))) 931 (error "Abort")))
933 (erase-buffer) 932 (erase-buffer)
@@ -1047,7 +1046,7 @@ While entering the regexp, completion on knows citation keys is possible.
1047(defun reftex-make-cite-echo-string (entry docstruct-symbol) 1046(defun reftex-make-cite-echo-string (entry docstruct-symbol)
1048 ;; Format a bibtex entry for the echo area and cache the result. 1047 ;; Format a bibtex entry for the echo area and cache the result.
1049 (let* ((key (reftex-get-bib-field "&key" entry)) 1048 (let* ((key (reftex-get-bib-field "&key" entry))
1050 (string 1049 (string
1051 (let* ((reftex-cite-punctuation '(" " " & " " etal."))) 1050 (let* ((reftex-cite-punctuation '(" " " & " " etal.")))
1052 (reftex-format-citation entry reftex-cite-view-format))) 1051 (reftex-format-citation entry reftex-cite-view-format)))
1053 (cache (assq 'bibview-cache (symbol-value docstruct-symbol))) 1052 (cache (assq 'bibview-cache (symbol-value docstruct-symbol)))
@@ -1089,7 +1088,7 @@ While entering the regexp, completion on knows citation keys is possible.
1089 (setq bibfile-list 1088 (setq bibfile-list
1090 (reftex-uniquify 1089 (reftex-uniquify
1091 (mapcar 'cdr 1090 (mapcar 'cdr
1092 (reftex-all-assq 1091 (reftex-all-assq
1093 'thebib (symbol-value reftex-docstruct-symbol)))) 1092 'thebib (symbol-value reftex-docstruct-symbol))))
1094 item t)) 1093 item t))
1095 (reftex-default-bibliography 1094 (reftex-default-bibliography
@@ -1100,10 +1099,10 @@ While entering the regexp, completion on knows citation keys is possible.
1100 (setq bibfile-list (reftex-visited-files bibfile-list))) 1099 (setq bibfile-list (reftex-visited-files bibfile-list)))
1101 1100
1102 (condition-case nil 1101 (condition-case nil
1103 (reftex-pop-to-bibtex-entry 1102 (reftex-pop-to-bibtex-entry
1104 key bibfile-list (not reftex-keep-temporary-buffers) t item) 1103 key bibfile-list (not reftex-keep-temporary-buffers) t item)
1105 (error (ding)))) 1104 (error (ding))))
1106 1105
1107 (select-window win))) 1106 (select-window win)))
1108 1107
1109;;; Global BibTeX file 1108;;; Global BibTeX file
@@ -1132,7 +1131,7 @@ While entering the regexp, completion on knows citation keys is possible.
1132 "Create a new BibTeX database file with all entries referenced in document. 1131 "Create a new BibTeX database file with all entries referenced in document.
1133The command prompts for a filename and writes the collected entries to 1132The command prompts for a filename and writes the collected entries to
1134that file. Only entries referenced in the current document with 1133that file. Only entries referenced in the current document with
1135any \\cite-like macros are used. 1134any \\cite-like macros are used.
1136The sequence in the new file is the same as it was in the old database." 1135The sequence in the new file is the same as it was in the old database."
1137 (interactive "FNew BibTeX file: ") 1136 (interactive "FNew BibTeX file: ")
1138 (let ((keys (reftex-all-used-citation-keys)) 1137 (let ((keys (reftex-all-used-citation-keys))
@@ -1146,7 +1145,7 @@ The sequence in the new file is the same as it was in the old database."
1146 (save-restriction 1145 (save-restriction
1147 (widen) 1146 (widen)
1148 (goto-char (point-min)) 1147 (goto-char (point-min))
1149 (while (re-search-forward 1148 (while (re-search-forward
1150 "^[ \t]*@[a-zA-Z]+[ \t]*{\\([^ \t\r\n]+\\)," 1149 "^[ \t]*@[a-zA-Z]+[ \t]*{\\([^ \t\r\n]+\\),"
1151 nil t) 1150 nil t)
1152 (setq key (match-string 1) 1151 (setq key (match-string 1)
@@ -1163,7 +1162,7 @@ The sequence in the new file is the same as it was in the old database."
1163 keys (delete key keys))))))))) 1162 keys (delete key keys)))))))))
1164 (find-file-other-window bibfile) 1163 (find-file-other-window bibfile)
1165 (if (> (buffer-size) 0) 1164 (if (> (buffer-size) 0)
1166 (unless (yes-or-no-p 1165 (unless (yes-or-no-p
1167 (format "Overwrite non-empty file %s? " bibfile)) 1166 (format "Overwrite non-empty file %s? " bibfile))
1168 (error "Abort"))) 1167 (error "Abort")))
1169 (erase-buffer) 1168 (erase-buffer)
diff --git a/lisp/textmodes/reftex-index.el b/lisp/textmodes/reftex-index.el
index 31627604b0b..d26365b6d70 100644
--- a/lisp/textmodes/reftex-index.el
+++ b/lisp/textmodes/reftex-index.el
@@ -424,8 +424,7 @@ With prefix 3, restrict index to region."
424 424
425 (if (get-buffer-window buffer-name) 425 (if (get-buffer-window buffer-name)
426 (select-window (get-buffer-window buffer-name)) 426 (select-window (get-buffer-window buffer-name))
427 (let ((default-major-mode 'reftex-index-mode)) 427 (switch-to-buffer buffer-name))
428 (switch-to-buffer buffer-name)))
429 428
430 (or (eq major-mode 'reftex-index-mode) (reftex-index-mode)) 429 (or (eq major-mode 'reftex-index-mode) (reftex-index-mode))
431 430
diff --git a/lisp/textmodes/reftex-ref.el b/lisp/textmodes/reftex-ref.el
index 4e892deca7f..3ec284eacac 100644
--- a/lisp/textmodes/reftex-ref.el
+++ b/lisp/textmodes/reftex-ref.el
@@ -536,14 +536,13 @@ When called with 2 C-u prefix args, disable magic word recognition."
536 (delete-other-windows) 536 (delete-other-windows)
537 (setq reftex-call-back-to-this-buffer buf 537 (setq reftex-call-back-to-this-buffer buf
538 reftex-latex-syntax-table (syntax-table)) 538 reftex-latex-syntax-table (syntax-table))
539 (let ((default-major-mode 'reftex-select-label-mode)) 539 (if reftex-use-multiple-selection-buffers
540 (if reftex-use-multiple-selection-buffers 540 (switch-to-buffer-other-window
541 (switch-to-buffer-other-window 541 (save-excursion
542 (save-excursion 542 (set-buffer buf)
543 (set-buffer buf) 543 (reftex-make-selection-buffer-name typekey)))
544 (reftex-make-selection-buffer-name typekey))) 544 (switch-to-buffer-other-window "*RefTeX Select*")
545 (switch-to-buffer-other-window "*RefTeX Select*") 545 (reftex-erase-buffer))
546 (reftex-erase-buffer)))
547 (unless (eq major-mode 'reftex-select-label-mode) 546 (unless (eq major-mode 'reftex-select-label-mode)
548 (reftex-select-label-mode)) 547 (reftex-select-label-mode))
549 (add-to-list 'selection-buffers (current-buffer)) 548 (add-to-list 'selection-buffers (current-buffer))
diff --git a/lisp/textmodes/reftex-toc.el b/lisp/textmodes/reftex-toc.el
index 0feda11a49f..6e07b78cb70 100644
--- a/lisp/textmodes/reftex-toc.el
+++ b/lisp/textmodes/reftex-toc.el
@@ -170,8 +170,7 @@ When called with a raw C-u prefix, rescan the document first."
170 (floor (* (window-height) 170 (floor (* (window-height)
171 reftex-toc-split-windows-fraction))))) 171 reftex-toc-split-windows-fraction)))))
172 172
173 (let ((default-major-mode 'reftex-toc-mode)) 173 (switch-to-buffer "*toc*"))
174 (switch-to-buffer "*toc*")))
175 174
176 (or (eq major-mode 'reftex-toc-mode) (reftex-toc-mode)) 175 (or (eq major-mode 'reftex-toc-mode) (reftex-toc-mode))
177 (set (make-local-variable 'reftex-docstruct-symbol) docstruct-symbol) 176 (set (make-local-variable 'reftex-docstruct-symbol) docstruct-symbol)