aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJoakim Verona2013-09-11 07:34:43 +0200
committerJoakim Verona2013-09-11 07:34:43 +0200
commit681bd2a1dd602397646a7382ae72c5f622c0946c (patch)
treed057b7f9d7a2aba40d2823eb7f999672433435b2
parentac845636437cfd96001525f7f090ec0dc336731e (diff)
parentebb99847285bca912e04f79dd3d9dcc84769ccf6 (diff)
downloademacs-681bd2a1dd602397646a7382ae72c5f622c0946c.tar.gz
emacs-681bd2a1dd602397646a7382ae72c5f622c0946c.zip
merge from trunk
-rw-r--r--etc/NEWS2
-rw-r--r--lisp/ChangeLog46
-rw-r--r--lisp/arc-mode.el4
-rw-r--r--lisp/array.el11
-rw-r--r--lisp/bookmark.el31
-rw-r--r--lisp/calc/calc.el48
-rw-r--r--lisp/cedet/ChangeLog75
-rw-r--r--lisp/cedet/data-debug.el18
-rw-r--r--lisp/cedet/semantic/grammar.el26
-rw-r--r--lisp/chistory.el18
-rw-r--r--lisp/comint.el28
-rw-r--r--lisp/emacs-lisp/debug.el8
-rw-r--r--lisp/emulation/ws-mode.el114
-rw-r--r--lisp/eshell/esh-mode.el149
-rw-r--r--lisp/gnus/ChangeLog58
-rw-r--r--lisp/gnus/gnus-art.el39
-rw-r--r--lisp/gnus/gnus-bookmark.el11
-rw-r--r--lisp/gnus/gnus-cus.el8
-rw-r--r--lisp/gnus/gnus-group.el20
-rw-r--r--lisp/gnus/gnus-kill.el46
-rw-r--r--lisp/gnus/gnus-srvr.el13
-rw-r--r--lisp/gnus/score-mode.el26
-rw-r--r--lisp/ibuffer.el15
-rw-r--r--lisp/info.el46
-rw-r--r--lisp/locate.el44
-rw-r--r--lisp/mail/mspools.el10
-rw-r--r--lisp/mail/rmailsum.el11
-rw-r--r--lisp/man.el15
-rw-r--r--lisp/net/eudc-hotlist.el37
-rw-r--r--lisp/net/eudc.el16
-rw-r--r--lisp/net/mairix.el41
-rw-r--r--lisp/net/newst-treeview.el6
-rw-r--r--lisp/net/quickurl.el8
-rw-r--r--lisp/obsolete/options.el16
-rw-r--r--lisp/play/5x5.el15
-rw-r--r--lisp/play/blackbox.el11
-rw-r--r--lisp/play/landmark.el19
-rw-r--r--lisp/play/mpuz.el12
-rw-r--r--lisp/play/snake.el16
-rw-r--r--lisp/profiler.el3
-rw-r--r--src/ChangeLog4
-rw-r--r--src/bytecode.c8
-rw-r--r--src/data.c76
-rw-r--r--src/fileio.c3
-rw-r--r--src/keyboard.c6
-rw-r--r--src/lisp.h10
-rw-r--r--test/automated/data-tests.el75
47 files changed, 590 insertions, 732 deletions
diff --git a/etc/NEWS b/etc/NEWS
index 78f99dbc621..929c86a7ba6 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -625,6 +625,8 @@ actually using interpreter-mode-alist for something.
625 625
626* Lisp Changes in Emacs 24.4 626* Lisp Changes in Emacs 24.4
627 627
628** Comparison functions =, <, >, <=, >= now take many arguments.
629
628** The second argument of `eval' can now be a lexical-environment. 630** The second argument of `eval' can now be a lexical-environment.
629 631
630** `with-demoted-errors' takes an additional argument `format'. 632** `with-demoted-errors' takes an additional argument `format'.
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 32ea5e72efd..e1f1aaa1888 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,49 @@
12013-09-11 Stefan Monnier <monnier@iro.umontreal.ca>
2
3 * play/snake.el (snake-mode):
4 * play/mpuz.el (mpuz-mode):
5 * play/landmark.el (lm-mode):
6 * play/blackbox.el (blackbox-mode):
7 * play/5x5.el (5x5-mode):
8 * obsolete/options.el (Edit-options-mode):
9 * net/quickurl.el (quickurl-list-mode):
10 * net/newst-treeview.el (newsticker-treeview-mode):
11 * mail/rmailsum.el (rmail-summary-mode):
12 * mail/mspools.el (mspools-mode):
13 * locate.el (locate-mode):
14 * ibuffer.el (ibuffer-mode):
15 * emulation/ws-mode.el (wordstar-mode):
16 * emacs-lisp/debug.el (debugger-mode):
17 * array.el (array-mode):
18 * net/eudc.el (eudc-mode): Use define-derived-mode.
19 * net/mairix.el (mairix-searches-mode-font-lock-keywords):
20 Move initialization into declaration.
21 (mairix-searches-mode): Use define-derived-mode.
22 * net/eudc-hotlist.el (eudc-hotlist-mode): Use define-derived-mode.
23 (eudc-edit-hotlist): Use dolist.
24 * man.el (Man-mode-syntax-table): Rename from man-mode-syntax-table.
25 (Man-mode): Use define-derived-mode.
26 * info.el (Info-edit-mode-map): Rename from Info-edit-map.
27 (Info-edit-mode): Use define-derived-mode.
28 (Info-cease-edit): Use Info-mode.
29 * eshell/esh-mode.el (eshell-mode-syntax-table): Move initialization
30 into declaration.
31 (eshell-mode): Use define-derived-mode.
32 * chistory.el (command-history-mode-map): Rename from
33 command-history-map.
34 (command-history-mode): Use define-derived-mode.
35 * calc/calc.el (calc-trail-mode-map): New var.
36 (calc-trail-mode): Use define-derived-mode.
37 (calc-trail-buffer): Set calc-main-buffer manually.
38 * bookmark.el (bookmark-insert-annotation): New function.
39 (bookmark-edit-annotation): Use it.
40 (bookmark-edit-annotation-mode): Make it a proper major mode.
41 (bookmark-send-edited-annotation): Use derived-mode-p.
42 * arc-mode.el (archive-mode): Move kill-all-local-variables a tiny bit
43 closer to its ideal place. Use \' to match EOS.
44
45 * profiler.el (profiler-calltree-find): Use function-equal.
46
12013-09-10 Glenn Morris <rgm@gnu.org> 472013-09-10 Glenn Morris <rgm@gnu.org>
2 48
3 * files.el (interpreter-mode-alist): Convert to regexps. 49 * files.el (interpreter-mode-alist): Convert to regexps.
diff --git a/lisp/arc-mode.el b/lisp/arc-mode.el
index a4f7015c844..c22205d5634 100644
--- a/lisp/arc-mode.el
+++ b/lisp/arc-mode.el
@@ -683,9 +683,9 @@ archive.
683 ;; At present we cannot create archives from scratch 683 ;; At present we cannot create archives from scratch
684 (funcall (or (default-value 'major-mode) 'fundamental-mode)) 684 (funcall (or (default-value 'major-mode) 'fundamental-mode))
685 (if (and (not force) archive-files) nil 685 (if (and (not force) archive-files) nil
686 (kill-all-local-variables)
686 (let* ((type (archive-find-type)) 687 (let* ((type (archive-find-type))
687 (typename (capitalize (symbol-name type)))) 688 (typename (capitalize (symbol-name type))))
688 (kill-all-local-variables)
689 (make-local-variable 'archive-subtype) 689 (make-local-variable 'archive-subtype)
690 (setq archive-subtype type) 690 (setq archive-subtype type)
691 691
@@ -761,7 +761,7 @@ archive.
761 ((looking-at "..-l[hz][0-9ds]-") 'lzh) 761 ((looking-at "..-l[hz][0-9ds]-") 'lzh)
762 ((looking-at "....................[\334]\247\304\375") 'zoo) 762 ((looking-at "....................[\334]\247\304\375") 'zoo)
763 ((and (looking-at "\C-z") ; signature too simple, IMHO 763 ((and (looking-at "\C-z") ; signature too simple, IMHO
764 (string-match "\\.[aA][rR][cC]$" 764 (string-match "\\.[aA][rR][cC]\\'"
765 (or buffer-file-name (buffer-name)))) 765 (or buffer-file-name (buffer-name))))
766 'arc) 766 'arc)
767 ;; This pattern modeled on the BSD/GNU+Linux `file' command. 767 ;; This pattern modeled on the BSD/GNU+Linux `file' command.
diff --git a/lisp/array.el b/lisp/array.el
index e60cbdfffc1..8c4f609e626 100644
--- a/lisp/array.el
+++ b/lisp/array.el
@@ -800,7 +800,7 @@ Return COLUMN."
800(put 'array-mode 'mode-class 'special) 800(put 'array-mode 'mode-class 'special)
801 801
802;;;###autoload 802;;;###autoload
803(defun array-mode () 803(define-derived-mode array-mode fundamental-mode "Array"
804 "Major mode for editing arrays. 804 "Major mode for editing arrays.
805 805
806 Array mode is a specialized mode for editing arrays. An array is 806 Array mode is a specialized mode for editing arrays. An array is
@@ -863,9 +863,6 @@ take a numeric prefix argument):
863 \\[array-display-local-variables] Display the current values of local variables. 863 \\[array-display-local-variables] Display the current values of local variables.
864 864
865Entering array mode calls the function `array-mode-hook'." 865Entering array mode calls the function `array-mode-hook'."
866
867 (interactive)
868 (kill-all-local-variables)
869 (make-local-variable 'array-buffer-line) 866 (make-local-variable 'array-buffer-line)
870 (make-local-variable 'array-buffer-column) 867 (make-local-variable 'array-buffer-column)
871 (make-local-variable 'array-row) 868 (make-local-variable 'array-row)
@@ -888,13 +885,9 @@ Entering array mode calls the function `array-mode-hook'."
888 (+ (floor (1- array-max-column) array-columns-per-line) 885 (+ (floor (1- array-max-column) array-columns-per-line)
889 (if array-rows-numbered 2 1))) 886 (if array-rows-numbered 2 1)))
890 (message "") 887 (message "")
891 (setq major-mode 'array-mode)
892 (setq mode-name "Array")
893 (force-mode-line-update) 888 (force-mode-line-update)
894 (set (make-local-variable 'truncate-lines) t) 889 (set (make-local-variable 'truncate-lines) t)
895 (setq overwrite-mode 'overwrite-mode-textual) 890 (setq overwrite-mode 'overwrite-mode-textual))
896 (use-local-map array-mode-map)
897 (run-mode-hooks 'array-mode-hook))
898 891
899 892
900 893
diff --git a/lisp/bookmark.el b/lisp/bookmark.el
index 9514317809b..ce0d6831a3a 100644
--- a/lisp/bookmark.el
+++ b/lisp/bookmark.el
@@ -862,31 +862,25 @@ It takes one argument, the name of the bookmark, as a string.")
862 map) 862 map)
863 "Keymap for editing an annotation of a bookmark.") 863 "Keymap for editing an annotation of a bookmark.")
864 864
865 865(defun bookmark-insert-annotation (bookmark-name-or-record)
866(defun bookmark-edit-annotation-mode (bookmark-name-or-record)
867 "Mode for editing the annotation of bookmark BOOKMARK-NAME-OR-RECORD.
868When you have finished composing, type \\[bookmark-send-annotation].
869
870\\{bookmark-edit-annotation-mode-map}"
871 (interactive)
872 (kill-all-local-variables)
873 (make-local-variable 'bookmark-annotation-name)
874 (setq bookmark-annotation-name bookmark-name-or-record)
875 (use-local-map bookmark-edit-annotation-mode-map)
876 (setq major-mode 'bookmark-edit-annotation-mode
877 mode-name "Edit Bookmark Annotation")
878 (insert (funcall bookmark-edit-annotation-text-func bookmark-name-or-record)) 866 (insert (funcall bookmark-edit-annotation-text-func bookmark-name-or-record))
879 (let ((annotation (bookmark-get-annotation bookmark-name-or-record))) 867 (let ((annotation (bookmark-get-annotation bookmark-name-or-record)))
880 (if (and annotation (not (string-equal annotation ""))) 868 (if (and annotation (not (string-equal annotation "")))
881 (insert annotation))) 869 (insert annotation))))
882 (run-mode-hooks 'text-mode-hook)) 870
871(define-derived-mode bookmark-edit-annotation-mode
872 text-mode "Edit Bookmark Annotation"
873 "Mode for editing the annotation of bookmarks.
874When you have finished composing, type \\[bookmark-send-annotation].
875
876\\{bookmark-edit-annotation-mode-map}")
883 877
884 878
885(defun bookmark-send-edited-annotation () 879(defun bookmark-send-edited-annotation ()
886 "Use buffer contents as annotation for a bookmark. 880 "Use buffer contents as annotation for a bookmark.
887Lines beginning with `#' are ignored." 881Lines beginning with `#' are ignored."
888 (interactive) 882 (interactive)
889 (if (not (eq major-mode 'bookmark-edit-annotation-mode)) 883 (if (not (derived-mode-p 'bookmark-edit-annotation-mode))
890 (error "Not in bookmark-edit-annotation-mode")) 884 (error "Not in bookmark-edit-annotation-mode"))
891 (goto-char (point-min)) 885 (goto-char (point-min))
892 (while (< (point) (point-max)) 886 (while (< (point) (point-max))
@@ -906,7 +900,10 @@ Lines beginning with `#' are ignored."
906(defun bookmark-edit-annotation (bookmark-name-or-record) 900(defun bookmark-edit-annotation (bookmark-name-or-record)
907 "Pop up a buffer for editing bookmark BOOKMARK-NAME-OR-RECORD's annotation." 901 "Pop up a buffer for editing bookmark BOOKMARK-NAME-OR-RECORD's annotation."
908 (pop-to-buffer (generate-new-buffer-name "*Bookmark Annotation Compose*")) 902 (pop-to-buffer (generate-new-buffer-name "*Bookmark Annotation Compose*"))
909 (bookmark-edit-annotation-mode bookmark-name-or-record)) 903 (bookmark-insert-annotation bookmark-name-or-record)
904 (bookmark-edit-annotation-mode)
905 (set (make-local-variable 'bookmark-annotation-name)
906 bookmark-name-or-record))
910 907
911 908
912(defun bookmark-buffer-name () 909(defun bookmark-buffer-name ()
diff --git a/lisp/calc/calc.el b/lisp/calc/calc.el
index 2eeb880c34d..2795a177a41 100644
--- a/lisp/calc/calc.el
+++ b/lisp/calc/calc.el
@@ -1387,7 +1387,12 @@ Notations: 3.14e6 3.14 * 10^6
1387 (calc-check-defines)) 1387 (calc-check-defines))
1388 (setplist 'calc-define nil))))) 1388 (setplist 'calc-define nil)))))
1389 1389
1390(defun calc-trail-mode (&optional buf) 1390(defvar calc-trail-mode-map
1391 (let ((map (make-sparse-keymap)))
1392 (set-keymap-parent map calc-mode-map)
1393 map))
1394
1395(define-derived-mode calc-trail-mode fundamental-mode "Calc Trail"
1391 "Calc Trail mode. 1396 "Calc Trail mode.
1392This mode is used by the *Calc Trail* buffer, which records all results 1397This mode is used by the *Calc Trail* buffer, which records all results
1393obtained by the GNU Emacs Calculator. 1398obtained by the GNU Emacs Calculator.
@@ -1397,26 +1402,18 @@ the Trail.
1397 1402
1398This buffer uses the same key map as the *Calculator* buffer; calculator 1403This buffer uses the same key map as the *Calculator* buffer; calculator
1399commands given here will actually operate on the *Calculator* stack." 1404commands given here will actually operate on the *Calculator* stack."
1400 (interactive)
1401 (fundamental-mode)
1402 (use-local-map calc-mode-map)
1403 (setq major-mode 'calc-trail-mode)
1404 (setq mode-name "Calc Trail")
1405 (setq truncate-lines t) 1405 (setq truncate-lines t)
1406 (setq buffer-read-only t) 1406 (setq buffer-read-only t)
1407 (make-local-variable 'overlay-arrow-position) 1407 (make-local-variable 'overlay-arrow-position)
1408 (make-local-variable 'overlay-arrow-string) 1408 (make-local-variable 'overlay-arrow-string)
1409 (when buf
1410 (set (make-local-variable 'calc-main-buffer) buf))
1411 (when (= (buffer-size) 0) 1409 (when (= (buffer-size) 0)
1412 (let ((buffer-read-only nil)) 1410 (let ((buffer-read-only nil))
1413 (insert (propertize "Emacs Calculator Trail\n" 'face 'italic)))) 1411 (insert (propertize "Emacs Calculator Trail\n" 'face 'italic)))))
1414 (run-mode-hooks 'calc-trail-mode-hook))
1415 1412
1416(defun calc-create-buffer () 1413(defun calc-create-buffer ()
1417 "Create and initialize a buffer for the Calculator." 1414 "Create and initialize a buffer for the Calculator."
1418 (set-buffer (get-buffer-create "*Calculator*")) 1415 (set-buffer (get-buffer-create "*Calculator*"))
1419 (or (eq major-mode 'calc-mode) 1416 (or (derived-mode-p 'calc-mode)
1420 (calc-mode)) 1417 (calc-mode))
1421 (setq max-lisp-eval-depth (max max-lisp-eval-depth 1000)) 1418 (setq max-lisp-eval-depth (max max-lisp-eval-depth 1000))
1422 (when calc-always-load-extensions 1419 (when calc-always-load-extensions
@@ -1439,7 +1436,7 @@ commands given here will actually operate on the *Calculator* stack."
1439 (when (get-buffer-window "*Calc Keypad*") 1436 (when (get-buffer-window "*Calc Keypad*")
1440 (calc-keypad) 1437 (calc-keypad)
1441 (set-buffer (window-buffer))) 1438 (set-buffer (window-buffer)))
1442 (if (eq major-mode 'calc-mode) 1439 (if (derived-mode-p 'calc-mode)
1443 (calc-quit) 1440 (calc-quit)
1444 (let ((oldbuf (current-buffer))) 1441 (let ((oldbuf (current-buffer)))
1445 (calc-create-buffer) 1442 (calc-create-buffer)
@@ -1490,7 +1487,7 @@ commands given here will actually operate on the *Calculator* stack."
1490 (if (and (equal (buffer-name) "*Gnuplot Trail*") 1487 (if (and (equal (buffer-name) "*Gnuplot Trail*")
1491 (> (recursion-depth) 0)) 1488 (> (recursion-depth) 0))
1492 (exit-recursive-edit) 1489 (exit-recursive-edit)
1493 (if (eq major-mode 'calc-edit-mode) 1490 (if (derived-mode-p 'calc-edit-mode)
1494 (calc-edit-finish arg) 1491 (calc-edit-finish arg)
1495 (if calc-was-keypad-mode 1492 (if calc-was-keypad-mode
1496 (calc-keypad) 1493 (calc-keypad)
@@ -1504,13 +1501,13 @@ commands given here will actually operate on the *Calculator* stack."
1504 (if (and (equal (buffer-name) "*Gnuplot Trail*") 1501 (if (and (equal (buffer-name) "*Gnuplot Trail*")
1505 (> (recursion-depth) 0)) 1502 (> (recursion-depth) 0))
1506 (exit-recursive-edit)) 1503 (exit-recursive-edit))
1507 (if (eq major-mode 'calc-edit-mode) 1504 (if (derived-mode-p 'calc-edit-mode)
1508 (calc-edit-cancel) 1505 (calc-edit-cancel)
1509 (if (and interactive 1506 (if (and interactive
1510 calc-embedded-info 1507 calc-embedded-info
1511 (eq (current-buffer) (aref calc-embedded-info 0))) 1508 (eq (current-buffer) (aref calc-embedded-info 0)))
1512 (calc-embedded nil) 1509 (calc-embedded nil)
1513 (unless (eq major-mode 'calc-mode) 1510 (unless (derived-mode-p 'calc-mode)
1514 (calc-create-buffer)) 1511 (calc-create-buffer))
1515 (run-hooks 'calc-end-hook) 1512 (run-hooks 'calc-end-hook)
1516 (if (integerp calc-undo-length) 1513 (if (integerp calc-undo-length)
@@ -1631,10 +1628,10 @@ See calc-keypad for details."
1631 (if (math-lessp 1 time) 1628 (if (math-lessp 1 time)
1632 (calc-record time "(t)")))) 1629 (calc-record time "(t)"))))
1633 (or (memq 'no-align calc-command-flags) 1630 (or (memq 'no-align calc-command-flags)
1634 (eq major-mode 'calc-trail-mode) 1631 (derived-mode-p 'calc-trail-mode)
1635 (calc-align-stack-window)) 1632 (calc-align-stack-window))
1636 (and (memq 'position-point calc-command-flags) 1633 (and (memq 'position-point calc-command-flags)
1637 (if (eq major-mode 'calc-mode) 1634 (if (derived-mode-p 'calc-mode)
1638 (progn 1635 (progn
1639 (goto-char (point-min)) 1636 (goto-char (point-min))
1640 (forward-line (1- calc-final-point-line)) 1637 (forward-line (1- calc-final-point-line))
@@ -1664,7 +1661,7 @@ See calc-keypad for details."
1664 (setq calc-command-flags (cons f calc-command-flags)))) 1661 (setq calc-command-flags (cons f calc-command-flags))))
1665 1662
1666(defun calc-select-buffer () 1663(defun calc-select-buffer ()
1667 (or (eq major-mode 'calc-mode) 1664 (or (derived-mode-p 'calc-mode)
1668 (if calc-main-buffer 1665 (if calc-main-buffer
1669 (set-buffer calc-main-buffer) 1666 (set-buffer calc-main-buffer)
1670 (let ((buf (get-buffer "*Calculator*"))) 1667 (let ((buf (get-buffer "*Calculator*")))
@@ -1801,7 +1798,7 @@ See calc-keypad for details."
1801 (and calc-embedded-info (calc-embedded-mode-line-change)))))) 1798 (and calc-embedded-info (calc-embedded-mode-line-change))))))
1802 1799
1803(defun calc-align-stack-window () 1800(defun calc-align-stack-window ()
1804 (if (eq major-mode 'calc-mode) 1801 (if (derived-mode-p 'calc-mode)
1805 (progn 1802 (progn
1806 (let ((win (get-buffer-window (current-buffer)))) 1803 (let ((win (get-buffer-window (current-buffer))))
1807 (if win 1804 (if win
@@ -1988,7 +1985,7 @@ See calc-keypad for details."
1988(defvar calc-any-evaltos nil) 1985(defvar calc-any-evaltos nil)
1989(defun calc-refresh (&optional align) 1986(defun calc-refresh (&optional align)
1990 (interactive) 1987 (interactive)
1991 (and (eq major-mode 'calc-mode) 1988 (and (derived-mode-p 'calc-mode)
1992 (not calc-executing-macro) 1989 (not calc-executing-macro)
1993 (let* ((buffer-read-only nil) 1990 (let* ((buffer-read-only nil)
1994 (save-point (point)) 1991 (save-point (point))
@@ -2016,7 +2013,7 @@ See calc-keypad for details."
2016 (calc-align-stack-window) 2013 (calc-align-stack-window)
2017 (goto-char save-point)) 2014 (goto-char save-point))
2018 (if save-mark (set-mark save-mark)))) 2015 (if save-mark (set-mark save-mark))))
2019 (and calc-embedded-info (not (eq major-mode 'calc-mode)) 2016 (and calc-embedded-info (not (derived-mode-p 'calc-mode))
2020 (with-current-buffer (aref calc-embedded-info 1) 2017 (with-current-buffer (aref calc-embedded-info 1)
2021 (calc-refresh align))) 2018 (calc-refresh align)))
2022 (setq calc-refresh-count (1+ calc-refresh-count))) 2019 (setq calc-refresh-count (1+ calc-refresh-count)))
@@ -2078,12 +2075,13 @@ the United States."
2078 (null (buffer-name calc-trail-buffer))) 2075 (null (buffer-name calc-trail-buffer)))
2079 (save-excursion 2076 (save-excursion
2080 (setq calc-trail-buffer (get-buffer-create "*Calc Trail*")) 2077 (setq calc-trail-buffer (get-buffer-create "*Calc Trail*"))
2081 (let ((buf (or (and (not (eq major-mode 'calc-mode)) 2078 (let ((buf (or (and (not (derived-mode-p 'calc-mode))
2082 (get-buffer "*Calculator*")) 2079 (get-buffer "*Calculator*"))
2083 (current-buffer)))) 2080 (current-buffer))))
2084 (set-buffer calc-trail-buffer) 2081 (set-buffer calc-trail-buffer)
2085 (or (eq major-mode 'calc-trail-mode) 2082 (unless (derived-mode-p 'calc-trail-mode)
2086 (calc-trail-mode buf))))) 2083 (calc-trail-mode)
2084 (set (make-local-variable 'calc-main-buffer) buf)))))
2087 (or (and calc-trail-pointer 2085 (or (and calc-trail-pointer
2088 (eq (marker-buffer calc-trail-pointer) calc-trail-buffer)) 2086 (eq (marker-buffer calc-trail-pointer) calc-trail-buffer))
2089 (with-current-buffer calc-trail-buffer 2087 (with-current-buffer calc-trail-buffer
@@ -2152,7 +2150,7 @@ the United States."
2152 2150
2153(defun calc-trail-here () 2151(defun calc-trail-here ()
2154 (interactive) 2152 (interactive)
2155 (if (eq major-mode 'calc-trail-mode) 2153 (if (derived-mode-p 'calc-trail-mode)
2156 (progn 2154 (progn
2157 (beginning-of-line) 2155 (beginning-of-line)
2158 (if (bobp) 2156 (if (bobp)
diff --git a/lisp/cedet/ChangeLog b/lisp/cedet/ChangeLog
index 50467fa6e37..f5528202bb4 100644
--- a/lisp/cedet/ChangeLog
+++ b/lisp/cedet/ChangeLog
@@ -1,3 +1,12 @@
12013-09-11 Stefan Monnier <monnier@iro.umontreal.ca>
2
3 * semantic/grammar.el (semantic-grammar-mode): Use define-derived-mode.
4 (semantic-grammar-mode-syntax-table): Rename from
5 semantic-grammar-syntax-table.
6 (semantic-grammar-mode-map): Rename from semantic-grammar-map.
7 * data-debug.el (data-debug-mode-map): Rename from data-debug-map.
8 (data-debug-mode): Use define-derived-mode.
9
12013-09-05 Glenn Morris <rgm@gnu.org> 102013-09-05 Glenn Morris <rgm@gnu.org>
2 11
3 * semantic/fw.el (semantic-make-local-hook): 12 * semantic/fw.el (semantic-make-local-hook):
@@ -15,15 +24,15 @@
15 24
16 * semantic/decorate/mode.el 25 * semantic/decorate/mode.el
17 (semantic-decoration-on-includes-p-default) 26 (semantic-decoration-on-includes-p-default)
18 (semantic-decoration-on-includes-highlight-default): Declare for 27 (semantic-decoration-on-includes-highlight-default): Declare for
19 byte compiler. 28 byte compiler.
20 29
21 * semantic/wisent/python.el (semantic/format): New require. 30 * semantic/wisent/python.el (semantic/format): New require.
22 31
232013-07-27 Eric Ludlam <zappo@gnu.org> 322013-07-27 Eric Ludlam <zappo@gnu.org>
24 33
25 * lisp/cedet/semantic/edit.el (semantic-edits-splice-remove): Wrap 34 * lisp/cedet/semantic/edit.el (semantic-edits-splice-remove):
26 debug message removing middle tag in semantic-edits-verbose-flag 35 Wrap debug message removing middle tag in semantic-edits-verbose-flag
27 check. 36 check.
28 37
292013-07-27 David Engster <deng@randomsample.de> 382013-07-27 David Engster <deng@randomsample.de>
@@ -69,8 +78,8 @@
69 `semantic/decorate/include' anymore. 78 `semantic/decorate/include' anymore.
70 (semantic-toggle-decoration-style): Error if an unknown decoration 79 (semantic-toggle-decoration-style): Error if an unknown decoration
71 style is toggled. 80 style is toggled.
72 (define-semantic-decoration-style): Add new :load option. When 81 (define-semantic-decoration-style): Add new :load option.
73 :load is specified, add autoload tokens for the definition 82 When :load is specified, add autoload tokens for the definition
74 functions so that code is loaded when the mode is used. 83 functions so that code is loaded when the mode is used.
75 (semantic-decoration-on-includes): New autoload definition for 84 (semantic-decoration-on-includes): New autoload definition for
76 highlighting includes. 85 highlighting includes.
@@ -94,8 +103,8 @@
94 * semantic/ctxt.el (semantic-ctxt-end-of-symbol): New. 103 * semantic/ctxt.el (semantic-ctxt-end-of-symbol): New.
95 (semantic-ctxt-current-symbol-default): New. 104 (semantic-ctxt-current-symbol-default): New.
96 105
97 * semantic/bovine/el.el (semantic-default-elisp-setup): Add 106 * semantic/bovine/el.el (semantic-default-elisp-setup):
98 autoload cookie. Explain existence. 107 Add autoload cookie. Explain existence.
99 (footer): Add local variable for loaddefs. 108 (footer): Add local variable for loaddefs.
100 109
101 * semantic/db.el (semanticdb-file-table-object): Add new filter, 110 * semantic/db.el (semanticdb-file-table-object): Add new filter,
@@ -120,7 +129,7 @@
120 * ede/cpp-root.el (ede-preprocessor-map): Protect against init 129 * ede/cpp-root.el (ede-preprocessor-map): Protect against init
121 problems. 130 problems.
122 131
123 * ede/proj.el (ede-proj-target): Added a new "custom" option for 132 * ede/proj.el (ede-proj-target): Add a new "custom" option for
124 custom symbols representing a compiler or linker instead of 133 custom symbols representing a compiler or linker instead of
125 restricting things to only the predefined compilers and linkers. 134 restricting things to only the predefined compilers and linkers.
126 135
@@ -198,15 +207,15 @@
1982013-04-27 David Engster <deng@randomsample.de> 2072013-04-27 David Engster <deng@randomsample.de>
199 208
200 * semantic/complete.el 209 * semantic/complete.el
201 (semantic-collector-calculate-completions-raw): If 210 (semantic-collector-calculate-completions-raw):
202 `completionslist' is not set, refresh the cache if necessary and 211 If `completionslist' is not set, refresh the cache if necessary and
203 use it for completions. This fixes the 212 use it for completions. This fixes the
204 `semantic-collector-buffer-deep' collector (bug#14265). 213 `semantic-collector-buffer-deep' collector (bug#14265).
205 214
2062013-03-26 Leo Liu <sdl.web@gmail.com> 2152013-03-26 Leo Liu <sdl.web@gmail.com>
207 216
208 * semantic/senator.el (senator-copy-tag-to-register): Move 217 * semantic/senator.el (senator-copy-tag-to-register):
209 register handling logic from register.el. (Bug#14052) 218 Move register handling logic from register.el. (Bug#14052)
210 219
2112013-03-21 Eric Ludlam <zappo@gnu.org> 2202013-03-21 Eric Ludlam <zappo@gnu.org>
212 221
@@ -223,17 +232,17 @@
223 232
224 * semantic/find.el (semantic-filter-tags-by-class): New function. 233 * semantic/find.el (semantic-filter-tags-by-class): New function.
225 234
226 * semantic/tag-ls.el (semantic-tag-similar-p-default): Add 235 * semantic/tag-ls.el (semantic-tag-similar-p-default):
227 short-circuit in case tag1 and 2 are identical. 236 Add short-circuit in case tag1 and 2 are identical.
228 237
229 * semantic/analyze/fcn.el 238 * semantic/analyze/fcn.el
230 (semantic-analyze-dereference-metatype-stack): Use 239 (semantic-analyze-dereference-metatype-stack):
231 `semantic-tag-similar-p' instead of 'eq' when comparing two tags 240 Use `semantic-tag-similar-p' instead of 'eq' when comparing two tags
232 during metatype evaluation in case they are the same, but not the 241 during metatype evaluation in case they are the same, but not the
233 same node. (Tweaked patch from Tomasz Gajewski) (Tiny change) 242 same node. (Tweaked patch from Tomasz Gajewski) (Tiny change)
234 243
235 * semantic/db-find.el (semanticdb-partial-synchronize): Fix 244 * semantic/db-find.el (semanticdb-partial-synchronize):
236 require to semantic/db-typecache to be correct. 245 Fix require to semantic/db-typecache to be correct.
237 (semanticdb-find-tags-external-children-of-type): Make this a 246 (semanticdb-find-tags-external-children-of-type): Make this a
238 brutish search by default. 247 brutish search by default.
239 248
@@ -243,19 +252,19 @@
243 input tag as the place to start searching for externally defined 252 input tag as the place to start searching for externally defined
244 methods. 253 methods.
245 254
246 * semantic/db-file.el (semanticdb-default-save-directory): Doc 255 * semantic/db-file.el (semanticdb-default-save-directory):
247 fix: Add ref to default value. 256 Doc fix: Add ref to default value.
248 257
249 * semantic/complete.el (semantic-complete-post-command-hook): When 258 * semantic/complete.el (semantic-complete-post-command-hook):
250 detecting if cursor is outside completion area, do so if cursor 259 When detecting if cursor is outside completion area, do so if cursor
251 moves before start of overlay, or the original starting location 260 moves before start of overlay, or the original starting location
252 of the overlay (i.e., if user deletes past beginning of the 261 of the overlay (i.e., if user deletes past beginning of the
253 overlay region). 262 overlay region).
254 (semantic-complete-inline-tag-engine): Initialize original start 263 (semantic-complete-inline-tag-engine): Initialize original start
255 of `semantic-complete-inline-overlay'. 264 of `semantic-complete-inline-overlay'.
256 265
257 * semantic/bovine/c.el (semantic-c-describe-environment): Update 266 * semantic/bovine/c.el (semantic-c-describe-environment):
258 some section titles. Test semanticdb table before printing it. 267 Update some section titles. Test semanticdb table before printing it.
259 (semantic-c-reset-preprocessor-symbol-map): Update 268 (semantic-c-reset-preprocessor-symbol-map): Update
260 `semantic-lex-spp-macro-symbol-obarray' outside the loop over all 269 `semantic-lex-spp-macro-symbol-obarray' outside the loop over all
261 the files contributing to its value. 270 the files contributing to its value.
@@ -271,8 +280,8 @@
271 * srecode/cpp.el (srecode-semantic-handle-:c): Replace all 280 * srecode/cpp.el (srecode-semantic-handle-:c): Replace all
272 characters in FILENAME_SYMBOL that aren't valid CPP symbol chars. 281 characters in FILENAME_SYMBOL that aren't valid CPP symbol chars.
273 282
274 * srecode/map.el (srecode-map-validate-file-for-mode): Force 283 * srecode/map.el (srecode-map-validate-file-for-mode):
275 semantic to load if it is not active in the template being added 284 Force semantic to load if it is not active in the template being added
276 to the map. 285 to the map.
277 286
278 * srecode/srt.el: Add local variables for setting the autoload 287 * srecode/srt.el: Add local variables for setting the autoload
@@ -287,7 +296,7 @@
287 has both a version variable and a Version: comment, always use 296 has both a version variable and a Version: comment, always use
288 `call-next-method'. 297 `call-next-method'.
289 298
290 * ede/cpp-root.el (ede-set-project-variables): Deleted. 299 * ede/cpp-root.el (ede-set-project-variables): Delete.
291 `ede-preprocessor-map' does the job this function was attempting 300 `ede-preprocessor-map' does the job this function was attempting
292 to do with :spp-table. 301 to do with :spp-table.
293 (ede-preprocessor-map): Update file tests to provide better 302 (ede-preprocessor-map): Update file tests to provide better
@@ -302,8 +311,8 @@
3022013-03-21 David Engster <deng@randomsample.de> 3112013-03-21 David Engster <deng@randomsample.de>
303 312
304 * semantic/bovine/c.el (semantic-get-local-variables): Also add a 313 * semantic/bovine/c.el (semantic-get-local-variables): Also add a
305 new variable 'this' if we are in an inline member function. For 314 new variable 'this' if we are in an inline member function.
306 detecting this, we check overlays at point if there is a class 315 For detecting this, we check overlays at point if there is a class
307 spanning the current function. Also, the variable 'this' has to 316 spanning the current function. Also, the variable 'this' has to
308 be a pointer. 317 be a pointer.
309 318
@@ -350,14 +359,14 @@
350 359
3512013-03-21 Tomasz Gajewski <tomga@wp.pl> (tiny change) 3602013-03-21 Tomasz Gajewski <tomga@wp.pl> (tiny change)
352 361
353 * ede/cpp-root.el (ede-project-autoload, initialize-instance): Fix 362 * ede/cpp-root.el (ede-project-autoload, initialize-instance):
354 EDE file symbol to match rename. Fix ede-cpp-root symbol to 363 Fix EDE file symbol to match rename. Fix ede-cpp-root symbol to
355 include -project in name. 364 include -project in name.
356 365
3572013-03-21 Alex Ott <alexott@gmail.com> 3662013-03-21 Alex Ott <alexott@gmail.com>
358 367
359 * cedet-files.el (cedet-files-list-recursively): New. Recursively 368 * cedet-files.el (cedet-files-list-recursively): New.
360 find files whose names are matching to given regex. 369 Recursively find files whose names are matching to given regex.
361 370
362 * ede.el (ede-current-project): Rewrite to avoid imperative style. 371 * ede.el (ede-current-project): Rewrite to avoid imperative style.
363 372
diff --git a/lisp/cedet/data-debug.el b/lisp/cedet/data-debug.el
index c468ec1046a..4658c604211 100644
--- a/lisp/cedet/data-debug.el
+++ b/lisp/cedet/data-debug.el
@@ -869,7 +869,8 @@ If PARENT is non-nil, it is somehow related as a parent to thing."
869 table) 869 table)
870 "Syntax table used in data-debug macro buffers.") 870 "Syntax table used in data-debug macro buffers.")
871 871
872(defvar data-debug-map 872(define-obsolete-variable-alias 'data-debug-map 'data-debug-mode-map "24.1")
873(defvar data-debug-mode-map
873 (let ((km (make-sparse-keymap))) 874 (let ((km (make-sparse-keymap)))
874 (suppress-keymap km) 875 (suppress-keymap km)
875 (define-key km [mouse-2] 'data-debug-expand-or-contract-mouse) 876 (define-key km [mouse-2] 'data-debug-expand-or-contract-mouse)
@@ -887,22 +888,15 @@ If PARENT is non-nil, it is somehow related as a parent to thing."
887 :group 'data-debug 888 :group 'data-debug
888 :type 'hook) 889 :type 'hook)
889 890
890(defun data-debug-mode () 891(define-derived-mode data-debug-mode fundamental-mode "DATA-DEBUG"
891 "Major-mode for the Analyzer debugger. 892 "Major-mode for the Analyzer debugger.
892 893
893\\{data-debug-map}" 894\\{data-debug-mode-map}"
894 (interactive) 895 (setq comment-start ";;"
895 (kill-all-local-variables)
896 (setq major-mode 'data-debug-mode
897 mode-name "DATA-DEBUG"
898 comment-start ";;"
899 comment-end "" 896 comment-end ""
900 buffer-read-only t) 897 buffer-read-only t)
901 (set (make-local-variable 'comment-start-skip) 898 (setq-local comment-start-skip
902 "\\(\\(^\\|[^\\\\\n]\\)\\(\\\\\\\\\\)*\\);+ *") 899 "\\(\\(^\\|[^\\\\\n]\\)\\(\\\\\\\\\\)*\\);+ *")
903 (set-syntax-table data-debug-mode-syntax-table)
904 (use-local-map data-debug-map)
905 (run-hooks 'data-debug-hook)
906 (buffer-disable-undo) 900 (buffer-disable-undo)
907 (set (make-local-variable 'font-lock-global-modes) nil) 901 (set (make-local-variable 'font-lock-global-modes) nil)
908 (font-lock-mode -1) 902 (font-lock-mode -1)
diff --git a/lisp/cedet/semantic/grammar.el b/lisp/cedet/semantic/grammar.el
index ce658cd5d54..60c4ccadf65 100644
--- a/lisp/cedet/semantic/grammar.el
+++ b/lisp/cedet/semantic/grammar.el
@@ -860,7 +860,7 @@ Lisp code."
860 ;; Use Unix EOLs, so that the file is portable to all platforms. 860 ;; Use Unix EOLs, so that the file is portable to all platforms.
861 (setq buffer-file-coding-system 'raw-text-unix) 861 (setq buffer-file-coding-system 'raw-text-unix)
862 (erase-buffer) 862 (erase-buffer)
863 (unless (eq major-mode 'emacs-lisp-mode) 863 (unless (derived-mode-p 'emacs-lisp-mode)
864 (emacs-lisp-mode)) 864 (emacs-lisp-mode))
865 865
866;;;; Header + Prologue 866;;;; Header + Prologue
@@ -1102,7 +1102,9 @@ END is the limit of the search."
1102;;;; Define major mode 1102;;;; Define major mode
1103;;;; 1103;;;;
1104 1104
1105(defvar semantic-grammar-syntax-table 1105(define-obsolete-variable-alias 'semantic-grammar-syntax-table
1106 'semantic-grammar-mode-syntax-table "24.1")
1107(defvar semantic-grammar-mode-syntax-table
1106 (let ((table (make-syntax-table (standard-syntax-table)))) 1108 (let ((table (make-syntax-table (standard-syntax-table))))
1107 (modify-syntax-entry ?\: "." table) ;; COLON 1109 (modify-syntax-entry ?\: "." table) ;; COLON
1108 (modify-syntax-entry ?\> "." table) ;; GT 1110 (modify-syntax-entry ?\> "." table) ;; GT
@@ -1170,7 +1172,9 @@ END is the limit of the search."
1170 semantic-grammar-mode-keywords-1 1172 semantic-grammar-mode-keywords-1
1171 "Font Lock keywords used to highlight Semantic grammar buffers.") 1173 "Font Lock keywords used to highlight Semantic grammar buffers.")
1172 1174
1173(defvar semantic-grammar-map 1175(define-obsolete-variable-alias 'semantic-grammar-map
1176 'semantic-grammar-mode-map "24.1")
1177(defvar semantic-grammar-mode-map
1174 (let ((km (make-sparse-keymap))) 1178 (let ((km (make-sparse-keymap)))
1175 1179
1176 (define-key km "|" 'semantic-grammar-electric-punctuation) 1180 (define-key km "|" 'semantic-grammar-electric-punctuation)
@@ -1271,22 +1275,17 @@ the change bounds to encompass the whole nonterminal tag."
1271 (semantic-tag-start outer) 1275 (semantic-tag-start outer)
1272 (semantic-tag-end outer))))) 1276 (semantic-tag-end outer)))))
1273 1277
1274(defun semantic-grammar-mode () 1278(define-derived-mode semantic-grammar-mode
1279 fundamental-mode "Semantic Grammar Framework"
1275 "Initialize a buffer for editing Semantic grammars. 1280 "Initialize a buffer for editing Semantic grammars.
1276 1281
1277\\{semantic-grammar-map}" 1282\\{semantic-grammar-mode-map}"
1278 (interactive)
1279 (kill-all-local-variables)
1280 (setq major-mode 'semantic-grammar-mode
1281 mode-name "Semantic Grammar Framework")
1282 (set (make-local-variable 'parse-sexp-ignore-comments) t) 1283 (set (make-local-variable 'parse-sexp-ignore-comments) t)
1283 (set (make-local-variable 'comment-start) ";;") 1284 (set (make-local-variable 'comment-start) ";;")
1284 ;; Look within the line for a ; following an even number of backslashes 1285 ;; Look within the line for a ; following an even number of backslashes
1285 ;; after either a non-backslash or the line beginning. 1286 ;; after either a non-backslash or the line beginning.
1286 (set (make-local-variable 'comment-start-skip) 1287 (set (make-local-variable 'comment-start-skip)
1287 "\\(\\(^\\|[^\\\\\n]\\)\\(\\\\\\\\\\)*\\);+ *") 1288 "\\(\\(^\\|[^\\\\\n]\\)\\(\\\\\\\\\\)*\\);+ *")
1288 (set-syntax-table semantic-grammar-syntax-table)
1289 (use-local-map semantic-grammar-map)
1290 (set (make-local-variable 'indent-line-function) 1289 (set (make-local-variable 'indent-line-function)
1291 'semantic-grammar-indent) 1290 'semantic-grammar-indent)
1292 (set (make-local-variable 'fill-paragraph-function) 1291 (set (make-local-variable 'fill-paragraph-function)
@@ -1335,15 +1334,14 @@ the change bounds to encompass the whole nonterminal tag."
1335 (semantic-make-local-hook 'semantic-edits-new-change-functions) 1334 (semantic-make-local-hook 'semantic-edits-new-change-functions)
1336 (add-hook 'semantic-edits-new-change-functions 1335 (add-hook 'semantic-edits-new-change-functions
1337 'semantic-grammar-edits-new-change-hook-fcn 1336 'semantic-grammar-edits-new-change-hook-fcn
1338 nil t) 1337 nil t))
1339 (semantic-run-mode-hooks 'semantic-grammar-mode-hook))
1340 1338
1341;;;; 1339;;;;
1342;;;; Useful commands 1340;;;; Useful commands
1343;;;; 1341;;;;
1344 1342
1345(defvar semantic-grammar-skip-quoted-syntax-table 1343(defvar semantic-grammar-skip-quoted-syntax-table
1346 (let ((st (copy-syntax-table semantic-grammar-syntax-table))) 1344 (let ((st (copy-syntax-table semantic-grammar-mode-syntax-table)))
1347 (modify-syntax-entry ?\' "$" st) 1345 (modify-syntax-entry ?\' "$" st)
1348 st) 1346 st)
1349 "Syntax table to skip a whole quoted expression in grammar code. 1347 "Syntax table to skip a whole quoted expression in grammar code.
diff --git a/lisp/chistory.el b/lisp/chistory.el
index 509324ade88..9a77793b1e1 100644
--- a/lisp/chistory.el
+++ b/lisp/chistory.el
@@ -121,7 +121,9 @@ The buffer is left in Command History mode."
121 (error "No command history") 121 (error "No command history")
122 (command-history-mode))))) 122 (command-history-mode)))))
123 123
124(defvar command-history-map 124(define-obsolete-variable-alias 'command-history-map
125 'command-history-mode-map "24.1")
126(defvar command-history-mode-map
125 (let ((map (make-sparse-keymap))) 127 (let ((map (make-sparse-keymap)))
126 (set-keymap-parent map lisp-mode-shared-map) 128 (set-keymap-parent map lisp-mode-shared-map)
127 (suppress-keymap map) 129 (suppress-keymap map)
@@ -132,21 +134,11 @@ The buffer is left in Command History mode."
132 map) 134 map)
133 "Keymap for `command-history-mode'.") 135 "Keymap for `command-history-mode'.")
134 136
135(defun command-history-mode () 137(define-derived-mode command-history-mode fundamental-mode "Command History"
136 "Major mode for listing and repeating recent commands. 138 "Major mode for listing and repeating recent commands.
137 139
138Keybindings: 140Keybindings:
139\\{command-history-map}" 141\\{command-history-mode-map}"
140 (interactive)
141 (Command-history-setup)
142 (setq major-mode 'command-history-mode)
143 (setq mode-name "Command History")
144 (use-local-map command-history-map)
145 (run-mode-hooks 'command-history-mode-hook))
146
147(defun Command-history-setup ()
148 (kill-all-local-variables)
149 (use-local-map command-history-map)
150 (lisp-mode-variables nil) 142 (lisp-mode-variables nil)
151 (set-syntax-table emacs-lisp-mode-syntax-table) 143 (set-syntax-table emacs-lisp-mode-syntax-table)
152 (setq buffer-read-only t)) 144 (setq buffer-read-only t))
diff --git a/lisp/comint.el b/lisp/comint.el
index 0ce7053c031..7572e8baabc 100644
--- a/lisp/comint.el
+++ b/lisp/comint.el
@@ -3793,25 +3793,21 @@ REGEXP-GROUP is the regular expression group in REGEXP to use."
3793;; comint-mode will take care of it. The following example, from shell.el, 3793;; comint-mode will take care of it. The following example, from shell.el,
3794;; is typical: 3794;; is typical:
3795;; 3795;;
3796;; (defvar shell-mode-map '()) 3796;; (defvar shell-mode-map
3797;; (cond ((not shell-mode-map) 3797;; (let ((map (make-sparse-keymap)))
3798;; (setq shell-mode-map (copy-keymap comint-mode-map)) 3798;; (set-keymap-parent map comint-mode-map)
3799;; (define-key shell-mode-map "\C-c\C-f" 'shell-forward-command) 3799;; (define-key map "\C-c\C-f" 'shell-forward-command)
3800;; (define-key shell-mode-map "\C-c\C-b" 'shell-backward-command) 3800;; (define-key map "\C-c\C-b" 'shell-backward-command)
3801;; (define-key shell-mode-map "\t" 'completion-at-point) 3801;; (define-key map "\t" 'completion-at-point)
3802;; (define-key shell-mode-map "\M-?" 3802;; (define-key map "\M-?"
3803;; 'comint-dynamic-list-filename-completions))) 3803;; 'comint-dynamic-list-filename-completions)
3804;; map))
3804;; 3805;;
3805;; (defun shell-mode () 3806;; (define-derived-mode shell-mode comint-mode "Shell"
3806;; (interactive) 3807;; "Doc."
3807;; (comint-mode)
3808;; (setq comint-prompt-regexp shell-prompt-pattern) 3808;; (setq comint-prompt-regexp shell-prompt-pattern)
3809;; (setq major-mode 'shell-mode)
3810;; (setq mode-name "Shell")
3811;; (use-local-map shell-mode-map)
3812;; (setq-local shell-directory-stack nil) 3809;; (setq-local shell-directory-stack nil)
3813;; (add-hook 'comint-input-filter-functions 'shell-directory-tracker) 3810;; (add-hook 'comint-input-filter-functions 'shell-directory-tracker))
3814;; (run-mode-hooks 'shell-mode-hook))
3815;; 3811;;
3816;; 3812;;
3817;; Completion for comint-mode users 3813;; Completion for comint-mode users
diff --git a/lisp/emacs-lisp/debug.el b/lisp/emacs-lisp/debug.el
index 709a094e73b..6c7a0d2db1d 100644
--- a/lisp/emacs-lisp/debug.el
+++ b/lisp/emacs-lisp/debug.el
@@ -626,7 +626,7 @@ The environment used is the one when entering the activation frame at point."
626 626
627(put 'debugger-mode 'mode-class 'special) 627(put 'debugger-mode 'mode-class 'special)
628 628
629(defun debugger-mode () 629(define-derived-mode debugger-mode fundamental-mode "Debugger"
630 "Mode for backtrace buffers, selected in debugger. 630 "Mode for backtrace buffers, selected in debugger.
631\\<debugger-mode-map> 631\\<debugger-mode-map>
632A line starts with `*' if exiting that frame will call the debugger. 632A line starts with `*' if exiting that frame will call the debugger.
@@ -641,13 +641,9 @@ which functions will enter the debugger when called.
641 641
642Complete list of commands: 642Complete list of commands:
643\\{debugger-mode-map}" 643\\{debugger-mode-map}"
644 (kill-all-local-variables)
645 (setq major-mode 'debugger-mode)
646 (setq mode-name "Debugger")
647 (setq truncate-lines t) 644 (setq truncate-lines t)
648 (set-syntax-table emacs-lisp-mode-syntax-table) 645 (set-syntax-table emacs-lisp-mode-syntax-table)
649 (use-local-map debugger-mode-map) 646 (use-local-map debugger-mode-map))
650 (run-mode-hooks 'debugger-mode-hook))
651 647
652(defcustom debugger-record-buffer "*Debugger-record*" 648(defcustom debugger-record-buffer "*Debugger-record*"
653 "Buffer name for expression values, for \\[debugger-record-expression]." 649 "Buffer name for expression values, for \\[debugger-record-expression]."
diff --git a/lisp/emulation/ws-mode.el b/lisp/emulation/ws-mode.el
index 03d7076195e..dfb81b3829c 100644
--- a/lisp/emulation/ws-mode.el
+++ b/lisp/emulation/ws-mode.el
@@ -73,8 +73,7 @@
73 (define-key map "\C-x" 'save-buffers-kill-emacs) 73 (define-key map "\C-x" 'save-buffers-kill-emacs)
74 (define-key map "y" 'ws-delete-block) 74 (define-key map "y" 'ws-delete-block)
75 (define-key map "\C-y" 'ws-delete-block) 75 (define-key map "\C-y" 'ws-delete-block)
76 map) 76 map))
77 "")
78 77
79(defvar wordstar-C-o-map 78(defvar wordstar-C-o-map
80 (let ((map (make-keymap))) 79 (let ((map (make-keymap)))
@@ -140,8 +139,7 @@
140 (define-key map "y" 'ws-kill-eol) 139 (define-key map "y" 'ws-kill-eol)
141 (define-key map "\C-y" 'ws-kill-eol) 140 (define-key map "\C-y" 'ws-kill-eol)
142 (define-key map "\177" 'ws-kill-bol) 141 (define-key map "\177" 'ws-kill-bol)
143 map) 142 map))
144 "")
145 143
146(defvar wordstar-mode-map 144(defvar wordstar-mode-map
147 (let ((map (make-keymap))) 145 (let ((map (make-keymap)))
@@ -170,17 +168,16 @@
170 (define-key map "\C-x" 'next-line) 168 (define-key map "\C-x" 'next-line)
171 (define-key map "\C-y" 'kill-complete-line) 169 (define-key map "\C-y" 'kill-complete-line)
172 (define-key map "\C-z" 'scroll-up-line) 170 (define-key map "\C-z" 'scroll-up-line)
173 map) 171 map))
174 "")
175 172
176;; wordstar-C-j-map not yet implemented 173;; wordstar-C-j-map not yet implemented
177(defvar wordstar-C-j-map nil "") 174(defvar wordstar-C-j-map nil)
178 175
179 176
180(put 'wordstar-mode 'mode-class 'special) 177(put 'wordstar-mode 'mode-class 'special)
181 178
182;;;###autoload 179;;;###autoload
183(defun wordstar-mode () 180(define-derived-mode wordstar-mode fundamental-mode "WordStar"
184 "Major mode with WordStar-like key bindings. 181 "Major mode with WordStar-like key bindings.
185 182
186BUGS: 183BUGS:
@@ -191,106 +188,7 @@ BUGS:
191 - Search and replace (C-q a) is only available in forward direction 188 - Search and replace (C-q a) is only available in forward direction
192 189
193No key bindings beginning with ESC are installed, they will work 190No key bindings beginning with ESC are installed, they will work
194Emacs-like. 191Emacs-like.")
195
196The key bindings are:
197
198 C-a backward-word
199 C-b fill-paragraph
200 C-c scroll-up-line
201 C-d forward-char
202 C-e previous-line
203 C-f forward-word
204 C-g delete-char
205 C-h backward-char
206 C-i indent-for-tab-command
207 C-j help-for-help
208 C-k ordstar-C-k-map
209 C-l ws-repeat-search
210 C-n open-line
211 C-p quoted-insert
212 C-r scroll-down-line
213 C-s backward-char
214 C-t kill-word
215 C-u keyboard-quit
216 C-v overwrite-mode
217 C-w scroll-down
218 C-x next-line
219 C-y kill-complete-line
220 C-z scroll-up
221
222 C-k 0 ws-set-marker-0
223 C-k 1 ws-set-marker-1
224 C-k 2 ws-set-marker-2
225 C-k 3 ws-set-marker-3
226 C-k 4 ws-set-marker-4
227 C-k 5 ws-set-marker-5
228 C-k 6 ws-set-marker-6
229 C-k 7 ws-set-marker-7
230 C-k 8 ws-set-marker-8
231 C-k 9 ws-set-marker-9
232 C-k b ws-begin-block
233 C-k c ws-copy-block
234 C-k d save-buffers-kill-emacs
235 C-k f find-file
236 C-k h ws-show-markers
237 C-k i ws-indent-block
238 C-k k ws-end-block
239 C-k p ws-print-block
240 C-k q kill-emacs
241 C-k r insert-file
242 C-k s save-some-buffers
243 C-k t ws-mark-word
244 C-k u ws-exdent-block
245 C-k C-u keyboard-quit
246 C-k v ws-move-block
247 C-k w ws-write-block
248 C-k x kill-emacs
249 C-k y ws-delete-block
250
251 C-o c wordstar-center-line
252 C-o b switch-to-buffer
253 C-o j justify-current-line
254 C-o k kill-buffer
255 C-o l list-buffers
256 C-o m auto-fill-mode
257 C-o r set-fill-column
258 C-o C-u keyboard-quit
259 C-o wd delete-other-windows
260 C-o wh split-window-right
261 C-o wo other-window
262 C-o wv split-window-below
263
264 C-q 0 ws-find-marker-0
265 C-q 1 ws-find-marker-1
266 C-q 2 ws-find-marker-2
267 C-q 3 ws-find-marker-3
268 C-q 4 ws-find-marker-4
269 C-q 5 ws-find-marker-5
270 C-q 6 ws-find-marker-6
271 C-q 7 ws-find-marker-7
272 C-q 8 ws-find-marker-8
273 C-q 9 ws-find-marker-9
274 C-q a ws-query-replace
275 C-q b ws-to-block-begin
276 C-q c end-of-buffer
277 C-q d end-of-line
278 C-q f ws-search
279 C-q k ws-to-block-end
280 C-q l ws-undo
281 C-q p ws-last-cursorp
282 C-q r beginning-of-buffer
283 C-q C-u keyboard-quit
284 C-q w ws-last-error
285 C-q y ws-kill-eol
286 C-q DEL ws-kill-bol
287"
288 (interactive)
289 (kill-all-local-variables)
290 (use-local-map wordstar-mode-map)
291 (setq mode-name "WordStar")
292 (setq major-mode 'wordstar-mode)
293 (run-mode-hooks 'wordstar-mode-hook))
294 192
295 193
296(defun wordstar-center-paragraph () 194(defun wordstar-center-paragraph ()
diff --git a/lisp/eshell/esh-mode.el b/lisp/eshell/esh-mode.el
index ed5fecf09ff..0d32dae7ddb 100644
--- a/lisp/eshell/esh-mode.el
+++ b/lisp/eshell/esh-mode.el
@@ -220,74 +220,66 @@ This is used by `eshell-watch-for-password-prompt'."
220(defvar eshell-last-output-end nil) 220(defvar eshell-last-output-end nil)
221 221
222(defvar eshell-currently-handling-window nil) 222(defvar eshell-currently-handling-window nil)
223(defvar eshell-mode-syntax-table nil)
224(defvar eshell-mode-abbrev-table nil)
225 223
226(define-abbrev-table 'eshell-mode-abbrev-table ()) 224(define-abbrev-table 'eshell-mode-abbrev-table ())
227 225
228(if (not eshell-mode-syntax-table) 226(defvar eshell-mode-syntax-table
229 (let ((i 0)) 227 (let ((st (make-syntax-table))
230 (setq eshell-mode-syntax-table (make-syntax-table)) 228 (i 0))
231 (while (< i ?0) 229 (while (< i ?0)
232 (modify-syntax-entry i "_ " eshell-mode-syntax-table) 230 (modify-syntax-entry i "_ " st)
233 (setq i (1+ i))) 231 (setq i (1+ i)))
234 (setq i (1+ ?9)) 232 (setq i (1+ ?9))
235 (while (< i ?A) 233 (while (< i ?A)
236 (modify-syntax-entry i "_ " eshell-mode-syntax-table) 234 (modify-syntax-entry i "_ " st)
237 (setq i (1+ i))) 235 (setq i (1+ i)))
238 (setq i (1+ ?Z)) 236 (setq i (1+ ?Z))
239 (while (< i ?a) 237 (while (< i ?a)
240 (modify-syntax-entry i "_ " eshell-mode-syntax-table) 238 (modify-syntax-entry i "_ " st)
241 (setq i (1+ i))) 239 (setq i (1+ i)))
242 (setq i (1+ ?z)) 240 (setq i (1+ ?z))
243 (while (< i 128) 241 (while (< i 128)
244 (modify-syntax-entry i "_ " eshell-mode-syntax-table) 242 (modify-syntax-entry i "_ " st)
245 (setq i (1+ i))) 243 (setq i (1+ i)))
246 (modify-syntax-entry ? " " eshell-mode-syntax-table) 244 (modify-syntax-entry ? " " st)
247 (modify-syntax-entry ?\t " " eshell-mode-syntax-table) 245 (modify-syntax-entry ?\t " " st)
248 (modify-syntax-entry ?\f " " eshell-mode-syntax-table) 246 (modify-syntax-entry ?\f " " st)
249 (modify-syntax-entry ?\n "> " eshell-mode-syntax-table) 247 (modify-syntax-entry ?\n "> " st)
250 ;; Give CR the same syntax as newline, for selective-display. 248 ;; Give CR the same syntax as newline, for selective-display.
251 (modify-syntax-entry ?\^m "> " eshell-mode-syntax-table) 249 (modify-syntax-entry ?\^m "> " st)
252;;; (modify-syntax-entry ?\; "< " eshell-mode-syntax-table) 250 ;; (modify-syntax-entry ?\; "< " st)
253 (modify-syntax-entry ?` "' " eshell-mode-syntax-table) 251 (modify-syntax-entry ?` "' " st)
254 (modify-syntax-entry ?' "' " eshell-mode-syntax-table) 252 (modify-syntax-entry ?' "' " st)
255 (modify-syntax-entry ?, "' " eshell-mode-syntax-table) 253 (modify-syntax-entry ?, "' " st)
256 ;; Used to be singlequote; changed for flonums. 254 ;; Used to be singlequote; changed for flonums.
257 (modify-syntax-entry ?. "_ " eshell-mode-syntax-table) 255 (modify-syntax-entry ?. "_ " st)
258 (modify-syntax-entry ?- "_ " eshell-mode-syntax-table) 256 (modify-syntax-entry ?- "_ " st)
259 (modify-syntax-entry ?| ". " eshell-mode-syntax-table) 257 (modify-syntax-entry ?| ". " st)
260 (modify-syntax-entry ?# "' " eshell-mode-syntax-table) 258 (modify-syntax-entry ?# "' " st)
261 (modify-syntax-entry ?\" "\" " eshell-mode-syntax-table) 259 (modify-syntax-entry ?\" "\" " st)
262 (modify-syntax-entry ?\\ "/ " eshell-mode-syntax-table) 260 (modify-syntax-entry ?\\ "/ " st)
263 (modify-syntax-entry ?\( "() " eshell-mode-syntax-table) 261 (modify-syntax-entry ?\( "() " st)
264 (modify-syntax-entry ?\) ")( " eshell-mode-syntax-table) 262 (modify-syntax-entry ?\) ")( " st)
265 (modify-syntax-entry ?\{ "(} " eshell-mode-syntax-table) 263 (modify-syntax-entry ?\{ "(} " st)
266 (modify-syntax-entry ?\} "){ " eshell-mode-syntax-table) 264 (modify-syntax-entry ?\} "){ " st)
267 (modify-syntax-entry ?\[ "(] " eshell-mode-syntax-table) 265 (modify-syntax-entry ?\[ "(] " st)
268 (modify-syntax-entry ?\] ")[ " eshell-mode-syntax-table) 266 (modify-syntax-entry ?\] ")[ " st)
269 ;; All non-word multibyte characters should be `symbol'. 267 ;; All non-word multibyte characters should be `symbol'.
270 (if (featurep 'xemacs) 268 (map-char-table
271 (map-char-table 269 (if (featurep 'xemacs)
272 (function 270 (lambda (key val)
273 (lambda (key val) 271 (and (characterp key)
274 (and (characterp key) 272 (>= (char-int key) 256)
275 (>= (char-int key) 256) 273 (/= (char-syntax key) ?w)
276 (/= (char-syntax key) ?w) 274 (modify-syntax-entry key "_ " st)))
277 (modify-syntax-entry key "_ " 275 (lambda (key val)
278 eshell-mode-syntax-table)))) 276 (and (if (consp key)
279 (standard-syntax-table)) 277 (and (>= (car key) 128)
280 (map-char-table 278 (/= (char-syntax (car key)) ?w))
281 (function 279 (and (>= key 256)
282 (lambda (key val) 280 (/= (char-syntax key) ?w)))
283 (and (if (consp key) 281 (modify-syntax-entry key "_ " st))))
284 (and (>= (car key) 128) 282 (standard-syntax-table))))
285 (/= (char-syntax (car key)) ?w))
286 (and (>= key 256)
287 (/= (char-syntax key) ?w)))
288 (modify-syntax-entry key "_ "
289 eshell-mode-syntax-table))))
290 (standard-syntax-table)))))
291 283
292;;; User Functions: 284;;; User Functions:
293 285
@@ -303,25 +295,18 @@ and the hook `eshell-exit-hook'."
303 (run-hooks 'eshell-exit-hook)) 295 (run-hooks 'eshell-exit-hook))
304 296
305;;;###autoload 297;;;###autoload
306(defun eshell-mode () 298(define-derived-mode eshell-mode fundamental-mode "EShell"
307 "Emacs shell interactive mode. 299 "Emacs shell interactive mode."
308 300 (setq-local eshell-mode t)
309\\{eshell-mode-map}"
310 (kill-all-local-variables)
311
312 (setq major-mode 'eshell-mode)
313 (setq mode-name "EShell")
314 (set (make-local-variable 'eshell-mode) t)
315 301
316 (make-local-variable 'eshell-mode-map) 302 ;; FIXME: What the hell!?
317 (setq eshell-mode-map (make-sparse-keymap)) 303 (setq-local eshell-mode-map (make-sparse-keymap))
318 (use-local-map eshell-mode-map) 304 (use-local-map eshell-mode-map)
319 305
320 (when eshell-status-in-mode-line 306 (when eshell-status-in-mode-line
321 (make-local-variable 'eshell-command-running-string) 307 (make-local-variable 'eshell-command-running-string)
322 (let ((fmt (copy-sequence mode-line-format))) 308 (let ((fmt (copy-sequence mode-line-format)))
323 (make-local-variable 'mode-line-format) 309 (setq-local mode-line-format fmt))
324 (setq mode-line-format fmt))
325 (let ((mode-line-elt (memq 'mode-line-modified mode-line-format))) 310 (let ((mode-line-elt (memq 'mode-line-modified mode-line-format)))
326 (if mode-line-elt 311 (if mode-line-elt
327 (setcar mode-line-elt 'eshell-command-running-string)))) 312 (setcar mode-line-elt 'eshell-command-running-string))))
@@ -331,11 +316,9 @@ and the hook `eshell-exit-hook'."
331 (define-key eshell-mode-map [(meta control ?l)] 'eshell-show-output) 316 (define-key eshell-mode-map [(meta control ?l)] 'eshell-show-output)
332 (define-key eshell-mode-map [(control ?a)] 'eshell-bol) 317 (define-key eshell-mode-map [(control ?a)] 'eshell-bol)
333 318
334 (set (make-local-variable 'eshell-command-prefix) 319 (setq-local eshell-command-prefix (make-symbol "eshell-command-prefix"))
335 (make-symbol "eshell-command-prefix"))
336 (fset eshell-command-prefix (make-sparse-keymap)) 320 (fset eshell-command-prefix (make-sparse-keymap))
337 (set (make-local-variable 'eshell-command-map) 321 (setq-local eshell-command-map (symbol-function eshell-command-prefix))
338 (symbol-function eshell-command-prefix))
339 (define-key eshell-mode-map [(control ?c)] eshell-command-prefix) 322 (define-key eshell-mode-map [(control ?c)] eshell-command-prefix)
340 323
341 ;; without this, find-tag complains about read-only text being 324 ;; without this, find-tag complains about read-only text being
@@ -359,7 +342,6 @@ and the hook `eshell-exit-hook'."
359 (define-key eshell-command-map [(control ?y)] 'eshell-repeat-argument) 342 (define-key eshell-command-map [(control ?y)] 'eshell-repeat-argument)
360 343
361 (setq local-abbrev-table eshell-mode-abbrev-table) 344 (setq local-abbrev-table eshell-mode-abbrev-table)
362 (set-syntax-table eshell-mode-syntax-table)
363 345
364 (set (make-local-variable 'dired-directory) default-directory) 346 (set (make-local-variable 'dired-directory) default-directory)
365 (set (make-local-variable 'list-buffers-directory) 347 (set (make-local-variable 'list-buffers-directory)
@@ -442,7 +424,6 @@ and the hook `eshell-exit-hook'."
442 424
443 (if eshell-first-time-p 425 (if eshell-first-time-p
444 (run-hooks 'eshell-first-time-mode-hook)) 426 (run-hooks 'eshell-first-time-mode-hook))
445 (run-mode-hooks 'eshell-mode-hook)
446 (run-hooks 'eshell-post-command-hook)) 427 (run-hooks 'eshell-post-command-hook))
447 428
448(put 'eshell-mode 'mode-class 'special) 429(put 'eshell-mode 'mode-class 'special)
diff --git a/lisp/gnus/ChangeLog b/lisp/gnus/ChangeLog
index c75588536a4..1bf7bb588f0 100644
--- a/lisp/gnus/ChangeLog
+++ b/lisp/gnus/ChangeLog
@@ -1,3 +1,27 @@
12013-09-11 Stefan Monnier <monnier@iro.umontreal.ca>
2
3 * score-mode.el (gnus-score-mode-map): Move initialization
4 into declaration.
5 (gnus-score-mode): Use define-derived-mode.
6 * gnus-srvr.el (gnus-browse-mode): Use define-derived-mode.
7 * gnus-kill.el (gnus-kill-file-mode-map): Move initialization
8 into declaration.
9 (gnus-kill-file-mode): Use define-derived-mode.
10 (gnus-kill-file-edit-file, gnus-kill-file-enter-kill, gnus-kill):
11 Use derived-mode-p.
12 * gnus-group.el (gnus-group-mode): Use define-derived-mode.
13 (gnus-group-setup-buffer, gnus-group-name-at-point)
14 (gnus-group-make-web-group, gnus-group-enter-directory)
15 (gnus-group-suspend): Use derived-mode-p.
16 * gnus-cus.el (gnus-custom-mode): Use define-derived-mode.
17 * gnus-bookmark.el (gnus-bookmark-bmenu-mode): Use define-derived-mode.
18 * gnus-art.el (gnus-article-mode): Use define-derived-mode.
19 (gnus-article-setup-buffer, gnus-article-prepare)
20 (gnus-article-prepare-display, gnus-sticky-article)
21 (gnus-kill-sticky-article-buffer, gnus-kill-sticky-article-buffers)
22 (gnus-bind-safe-url-regexp, gnus-article-check-buffer)
23 (gnus-article-read-summary-keys): Use derived-mode-p.
24
12013-08-28 Katsumi Yamaoka <yamaoka@jpl.org> 252013-08-28 Katsumi Yamaoka <yamaoka@jpl.org>
2 26
3 * mm-decode.el (mm-temp-files-delete): Fix file deletion logic. 27 * mm-decode.el (mm-temp-files-delete): Fix file deletion logic.
@@ -177,15 +201,15 @@
1772013-07-10 David Engster <deng@randomsample.de> 2012013-07-10 David Engster <deng@randomsample.de>
178 202
179 * gnus-start.el (gnus-clean-old-newsrc): Always remove 'unexist' marks 203 * gnus-start.el (gnus-clean-old-newsrc): Always remove 'unexist' marks
180 if `gnus-newsrc-file-version' does not match `gnus-version'. This 204 if `gnus-newsrc-file-version' does not match `gnus-version'.
181 fixes a bug in Emacs trunk where the 'unexist' marks were always 205 This fixes a bug in Emacs trunk where the 'unexist' marks were always
182 removed at startup because "Gnus v5.13" was considered smaller than "Ma 206 removed at startup because "Gnus v5.13" was considered smaller than "Ma
183 Gnus v0.03". 207 Gnus v0.03".
184 208
1852013-07-10 Tassilo Horn <tsdh@gnu.org> 2092013-07-10 Tassilo Horn <tsdh@gnu.org>
186 210
187 * gnus.el (gnus-summary-line-format): Reference 211 * gnus.el (gnus-summary-line-format):
188 `gnus-user-date-format-alist' for the &user-date; format, not 212 Reference `gnus-user-date-format-alist' for the &user-date; format, not
189 `gnus-summary-user-date-format-alist'. 213 `gnus-summary-user-date-format-alist'.
190 214
1912013-07-08 Lars Magne Ingebrigtsen <larsi@gnus.org> 2152013-07-08 Lars Magne Ingebrigtsen <larsi@gnus.org>
@@ -467,7 +491,7 @@
467 491
468 * shr.el (shr-render-td): Support horizontal alignment. 492 * shr.el (shr-render-td): Support horizontal alignment.
469 493
470 * eww.el (eww-put-color): Removed. 494 * eww.el (eww-put-color): Remove.
471 (eww-colorize-region): Use `add-face-text-property'. 495 (eww-colorize-region): Use `add-face-text-property'.
472 496
473 * shr.el (shr-add-font): Append face data, so that we get the correct 497 * shr.el (shr-add-font): Append face data, so that we get the correct
@@ -522,7 +546,7 @@
522 546
5232013-06-16 Rüdiger Sonderfeld <ruediger@c-plusplus.de> 5472013-06-16 Rüdiger Sonderfeld <ruediger@c-plusplus.de>
524 548
525 * shr.el (shr-dom-to-xml): Fixed function call. 549 * shr.el (shr-dom-to-xml): Fix function call.
526 550
527 * eww.el (eww): New group. 551 * eww.el (eww): New group.
528 (eww-header-line-format): New custom variable. 552 (eww-header-line-format): New custom variable.
@@ -558,8 +582,8 @@
558 (auth-source-netrc-parse): Refactor and improve netrc parser to support 582 (auth-source-netrc-parse): Refactor and improve netrc parser to support
559 single-quoted strings and multiline entries. 583 single-quoted strings and multiline entries.
560 (auth-source-netrc-parse-next-interesting) 584 (auth-source-netrc-parse-next-interesting)
561 (auth-source-netrc-parse-one, auth-source-netrc-parse-entries): New 585 (auth-source-netrc-parse-one, auth-source-netrc-parse-entries):
562 functions to support parser. 586 New functions to support parser.
563 587
5642013-06-14 Lars Magne Ingebrigtsen <larsi@gnus.org> 5882013-06-14 Lars Magne Ingebrigtsen <larsi@gnus.org>
565 589
@@ -707,8 +731,8 @@
707 * registry.el (initialize-instance, registry-lookup) 731 * registry.el (initialize-instance, registry-lookup)
708 (registry-lookup-breaks-before-lexbind, registry-lookup-secondary) 732 (registry-lookup-breaks-before-lexbind, registry-lookup-secondary)
709 (registry-lookup-secondary-value, registry-search, registry-delete) 733 (registry-lookup-secondary-value, registry-search, registry-delete)
710 (registry-insert, registry-reindex, registry-size, registry-prune): Do 734 (registry-insert, registry-reindex, registry-size, registry-prune):
711 not wrap methods in `eval-and-compile'. This breaks due to latest 735 Do not wrap methods in `eval-and-compile'. This breaks due to latest
712 changes in EIEIO (introduction of eieio-core.el). 736 changes in EIEIO (introduction of eieio-core.el).
713 737
7142013-05-30 Glenn Morris <rgm@gnu.org> 7382013-05-30 Glenn Morris <rgm@gnu.org>
@@ -988,8 +1012,8 @@
9882013-03-26 Andrew Cohen <cohen@bu.edu> 10122013-03-26 Andrew Cohen <cohen@bu.edu>
989 1013
990 * nnir.el: Major rewrite. Cleaner separation between searches and group 1014 * nnir.el: Major rewrite. Cleaner separation between searches and group
991 management. Marks are now shown in nnir summary buffers. Rudimentary 1015 management. Marks are now shown in nnir summary buffers.
992 support for real (i.e. not ephemeral) nnir groups. 1016 Rudimentary support for real (i.e. not ephemeral) nnir groups.
993 (gnus-summary-make-nnir-group): New function for initiating searches 1017 (gnus-summary-make-nnir-group): New function for initiating searches
994 from a summary buffer. 1018 from a summary buffer.
995 1019
@@ -1018,8 +1042,8 @@
10182013-02-22 David Engster <deng@randomsample.de> 10422013-02-22 David Engster <deng@randomsample.de>
1019 1043
1020 * gnus-registry.el (gnus-registry-save): Provide class name when 1044 * gnus-registry.el (gnus-registry-save): Provide class name when
1021 calling `eieio-persistent-read' to avoid "unsafe call" warning. Use 1045 calling `eieio-persistent-read' to avoid "unsafe call" warning.
1022 `condition-case' to stay compatible with older EIEIO versions which 1046 Use `condition-case' to stay compatible with older EIEIO versions which
1023 only accept one argument. 1047 only accept one argument.
1024 1048
10252013-02-17 Daiki Ueno <ueno@gnu.org> 10492013-02-17 Daiki Ueno <ueno@gnu.org>
@@ -5295,7 +5319,7 @@
5295 a creation default, pass the whole port list down. It will be 5319 a creation default, pass the whole port list down. It will be
5296 completed. 5320 completed.
5297 5321
5298 * auth-source.el (auth-source-search): Updated docs to talk about 5322 * auth-source.el (auth-source-search): Update docs to talk about
5299 multiple creation choices. 5323 multiple creation choices.
5300 (auth-source-netrc-create): Accept a list as a value (from the search 5324 (auth-source-netrc-create): Accept a list as a value (from the search
5301 parameters) and do completion on that list. Keep a separate netrc line 5325 parameters) and do completion on that list. Keep a separate netrc line
@@ -5362,7 +5386,7 @@
5362 (gnus-summary-exit): Kill the correct article buffer on exit from a 5386 (gnus-summary-exit): Kill the correct article buffer on exit from a
5363 `C-d' group. 5387 `C-d' group.
5364 5388
5365 * gnus-start.el (gnus-use-backend-marks): Removed, since it duplicates 5389 * gnus-start.el (gnus-use-backend-marks): Remove, since it duplicates
5366 gnus-propagate-marks. 5390 gnus-propagate-marks.
5367 5391
5368 * gnus-sum.el (gnus-summary-exit-no-update): Restore the group conf 5392 * gnus-sum.el (gnus-summary-exit-no-update): Restore the group conf
@@ -18399,7 +18423,7 @@
18399 18423
184002005-11-19 Kevin Greiner <kevin.greiner@compsol.cc> 184242005-11-19 Kevin Greiner <kevin.greiner@compsol.cc>
18401 18425
18402 * gnus-sum.el (gnus-fetch-old-headers): Updated docs to warn that 18426 * gnus-sum.el (gnus-fetch-old-headers): Update docs to warn that
18403 it can seriously impact performance as it bypasses the agent's 18427 it can seriously impact performance as it bypasses the agent's
18404 local caches. 18428 local caches.
18405 18429
diff --git a/lisp/gnus/gnus-art.el b/lisp/gnus/gnus-art.el
index e65b9fb99e4..b80aa3a24e9 100644
--- a/lisp/gnus/gnus-art.el
+++ b/lisp/gnus/gnus-art.el
@@ -3683,7 +3683,7 @@ function and want to see what the date was before converting."
3683 (walk-windows 3683 (walk-windows
3684 (lambda (w) 3684 (lambda (w)
3685 (set-buffer (window-buffer w)) 3685 (set-buffer (window-buffer w))
3686 (when (eq major-mode 'gnus-article-mode) 3686 (when (derived-mode-p 'gnus-article-mode)
3687 (let ((old-line (count-lines (point-min) (point))) 3687 (let ((old-line (count-lines (point-min) (point)))
3688 (old-column (- (point) (line-beginning-position))) 3688 (old-column (- (point) (line-beginning-position)))
3689 (window-start (window-start w)) 3689 (window-start (window-start w))
@@ -4455,7 +4455,7 @@ If variable `gnus-use-long-file-name' is non-nil, it is
4455(defvar bookmark-make-record-function) 4455(defvar bookmark-make-record-function)
4456(defvar shr-put-image-function) 4456(defvar shr-put-image-function)
4457 4457
4458(defun gnus-article-mode () 4458(define-derived-mode gnus-article-mode fundamental-mode "Article"
4459 "Major mode for displaying an article. 4459 "Major mode for displaying an article.
4460 4460
4461All normal editing commands are switched off. 4461All normal editing commands are switched off.
@@ -4470,13 +4470,8 @@ commands:
4470\\[gnus-article-mail]\t Send a reply to the address near point 4470\\[gnus-article-mail]\t Send a reply to the address near point
4471\\[gnus-article-describe-briefly]\t Describe the current mode briefly 4471\\[gnus-article-describe-briefly]\t Describe the current mode briefly
4472\\[gnus-info-find-node]\t Go to the Gnus info node" 4472\\[gnus-info-find-node]\t Go to the Gnus info node"
4473 (interactive)
4474 (kill-all-local-variables)
4475 (gnus-simplify-mode-line) 4473 (gnus-simplify-mode-line)
4476 (setq mode-name "Article")
4477 (setq major-mode 'gnus-article-mode)
4478 (make-local-variable 'minor-mode-alist) 4474 (make-local-variable 'minor-mode-alist)
4479 (use-local-map gnus-article-mode-map)
4480 (when (gnus-visual-p 'article-menu 'menu) 4475 (when (gnus-visual-p 'article-menu 'menu)
4481 (gnus-article-make-menu-bar) 4476 (gnus-article-make-menu-bar)
4482 (when gnus-summary-tool-bar-map 4477 (when gnus-summary-tool-bar-map
@@ -4504,9 +4499,7 @@ commands:
4504 (buffer-disable-undo) 4499 (buffer-disable-undo)
4505 (setq buffer-read-only t 4500 (setq buffer-read-only t
4506 show-trailing-whitespace nil) 4501 show-trailing-whitespace nil)
4507 (set-syntax-table gnus-article-mode-syntax-table) 4502 (mm-enable-multibyte))
4508 (mm-enable-multibyte)
4509 (gnus-run-mode-hooks 'gnus-article-mode-hook))
4510 4503
4511(defun gnus-article-setup-buffer () 4504(defun gnus-article-setup-buffer ()
4512 "Initialize the article buffer." 4505 "Initialize the article buffer."
@@ -4554,7 +4547,7 @@ commands:
4554 (setq gnus-article-mime-handle-alist nil) 4547 (setq gnus-article-mime-handle-alist nil)
4555 (buffer-disable-undo) 4548 (buffer-disable-undo)
4556 (setq buffer-read-only t) 4549 (setq buffer-read-only t)
4557 (unless (eq major-mode 'gnus-article-mode) 4550 (unless (derived-mode-p 'gnus-article-mode)
4558 (gnus-article-mode)) 4551 (gnus-article-mode))
4559 (setq truncate-lines gnus-article-truncate-lines) 4552 (setq truncate-lines gnus-article-truncate-lines)
4560 (current-buffer)) 4553 (current-buffer))
@@ -4603,7 +4596,7 @@ If ARTICLE is an id, HEADER should be the article headers.
4603If ALL-HEADERS is non-nil, no headers are hidden." 4596If ALL-HEADERS is non-nil, no headers are hidden."
4604 (save-excursion 4597 (save-excursion
4605 ;; Make sure we start in a summary buffer. 4598 ;; Make sure we start in a summary buffer.
4606 (unless (eq major-mode 'gnus-summary-mode) 4599 (unless (derived-mode-p 'gnus-summary-mode)
4607 (set-buffer gnus-summary-buffer)) 4600 (set-buffer gnus-summary-buffer))
4608 (setq gnus-summary-buffer (current-buffer)) 4601 (setq gnus-summary-buffer (current-buffer))
4609 (let* ((gnus-article (if header (mail-header-number header) article)) 4602 (let* ((gnus-article (if header (mail-header-number header) article))
@@ -4714,7 +4707,7 @@ If ALL-HEADERS is non-nil, no headers are hidden."
4714 (let ((gnus-article-buffer (current-buffer)) 4707 (let ((gnus-article-buffer (current-buffer))
4715 buffer-read-only 4708 buffer-read-only
4716 (inhibit-read-only t)) 4709 (inhibit-read-only t))
4717 (unless (eq major-mode 'gnus-article-mode) 4710 (unless (derived-mode-p 'gnus-article-mode)
4718 (gnus-article-mode)) 4711 (gnus-article-mode))
4719 (setq buffer-read-only nil 4712 (setq buffer-read-only nil
4720 gnus-article-wash-types nil 4713 gnus-article-wash-types nil
@@ -4776,7 +4769,7 @@ If a prefix ARG is given, ask for a name for this sticky article buffer."
4776 "*")) 4769 "*"))
4777 (if (and (gnus-buffer-live-p new-art-buf-name) 4770 (if (and (gnus-buffer-live-p new-art-buf-name)
4778 (with-current-buffer new-art-buf-name 4771 (with-current-buffer new-art-buf-name
4779 (eq major-mode 'gnus-sticky-article-mode))) 4772 (derived-mode-p 'gnus-sticky-article-mode)))
4780 (switch-to-buffer new-art-buf-name) 4773 (switch-to-buffer new-art-buf-name)
4781 (setq new-art-buf-name (rename-buffer new-art-buf-name t))) 4774 (setq new-art-buf-name (rename-buffer new-art-buf-name t)))
4782 (gnus-sticky-article-mode)) 4775 (gnus-sticky-article-mode))
@@ -4792,7 +4785,7 @@ If none is given, assume the current buffer and kill it if it has
4792 (unless buffer 4785 (unless buffer
4793 (setq buffer (current-buffer))) 4786 (setq buffer (current-buffer)))
4794 (with-current-buffer buffer 4787 (with-current-buffer buffer
4795 (when (eq major-mode 'gnus-sticky-article-mode) 4788 (when (derived-mode-p 'gnus-sticky-article-mode)
4796 (gnus-kill-buffer buffer)))) 4789 (gnus-kill-buffer buffer))))
4797 4790
4798(defun gnus-kill-sticky-article-buffers (arg) 4791(defun gnus-kill-sticky-article-buffers (arg)
@@ -4801,11 +4794,11 @@ If a prefix ARG is given, ask for confirmation."
4801 (interactive "P") 4794 (interactive "P")
4802 (dolist (buf (gnus-buffers)) 4795 (dolist (buf (gnus-buffers))
4803 (with-current-buffer buf 4796 (with-current-buffer buf
4804 (when (eq major-mode 'gnus-sticky-article-mode) 4797 (when (derived-mode-p 'gnus-sticky-article-mode)
4805 (if (not arg) 4798 (if (not arg)
4806 (gnus-kill-buffer buf) 4799 (gnus-kill-buffer buf)
4807 (when (yes-or-no-p (concat "Kill buffer " (buffer-name buf) "? ")) 4800 (when (yes-or-no-p (concat "Kill buffer " (buffer-name buf) "? "))
4808 (gnus-kill-buffer buf))))))) 4801 (gnus-kill-buffer buf)))))))
4809 4802
4810;;; 4803;;;
4811;;; Gnus MIME viewing functions 4804;;; Gnus MIME viewing functions
@@ -4893,7 +4886,7 @@ General format specifiers can also be used. See Info node
4893(defmacro gnus-bind-safe-url-regexp (&rest body) 4886(defmacro gnus-bind-safe-url-regexp (&rest body)
4894 "Bind `mm-w3m-safe-url-regexp' according to `gnus-safe-html-newsgroups'." 4887 "Bind `mm-w3m-safe-url-regexp' according to `gnus-safe-html-newsgroups'."
4895 `(let ((mm-w3m-safe-url-regexp 4888 `(let ((mm-w3m-safe-url-regexp
4896 (let ((group (if (and (eq major-mode 'gnus-article-mode) 4889 (let ((group (if (and (derived-mode-p 'gnus-article-mode)
4897 (gnus-buffer-live-p 4890 (gnus-buffer-live-p
4898 gnus-article-current-summary)) 4891 gnus-article-current-summary))
4899 (with-current-buffer gnus-article-current-summary 4892 (with-current-buffer gnus-article-current-summary
@@ -6477,7 +6470,7 @@ not have a face in `gnus-article-boring-faces'."
6477 6470
6478(defun gnus-article-check-buffer () 6471(defun gnus-article-check-buffer ()
6479 "Beep if not in an article buffer." 6472 "Beep if not in an article buffer."
6480 (unless (equal major-mode 'gnus-article-mode) 6473 (unless (derived-mode-p 'gnus-article-mode)
6481 (error "Command invoked outside of a Gnus article buffer"))) 6474 (error "Command invoked outside of a Gnus article buffer")))
6482 6475
6483(defun gnus-article-read-summary-keys (&optional arg key not-restore-window) 6476(defun gnus-article-read-summary-keys (&optional arg key not-restore-window)
@@ -6592,7 +6585,7 @@ not have a face in `gnus-article-boring-faces'."
6592 new-sum-point 6585 new-sum-point
6593 (window-live-p win) 6586 (window-live-p win)
6594 (with-current-buffer (window-buffer win) 6587 (with-current-buffer (window-buffer win)
6595 (eq major-mode 'gnus-summary-mode))) 6588 (derived-mode-p 'gnus-summary-mode)))
6596 (set-window-point win new-sum-point) 6589 (set-window-point win new-sum-point)
6597 (set-window-start win new-sum-start) 6590 (set-window-start win new-sum-start)
6598 (set-window-hscroll win new-sum-hscroll)))) 6591 (set-window-hscroll win new-sum-hscroll))))
diff --git a/lisp/gnus/gnus-bookmark.el b/lisp/gnus/gnus-bookmark.el
index 7a3d273622a..c31cb1aef36 100644
--- a/lisp/gnus/gnus-bookmark.el
+++ b/lisp/gnus/gnus-bookmark.el
@@ -190,7 +190,7 @@ So the cdr of each bookmark is an alist too.")
190 "Set a bookmark for this article." 190 "Set a bookmark for this article."
191 (interactive) 191 (interactive)
192 (gnus-bookmark-maybe-load-default-file) 192 (gnus-bookmark-maybe-load-default-file)
193 (if (or (not (eq major-mode 'gnus-summary-mode)) 193 (if (or (not (derived-mode-p 'gnus-summary-mode))
194 (not gnus-article-current)) 194 (not gnus-article-current))
195 (error "Please select an article in the Gnus summary buffer") 195 (error "Please select an article in the Gnus summary buffer")
196 (let* ((group (car gnus-article-current)) 196 (let* ((group (car gnus-article-current))
@@ -473,7 +473,7 @@ That is, all information but the name."
473;; Been to lazy to use gnus-bookmark-save... 473;; Been to lazy to use gnus-bookmark-save...
474(defalias 'gnus-bookmark-bmenu-save 'gnus-bookmark-write-file) 474(defalias 'gnus-bookmark-bmenu-save 'gnus-bookmark-write-file)
475 475
476(defun gnus-bookmark-bmenu-mode () 476(define-derived-mode gnus-bookmark-bmenu-mode fundamental-mode "Bookmark Menu"
477 "Major mode for editing a list of Gnus bookmarks. 477 "Major mode for editing a list of Gnus bookmarks.
478Each line describes one of the bookmarks in Gnus. 478Each line describes one of the bookmarks in Gnus.
479Letters do not insert themselves; instead, they are commands. 479Letters do not insert themselves; instead, they are commands.
@@ -497,13 +497,8 @@ Gnus bookmarks names preceded by a \"*\" have annotations.
497 in another buffer. 497 in another buffer.
498\\[gnus-bookmark-bmenu-show-all-annotations] -- show the annotations of all bookmarks in another buffer. 498\\[gnus-bookmark-bmenu-show-all-annotations] -- show the annotations of all bookmarks in another buffer.
499\\[gnus-bookmark-bmenu-edit-annotation] -- edit the annotation for the current bookmark." 499\\[gnus-bookmark-bmenu-edit-annotation] -- edit the annotation for the current bookmark."
500 (kill-all-local-variables)
501 (use-local-map gnus-bookmark-bmenu-mode-map)
502 (setq truncate-lines t) 500 (setq truncate-lines t)
503 (setq buffer-read-only t) 501 (setq buffer-read-only t))
504 (setq major-mode 'gnus-bookmark-bmenu-mode)
505 (setq mode-name "Bookmark Menu")
506 (gnus-run-mode-hooks 'gnus-bookmark-bmenu-mode-hook))
507 502
508;; avoid compilation warnings 503;; avoid compilation warnings
509(defvar gnus-bookmark-bmenu-toggle-infos nil) 504(defvar gnus-bookmark-bmenu-toggle-infos nil)
diff --git a/lisp/gnus/gnus-cus.el b/lisp/gnus/gnus-cus.el
index c8fb5b5dc73..247c081a20f 100644
--- a/lisp/gnus/gnus-cus.el
+++ b/lisp/gnus/gnus-cus.el
@@ -33,7 +33,7 @@
33 33
34;;; Widgets: 34;;; Widgets:
35 35
36(defun gnus-custom-mode () 36(define-derived-mode gnus-custom-mode fundamental-mode "Gnus Customize"
37 "Major mode for editing Gnus customization buffers. 37 "Major mode for editing Gnus customization buffers.
38 38
39The following commands are available: 39The following commands are available:
@@ -45,9 +45,6 @@ The following commands are available:
45 45
46Entry to this mode calls the value of `gnus-custom-mode-hook' 46Entry to this mode calls the value of `gnus-custom-mode-hook'
47if that value is non-nil." 47if that value is non-nil."
48 (kill-all-local-variables)
49 (setq major-mode 'gnus-custom-mode
50 mode-name "Gnus Customize")
51 (use-local-map widget-keymap) 48 (use-local-map widget-keymap)
52 ;; Emacs stuff: 49 ;; Emacs stuff:
53 (when (and (facep 'custom-button-face) 50 (when (and (facep 'custom-button-face)
@@ -63,8 +60,7 @@ if that value is non-nil."
63 (set (make-local-variable 'widget-push-button-prefix) "") 60 (set (make-local-variable 'widget-push-button-prefix) "")
64 (set (make-local-variable 'widget-push-button-suffix) "") 61 (set (make-local-variable 'widget-push-button-suffix) "")
65 (set (make-local-variable 'widget-link-prefix) "") 62 (set (make-local-variable 'widget-link-prefix) "")
66 (set (make-local-variable 'widget-link-suffix) "")) 63 (set (make-local-variable 'widget-link-suffix) "")))
67 (gnus-run-mode-hooks 'gnus-custom-mode-hook))
68 64
69;;; Group Customization: 65;;; Group Customization:
70 66
diff --git a/lisp/gnus/gnus-group.el b/lisp/gnus/gnus-group.el
index 9533f5819a4..c8945e57531 100644
--- a/lisp/gnus/gnus-group.el
+++ b/lisp/gnus/gnus-group.el
@@ -1105,7 +1105,7 @@ When FORCE, rebuild the tool bar."
1105 (set (make-local-variable 'tool-bar-map) map)))) 1105 (set (make-local-variable 'tool-bar-map) map))))
1106 gnus-group-tool-bar-map) 1106 gnus-group-tool-bar-map)
1107 1107
1108(defun gnus-group-mode () 1108(define-derived-mode gnus-group-mode fundamental-mode "Group"
1109 "Major mode for reading news. 1109 "Major mode for reading news.
1110 1110
1111All normal editing commands are switched off. 1111All normal editing commands are switched off.
@@ -1122,17 +1122,12 @@ For more in-depth information on this mode, read the manual (`\\[gnus-info-find-
1122The following commands are available: 1122The following commands are available:
1123 1123
1124\\{gnus-group-mode-map}" 1124\\{gnus-group-mode-map}"
1125 (interactive)
1126 (kill-all-local-variables)
1127 (when (gnus-visual-p 'group-menu 'menu) 1125 (when (gnus-visual-p 'group-menu 'menu)
1128 (gnus-group-make-menu-bar) 1126 (gnus-group-make-menu-bar)
1129 (gnus-group-make-tool-bar)) 1127 (gnus-group-make-tool-bar))
1130 (gnus-simplify-mode-line) 1128 (gnus-simplify-mode-line)
1131 (setq major-mode 'gnus-group-mode)
1132 (setq mode-name "Group")
1133 (gnus-group-set-mode-line) 1129 (gnus-group-set-mode-line)
1134 (setq mode-line-process nil) 1130 (setq mode-line-process nil)
1135 (use-local-map gnus-group-mode-map)
1136 (buffer-disable-undo) 1131 (buffer-disable-undo)
1137 (setq truncate-lines t) 1132 (setq truncate-lines t)
1138 (setq buffer-read-only t 1133 (setq buffer-read-only t
@@ -1143,8 +1138,7 @@ The following commands are available:
1143 (when gnus-use-undo 1138 (when gnus-use-undo
1144 (gnus-undo-mode 1)) 1139 (gnus-undo-mode 1))
1145 (when gnus-slave 1140 (when gnus-slave
1146 (gnus-slave-mode)) 1141 (gnus-slave-mode)))
1147 (gnus-run-mode-hooks 'gnus-group-mode-hook))
1148 1142
1149(defun gnus-update-group-mark-positions () 1143(defun gnus-update-group-mark-positions ()
1150 (save-excursion 1144 (save-excursion
@@ -1193,7 +1187,7 @@ The following commands are available:
1193 1187
1194(defun gnus-group-setup-buffer () 1188(defun gnus-group-setup-buffer ()
1195 (set-buffer (gnus-get-buffer-create gnus-group-buffer)) 1189 (set-buffer (gnus-get-buffer-create gnus-group-buffer))
1196 (unless (eq major-mode 'gnus-group-mode) 1190 (unless (derived-mode-p 'gnus-group-mode)
1197 (gnus-group-mode))) 1191 (gnus-group-mode)))
1198 1192
1199(defun gnus-group-name-charset (method group) 1193(defun gnus-group-name-charset (method group)
@@ -2147,7 +2141,7 @@ be permanent."
2147 2141
2148(defun gnus-group-name-at-point () 2142(defun gnus-group-name-at-point ()
2149 "Return a group name from around point if it exists, or nil." 2143 "Return a group name from around point if it exists, or nil."
2150 (if (eq major-mode 'gnus-group-mode) 2144 (if (derived-mode-p 'gnus-group-mode)
2151 (let ((group (gnus-group-group-name))) 2145 (let ((group (gnus-group-group-name)))
2152 (when group 2146 (when group
2153 (gnus-group-decoded-name group))) 2147 (gnus-group-decoded-name group)))
@@ -3114,7 +3108,7 @@ If SOLID (the prefix), create a solid group."
3114 (gnus-group-read-ephemeral-group 3108 (gnus-group-read-ephemeral-group
3115 group method t 3109 group method t
3116 (cons (current-buffer) 3110 (cons (current-buffer)
3117 (if (eq major-mode 'gnus-summary-mode) 'summary 'group)))))) 3111 (if (derived-mode-p 'gnus-summary-mode) 'summary 'group))))))
3118 3112
3119(defvar nnrss-group-alist) 3113(defvar nnrss-group-alist)
3120(eval-when-compile 3114(eval-when-compile
@@ -3229,7 +3223,7 @@ mail messages or news articles in files that have numeric names."
3229 (unless (gnus-group-read-ephemeral-group 3223 (unless (gnus-group-read-ephemeral-group
3230 name method t 3224 name method t
3231 (cons (current-buffer) 3225 (cons (current-buffer)
3232 (if (eq major-mode 'gnus-summary-mode) 3226 (if (derived-mode-p 'gnus-summary-mode)
3233 'summary 'group))) 3227 'summary 'group)))
3234 (error "Couldn't enter %s" dir)))) 3228 (error "Couldn't enter %s" dir))))
3235 3229
@@ -4319,7 +4313,7 @@ The hook `gnus-suspend-gnus-hook' is called before actually suspending."
4319 (unless (or (eq buf group-buf) 4313 (unless (or (eq buf group-buf)
4320 (eq buf gnus-dribble-buffer) 4314 (eq buf gnus-dribble-buffer)
4321 (with-current-buffer buf 4315 (with-current-buffer buf
4322 (eq major-mode 'message-mode))) 4316 (derived-mode-p 'message-mode)))
4323 (gnus-kill-buffer buf))) 4317 (gnus-kill-buffer buf)))
4324 (setq gnus-backlog-articles nil) 4318 (setq gnus-backlog-articles nil)
4325 (gnus-kill-gnus-frames) 4319 (gnus-kill-gnus-frames)
diff --git a/lisp/gnus/gnus-kill.el b/lisp/gnus/gnus-kill.el
index b3f06de0868..011288e280b 100644
--- a/lisp/gnus/gnus-kill.el
+++ b/lisp/gnus/gnus-kill.el
@@ -75,20 +75,20 @@ of time."
75;;; Gnus Kill File Mode 75;;; Gnus Kill File Mode
76;;; 76;;;
77 77
78(defvar gnus-kill-file-mode-map nil) 78(defvar gnus-kill-file-mode-map
79 79 (let ((map (make-sparse-keymap)))
80(unless gnus-kill-file-mode-map 80 (set-keymap-parent map emacs-lisp-mode-map)
81 (gnus-define-keymap (setq gnus-kill-file-mode-map 81 (gnus-define-keymap map
82 (copy-keymap emacs-lisp-mode-map)) 82 "\C-c\C-k\C-s" gnus-kill-file-kill-by-subject
83 "\C-c\C-k\C-s" gnus-kill-file-kill-by-subject 83 "\C-c\C-k\C-a" gnus-kill-file-kill-by-author
84 "\C-c\C-k\C-a" gnus-kill-file-kill-by-author 84 "\C-c\C-k\C-t" gnus-kill-file-kill-by-thread
85 "\C-c\C-k\C-t" gnus-kill-file-kill-by-thread 85 "\C-c\C-k\C-x" gnus-kill-file-kill-by-xref
86 "\C-c\C-k\C-x" gnus-kill-file-kill-by-xref 86 "\C-c\C-a" gnus-kill-file-apply-buffer
87 "\C-c\C-a" gnus-kill-file-apply-buffer 87 "\C-c\C-e" gnus-kill-file-apply-last-sexp
88 "\C-c\C-e" gnus-kill-file-apply-last-sexp 88 "\C-c\C-c" gnus-kill-file-exit)
89 "\C-c\C-c" gnus-kill-file-exit)) 89 map))
90 90
91(defun gnus-kill-file-mode () 91(define-derived-mode gnus-kill-file-mode emacs-lisp-mode "Kill"
92 "Major mode for editing kill files. 92 "Major mode for editing kill files.
93 93
94If you are using this mode - you probably shouldn't. Kill files 94If you are using this mode - you probably shouldn't. Kill files
@@ -151,15 +151,7 @@ which are marked as read in the previous Gnus sessions. Marks other
151than `D' should be used for articles which should really be deleted. 151than `D' should be used for articles which should really be deleted.
152 152
153Entry to this mode calls emacs-lisp-mode-hook and 153Entry to this mode calls emacs-lisp-mode-hook and
154gnus-kill-file-mode-hook with no arguments, if that value is non-nil." 154gnus-kill-file-mode-hook with no arguments, if that value is non-nil.")
155 (interactive)
156 (kill-all-local-variables)
157 (use-local-map gnus-kill-file-mode-map)
158 (set-syntax-table emacs-lisp-mode-syntax-table)
159 (setq major-mode 'gnus-kill-file-mode)
160 (setq mode-name "Kill")
161 (lisp-mode-variables nil)
162 (gnus-run-mode-hooks 'emacs-lisp-mode-hook 'gnus-kill-file-mode-hook))
163 155
164(defun gnus-kill-file-edit-file (newsgroup) 156(defun gnus-kill-file-edit-file (newsgroup)
165 "Begin editing a kill file for NEWSGROUP. 157 "Begin editing a kill file for NEWSGROUP.
@@ -175,10 +167,10 @@ If NEWSGROUP is nil, the global kill file is selected."
175 (let ((buffer (find-file-noselect file))) 167 (let ((buffer (find-file-noselect file)))
176 (cond ((get-buffer-window buffer) 168 (cond ((get-buffer-window buffer)
177 (pop-to-buffer buffer)) 169 (pop-to-buffer buffer))
178 ((eq major-mode 'gnus-group-mode) 170 ((derived-mode-p 'gnus-group-mode)
179 (gnus-configure-windows 'group) ;Take all windows. 171 (gnus-configure-windows 'group) ;Take all windows.
180 (pop-to-buffer buffer)) 172 (pop-to-buffer buffer))
181 ((eq major-mode 'gnus-summary-mode) 173 ((derived-mode-p 'gnus-summary-mode)
182 (gnus-configure-windows 'article) 174 (gnus-configure-windows 'article)
183 (pop-to-buffer gnus-article-buffer) 175 (pop-to-buffer gnus-article-buffer)
184 (bury-buffer gnus-article-buffer) 176 (bury-buffer gnus-article-buffer)
@@ -201,7 +193,7 @@ If NEWSGROUP is nil, the global kill file is selected."
201 ;; REGEXP: The string to kill. 193 ;; REGEXP: The string to kill.
202 (save-excursion 194 (save-excursion
203 (let (string) 195 (let (string)
204 (unless (eq major-mode 'gnus-kill-file-mode) 196 (unless (derived-mode-p 'gnus-kill-file-mode)
205 (gnus-kill-set-kill-buffer)) 197 (gnus-kill-set-kill-buffer))
206 (unless dont-move 198 (unless dont-move
207 (goto-char (point-max))) 199 (goto-char (point-max)))
@@ -520,7 +512,7 @@ COMMAND must be a Lisp expression or a string representing a key sequence."
520 (setq kill-list (cdr kill-list)))) 512 (setq kill-list (cdr kill-list))))
521 (gnus-execute field kill-list command nil (not all)))))) 513 (gnus-execute field kill-list command nil (not all))))))
522 (switch-to-buffer old-buffer) 514 (switch-to-buffer old-buffer)
523 (when (and (eq major-mode 'gnus-kill-file-mode) regexp (not silent)) 515 (when (and (derived-mode-p 'gnus-kill-file-mode) regexp (not silent))
524 (gnus-pp-gnus-kill 516 (gnus-pp-gnus-kill
525 (nconc (list 'gnus-kill field 517 (nconc (list 'gnus-kill field
526 (if (consp regexp) (list 'quote regexp) regexp)) 518 (if (consp regexp) (list 'quote regexp) regexp))
diff --git a/lisp/gnus/gnus-srvr.el b/lisp/gnus/gnus-srvr.el
index 69774587d80..2f151e570d7 100644
--- a/lisp/gnus/gnus-srvr.el
+++ b/lisp/gnus/gnus-srvr.el
@@ -244,6 +244,7 @@ For more in-depth information on this mode, read the manual
244The following commands are available: 244The following commands are available:
245 245
246\\{gnus-server-mode-map}" 246\\{gnus-server-mode-map}"
247 ;; FIXME: Use define-derived-mode.
247 (interactive) 248 (interactive)
248 (when (gnus-visual-p 'server-menu 'menu) 249 (when (gnus-visual-p 'server-menu 'menu)
249 (gnus-server-make-menu-bar)) 250 (gnus-server-make-menu-bar))
@@ -869,7 +870,7 @@ claim them."
869 (gnus-message 5 "Connecting to %s...done" (nth 1 method)) 870 (gnus-message 5 "Connecting to %s...done" (nth 1 method))
870 t)))) 871 t))))
871 872
872(defun gnus-browse-mode () 873(define-derived-mode gnus-browse-mode fundamental-mode "Browse Server"
873 "Major mode for browsing a foreign server. 874 "Major mode for browsing a foreign server.
874 875
875All normal editing commands are switched off. 876All normal editing commands are switched off.
@@ -884,20 +885,14 @@ buffer.
8842) `\\[gnus-browse-read-group]' to read a group ephemerally. 8852) `\\[gnus-browse-read-group]' to read a group ephemerally.
885 886
8863) `\\[gnus-browse-exit]' to return to the group buffer." 8873) `\\[gnus-browse-exit]' to return to the group buffer."
887 (interactive)
888 (kill-all-local-variables)
889 (when (gnus-visual-p 'browse-menu 'menu) 888 (when (gnus-visual-p 'browse-menu 'menu)
890 (gnus-browse-make-menu-bar)) 889 (gnus-browse-make-menu-bar))
891 (gnus-simplify-mode-line) 890 (gnus-simplify-mode-line)
892 (setq major-mode 'gnus-browse-mode)
893 (setq mode-name "Browse Server")
894 (setq mode-line-process nil) 891 (setq mode-line-process nil)
895 (use-local-map gnus-browse-mode-map)
896 (buffer-disable-undo) 892 (buffer-disable-undo)
897 (setq truncate-lines t) 893 (setq truncate-lines t)
898 (gnus-set-default-directory) 894 (gnus-set-default-directory)
899 (setq buffer-read-only t) 895 (setq buffer-read-only t))
900 (gnus-run-mode-hooks 'gnus-browse-mode-hook))
901 896
902(defun gnus-browse-read-group (&optional no-article number) 897(defun gnus-browse-read-group (&optional no-article number)
903 "Enter the group at the current line. 898 "Enter the group at the current line.
@@ -1022,7 +1017,7 @@ doing the deletion."
1022(defun gnus-browse-exit () 1017(defun gnus-browse-exit ()
1023 "Quit browsing and return to the group buffer." 1018 "Quit browsing and return to the group buffer."
1024 (interactive) 1019 (interactive)
1025 (when (eq major-mode 'gnus-browse-mode) 1020 (when (derived-mode-p 'gnus-browse-mode)
1026 (gnus-kill-buffer (current-buffer))) 1021 (gnus-kill-buffer (current-buffer)))
1027 ;; Insert the newly subscribed groups in the group buffer. 1022 ;; Insert the newly subscribed groups in the group buffer.
1028 (with-current-buffer gnus-group-buffer 1023 (with-current-buffer gnus-group-buffer
diff --git a/lisp/gnus/score-mode.el b/lisp/gnus/score-mode.el
index ec24f1f9670..58767cfcc7a 100644
--- a/lisp/gnus/score-mode.el
+++ b/lisp/gnus/score-mode.el
@@ -40,13 +40,13 @@
40(defvar gnus-score-edit-exit-function nil 40(defvar gnus-score-edit-exit-function nil
41 "Function run on exit from the score buffer.") 41 "Function run on exit from the score buffer.")
42 42
43(defvar gnus-score-mode-map nil) 43(defvar gnus-score-mode-map
44(unless gnus-score-mode-map 44 (let ((map (make-sparse-keymap)))
45 (setq gnus-score-mode-map (make-sparse-keymap)) 45 (set-keymap-parent map emacs-lisp-mode-map)
46 (set-keymap-parent gnus-score-mode-map emacs-lisp-mode-map) 46 (define-key map "\C-c\C-c" 'gnus-score-edit-exit)
47 (define-key gnus-score-mode-map "\C-c\C-c" 'gnus-score-edit-exit) 47 (define-key map "\C-c\C-d" 'gnus-score-edit-insert-date)
48 (define-key gnus-score-mode-map "\C-c\C-d" 'gnus-score-edit-insert-date) 48 (define-key map "\C-c\C-p" 'gnus-score-pretty-print)
49 (define-key gnus-score-mode-map "\C-c\C-p" 'gnus-score-pretty-print)) 49 map))
50 50
51(defvar score-mode-syntax-table 51(defvar score-mode-syntax-table
52 (let ((table (copy-syntax-table lisp-mode-syntax-table))) 52 (let ((table (copy-syntax-table lisp-mode-syntax-table)))
@@ -58,21 +58,13 @@
58(defvar score-mode-coding-system mm-universal-coding-system) 58(defvar score-mode-coding-system mm-universal-coding-system)
59 59
60;;;###autoload 60;;;###autoload
61(defun gnus-score-mode () 61(define-derived-mode gnus-score-mode emacs-lisp-mode "Score"
62 "Mode for editing Gnus score files. 62 "Mode for editing Gnus score files.
63This mode is an extended emacs-lisp mode. 63This mode is an extended emacs-lisp mode.
64 64
65\\{gnus-score-mode-map}" 65\\{gnus-score-mode-map}"
66 (interactive)
67 (kill-all-local-variables)
68 (use-local-map gnus-score-mode-map)
69 (gnus-score-make-menu-bar) 66 (gnus-score-make-menu-bar)
70 (set-syntax-table score-mode-syntax-table) 67 (make-local-variable 'gnus-score-edit-exit-function))
71 (setq major-mode 'gnus-score-mode)
72 (setq mode-name "Score")
73 (lisp-mode-variables nil)
74 (make-local-variable 'gnus-score-edit-exit-function)
75 (gnus-run-mode-hooks 'emacs-lisp-mode-hook 'gnus-score-mode-hook))
76 68
77(defun gnus-score-make-menu-bar () 69(defun gnus-score-make-menu-bar ()
78 (unless (boundp 'gnus-score-menu) 70 (unless (boundp 'gnus-score-menu)
diff --git a/lisp/ibuffer.el b/lisp/ibuffer.el
index ce29505d6f2..8356a186f13 100644
--- a/lisp/ibuffer.el
+++ b/lisp/ibuffer.el
@@ -156,7 +156,7 @@ elisp byte-compiler."
156 (null buffer-file-name)) 156 (null buffer-file-name))
157 italic) 157 italic)
158 (30 (memq major-mode ibuffer-help-buffer-modes) font-lock-comment-face) 158 (30 (memq major-mode ibuffer-help-buffer-modes) font-lock-comment-face)
159 (35 (eq major-mode 'dired-mode) font-lock-function-name-face)) 159 (35 (derived-mode-p 'dired-mode) font-lock-function-name-face))
160 "An alist describing how to fontify buffers. 160 "An alist describing how to fontify buffers.
161Each element should be of the form (PRIORITY FORM FACE), where 161Each element should be of the form (PRIORITY FORM FACE), where
162PRIORITY is an integer, FORM is an arbitrary form to evaluate in the 162PRIORITY is an integer, FORM is an arbitrary form to evaluate in the
@@ -2358,7 +2358,7 @@ FORMATS is the value to use for `ibuffer-formats'.
2358 ;; We switch to the buffer's window in order to be able 2358 ;; We switch to the buffer's window in order to be able
2359 ;; to modify the value of point 2359 ;; to modify the value of point
2360 (select-window (get-buffer-window buf 0)) 2360 (select-window (get-buffer-window buf 0))
2361 (or (eq major-mode 'ibuffer-mode) 2361 (or (derived-mode-p 'ibuffer-mode)
2362 (ibuffer-mode)) 2362 (ibuffer-mode))
2363 (setq ibuffer-restore-window-config-on-quit other-window-p) 2363 (setq ibuffer-restore-window-config-on-quit other-window-p)
2364 (when shrink 2364 (when shrink
@@ -2383,7 +2383,7 @@ FORMATS is the value to use for `ibuffer-formats'.
2383 (message "Commands: m, u, t, RET, g, k, S, D, Q; q to quit; h for help")))))) 2383 (message "Commands: m, u, t, RET, g, k, S, D, Q; q to quit; h for help"))))))
2384 2384
2385(put 'ibuffer-mode 'mode-class 'special) 2385(put 'ibuffer-mode 'mode-class 'special)
2386(defun ibuffer-mode () 2386(define-derived-mode ibuffer-mode special-mode "IBuffer"
2387 "A major mode for viewing a list of buffers. 2387 "A major mode for viewing a list of buffers.
2388In Ibuffer, you can conveniently perform many operations on the 2388In Ibuffer, you can conveniently perform many operations on the
2389currently open buffers, in addition to filtering your view to a 2389currently open buffers, in addition to filtering your view to a
@@ -2564,10 +2564,6 @@ filter groups are displayed in this order of precedence.
2564You may rearrange filter groups by using the regular 2564You may rearrange filter groups by using the regular
2565'\\[ibuffer-kill-line]' and '\\[ibuffer-yank]' pair. Yanked groups 2565'\\[ibuffer-kill-line]' and '\\[ibuffer-yank]' pair. Yanked groups
2566will be inserted before the group at point." 2566will be inserted before the group at point."
2567 (kill-all-local-variables)
2568 (use-local-map ibuffer-mode-map)
2569 (setq major-mode 'ibuffer-mode)
2570 (setq mode-name "Ibuffer")
2571 ;; Include state info next to the mode name. 2567 ;; Include state info next to the mode name.
2572 (set (make-local-variable 'mode-line-process) 2568 (set (make-local-variable 'mode-line-process)
2573 '(" by " 2569 '(" by "
@@ -2627,13 +2623,12 @@ will be inserted before the group at point."
2627 (ibuffer-update-format) 2623 (ibuffer-update-format)
2628 (when ibuffer-default-directory 2624 (when ibuffer-default-directory
2629 (setq default-directory ibuffer-default-directory)) 2625 (setq default-directory ibuffer-default-directory))
2630 (add-hook 'change-major-mode-hook 'font-lock-defontify nil t) 2626 (add-hook 'change-major-mode-hook 'font-lock-defontify nil t))
2631 (run-mode-hooks 'ibuffer-mode-hook))
2632 2627
2633 2628
2634;;; Start of automatically extracted autoloads. 2629;;; Start of automatically extracted autoloads.
2635 2630
2636;;;### (autoloads nil "ibuf-ext" "ibuf-ext.el" "d06b2735a74954e0c6922a811de7608c") 2631;;;### (autoloads nil "ibuf-ext" "ibuf-ext.el" "85795a4045d20654599b73b88e8e1bc9")
2637;;; Generated autoloads from ibuf-ext.el 2632;;; Generated autoloads from ibuf-ext.el
2638 2633
2639(autoload 'ibuffer-auto-mode "ibuf-ext" "\ 2634(autoload 'ibuffer-auto-mode "ibuf-ext" "\
diff --git a/lisp/info.el b/lisp/info.el
index 65cd7eddcfd..93442689319 100644
--- a/lisp/info.el
+++ b/lisp/info.el
@@ -790,7 +790,7 @@ See a list of available Info commands in `Info-mode'."
790 790
791(defun info-setup (file-or-node buffer) 791(defun info-setup (file-or-node buffer)
792 "Display Info node FILE-OR-NODE in BUFFER." 792 "Display Info node FILE-OR-NODE in BUFFER."
793 (if (and buffer (not (eq major-mode 'Info-mode))) 793 (if (and buffer (not (derived-mode-p 'Info-mode)))
794 (Info-mode)) 794 (Info-mode))
795 (if file-or-node 795 (if file-or-node
796 ;; If argument already contains parentheses, don't add another set 796 ;; If argument already contains parentheses, don't add another set
@@ -931,7 +931,7 @@ STRICT-CASE is non-nil)."
931 (info-initialize) 931 (info-initialize)
932 (setq filename (Info-find-file filename)) 932 (setq filename (Info-find-file filename))
933 ;; Go into Info buffer. 933 ;; Go into Info buffer.
934 (or (eq major-mode 'Info-mode) (switch-to-buffer "*info*")) 934 (or (derived-mode-p 'Info-mode) (switch-to-buffer "*info*"))
935 ;; Record the node we are leaving, if we were in one. 935 ;; Record the node we are leaving, if we were in one.
936 (and (not no-going-back) 936 (and (not no-going-back)
937 Info-current-file 937 Info-current-file
@@ -961,7 +961,7 @@ otherwise, that defaults to `Top'."
961 "Go to an Info node FILENAME and NODENAME, re-reading disk contents. 961 "Go to an Info node FILENAME and NODENAME, re-reading disk contents.
962When *info* is already displaying FILENAME and NODENAME, the window position 962When *info* is already displaying FILENAME and NODENAME, the window position
963is preserved, if possible." 963is preserved, if possible."
964 (or (eq major-mode 'Info-mode) (switch-to-buffer "*info*")) 964 (or (derived-mode-p 'Info-mode) (switch-to-buffer "*info*"))
965 (let ((old-filename Info-current-file) 965 (let ((old-filename Info-current-file)
966 (old-nodename Info-current-node) 966 (old-nodename Info-current-node)
967 (window-selected (eq (selected-window) (get-buffer-window))) 967 (window-selected (eq (selected-window) (get-buffer-window)))
@@ -1065,7 +1065,7 @@ is non-nil)."
1065 1065
1066(defun Info-find-node-2 (filename nodename &optional no-going-back strict-case) 1066(defun Info-find-node-2 (filename nodename &optional no-going-back strict-case)
1067 (buffer-disable-undo (current-buffer)) 1067 (buffer-disable-undo (current-buffer))
1068 (or (eq major-mode 'Info-mode) 1068 (or (derived-mode-p 'Info-mode)
1069 (Info-mode)) 1069 (Info-mode))
1070 (widen) 1070 (widen)
1071 (setq Info-current-node nil) 1071 (setq Info-current-node nil)
@@ -2212,7 +2212,7 @@ End of submatch 0, 1, and 3 are the same, so you can safely concat."
2212 (interactive) 2212 (interactive)
2213 ;; In case another window is currently selected 2213 ;; In case another window is currently selected
2214 (save-window-excursion 2214 (save-window-excursion
2215 (or (eq major-mode 'Info-mode) (switch-to-buffer "*info*")) 2215 (or (derived-mode-p 'Info-mode) (switch-to-buffer "*info*"))
2216 (Info-goto-node (Info-extract-pointer "next")))) 2216 (Info-goto-node (Info-extract-pointer "next"))))
2217 2217
2218(defun Info-prev () 2218(defun Info-prev ()
@@ -2220,7 +2220,7 @@ End of submatch 0, 1, and 3 are the same, so you can safely concat."
2220 (interactive) 2220 (interactive)
2221 ;; In case another window is currently selected 2221 ;; In case another window is currently selected
2222 (save-window-excursion 2222 (save-window-excursion
2223 (or (eq major-mode 'Info-mode) (switch-to-buffer "*info*")) 2223 (or (derived-mode-p 'Info-mode) (switch-to-buffer "*info*"))
2224 (Info-goto-node (Info-extract-pointer "prev[ious]*" "previous")))) 2224 (Info-goto-node (Info-extract-pointer "prev[ious]*" "previous"))))
2225 2225
2226(defun Info-up (&optional same-file) 2226(defun Info-up (&optional same-file)
@@ -2229,7 +2229,7 @@ If SAME-FILE is non-nil, do not move to a different Info file."
2229 (interactive) 2229 (interactive)
2230 ;; In case another window is currently selected 2230 ;; In case another window is currently selected
2231 (save-window-excursion 2231 (save-window-excursion
2232 (or (eq major-mode 'Info-mode) (switch-to-buffer "*info*")) 2232 (or (derived-mode-p 'Info-mode) (switch-to-buffer "*info*"))
2233 (let ((old-node Info-current-node) 2233 (let ((old-node Info-current-node)
2234 (old-file Info-current-file) 2234 (old-file Info-current-file)
2235 (node (Info-extract-pointer "up")) p) 2235 (node (Info-extract-pointer "up")) p)
@@ -4082,7 +4082,7 @@ If FORK is non-nil, it is passed to `Info-goto-node'."
4082(defun Info-menu-update () 4082(defun Info-menu-update ()
4083 "Update the Info menu for the current node." 4083 "Update the Info menu for the current node."
4084 (condition-case nil 4084 (condition-case nil
4085 (if (or (not (eq major-mode 'Info-mode)) 4085 (if (or (not (derived-mode-p 'Info-mode))
4086 (equal (list Info-current-file Info-current-node) 4086 (equal (list Info-current-file Info-current-node)
4087 Info-menu-last-node)) 4087 Info-menu-last-node))
4088 () 4088 ()
@@ -4285,7 +4285,7 @@ Advanced commands:
4285;; When an Info buffer is killed, make sure the associated tags buffer 4285;; When an Info buffer is killed, make sure the associated tags buffer
4286;; is killed too. 4286;; is killed too.
4287(defun Info-kill-buffer () 4287(defun Info-kill-buffer ()
4288 (and (eq major-mode 'Info-mode) 4288 (and (derived-mode-p 'Info-mode)
4289 Info-tag-table-buffer 4289 Info-tag-table-buffer
4290 (kill-buffer Info-tag-table-buffer))) 4290 (kill-buffer Info-tag-table-buffer)))
4291 4291
@@ -4302,10 +4302,11 @@ Advanced commands:
4302 (copy-marker (marker-position m))) 4302 (copy-marker (marker-position m)))
4303 (make-marker)))))) 4303 (make-marker))))))
4304 4304
4305(defvar Info-edit-map (let ((map (make-sparse-keymap))) 4305(define-obsolete-variable-alias 'Info-edit-map 'Info-edit-mode-map "24.1")
4306 (set-keymap-parent map text-mode-map) 4306(defvar Info-edit-mode-map (let ((map (make-sparse-keymap)))
4307 (define-key map "\C-c\C-c" 'Info-cease-edit) 4307 (set-keymap-parent map text-mode-map)
4308 map) 4308 (define-key map "\C-c\C-c" 'Info-cease-edit)
4309 map)
4309 "Local keymap used within `e' command of Info.") 4310 "Local keymap used within `e' command of Info.")
4310 4311
4311(make-obsolete-variable 'Info-edit-map 4312(make-obsolete-variable 'Info-edit-map
@@ -4315,19 +4316,14 @@ Advanced commands:
4315;; Info-edit mode is suitable only for specially formatted data. 4316;; Info-edit mode is suitable only for specially formatted data.
4316(put 'Info-edit-mode 'mode-class 'special) 4317(put 'Info-edit-mode 'mode-class 'special)
4317 4318
4318(defun Info-edit-mode () 4319(define-derived-mode Info-edit-mode text-mode "Info Edit"
4319 "Major mode for editing the contents of an Info node. 4320 "Major mode for editing the contents of an Info node.
4320Like text mode with the addition of `Info-cease-edit' 4321Like text mode with the addition of `Info-cease-edit'
4321which returns to Info mode for browsing. 4322which returns to Info mode for browsing.
4322\\{Info-edit-map}" 4323\\{Info-edit-map}"
4323 (use-local-map Info-edit-map)
4324 (setq major-mode 'Info-edit-mode)
4325 (setq mode-name "Info Edit")
4326 (kill-local-variable 'mode-line-buffer-identification)
4327 (setq buffer-read-only nil) 4324 (setq buffer-read-only nil)
4328 (force-mode-line-update) 4325 (force-mode-line-update)
4329 (buffer-enable-undo (current-buffer)) 4326 (buffer-enable-undo (current-buffer)))
4330 (run-mode-hooks 'Info-edit-mode-hook))
4331 4327
4332(make-obsolete 'Info-edit-mode 4328(make-obsolete 'Info-edit-mode
4333 "editing Info nodes by hand is not recommended." "24.4") 4329 "editing Info nodes by hand is not recommended." "24.4")
@@ -4352,11 +4348,7 @@ This feature will be removed in future.")
4352 (and (buffer-modified-p) 4348 (and (buffer-modified-p)
4353 (y-or-n-p "Save the file? ") 4349 (y-or-n-p "Save the file? ")
4354 (save-buffer)) 4350 (save-buffer))
4355 (use-local-map Info-mode-map) 4351 (Info-mode)
4356 (setq major-mode 'Info-mode)
4357 (setq mode-name "Info")
4358 (Info-set-mode-line)
4359 (setq buffer-read-only t)
4360 (force-mode-line-update) 4352 (force-mode-line-update)
4361 (and (marker-position Info-tag-table-marker) 4353 (and (marker-position Info-tag-table-marker)
4362 (buffer-modified-p) 4354 (buffer-modified-p)
@@ -4469,7 +4461,7 @@ COMMAND must be a symbol or string."
4469 ;; Get Info running, and pop to it in another window. 4461 ;; Get Info running, and pop to it in another window.
4470 (save-window-excursion 4462 (save-window-excursion
4471 (info)) 4463 (info))
4472 (or (eq major-mode 'Info-mode) (pop-to-buffer "*info*")) 4464 (or (derived-mode-p 'Info-mode) (pop-to-buffer "*info*"))
4473 ;; Bind Info-history to nil, to prevent the last Index node 4465 ;; Bind Info-history to nil, to prevent the last Index node
4474 ;; visited by Info-find-emacs-command-nodes from being 4466 ;; visited by Info-find-emacs-command-nodes from being
4475 ;; pushed onto the history. 4467 ;; pushed onto the history.
@@ -5133,7 +5125,7 @@ INDENT is the current indentation depth."
5133NODESPEC is a string of the form: (file)node." 5125NODESPEC is a string of the form: (file)node."
5134 ;; Set up a buffer we can use to fake-out Info. 5126 ;; Set up a buffer we can use to fake-out Info.
5135 (with-current-buffer (get-buffer-create " *info-browse-tmp*") 5127 (with-current-buffer (get-buffer-create " *info-browse-tmp*")
5136 (if (not (equal major-mode 'Info-mode)) 5128 (if (not (derived-mode-p 'Info-mode))
5137 (Info-mode)) 5129 (Info-mode))
5138 ;; Get the node into this buffer 5130 ;; Get the node into this buffer
5139 (if (not (string-match "^(\\([^)]+\\))\\([^.]+\\)$" nodespec)) 5131 (if (not (string-match "^(\\([^)]+\\))\\([^.]+\\)$" nodespec))
diff --git a/lisp/locate.el b/lisp/locate.el
index ab0417070e7..99a99853da9 100644
--- a/lisp/locate.el
+++ b/lisp/locate.el
@@ -95,7 +95,7 @@
95;; 95;;
96;; (defadvice dired-make-relative (before set-no-error activate) 96;; (defadvice dired-make-relative (before set-no-error activate)
97;; "For locate mode and Windows, don't return errors" 97;; "For locate mode and Windows, don't return errors"
98;; (if (and (eq major-mode 'locate-mode) 98;; (if (and (derived-mode-p 'locate-mode)
99;; (memq system-type '(windows-nt ms-dos))) 99;; (memq system-type '(windows-nt ms-dos)))
100;; (ad-set-arg 2 t) 100;; (ad-set-arg 2 t)
101;; )) 101;; ))
@@ -448,7 +448,7 @@ file name or is inside a subdirectory."
448;; Define a mode for locate 448;; Define a mode for locate
449;; Default directory is set to "/" so that dired commands, which 449;; Default directory is set to "/" so that dired commands, which
450;; expect to be in a tree, will work properly 450;; expect to be in a tree, will work properly
451(defun locate-mode () 451(define-derived-mode locate-mode special-mode "Locate"
452 "Major mode for the `*Locate*' buffer made by \\[locate]. 452 "Major mode for the `*Locate*' buffer made by \\[locate].
453\\<locate-mode-map>\ 453\\<locate-mode-map>\
454In that buffer, you can use almost all the usual dired bindings. 454In that buffer, you can use almost all the usual dired bindings.
@@ -463,39 +463,31 @@ Specific `locate-mode' commands, such as \\[locate-find-directory],
463do not work in subdirectories. 463do not work in subdirectories.
464 464
465\\{locate-mode-map}" 465\\{locate-mode-map}"
466 ;; Not to be called interactively.
467 (kill-all-local-variables)
468 ;; Avoid clobbering this variable 466 ;; Avoid clobbering this variable
469 (make-local-variable 'dired-subdir-alist) 467 (make-local-variable 'dired-subdir-alist)
470 (use-local-map locate-mode-map) 468 (setq default-directory "/"
471 (setq major-mode 'locate-mode
472 mode-name "Locate"
473 default-directory "/"
474 buffer-read-only t 469 buffer-read-only t
475 selective-display t) 470 selective-display t)
476 (dired-alist-add-1 default-directory (point-min-marker)) 471 (dired-alist-add-1 default-directory (point-min-marker))
477 (set (make-local-variable 'dired-directory) "/") 472 (set (make-local-variable 'dired-directory) "/")
478 (set (make-local-variable 'dired-subdir-switches) locate-ls-subdir-switches) 473 (set (make-local-variable 'dired-subdir-switches) locate-ls-subdir-switches)
479 (setq dired-switches-alist nil) 474 (setq dired-switches-alist nil)
480 (make-local-variable 'directory-listing-before-filename-regexp)
481 ;; This should support both Unix and Windoze style names 475 ;; This should support both Unix and Windoze style names
482 (setq directory-listing-before-filename-regexp 476 (setq-local directory-listing-before-filename-regexp
483 (concat "^.\\(" 477 (concat "^.\\("
484 (make-string (1- locate-filename-indentation) ?\s) 478 (make-string (1- locate-filename-indentation) ?\s)
485 "\\)\\|" 479 "\\)\\|"
486 (default-value 'directory-listing-before-filename-regexp))) 480 (default-value
487 (make-local-variable 'dired-actual-switches) 481 'directory-listing-before-filename-regexp)))
488 (setq dired-actual-switches "") 482 (setq-local dired-actual-switches "")
489 (make-local-variable 'dired-permission-flags-regexp) 483 (setq-local dired-permission-flags-regexp
490 (setq dired-permission-flags-regexp 484 (concat "^.\\("
491 (concat "^.\\(" 485 (make-string (1- locate-filename-indentation) ?\s)
492 (make-string (1- locate-filename-indentation) ?\s) 486 "\\)\\|"
493 "\\)\\|" 487 (default-value 'dired-permission-flags-regexp)))
494 (default-value 'dired-permission-flags-regexp))) 488
495 (make-local-variable 'revert-buffer-function) 489 (setq-local revert-buffer-function #'locate-update)
496 (setq revert-buffer-function 'locate-update) 490 (setq-local page-delimiter "\n\n"))
497 (set (make-local-variable 'page-delimiter) "\n\n")
498 (run-mode-hooks 'locate-mode-hook))
499(put 'locate-mode 'derived-mode-parent 'dired-mode) 491(put 'locate-mode 'derived-mode-parent 'dired-mode)
500 492
501(defun locate-do-setup (search-string) 493(defun locate-do-setup (search-string)
diff --git a/lisp/mail/mspools.el b/lisp/mail/mspools.el
index 5e01a7149a8..b2618ef42db 100644
--- a/lisp/mail/mspools.el
+++ b/lisp/mail/mspools.el
@@ -344,19 +344,13 @@ nil."
344 (interactive) 344 (interactive)
345 (kill-buffer mspools-buffer)) 345 (kill-buffer mspools-buffer))
346 346
347(defun mspools-mode () 347(define-derived-mode mspools-mode special-mode "MSpools"
348 "Major mode for output from mspools-show. 348 "Major mode for output from mspools-show.
349\\<mspools-mode-map>Move point to one of the items in this buffer, then use 349\\<mspools-mode-map>Move point to one of the items in this buffer, then use
350\\[mspools-visit-spool] to go to the spool that the current line refers to. 350\\[mspools-visit-spool] to go to the spool that the current line refers to.
351\\[revert-buffer] to regenerate the list of spools. 351\\[revert-buffer] to regenerate the list of spools.
352\\{mspools-mode-map}" 352\\{mspools-mode-map}"
353 (kill-all-local-variables) 353 (setq-local revert-buffer-function 'mspools-revert-buffer))
354 (make-local-variable 'revert-buffer-function)
355 (setq revert-buffer-function 'mspools-revert-buffer)
356 (use-local-map mspools-mode-map)
357 (setq major-mode 'mspools-mode)
358 (setq mode-name "MSpools")
359 (run-mode-hooks 'mspools-mode-hook))
360 354
361(defun mspools-get-spool-files () 355(defun mspools-get-spool-files ()
362 "Find the list of spool files and display them in *spools* buffer." 356 "Find the list of spool files and display them in *spools* buffer."
diff --git a/lisp/mail/rmailsum.el b/lisp/mail/rmailsum.el
index 3a0a7824ad8..cced2231522 100644
--- a/lisp/mail/rmailsum.el
+++ b/lisp/mail/rmailsum.el
@@ -408,7 +408,7 @@ If FUNCTION is nil, includes all messages."
408 (unless rmail-buffer 408 (unless rmail-buffer
409 (error "No RMAIL buffer found")) 409 (error "No RMAIL buffer found"))
410 (let (mesg was-in-summary sumbuf) 410 (let (mesg was-in-summary sumbuf)
411 (if (eq major-mode 'rmail-summary-mode) 411 (if (derived-mode-p 'rmail-summary-mode)
412 (setq was-in-summary t)) 412 (setq was-in-summary t))
413 (with-current-buffer rmail-buffer 413 (with-current-buffer rmail-buffer
414 (setq rmail-summary-buffer (rmail-new-summary-1 desc redo function args) 414 (setq rmail-summary-buffer (rmail-new-summary-1 desc redo function args)
@@ -1035,7 +1035,7 @@ Optional prefix ARG means undelete ARG previous messages."
1035;; Rmail Summary mode is suitable only for specially formatted data. 1035;; Rmail Summary mode is suitable only for specially formatted data.
1036(put 'rmail-summary-mode 'mode-class 'special) 1036(put 'rmail-summary-mode 'mode-class 'special)
1037 1037
1038(defun rmail-summary-mode () 1038(define-derived-mode rmail-summary-mode special-mode "RMAIL Summary"
1039 "Rmail Summary Mode is invoked from Rmail Mode by using \\<rmail-mode-map>\\[rmail-summary]. 1039 "Rmail Summary Mode is invoked from Rmail Mode by using \\<rmail-mode-map>\\[rmail-summary].
1040As commands are issued in the summary buffer, they are applied to the 1040As commands are issued in the summary buffer, they are applied to the
1041corresponding mail messages in the rmail buffer. 1041corresponding mail messages in the rmail buffer.
@@ -1058,10 +1058,6 @@ Commands for sorting the summary:
1058\\[rmail-summary-sort-by-correspondent] Sort by correspondent. 1058\\[rmail-summary-sort-by-correspondent] Sort by correspondent.
1059\\[rmail-summary-sort-by-lines] Sort by lines. 1059\\[rmail-summary-sort-by-lines] Sort by lines.
1060\\[rmail-summary-sort-by-labels] Sort by labels." 1060\\[rmail-summary-sort-by-labels] Sort by labels."
1061 (interactive)
1062 (kill-all-local-variables)
1063 (setq major-mode 'rmail-summary-mode)
1064 (setq mode-name "RMAIL Summary")
1065 (setq truncate-lines t) 1061 (setq truncate-lines t)
1066 (setq buffer-read-only t) 1062 (setq buffer-read-only t)
1067 (set-syntax-table text-mode-syntax-table) 1063 (set-syntax-table text-mode-syntax-table)
@@ -1074,8 +1070,7 @@ Commands for sorting the summary:
1074 (make-local-variable 'revert-buffer-function) 1070 (make-local-variable 'revert-buffer-function)
1075 (make-local-variable 'font-lock-defaults) 1071 (make-local-variable 'font-lock-defaults)
1076 (setq font-lock-defaults '(rmail-summary-font-lock-keywords t)) 1072 (setq font-lock-defaults '(rmail-summary-font-lock-keywords t))
1077 (rmail-summary-enable) 1073 (rmail-summary-enable))
1078 (run-mode-hooks 'rmail-summary-mode-hook))
1079 1074
1080;; Summary features need to be disabled during edit mode. 1075;; Summary features need to be disabled during edit mode.
1081(defun rmail-summary-disable () 1076(defun rmail-summary-disable ()
diff --git a/lisp/man.el b/lisp/man.el
index 34131f43692..9eb0ccd719a 100644
--- a/lisp/man.el
+++ b/lisp/man.el
@@ -413,7 +413,7 @@ Otherwise, the value is whatever the function
413 413
414(defvar Man-topic-history nil "Topic read history.") 414(defvar Man-topic-history nil "Topic read history.")
415 415
416(defvar man-mode-syntax-table 416(defvar Man-mode-syntax-table
417 (let ((table (copy-syntax-table (standard-syntax-table)))) 417 (let ((table (copy-syntax-table (standard-syntax-table))))
418 (modify-syntax-entry ?. "w" table) 418 (modify-syntax-entry ?. "w" table)
419 (modify-syntax-entry ?_ "w" table) 419 (modify-syntax-entry ?_ "w" table)
@@ -1350,7 +1350,7 @@ manpage command."
1350 1350
1351(put 'Man-mode 'mode-class 'special) 1351(put 'Man-mode 'mode-class 'special)
1352 1352
1353(defun Man-mode () 1353(define-derived-mode Man-mode fundamental-mode "Man"
1354 "A mode for browsing Un*x manual pages. 1354 "A mode for browsing Un*x manual pages.
1355 1355
1356The following man commands are available in the buffer. Try 1356The following man commands are available in the buffer. Try
@@ -1387,11 +1387,7 @@ The following variables may be of some use. Try
1387 1387
1388The following key bindings are currently in effect in the buffer: 1388The following key bindings are currently in effect in the buffer:
1389\\{Man-mode-map}" 1389\\{Man-mode-map}"
1390 (interactive) 1390 (setq buffer-auto-save-file-name nil
1391 (kill-all-local-variables)
1392 (setq major-mode 'Man-mode
1393 mode-name "Man"
1394 buffer-auto-save-file-name nil
1395 mode-line-buffer-identification 1391 mode-line-buffer-identification
1396 (list (default-value 'mode-line-buffer-identification) 1392 (list (default-value 'mode-line-buffer-identification)
1397 " {" 'Man-page-mode-string "}") 1393 " {" 'Man-page-mode-string "}")
@@ -1399,8 +1395,6 @@ The following key bindings are currently in effect in the buffer:
1399 buffer-read-only t) 1395 buffer-read-only t)
1400 (buffer-disable-undo) 1396 (buffer-disable-undo)
1401 (auto-fill-mode -1) 1397 (auto-fill-mode -1)
1402 (use-local-map Man-mode-map)
1403 (set-syntax-table man-mode-syntax-table)
1404 (setq imenu-generic-expression (list (list nil Man-heading-regexp 0))) 1398 (setq imenu-generic-expression (list (list nil Man-heading-regexp 0)))
1405 (set (make-local-variable 'outline-regexp) Man-heading-regexp) 1399 (set (make-local-variable 'outline-regexp) Man-heading-regexp)
1406 (set (make-local-variable 'outline-level) (lambda () 1)) 1400 (set (make-local-variable 'outline-level) (lambda () 1))
@@ -1409,8 +1403,7 @@ The following key bindings are currently in effect in the buffer:
1409 (Man-build-page-list) 1403 (Man-build-page-list)
1410 (Man-strip-page-headers) 1404 (Man-strip-page-headers)
1411 (Man-unindent) 1405 (Man-unindent)
1412 (Man-goto-page 1 t) 1406 (Man-goto-page 1 t))
1413 (run-mode-hooks 'Man-mode-hook))
1414 1407
1415(defsubst Man-build-section-alist () 1408(defsubst Man-build-section-alist ()
1416 "Build the list of manpage sections." 1409 "Build the list of manpage sections."
diff --git a/lisp/net/eudc-hotlist.el b/lisp/net/eudc-hotlist.el
index a8a51b7d61b..57675a483b2 100644
--- a/lisp/net/eudc-hotlist.el
+++ b/lisp/net/eudc-hotlist.el
@@ -44,7 +44,7 @@
44 (define-key map "x" 'kill-this-buffer) 44 (define-key map "x" 'kill-this-buffer)
45 map)) 45 map))
46 46
47(defun eudc-hotlist-mode () 47(define-derived-mode eudc-hotlist-mode fundamental-mode "EUDC-Servers"
48 "Major mode used to edit the hotlist of servers. 48 "Major mode used to edit the hotlist of servers.
49 49
50These are the special commands of this mode: 50These are the special commands of this mode:
@@ -54,18 +54,12 @@ These are the special commands of this mode:
54 t -- Transpose the server at point and the previous one 54 t -- Transpose the server at point and the previous one
55 q -- Commit the changes and quit. 55 q -- Commit the changes and quit.
56 x -- Quit without committing the changes." 56 x -- Quit without committing the changes."
57 (interactive)
58 (kill-all-local-variables)
59 (setq major-mode 'eudc-hotlist-mode)
60 (setq mode-name "EUDC-Servers")
61 (use-local-map eudc-hotlist-mode-map)
62 (when (featurep 'xemacs) 57 (when (featurep 'xemacs)
63 (setq mode-popup-menu eudc-hotlist-menu) 58 (setq mode-popup-menu eudc-hotlist-menu)
64 (when (featurep 'menubar) 59 (when (featurep 'menubar)
65 (set-buffer-menubar current-menubar) 60 (set-buffer-menubar current-menubar)
66 (add-submenu nil (cons "EUDC-Hotlist" (cdr (cdr eudc-hotlist-menu)))))) 61 (add-submenu nil (cons "EUDC-Hotlist" (cdr (cdr eudc-hotlist-menu))))))
67 (setq buffer-read-only t) 62 (setq buffer-read-only t))
68 (run-mode-hooks 'eudc-hotlist-mode-hook))
69 63
70;;;###autoload 64;;;###autoload
71(defun eudc-edit-hotlist () 65(defun eudc-edit-hotlist ()
@@ -76,10 +70,8 @@ These are the special commands of this mode:
76 (switch-to-buffer (get-buffer-create "*EUDC Servers*")) 70 (switch-to-buffer (get-buffer-create "*EUDC Servers*"))
77 (setq buffer-read-only nil) 71 (setq buffer-read-only nil)
78 (erase-buffer) 72 (erase-buffer)
79 (mapc (function 73 (dolist (entry eudc-server-hotlist)
80 (lambda (entry) 74 (setq proto-col (max (length (car entry)) proto-col)))
81 (setq proto-col (max (length (car entry)) proto-col))))
82 eudc-server-hotlist)
83 (setq proto-col (+ 3 proto-col)) 75 (setq proto-col (+ 3 proto-col))
84 (setq gap (make-string (- proto-col 6) ?\ )) 76 (setq gap (make-string (- proto-col 6) ?\ ))
85 (insert " EUDC Servers\n" 77 (insert " EUDC Servers\n"
@@ -89,17 +81,16 @@ These are the special commands of this mode:
89 "------" gap "--------\n" 81 "------" gap "--------\n"
90 "\n") 82 "\n")
91 (setq eudc-hotlist-list-beginning (point)) 83 (setq eudc-hotlist-list-beginning (point))
92 (mapc (lambda (entry) 84 (dolist (entry eudc-server-hotlist)
93 (insert (car entry)) 85 (insert (car entry))
94 (indent-to proto-col) 86 (indent-to proto-col)
95 (insert (symbol-name (cdr entry)) "\n")) 87 (insert (symbol-name (cdr entry)) "\n"))
96 eudc-server-hotlist) 88 (eudc-hotlist-mode)))
97 (eudc-hotlist-mode)))
98 89
99(defun eudc-hotlist-add-server () 90(defun eudc-hotlist-add-server ()
100 "Add a new server to the list after current one." 91 "Add a new server to the list after current one."
101 (interactive) 92 (interactive)
102 (if (not (eq major-mode 'eudc-hotlist-mode)) 93 (if (not (derived-mode-p 'eudc-hotlist-mode))
103 (error "Not in a EUDC hotlist edit buffer")) 94 (error "Not in a EUDC hotlist edit buffer"))
104 (let ((server (read-from-minibuffer "Server: ")) 95 (let ((server (read-from-minibuffer "Server: "))
105 (protocol (completing-read "Protocol: " 96 (protocol (completing-read "Protocol: "
@@ -117,7 +108,7 @@ These are the special commands of this mode:
117(defun eudc-hotlist-delete-server () 108(defun eudc-hotlist-delete-server ()
118 "Delete the server at point from the list." 109 "Delete the server at point from the list."
119 (interactive) 110 (interactive)
120 (if (not (eq major-mode 'eudc-hotlist-mode)) 111 (if (not (derived-mode-p 'eudc-hotlist-mode))
121 (error "Not in a EUDC hotlist edit buffer")) 112 (error "Not in a EUDC hotlist edit buffer"))
122 (let ((buffer-read-only nil)) 113 (let ((buffer-read-only nil))
123 (save-excursion 114 (save-excursion
@@ -130,7 +121,7 @@ These are the special commands of this mode:
130(defun eudc-hotlist-quit-edit () 121(defun eudc-hotlist-quit-edit ()
131 "Quit the hotlist editing mode and save changes to the hotlist." 122 "Quit the hotlist editing mode and save changes to the hotlist."
132 (interactive) 123 (interactive)
133 (if (not (eq major-mode 'eudc-hotlist-mode)) 124 (if (not (derived-mode-p 'eudc-hotlist-mode))
134 (error "Not in a EUDC hotlist edit buffer")) 125 (error "Not in a EUDC hotlist edit buffer"))
135 (let (hotlist) 126 (let (hotlist)
136 (goto-char eudc-hotlist-list-beginning) 127 (goto-char eudc-hotlist-list-beginning)
@@ -149,7 +140,7 @@ These are the special commands of this mode:
149(defun eudc-hotlist-select-server () 140(defun eudc-hotlist-select-server ()
150 "Select the server at point as the current server." 141 "Select the server at point as the current server."
151 (interactive) 142 (interactive)
152 (if (not (eq major-mode 'eudc-hotlist-mode)) 143 (if (not (derived-mode-p 'eudc-hotlist-mode))
153 (error "Not in a EUDC hotlist edit buffer")) 144 (error "Not in a EUDC hotlist edit buffer"))
154 (save-excursion 145 (save-excursion
155 (beginning-of-line) 146 (beginning-of-line)
@@ -163,7 +154,7 @@ These are the special commands of this mode:
163(defun eudc-hotlist-transpose-servers () 154(defun eudc-hotlist-transpose-servers ()
164 "Swap the order of the server with the previous one in the list." 155 "Swap the order of the server with the previous one in the list."
165 (interactive) 156 (interactive)
166 (if (not (eq major-mode 'eudc-hotlist-mode)) 157 (if (not (derived-mode-p 'eudc-hotlist-mode))
167 (error "Not in a EUDC hotlist edit buffer")) 158 (error "Not in a EUDC hotlist edit buffer"))
168 (let ((buffer-read-only nil)) 159 (let ((buffer-read-only nil))
169 (save-excursion 160 (save-excursion
diff --git a/lisp/net/eudc.el b/lisp/net/eudc.el
index c474ac9380d..453c19b27f9 100644
--- a/lisp/net/eudc.el
+++ b/lisp/net/eudc.el
@@ -652,7 +652,7 @@ Each copy is added a new field containing one of the values of FIELD."
652 result)) 652 result))
653 653
654 654
655(defun eudc-mode () 655(define-derived-mode eudc-mode special-mode "EUDC"
656 "Major mode used in buffers displaying the results of directory queries. 656 "Major mode used in buffers displaying the results of directory queries.
657There is no sense in calling this command from a buffer other than 657There is no sense in calling this command from a buffer other than
658one containing the results of a directory query. 658one containing the results of a directory query.
@@ -663,15 +663,9 @@ These are the special commands of EUDC mode:
663 n -- Move to next record. 663 n -- Move to next record.
664 p -- Move to previous record. 664 p -- Move to previous record.
665 b -- Insert record at point into the BBDB database." 665 b -- Insert record at point into the BBDB database."
666 (interactive)
667 (kill-all-local-variables)
668 (setq major-mode 'eudc-mode)
669 (setq mode-name "EUDC")
670 (use-local-map eudc-mode-map)
671 (if (not (featurep 'xemacs)) 666 (if (not (featurep 'xemacs))
672 (easy-menu-define eudc-emacs-menu eudc-mode-map "" (eudc-menu)) 667 (easy-menu-define eudc-emacs-menu eudc-mode-map "" (eudc-menu))
673 (setq mode-popup-menu (eudc-menu))) 668 (setq mode-popup-menu (eudc-menu))))
674 (run-mode-hooks 'eudc-mode-hook))
675 669
676;;}}} 670;;}}}
677 671
@@ -1084,7 +1078,7 @@ queries the server for the existing fields and displays a corresponding form."
1084(defun eudc-move-to-next-record () 1078(defun eudc-move-to-next-record ()
1085 "Move to next record, in a buffer displaying directory query results." 1079 "Move to next record, in a buffer displaying directory query results."
1086 (interactive) 1080 (interactive)
1087 (if (not (eq major-mode 'eudc-mode)) 1081 (if (not (derived-mode-p 'eudc-mode))
1088 (error "Not in a EUDC buffer") 1082 (error "Not in a EUDC buffer")
1089 (let ((pt (next-overlay-change (point)))) 1083 (let ((pt (next-overlay-change (point))))
1090 (if (< pt (point-max)) 1084 (if (< pt (point-max))
@@ -1094,7 +1088,7 @@ queries the server for the existing fields and displays a corresponding form."
1094(defun eudc-move-to-previous-record () 1088(defun eudc-move-to-previous-record ()
1095 "Move to previous record, in a buffer displaying directory query results." 1089 "Move to previous record, in a buffer displaying directory query results."
1096 (interactive) 1090 (interactive)
1097 (if (not (eq major-mode 'eudc-mode)) 1091 (if (not (derived-mode-p 'eudc-mode))
1098 (error "Not in a EUDC buffer") 1092 (error "Not in a EUDC buffer")
1099 (let ((pt (previous-overlay-change (point)))) 1093 (let ((pt (previous-overlay-change (point))))
1100 (if (> pt (point-min)) 1094 (if (> pt (point-min))
@@ -1122,7 +1116,7 @@ queries the server for the existing fields and displays a corresponding form."
1122 (overlay-get (car (overlays-at (point))) 'eudc-record)) 1116 (overlay-get (car (overlays-at (point))) 'eudc-record))
1123 :help "Insert record at point into the BBDB database"] 1117 :help "Insert record at point into the BBDB database"]
1124 ["Insert All Records into BBDB" eudc-batch-export-records-to-bbdb 1118 ["Insert All Records into BBDB" eudc-batch-export-records-to-bbdb
1125 (and (eq major-mode 'eudc-mode) 1119 (and (derived-mode-p 'eudc-mode)
1126 (or (featurep 'bbdb) 1120 (or (featurep 'bbdb)
1127 (prog1 (locate-library "bbdb") (message "")))) 1121 (prog1 (locate-library "bbdb") (message ""))))
1128 :help "Insert all the records returned by a directory query into BBDB"] 1122 :help "Insert all the records returned by a directory query into BBDB"]
diff --git a/lisp/net/mairix.el b/lisp/net/mairix.el
index e6a5f8299ac..f2d404afa58 100644
--- a/lisp/net/mairix.el
+++ b/lisp/net/mairix.el
@@ -757,31 +757,24 @@ VALUES may contain values for editable fields from current article."
757 map) 757 map)
758 "'mairix-searches-mode' keymap.") 758 "'mairix-searches-mode' keymap.")
759 759
760(defvar mairix-searches-mode-font-lock-keywords) 760(defvar mairix-searches-mode-font-lock-keywords
761 761 '(("^\\([0-9]+\\)"
762(defun mairix-searches-mode () 762 (1 font-lock-constant-face))
763 ("^[0-9 ]+\\(Name:\\) \\(.*\\)"
764 (1 font-lock-keyword-face) (2 font-lock-string-face))
765 ("^[ ]+\\(Query:\\) \\(.*\\) , "
766 (1 font-lock-keyword-face) (2 font-lock-string-face))
767 (", \\(Threads:\\) \\(.*\\)"
768 (1 font-lock-keyword-face) (2 font-lock-constant-face))
769 ("^\\([A-Z].*\\)$"
770 (1 font-lock-comment-face))
771 ("^[ ]+\\(Folder:\\) \\(.*\\)"
772 (1 font-lock-keyword-face) (2 font-lock-string-face))))
773
774(define-derived-mode mairix-searches-mode fundamental-mode "mairix-searches"
763 "Major mode for editing mairix searches." 775 "Major mode for editing mairix searches."
764 (interactive) 776 :syntax-table text-mode-syntax-table
765 (kill-all-local-variables) 777 (setq-local font-lock-defaults '(mairix-searches-mode-font-lock-keywords)))
766 (setq major-mode 'mairix-searches-mode)
767 (setq mode-name "mairix-searches")
768 (set-syntax-table text-mode-syntax-table)
769 (use-local-map mairix-searches-mode-map)
770 (make-local-variable 'font-lock-defaults)
771 (setq mairix-searches-mode-font-lock-keywords
772 (list (list "^\\([0-9]+\\)"
773 '(1 font-lock-constant-face))
774 (list "^[0-9 ]+\\(Name:\\) \\(.*\\)"
775 '(1 font-lock-keyword-face) '(2 font-lock-string-face))
776 (list "^[ ]+\\(Query:\\) \\(.*\\) , "
777 '(1 font-lock-keyword-face) '(2 font-lock-string-face))
778 (list ", \\(Threads:\\) \\(.*\\)"
779 '(1 font-lock-keyword-face) '(2 font-lock-constant-face))
780 (list "^\\([A-Z].*\\)$"
781 '(1 font-lock-comment-face))
782 (list "^[ ]+\\(Folder:\\) \\(.*\\)"
783 '(1 font-lock-keyword-face) '(2 font-lock-string-face))))
784 (setq font-lock-defaults '(mairix-searches-mode-font-lock-keywords)))
785 778
786(defun mairix-build-search-list () 779(defun mairix-build-search-list ()
787 "Display saved searches in current buffer." 780 "Display saved searches in current buffer."
diff --git a/lisp/net/newst-treeview.el b/lisp/net/newst-treeview.el
index d6c8f6f557d..411d4dfdb43 100644
--- a/lisp/net/newst-treeview.el
+++ b/lisp/net/newst-treeview.el
@@ -1909,13 +1909,9 @@ Return t if groups have changed, nil otherwise."
1909 map) 1909 map)
1910 "Mode map for newsticker treeview.") 1910 "Mode map for newsticker treeview.")
1911 1911
1912(defun newsticker-treeview-mode () 1912(define-derived-mode newsticker-treeview-mode fundamental-mode "Newsticker TV"
1913 "Major mode for Newsticker Treeview. 1913 "Major mode for Newsticker Treeview.
1914\\{newsticker-treeview-mode-map}" 1914\\{newsticker-treeview-mode-map}"
1915 (kill-all-local-variables)
1916 (use-local-map newsticker-treeview-mode-map)
1917 (setq major-mode 'newsticker-treeview-mode)
1918 (setq mode-name "Newsticker TV")
1919 (if (boundp 'tool-bar-map) 1915 (if (boundp 'tool-bar-map)
1920 (set (make-local-variable 'tool-bar-map) 1916 (set (make-local-variable 'tool-bar-map)
1921 newsticker-treeview-tool-bar-map)) 1917 newsticker-treeview-tool-bar-map))
diff --git a/lisp/net/quickurl.el b/lisp/net/quickurl.el
index 1e05d8db336..08ae9574a33 100644
--- a/lisp/net/quickurl.el
+++ b/lisp/net/quickurl.el
@@ -429,18 +429,12 @@ current buffer, this default action can be modified via
429(put 'quickurl-list-mode 'mode-class 'special) 429(put 'quickurl-list-mode 'mode-class 'special)
430 430
431;;;###autoload 431;;;###autoload
432(defun quickurl-list-mode () 432(define-derived-mode quickurl-list-mode fundamental-mode "quickurl list"
433 "A mode for browsing the quickurl URL list. 433 "A mode for browsing the quickurl URL list.
434 434
435The key bindings for `quickurl-list-mode' are: 435The key bindings for `quickurl-list-mode' are:
436 436
437\\{quickurl-list-mode-map}" 437\\{quickurl-list-mode-map}"
438 (interactive)
439 (kill-all-local-variables)
440 (use-local-map quickurl-list-mode-map)
441 (setq major-mode 'quickurl-list-mode
442 mode-name "quickurl list")
443 (run-mode-hooks 'quickurl-list-mode-hook)
444 (setq buffer-read-only t 438 (setq buffer-read-only t
445 truncate-lines t)) 439 truncate-lines t))
446 440
diff --git a/lisp/obsolete/options.el b/lisp/obsolete/options.el
index f25003e5652..16941167fb6 100644
--- a/lisp/obsolete/options.el
+++ b/lisp/obsolete/options.el
@@ -88,7 +88,7 @@ The Custom feature is intended to make this obsolete."
88;; Edit Options mode is suitable only for specially formatted data. 88;; Edit Options mode is suitable only for specially formatted data.
89(put 'Edit-options-mode 'mode-class 'special) 89(put 'Edit-options-mode 'mode-class 'special)
90 90
91(defun Edit-options-mode () 91(define-derived-mode Edit-options-mode emacs-lisp-mode "Options"
92 "\\<Edit-options-mode-map>\ 92 "\\<Edit-options-mode-map>\
93Major mode for editing Emacs user option settings. 93Major mode for editing Emacs user option settings.
94Special commands are: 94Special commands are:
@@ -100,17 +100,9 @@ Changed values made by these commands take effect immediately.
100 100
101Each variable description is a paragraph. 101Each variable description is a paragraph.
102For convenience, the characters \\[backward-paragraph] and \\[forward-paragraph] move back and forward by paragraphs." 102For convenience, the characters \\[backward-paragraph] and \\[forward-paragraph] move back and forward by paragraphs."
103 (kill-all-local-variables) 103 (setq-local paragraph-separate "[^\^@-\^?]")
104 (set-syntax-table emacs-lisp-mode-syntax-table) 104 (setq-local paragraph-start "\t")
105 (use-local-map Edit-options-mode-map) 105 (setq-local truncate-lines t))
106 (make-local-variable 'paragraph-separate)
107 (setq paragraph-separate "[^\^@-\^?]")
108 (make-local-variable 'paragraph-start)
109 (setq paragraph-start "\t")
110 (setq truncate-lines t)
111 (setq major-mode 'Edit-options-mode)
112 (setq mode-name "Options")
113 (run-mode-hooks 'Edit-options-mode-hook))
114 106
115(defun Edit-options-set () (interactive) 107(defun Edit-options-set () (interactive)
116 (Edit-options-modify 108 (Edit-options-modify
diff --git a/lisp/play/5x5.el b/lisp/play/5x5.el
index 2e3f500766f..4bd0c4ddcf4 100644
--- a/lisp/play/5x5.el
+++ b/lisp/play/5x5.el
@@ -185,19 +185,8 @@ GRID is the grid of positions to click.")
185 185
186;; Gameplay functions. 186;; Gameplay functions.
187 187
188(put '5x5-mode 'mode-class 'special) 188(define-derived-mode 5x5-mode special-mode "5x5"
189 189 "A mode for playing `5x5'."
190(defun 5x5-mode ()
191 "A mode for playing `5x5'.
192
193The key bindings for `5x5-mode' are:
194
195\\{5x5-mode-map}"
196 (kill-all-local-variables)
197 (use-local-map 5x5-mode-map)
198 (setq major-mode '5x5-mode
199 mode-name "5x5")
200 (run-mode-hooks '5x5-mode-hook)
201 (setq buffer-read-only t 190 (setq buffer-read-only t
202 truncate-lines t) 191 truncate-lines t)
203 (buffer-disable-undo)) 192 (buffer-disable-undo))
diff --git a/lisp/play/blackbox.el b/lisp/play/blackbox.el
index d38f799756b..ce2c928db0d 100644
--- a/lisp/play/blackbox.el
+++ b/lisp/play/blackbox.el
@@ -113,9 +113,8 @@
113 map)) 113 map))
114 114
115;; Blackbox mode is suitable only for specially formatted data. 115;; Blackbox mode is suitable only for specially formatted data.
116(put 'blackbox-mode 'mode-class 'special)
117 116
118(defun blackbox-mode () 117(define-derived-mode blackbox-mode special-mode "Blackbox"
119 "Major mode for playing blackbox. 118 "Major mode for playing blackbox.
120To learn how to play blackbox, see the documentation for function `blackbox'. 119To learn how to play blackbox, see the documentation for function `blackbox'.
121 120
@@ -124,13 +123,7 @@ The usual mnemonic keys move the cursor around the box.
124 123
125\\[bb-romp] -- send in a ray from point, or toggle a ball at point 124\\[bb-romp] -- send in a ray from point, or toggle a ball at point
126\\[bb-done] -- end game and get score" 125\\[bb-done] -- end game and get score"
127 (interactive) 126 (setq truncate-lines t))
128 (kill-all-local-variables)
129 (use-local-map blackbox-mode-map)
130 (setq truncate-lines t)
131 (setq major-mode 'blackbox-mode)
132 (setq mode-name "Blackbox")
133 (run-mode-hooks 'blackbox-mode-hook))
134 127
135;;;###autoload 128;;;###autoload
136(defun blackbox (num) 129(defun blackbox (num)
diff --git a/lisp/play/landmark.el b/lisp/play/landmark.el
index cf86d7a9de5..b995da4513c 100644
--- a/lisp/play/landmark.el
+++ b/lisp/play/landmark.el
@@ -233,10 +233,8 @@
233(put 'landmark-mode 'intangible 1) 233(put 'landmark-mode 'intangible 1)
234;; This one is for when they set view-read-only to t: Landmark cannot 234;; This one is for when they set view-read-only to t: Landmark cannot
235;; allow View Mode to be activated in its buffer. 235;; allow View Mode to be activated in its buffer.
236(put 'landmark-mode 'mode-class 'special) 236(define-derived-mode lm-mode special-mode "Lm"
237 237 "Major mode for playing Lm against Emacs.
238(defun landmark-mode ()
239 "Major mode for playing Landmark against Emacs.
240You and Emacs play in turn by marking a free square. You mark it with X 238You and Emacs play in turn by marking a free square. You mark it with X
241and Emacs marks it with O. The winner is the first to get five contiguous 239and Emacs marks it with O. The winner is the first to get five contiguous
242marks horizontally, vertically or in diagonal. 240marks horizontally, vertically or in diagonal.
@@ -247,16 +245,9 @@ Other useful commands:
247\\{landmark-mode-map} 245\\{landmark-mode-map}
248Entry to this mode calls the value of `landmark-mode-hook' if that value 246Entry to this mode calls the value of `landmark-mode-hook' if that value
249is non-nil. One interesting value is `turn-on-font-lock'." 247is non-nil. One interesting value is `turn-on-font-lock'."
250 (interactive) 248 (lm-display-statistics)
251 (kill-all-local-variables) 249 (setq-local font-lock-defaults '(lm-font-lock-keywords t))
252 (setq major-mode 'landmark-mode 250 (setq buffer-read-only t))
253 mode-name "Landmark")
254 (landmark-display-statistics)
255 (use-local-map landmark-mode-map)
256 (make-local-variable 'font-lock-defaults)
257 (setq font-lock-defaults '(landmark-font-lock-keywords t)
258 buffer-read-only t)
259 (run-mode-hooks 'landmark-mode-hook))
260 251
261 252
262;;;_ + THE SCORE TABLE. 253;;;_ + THE SCORE TABLE.
diff --git a/lisp/play/mpuz.el b/lisp/play/mpuz.el
index e4e627a5293..f4c26bfc6c4 100644
--- a/lisp/play/mpuz.el
+++ b/lisp/play/mpuz.el
@@ -94,7 +94,9 @@ The value t means never ding, and `error' means only ding on wrong input."
94 map) 94 map)
95 "Local keymap to use in Mult Puzzle.") 95 "Local keymap to use in Mult Puzzle.")
96 96
97(defun mpuz-mode () 97
98
99(define-derived-mode mpuz-mode fundamental-mode "Mult Puzzle"
98 "Multiplication puzzle mode. 100 "Multiplication puzzle mode.
99 101
100You have to guess which letters stand for which digits in the 102You have to guess which letters stand for which digits in the
@@ -106,13 +108,7 @@ then the digit. Thus, to guess that A=3, type `A 3'.
106To leave the game to do other editing work, just switch buffers. 108To leave the game to do other editing work, just switch buffers.
107Then you may resume the game with M-x mpuz. 109Then you may resume the game with M-x mpuz.
108You may abort a game by typing \\<mpuz-mode-map>\\[mpuz-offer-abort]." 110You may abort a game by typing \\<mpuz-mode-map>\\[mpuz-offer-abort]."
109 (interactive) 111 (setq tab-width 30))
110 (kill-all-local-variables)
111 (setq major-mode 'mpuz-mode
112 mode-name "Mult Puzzle"
113 tab-width 30)
114 (use-local-map mpuz-mode-map)
115 (run-mode-hooks 'mpuz-mode-hook))
116 112
117 113
118;; Some variables for statistics 114;; Some variables for statistics
diff --git a/lisp/play/snake.el b/lisp/play/snake.el
index 85acfb116d2..4c110914298 100644
--- a/lisp/play/snake.el
+++ b/lisp/play/snake.el
@@ -353,21 +353,13 @@ Argument SNAKE-BUFFER is the name of the buffer."
353 353
354(put 'snake-mode 'mode-class 'special) 354(put 'snake-mode 'mode-class 'special)
355 355
356(defun snake-mode () 356(define-derived-mode snake-mode special-mode "Snake"
357 "A mode for playing Snake. 357 "A mode for playing Snake."
358
359Snake mode keybindings:
360 \\{snake-mode-map}
361"
362 (kill-all-local-variables)
363 358
364 (add-hook 'kill-buffer-hook 'gamegrid-kill-timer nil t) 359 (add-hook 'kill-buffer-hook 'gamegrid-kill-timer nil t)
365 360
366 (use-local-map snake-null-map) 361 (use-local-map snake-null-map)
367 362
368 (setq major-mode 'snake-mode)
369 (setq mode-name "Snake")
370
371 (unless (featurep 'emacs) 363 (unless (featurep 'emacs)
372 (setq mode-popup-menu 364 (setq mode-popup-menu
373 '("Snake Commands" 365 '("Snake Commands"
@@ -382,9 +374,7 @@ Snake mode keybindings:
382 (setq gamegrid-use-glyphs snake-use-glyphs-flag) 374 (setq gamegrid-use-glyphs snake-use-glyphs-flag)
383 (setq gamegrid-use-color snake-use-color-flag) 375 (setq gamegrid-use-color snake-use-color-flag)
384 376
385 (gamegrid-init (snake-display-options)) 377 (gamegrid-init (snake-display-options)))
386
387 (run-mode-hooks 'snake-mode-hook))
388 378
389;;;###autoload 379;;;###autoload
390(defun snake () 380(defun snake ()
diff --git a/lisp/profiler.el b/lisp/profiler.el
index 609a0308cf0..93ab10015ea 100644
--- a/lisp/profiler.el
+++ b/lisp/profiler.el
@@ -256,10 +256,9 @@ Optional argument MODE means only check for the specified mode (cpu or mem)."
256(defun profiler-calltree-find (tree entry) 256(defun profiler-calltree-find (tree entry)
257 "Return a child tree of ENTRY under TREE." 257 "Return a child tree of ENTRY under TREE."
258 (let (result (children (profiler-calltree-children tree))) 258 (let (result (children (profiler-calltree-children tree)))
259 ;; FIXME: Use `assoc'.
260 (while (and children (null result)) 259 (while (and children (null result))
261 (let ((child (car children))) 260 (let ((child (car children)))
262 (when (equal (profiler-calltree-entry child) entry) 261 (when (function-equal (profiler-calltree-entry child) entry)
263 (setq result child)) 262 (setq result child))
264 (setq children (cdr children)))) 263 (setq children (cdr children))))
265 result)) 264 result))
diff --git a/src/ChangeLog b/src/ChangeLog
index 4e08178989e..e609c38be7e 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,7 @@
12013-09-11 Stefan Monnier <monnier@iro.umontreal.ca>
2
3 * keyboard.c (read_char): Don't break immediate_echo (bug#15332).
4
12013-09-10 Stefan Monnier <monnier@iro.umontreal.ca> 52013-09-10 Stefan Monnier <monnier@iro.umontreal.ca>
2 6
3 * eval.c (Feval): Document the new use of `lexical'. 7 * eval.c (Feval): Document the new use of `lexical'.
diff --git a/src/bytecode.c b/src/bytecode.c
index e0e7b22ea13..3ac8b452fbe 100644
--- a/src/bytecode.c
+++ b/src/bytecode.c
@@ -1367,7 +1367,7 @@ exec_byte_code (Lisp_Object bytestr, Lisp_Object vector, Lisp_Object maxdepth,
1367 Lisp_Object v1; 1367 Lisp_Object v1;
1368 BEFORE_POTENTIAL_GC (); 1368 BEFORE_POTENTIAL_GC ();
1369 v1 = POP; 1369 v1 = POP;
1370 TOP = Fgtr (TOP, v1); 1370 TOP = arithcompare (TOP, v1, ARITH_GRTR);
1371 AFTER_POTENTIAL_GC (); 1371 AFTER_POTENTIAL_GC ();
1372 NEXT; 1372 NEXT;
1373 } 1373 }
@@ -1377,7 +1377,7 @@ exec_byte_code (Lisp_Object bytestr, Lisp_Object vector, Lisp_Object maxdepth,
1377 Lisp_Object v1; 1377 Lisp_Object v1;
1378 BEFORE_POTENTIAL_GC (); 1378 BEFORE_POTENTIAL_GC ();
1379 v1 = POP; 1379 v1 = POP;
1380 TOP = Flss (TOP, v1); 1380 TOP = arithcompare (TOP, v1, ARITH_LESS);
1381 AFTER_POTENTIAL_GC (); 1381 AFTER_POTENTIAL_GC ();
1382 NEXT; 1382 NEXT;
1383 } 1383 }
@@ -1387,7 +1387,7 @@ exec_byte_code (Lisp_Object bytestr, Lisp_Object vector, Lisp_Object maxdepth,
1387 Lisp_Object v1; 1387 Lisp_Object v1;
1388 BEFORE_POTENTIAL_GC (); 1388 BEFORE_POTENTIAL_GC ();
1389 v1 = POP; 1389 v1 = POP;
1390 TOP = Fleq (TOP, v1); 1390 TOP = arithcompare (TOP, v1, ARITH_LESS_OR_EQUAL);
1391 AFTER_POTENTIAL_GC (); 1391 AFTER_POTENTIAL_GC ();
1392 NEXT; 1392 NEXT;
1393 } 1393 }
@@ -1397,7 +1397,7 @@ exec_byte_code (Lisp_Object bytestr, Lisp_Object vector, Lisp_Object maxdepth,
1397 Lisp_Object v1; 1397 Lisp_Object v1;
1398 BEFORE_POTENTIAL_GC (); 1398 BEFORE_POTENTIAL_GC ();
1399 v1 = POP; 1399 v1 = POP;
1400 TOP = Fgeq (TOP, v1); 1400 TOP = arithcompare (TOP, v1, ARITH_GRTR_OR_EQUAL);
1401 AFTER_POTENTIAL_GC (); 1401 AFTER_POTENTIAL_GC ();
1402 NEXT; 1402 NEXT;
1403 } 1403 }
diff --git a/src/data.c b/src/data.c
index 9f4bd1f1c02..7f28028f604 100644
--- a/src/data.c
+++ b/src/data.c
@@ -2255,10 +2255,8 @@ bool-vector. IDX starts at 0. */)
2255 2255
2256/* Arithmetic functions */ 2256/* Arithmetic functions */
2257 2257
2258enum comparison { equal, notequal, less, grtr, less_or_equal, grtr_or_equal }; 2258Lisp_Object
2259 2259arithcompare (Lisp_Object num1, Lisp_Object num2, enum Arith_Comparison comparison)
2260static Lisp_Object
2261arithcompare (Lisp_Object num1, Lisp_Object num2, enum comparison comparison)
2262{ 2260{
2263 double f1 = 0, f2 = 0; 2261 double f1 = 0, f2 = 0;
2264 bool floatp = 0; 2262 bool floatp = 0;
@@ -2275,32 +2273,32 @@ arithcompare (Lisp_Object num1, Lisp_Object num2, enum comparison comparison)
2275 2273
2276 switch (comparison) 2274 switch (comparison)
2277 { 2275 {
2278 case equal: 2276 case ARITH_EQUAL:
2279 if (floatp ? f1 == f2 : XINT (num1) == XINT (num2)) 2277 if (floatp ? f1 == f2 : XINT (num1) == XINT (num2))
2280 return Qt; 2278 return Qt;
2281 return Qnil; 2279 return Qnil;
2282 2280
2283 case notequal: 2281 case ARITH_NOTEQUAL:
2284 if (floatp ? f1 != f2 : XINT (num1) != XINT (num2)) 2282 if (floatp ? f1 != f2 : XINT (num1) != XINT (num2))
2285 return Qt; 2283 return Qt;
2286 return Qnil; 2284 return Qnil;
2287 2285
2288 case less: 2286 case ARITH_LESS:
2289 if (floatp ? f1 < f2 : XINT (num1) < XINT (num2)) 2287 if (floatp ? f1 < f2 : XINT (num1) < XINT (num2))
2290 return Qt; 2288 return Qt;
2291 return Qnil; 2289 return Qnil;
2292 2290
2293 case less_or_equal: 2291 case ARITH_LESS_OR_EQUAL:
2294 if (floatp ? f1 <= f2 : XINT (num1) <= XINT (num2)) 2292 if (floatp ? f1 <= f2 : XINT (num1) <= XINT (num2))
2295 return Qt; 2293 return Qt;
2296 return Qnil; 2294 return Qnil;
2297 2295
2298 case grtr: 2296 case ARITH_GRTR:
2299 if (floatp ? f1 > f2 : XINT (num1) > XINT (num2)) 2297 if (floatp ? f1 > f2 : XINT (num1) > XINT (num2))
2300 return Qt; 2298 return Qt;
2301 return Qnil; 2299 return Qnil;
2302 2300
2303 case grtr_or_equal: 2301 case ARITH_GRTR_OR_EQUAL:
2304 if (floatp ? f1 >= f2 : XINT (num1) >= XINT (num2)) 2302 if (floatp ? f1 >= f2 : XINT (num1) >= XINT (num2))
2305 return Qt; 2303 return Qt;
2306 return Qnil; 2304 return Qnil;
@@ -2310,48 +2308,60 @@ arithcompare (Lisp_Object num1, Lisp_Object num2, enum comparison comparison)
2310 } 2308 }
2311} 2309}
2312 2310
2313DEFUN ("=", Feqlsign, Seqlsign, 2, 2, 0, 2311static Lisp_Object
2314 doc: /* Return t if two args, both numbers or markers, are equal. */) 2312arithcompare_driver (ptrdiff_t nargs, Lisp_Object *args,
2315 (register Lisp_Object num1, Lisp_Object num2) 2313 enum Arith_Comparison comparison)
2316{ 2314{
2317 return arithcompare (num1, num2, equal); 2315 for (ptrdiff_t argnum = 1; argnum < nargs; ++argnum)
2316 {
2317 if (EQ (Qnil, arithcompare (args[argnum-1], args[argnum], comparison)))
2318 return Qnil;
2319 }
2320 return Qt;
2318} 2321}
2319 2322
2320DEFUN ("<", Flss, Slss, 2, 2, 0, 2323DEFUN ("=", Feqlsign, Seqlsign, 1, MANY, 0,
2321 doc: /* Return t if first arg is less than second arg. Both must be numbers or markers. */) 2324 doc: /* Return t if args, all numbers or markers, are equal. */)
2322 (register Lisp_Object num1, Lisp_Object num2) 2325 (ptrdiff_t nargs, Lisp_Object *args)
2323{ 2326{
2324 return arithcompare (num1, num2, less); 2327 return arithcompare_driver (nargs, args, ARITH_EQUAL);
2325} 2328}
2326 2329
2327DEFUN (">", Fgtr, Sgtr, 2, 2, 0, 2330DEFUN ("<", Flss, Slss, 1, MANY, 0,
2328 doc: /* Return t if first arg is greater than second arg. Both must be numbers or markers. */) 2331 doc: /* Return t if each arg is less than the next arg. All must be numbers or markers. */)
2329 (register Lisp_Object num1, Lisp_Object num2) 2332 (ptrdiff_t nargs, Lisp_Object *args)
2330{ 2333{
2331 return arithcompare (num1, num2, grtr); 2334 return arithcompare_driver (nargs, args, ARITH_LESS);
2332} 2335}
2333 2336
2334DEFUN ("<=", Fleq, Sleq, 2, 2, 0, 2337DEFUN (">", Fgtr, Sgtr, 1, MANY, 0,
2335 doc: /* Return t if first arg is less than or equal to second arg. 2338 doc: /* Return t if each arg is greater than the next arg. All must be numbers or markers. */)
2336Both must be numbers or markers. */) 2339 (ptrdiff_t nargs, Lisp_Object *args)
2337 (register Lisp_Object num1, Lisp_Object num2)
2338{ 2340{
2339 return arithcompare (num1, num2, less_or_equal); 2341 return arithcompare_driver (nargs, args, ARITH_GRTR);
2340} 2342}
2341 2343
2342DEFUN (">=", Fgeq, Sgeq, 2, 2, 0, 2344DEFUN ("<=", Fleq, Sleq, 1, MANY, 0,
2343 doc: /* Return t if first arg is greater than or equal to second arg. 2345 doc: /* Return t if each arg is less than or equal to the next arg.
2344Both must be numbers or markers. */) 2346All must be numbers or markers. */)
2345 (register Lisp_Object num1, Lisp_Object num2) 2347 (ptrdiff_t nargs, Lisp_Object *args)
2348{
2349 return arithcompare_driver (nargs, args, ARITH_LESS_OR_EQUAL);
2350}
2351
2352DEFUN (">=", Fgeq, Sgeq, 1, MANY, 0,
2353 doc: /* Return t if each arg is greater than or equal to the next arg.
2354All must be numbers or markers. */)
2355 (ptrdiff_t nargs, Lisp_Object *args)
2346{ 2356{
2347 return arithcompare (num1, num2, grtr_or_equal); 2357 return arithcompare_driver (nargs, args, ARITH_GRTR_OR_EQUAL);
2348} 2358}
2349 2359
2350DEFUN ("/=", Fneq, Sneq, 2, 2, 0, 2360DEFUN ("/=", Fneq, Sneq, 2, 2, 0,
2351 doc: /* Return t if first arg is not equal to second arg. Both must be numbers or markers. */) 2361 doc: /* Return t if first arg is not equal to second arg. Both must be numbers or markers. */)
2352 (register Lisp_Object num1, Lisp_Object num2) 2362 (register Lisp_Object num1, Lisp_Object num2)
2353{ 2363{
2354 return arithcompare (num1, num2, notequal); 2364 return arithcompare (num1, num2, ARITH_NOTEQUAL);
2355} 2365}
2356 2366
2357DEFUN ("zerop", Fzerop, Szerop, 1, 1, 0, 2367DEFUN ("zerop", Fzerop, Szerop, 1, 1, 0,
diff --git a/src/fileio.c b/src/fileio.c
index 0e6113f349d..1a2bdfa237c 100644
--- a/src/fileio.c
+++ b/src/fileio.c
@@ -5121,7 +5121,8 @@ DEFUN ("car-less-than-car", Fcar_less_than_car, Scar_less_than_car, 2, 2, 0,
5121 doc: /* Return t if (car A) is numerically less than (car B). */) 5121 doc: /* Return t if (car A) is numerically less than (car B). */)
5122 (Lisp_Object a, Lisp_Object b) 5122 (Lisp_Object a, Lisp_Object b)
5123{ 5123{
5124 return Flss (Fcar (a), Fcar (b)); 5124 Lisp_Object args[2] = { Fcar (a), Fcar (b), };
5125 return Flss (2, args);
5125} 5126}
5126 5127
5127/* Build the complete list of annotations appropriate for writing out 5128/* Build the complete list of annotations appropriate for writing out
diff --git a/src/keyboard.c b/src/keyboard.c
index 5996986bfb4..5b49d79fd6e 100644
--- a/src/keyboard.c
+++ b/src/keyboard.c
@@ -2599,10 +2599,8 @@ read_char (int commandflag, Lisp_Object map,
2599 2599
2600 if (/* There currently is something in the echo area. */ 2600 if (/* There currently is something in the echo area. */
2601 !NILP (echo_area_buffer[0]) 2601 !NILP (echo_area_buffer[0])
2602 && (/* And it's either not from echoing. */ 2602 && (/* It's an echo from a different kboard. */
2603 !EQ (echo_area_buffer[0], echo_message_buffer) 2603 echo_kboard != current_kboard
2604 /* Or it's an echo from a different kboard. */
2605 || echo_kboard != current_kboard
2606 /* Or we explicitly allow overwriting whatever there is. */ 2604 /* Or we explicitly allow overwriting whatever there is. */
2607 || ok_to_echo_at_next_pause == NULL)) 2605 || ok_to_echo_at_next_pause == NULL))
2608 cancel_echoing (); 2606 cancel_echoing ();
diff --git a/src/lisp.h b/src/lisp.h
index dce1b17146b..2263a8cebef 100644
--- a/src/lisp.h
+++ b/src/lisp.h
@@ -3165,6 +3165,16 @@ EXFUN (Fbyteorder, 0) ATTRIBUTE_CONST;
3165/* Defined in data.c. */ 3165/* Defined in data.c. */
3166extern Lisp_Object indirect_function (Lisp_Object); 3166extern Lisp_Object indirect_function (Lisp_Object);
3167extern Lisp_Object find_symbol_value (Lisp_Object); 3167extern Lisp_Object find_symbol_value (Lisp_Object);
3168enum Arith_Comparison {
3169 ARITH_EQUAL,
3170 ARITH_NOTEQUAL,
3171 ARITH_LESS,
3172 ARITH_GRTR,
3173 ARITH_LESS_OR_EQUAL,
3174 ARITH_GRTR_OR_EQUAL
3175};
3176extern Lisp_Object arithcompare (Lisp_Object num1, Lisp_Object num2,
3177 enum Arith_Comparison comparison);
3168 3178
3169/* Convert the integer I to an Emacs representation, either the integer 3179/* Convert the integer I to an Emacs representation, either the integer
3170 itself, or a cons of two or three integers, or if all else fails a float. 3180 itself, or a cons of two or three integers, or if all else fails a float.
diff --git a/test/automated/data-tests.el b/test/automated/data-tests.el
new file mode 100644
index 00000000000..2298fa3fe71
--- /dev/null
+++ b/test/automated/data-tests.el
@@ -0,0 +1,75 @@
1;;; data-tests.el --- tests for src/data.c
2
3;; Copyright (C) 2013 Free Software Foundation, Inc.
4
5;; This file is part of GNU Emacs.
6
7;; This program is free software: you can redistribute it and/or
8;; modify it under the terms of the GNU General Public License as
9;; published by the Free Software Foundation, either version 3 of the
10;; License, or (at your option) any later version.
11;;
12;; This program is distributed in the hope that it will be useful, but
13;; WITHOUT ANY WARRANTY; without even the implied warranty of
14;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15;; General Public License for more details.
16;;
17;; You should have received a copy of the GNU General Public License
18;; along with this program. If not, see `http://www.gnu.org/licenses/'.
19
20;;; Commentary:
21
22;;; Code:
23
24(ert-deftest data-tests-= ()
25 (should-error (=))
26 (should (= 1))
27 (should (= 2 2))
28 (should (= 9 9 9 9 9 9 9 9 9))
29 (should-not (apply #'= '(3 8 3)))
30 (should-error (= 9 9 'foo))
31 ;; Short circuits before getting to bad arg
32 (should-not (= 9 8 'foo)))
33
34(ert-deftest data-tests-< ()
35 (should-error (<))
36 (should (< 1))
37 (should (< 2 3))
38 (should (< -6 -1 0 2 3 4 8 9 999))
39 (should-not (apply #'< '(3 8 3)))
40 (should-error (< 9 10 'foo))
41 ;; Short circuits before getting to bad arg
42 (should-not (< 9 8 'foo)))
43
44(ert-deftest data-tests-> ()
45 (should-error (>))
46 (should (> 1))
47 (should (> 3 2))
48 (should (> 6 1 0 -2 -3 -4 -8 -9 -999))
49 (should-not (apply #'> '(3 8 3)))
50 (should-error (> 9 8 'foo))
51 ;; Short circuits before getting to bad arg
52 (should-not (> 8 9 'foo)))
53
54(ert-deftest data-tests-<= ()
55 (should-error (<=))
56 (should (<= 1))
57 (should (<= 2 3))
58 (should (<= -6 -1 -1 0 0 0 2 3 4 8 999))
59 (should-not (apply #'<= '(3 8 3 3)))
60 (should-error (<= 9 10 'foo))
61 ;; Short circuits before getting to bad arg
62 (should-not (<= 9 8 'foo)))
63
64(ert-deftest data-tests->= ()
65 (should-error (>=))
66 (should (>= 1))
67 (should (>= 3 2))
68 (should (>= 666 1 0 0 -2 -3 -3 -3 -4 -8 -8 -9 -999))
69 (should-not (apply #'>= '(3 8 3)))
70 (should-error (>= 9 8 'foo))
71 ;; Short circuits before getting to bad arg
72 (should-not (>= 8 9 'foo)))
73
74;;; data-tests.el ends here
75