Now on revision 114202. ------------------------------------------------------------ revno: 114202 committer: Glenn Morris branch nick: trunk timestamp: Tue 2013-09-10 23:44:35 -0700 message: Improve previous interpreter-mode-alist change * lisp/files.el (interpreter-mode-alist): Remove \\` \\' parts. (set-auto-mode): Don't regexp-quote elements. * lisp/progmodes/python.el (interpreter-mode-alist): Remove \\` \\'. * lisp/progmodes/cc-mode.el (interpreter-mode-alist): * lisp/progmodes/ruby-mode.el (interpreter-mode-alist): Revert previous change. * etc/NEWS: Update. diff: === modified file 'etc/NEWS' --- etc/NEWS 2013-09-11 05:03:23 +0000 +++ etc/NEWS 2013-09-11 06:44:35 +0000 @@ -616,11 +616,9 @@ in the presence of files with negative time stamps. ** The cars of the elements in `interpreter-mode-alist' are now treated -as regexps rather than literal strings. For the time being, any -element whose car does not start with "\\" is still treated as a -literal string, so this change should not cause any incompatibilities -if you have code that just adds elements to the list, only if you are -actually using interpreter-mode-alist for something. +as regexps rather than literal strings. Technically this is an +incompatible change, but unless you are using interpreter-mode-alist +for something (not just adding elements to it), it ought not to affect you. * Lisp Changes in Emacs 24.4 === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2013-09-11 03:31:56 +0000 +++ lisp/ChangeLog 2013-09-11 06:44:35 +0000 @@ -1,3 +1,12 @@ +2013-09-11 Glenn Morris + + * files.el (interpreter-mode-alist): Remove \\` \\' parts. + (set-auto-mode): Don't regexp-quote elements. + * progmodes/python.el (interpreter-mode-alist): Remove \\` \\'. + * progmodes/cc-mode.el (interpreter-mode-alist): + * progmodes/ruby-mode.el (interpreter-mode-alist): + Revert previous change. + 2013-09-11 Stefan Monnier * play/snake.el (snake-mode): === modified file 'lisp/files.el' --- lisp/files.el 2013-09-10 20:38:52 +0000 +++ lisp/files.el 2013-09-11 06:44:35 +0000 @@ -2447,43 +2447,34 @@ (mapcar (lambda (l) (cons (purecopy (car l)) (cdr l))) - '(("\\`\\(mini\\)?perl5?\\'" . perl-mode) - ("\\`wishx?\\'" . tcl-mode) - ("\\`tcl\\(sh\\)?\\'" . tcl-mode) - ("\\`expect\\'" . tcl-mode) - ("\\`scm\\'" . scheme-mode) - ("\\`[acjkwz]sh\\'" . sh-mode) - ("\\`bash2?\\'" . sh-mode) - ("\\`dtksh\\'" . sh-mode) - ("\\`es\\'" . sh-mode) - ("\\`itcsh\\'" . sh-mode) - ("\\`oash\\'" . sh-mode) - ("\\`pdksh\\'" . sh-mode) - ("\\`rbash\\'" . sh-mode) - ("\\`rc\\'" . sh-mode) - ("\\`rpm\\'" . sh-mode) - ("\\`sh5?\\'" . sh-mode) - ("\\`tcsh\\'" . sh-mode) - ("\\`wksh\\'" . sh-mode) - ("\\`tail\\'" . text-mode) - ("\\`more\\'" . text-mode) - ("\\`less\\'" . text-mode) - ("\\`pg\\'" . text-mode) - ("\\`make\\'" . makefile-gmake-mode) ; Debian uses this - ("\\`guile\\'" . scheme-mode) - ("\\`clisp\\'" . lisp-mode) - ("\\`emacs\\'" . emacs-lisp-mode))) + '(("\\(mini\\)?perl5?" . perl-mode) + ("wishx?" . tcl-mode) + ("tcl\\(sh\\)?" . tcl-mode) + ("expect" . tcl-mode) + ("scm" . scheme-mode) + ("[acjkwz]sh" . sh-mode) + ("r?bash2?" . sh-mode) + ("\\(dt\\|pd\\|w\\)ksh" . sh-mode) + ("es" . sh-mode) + ("i?tcsh" . sh-mode) + ("oash" . sh-mode) + ("rc" . sh-mode) + ("rpm" . sh-mode) + ("sh5?" . sh-mode) + ("tail" . text-mode) + ("more" . text-mode) + ("less" . text-mode) + ("pg" . text-mode) + ("make" . makefile-gmake-mode) ; Debian uses this + ("guile" . scheme-mode) + ("clisp" . lisp-mode) + ("emacs" . emacs-lisp-mode))) "Alist mapping interpreter names to major modes. This is used for files whose first lines match `auto-mode-interpreter-regexp'. Each element looks like (REGEXP . MODE). -If REGEXP matches the name (minus any directory part) of the interpreter -specified in the first line of a script, enable major mode MODE. - -Emacs versions earlier than 24.4 treat the car of each element as a -literal string that must match the entire name, rather than a regexp. -For backwards compatibility, any REGEXP that does not begin with \"\\\\\" -continues to be treated in this way. This behavior may be removed in -future and should not be relied upon. +If \\\\`REGEXP\\\\' matches the name (minus any directory part) of +the interpreter specified in the first line of a script, enable +major mode MODE. See also `auto-mode-alist'.") @@ -2687,13 +2678,11 @@ ;; same time. (setq done (assoc-default (file-name-nondirectory mode) - ;; Backwards compat: if car of i-m-alist does not start - ;; with "\\", treat as literal string. (mapcar (lambda (e) - (if (string-match-p "\\`\\\\" (car e)) + (if (string-match-p "\\`\\\\`" (car e)) e (cons - (format "\\`%s\\'" (regexp-quote (car e))) + (format "\\`%s\\'" (car e)) (cdr e)))) interpreter-mode-alist) #'string-match-p)) === modified file 'lisp/progmodes/cc-mode.el' --- lisp/progmodes/cc-mode.el 2013-09-10 20:38:52 +0000 +++ lisp/progmodes/cc-mode.el 2013-09-11 06:44:35 +0000 @@ -1555,7 +1555,7 @@ (cons "Pike" (c-lang-const c-mode-menu pike))) ;;;###autoload (add-to-list 'auto-mode-alist '("\\.\\(u?lpc\\|pike\\|pmod\\(\\.in\\)?\\)\\'" . pike-mode)) -;;;###autoload (add-to-list 'interpreter-mode-alist '("\\`pike\\'" . pike-mode)) +;;;###autoload (add-to-list 'interpreter-mode-alist '("pike" . pike-mode)) ;;;###autoload (define-derived-mode pike-mode prog-mode "Pike" @@ -1589,7 +1589,10 @@ ;; Support for AWK ;;;###autoload (add-to-list 'auto-mode-alist '("\\.awk\\'" . awk-mode)) -;;;###autoload (add-to-list 'interpreter-mode-alist '("\\`[gmn]?awk\\'" . awk-mode)) +;;;###autoload (add-to-list 'interpreter-mode-alist '("awk" . awk-mode)) +;;;###autoload (add-to-list 'interpreter-mode-alist '("mawk" . awk-mode)) +;;;###autoload (add-to-list 'interpreter-mode-alist '("nawk" . awk-mode)) +;;;###autoload (add-to-list 'interpreter-mode-alist '("gawk" . awk-mode)) (c-define-abbrev-table 'awk-mode-abbrev-table '(("else" "else" c-electric-continued-statement 0) === modified file 'lisp/progmodes/python.el' --- lisp/progmodes/python.el 2013-09-10 20:46:25 +0000 +++ lisp/progmodes/python.el 2013-09-11 06:44:35 +0000 @@ -225,7 +225,7 @@ ;;;###autoload (add-to-list 'auto-mode-alist (cons (purecopy "\\.py\\'") 'python-mode)) ;;;###autoload -(add-to-list 'interpreter-mode-alist (cons (purecopy "\\`python[0-9.]*\\'") 'python-mode)) +(add-to-list 'interpreter-mode-alist (cons (purecopy "python[0-9.]*") 'python-mode)) (defgroup python nil "Python Language's flying circus support for Emacs." === modified file 'lisp/progmodes/ruby-mode.el' --- lisp/progmodes/ruby-mode.el 2013-09-10 20:38:52 +0000 +++ lisp/progmodes/ruby-mode.el 2013-09-11 06:44:35 +0000 @@ -1968,7 +1968,8 @@ "\\)\\'")) 'ruby-mode)) ;;;###autoload -(add-to-list 'interpreter-mode-alist (cons (purecopy "\\`\\(rbx\\|j?ruby\\(1\\.[89]\\)?\\)\\'") 'ruby-mode)) +(dolist (name (list "ruby" "rbx" "jruby" "ruby1.9" "ruby1.8")) + (add-to-list 'interpreter-mode-alist (cons (purecopy name) 'ruby-mode))) (provide 'ruby-mode) ------------------------------------------------------------ revno: 114201 committer: Glenn Morris branch nick: trunk timestamp: Tue 2013-09-10 23:33:28 -0700 message: Comment formatting diff: === modified file 'lisp/progmodes/cperl-mode.el' --- lisp/progmodes/cperl-mode.el 2013-09-10 20:38:52 +0000 +++ lisp/progmodes/cperl-mode.el 2013-09-11 06:33:28 +0000 @@ -412,15 +412,15 @@ "use cperl-vc-rcs-header or cperl-vc-sccs-header instead." "22.1") -;;; (defcustom cperl-clobber-mode-lists -;;; (not -;;; (and -;;; (boundp 'interpreter-mode-alist) -;;; (assoc "miniperl" interpreter-mode-alist) -;;; (assoc "\\.\\([pP][Llm]\\|al\\)$" auto-mode-alist))) -;;; "*Whether to install us into `interpreter-' and `extension' mode lists." -;;; :type 'boolean -;;; :group 'cperl) +;; (defcustom cperl-clobber-mode-lists +;; (not +;; (and +;; (boundp 'interpreter-mode-alist) +;; (assoc "miniperl" interpreter-mode-alist) +;; (assoc "\\.\\([pP][Llm]\\|al\\)$" auto-mode-alist))) +;; "*Whether to install us into `interpreter-' and `extension' mode lists." +;; :type 'boolean +;; :group 'cperl) (defcustom cperl-info-on-command-no-prompt nil "*Not-nil (and non-null) means not to prompt on C-h f. ------------------------------------------------------------ revno: 114200 committer: Barry O'Reilly branch nick: trunk timestamp: Wed 2013-09-11 01:03:23 -0400 message: Change comparison functions =, <, >, <=, >= to take many arguments. * src/data.c: Change comparison functions' interface and implementation * src/lisp.h: Make arithcompare available for efficient two arg comparisons * src/bytecode.c: Use arithcompare * src/fileio.c: Use new interface * test/automated/data-tests.el: New tests for comparison functions * etc/NEWS diff: === modified file 'etc/NEWS' --- etc/NEWS 2013-09-10 20:38:52 +0000 +++ etc/NEWS 2013-09-11 05:03:23 +0000 @@ -625,6 +625,8 @@ * Lisp Changes in Emacs 24.4 +** Comparison functions =, <, >, <=, >= now take many arguments. + ** The second argument of `eval' can now be a lexical-environment. ** `with-demoted-errors' takes an additional argument `format'. === modified file 'src/bytecode.c' --- src/bytecode.c 2013-07-16 21:35:45 +0000 +++ src/bytecode.c 2013-09-11 05:03:23 +0000 @@ -1367,7 +1367,7 @@ Lisp_Object v1; BEFORE_POTENTIAL_GC (); v1 = POP; - TOP = Fgtr (TOP, v1); + TOP = arithcompare (TOP, v1, ARITH_GRTR); AFTER_POTENTIAL_GC (); NEXT; } @@ -1377,7 +1377,7 @@ Lisp_Object v1; BEFORE_POTENTIAL_GC (); v1 = POP; - TOP = Flss (TOP, v1); + TOP = arithcompare (TOP, v1, ARITH_LESS); AFTER_POTENTIAL_GC (); NEXT; } @@ -1387,7 +1387,7 @@ Lisp_Object v1; BEFORE_POTENTIAL_GC (); v1 = POP; - TOP = Fleq (TOP, v1); + TOP = arithcompare (TOP, v1, ARITH_LESS_OR_EQUAL); AFTER_POTENTIAL_GC (); NEXT; } @@ -1397,7 +1397,7 @@ Lisp_Object v1; BEFORE_POTENTIAL_GC (); v1 = POP; - TOP = Fgeq (TOP, v1); + TOP = arithcompare (TOP, v1, ARITH_GRTR_OR_EQUAL); AFTER_POTENTIAL_GC (); NEXT; } === modified file 'src/data.c' --- src/data.c 2013-08-07 13:21:59 +0000 +++ src/data.c 2013-09-11 05:03:23 +0000 @@ -2255,10 +2255,8 @@ /* Arithmetic functions */ -enum comparison { equal, notequal, less, grtr, less_or_equal, grtr_or_equal }; - -static Lisp_Object -arithcompare (Lisp_Object num1, Lisp_Object num2, enum comparison comparison) +Lisp_Object +arithcompare (Lisp_Object num1, Lisp_Object num2, enum Arith_Comparison comparison) { double f1 = 0, f2 = 0; bool floatp = 0; @@ -2275,32 +2273,32 @@ switch (comparison) { - case equal: + case ARITH_EQUAL: if (floatp ? f1 == f2 : XINT (num1) == XINT (num2)) return Qt; return Qnil; - case notequal: + case ARITH_NOTEQUAL: if (floatp ? f1 != f2 : XINT (num1) != XINT (num2)) return Qt; return Qnil; - case less: + case ARITH_LESS: if (floatp ? f1 < f2 : XINT (num1) < XINT (num2)) return Qt; return Qnil; - case less_or_equal: + case ARITH_LESS_OR_EQUAL: if (floatp ? f1 <= f2 : XINT (num1) <= XINT (num2)) return Qt; return Qnil; - case grtr: + case ARITH_GRTR: if (floatp ? f1 > f2 : XINT (num1) > XINT (num2)) return Qt; return Qnil; - case grtr_or_equal: + case ARITH_GRTR_OR_EQUAL: if (floatp ? f1 >= f2 : XINT (num1) >= XINT (num2)) return Qt; return Qnil; @@ -2310,48 +2308,60 @@ } } -DEFUN ("=", Feqlsign, Seqlsign, 2, 2, 0, - doc: /* Return t if two args, both numbers or markers, are equal. */) - (register Lisp_Object num1, Lisp_Object num2) -{ - return arithcompare (num1, num2, equal); -} - -DEFUN ("<", Flss, Slss, 2, 2, 0, - doc: /* Return t if first arg is less than second arg. Both must be numbers or markers. */) - (register Lisp_Object num1, Lisp_Object num2) -{ - return arithcompare (num1, num2, less); -} - -DEFUN (">", Fgtr, Sgtr, 2, 2, 0, - doc: /* Return t if first arg is greater than second arg. Both must be numbers or markers. */) - (register Lisp_Object num1, Lisp_Object num2) -{ - return arithcompare (num1, num2, grtr); -} - -DEFUN ("<=", Fleq, Sleq, 2, 2, 0, - doc: /* Return t if first arg is less than or equal to second arg. -Both must be numbers or markers. */) - (register Lisp_Object num1, Lisp_Object num2) -{ - return arithcompare (num1, num2, less_or_equal); -} - -DEFUN (">=", Fgeq, Sgeq, 2, 2, 0, - doc: /* Return t if first arg is greater than or equal to second arg. -Both must be numbers or markers. */) - (register Lisp_Object num1, Lisp_Object num2) -{ - return arithcompare (num1, num2, grtr_or_equal); +static Lisp_Object +arithcompare_driver (ptrdiff_t nargs, Lisp_Object *args, + enum Arith_Comparison comparison) +{ + for (ptrdiff_t argnum = 1; argnum < nargs; ++argnum) + { + if (EQ (Qnil, arithcompare (args[argnum-1], args[argnum], comparison))) + return Qnil; + } + return Qt; +} + +DEFUN ("=", Feqlsign, Seqlsign, 1, MANY, 0, + doc: /* Return t if args, all numbers or markers, are equal. */) + (ptrdiff_t nargs, Lisp_Object *args) +{ + return arithcompare_driver (nargs, args, ARITH_EQUAL); +} + +DEFUN ("<", Flss, Slss, 1, MANY, 0, + doc: /* Return t if each arg is less than the next arg. All must be numbers or markers. */) + (ptrdiff_t nargs, Lisp_Object *args) +{ + return arithcompare_driver (nargs, args, ARITH_LESS); +} + +DEFUN (">", Fgtr, Sgtr, 1, MANY, 0, + doc: /* Return t if each arg is greater than the next arg. All must be numbers or markers. */) + (ptrdiff_t nargs, Lisp_Object *args) +{ + return arithcompare_driver (nargs, args, ARITH_GRTR); +} + +DEFUN ("<=", Fleq, Sleq, 1, MANY, 0, + doc: /* Return t if each arg is less than or equal to the next arg. +All must be numbers or markers. */) + (ptrdiff_t nargs, Lisp_Object *args) +{ + return arithcompare_driver (nargs, args, ARITH_LESS_OR_EQUAL); +} + +DEFUN (">=", Fgeq, Sgeq, 1, MANY, 0, + doc: /* Return t if each arg is greater than or equal to the next arg. +All must be numbers or markers. */) + (ptrdiff_t nargs, Lisp_Object *args) +{ + return arithcompare_driver (nargs, args, ARITH_GRTR_OR_EQUAL); } DEFUN ("/=", Fneq, Sneq, 2, 2, 0, doc: /* Return t if first arg is not equal to second arg. Both must be numbers or markers. */) (register Lisp_Object num1, Lisp_Object num2) { - return arithcompare (num1, num2, notequal); + return arithcompare (num1, num2, ARITH_NOTEQUAL); } DEFUN ("zerop", Fzerop, Szerop, 1, 1, 0, === modified file 'src/fileio.c' --- src/fileio.c 2013-09-03 14:40:09 +0000 +++ src/fileio.c 2013-09-11 05:03:23 +0000 @@ -5121,7 +5121,8 @@ doc: /* Return t if (car A) is numerically less than (car B). */) (Lisp_Object a, Lisp_Object b) { - return Flss (Fcar (a), Fcar (b)); + Lisp_Object args[2] = { Fcar (a), Fcar (b), }; + return Flss (2, args); } /* Build the complete list of annotations appropriate for writing out === modified file 'src/lisp.h' --- src/lisp.h 2013-09-06 16:40:12 +0000 +++ src/lisp.h 2013-09-11 05:03:23 +0000 @@ -3160,6 +3160,16 @@ /* Defined in data.c. */ extern Lisp_Object indirect_function (Lisp_Object); extern Lisp_Object find_symbol_value (Lisp_Object); +enum Arith_Comparison { + ARITH_EQUAL, + ARITH_NOTEQUAL, + ARITH_LESS, + ARITH_GRTR, + ARITH_LESS_OR_EQUAL, + ARITH_GRTR_OR_EQUAL +}; +extern Lisp_Object arithcompare (Lisp_Object num1, Lisp_Object num2, + enum Arith_Comparison comparison); /* Convert the integer I to an Emacs representation, either the integer itself, or a cons of two or three integers, or if all else fails a float. === added file 'test/automated/data-tests.el' --- test/automated/data-tests.el 1970-01-01 00:00:00 +0000 +++ test/automated/data-tests.el 2013-09-11 05:03:23 +0000 @@ -0,0 +1,75 @@ +;;; data-tests.el --- tests for src/data.c + +;; Copyright (C) 2013 Free Software Foundation, Inc. + +;; This file is part of GNU Emacs. + +;; This program is free software: you can redistribute it and/or +;; modify it under the terms of the GNU General Public License as +;; published by the Free Software Foundation, either version 3 of the +;; License, or (at your option) any later version. +;; +;; This program is distributed in the hope that it will be useful, but +;; WITHOUT ANY WARRANTY; without even the implied warranty of +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +;; General Public License for more details. +;; +;; You should have received a copy of the GNU General Public License +;; along with this program. If not, see `http://www.gnu.org/licenses/'. + +;;; Commentary: + +;;; Code: + +(ert-deftest data-tests-= () + (should-error (=)) + (should (= 1)) + (should (= 2 2)) + (should (= 9 9 9 9 9 9 9 9 9)) + (should-not (apply #'= '(3 8 3))) + (should-error (= 9 9 'foo)) + ;; Short circuits before getting to bad arg + (should-not (= 9 8 'foo))) + +(ert-deftest data-tests-< () + (should-error (<)) + (should (< 1)) + (should (< 2 3)) + (should (< -6 -1 0 2 3 4 8 9 999)) + (should-not (apply #'< '(3 8 3))) + (should-error (< 9 10 'foo)) + ;; Short circuits before getting to bad arg + (should-not (< 9 8 'foo))) + +(ert-deftest data-tests-> () + (should-error (>)) + (should (> 1)) + (should (> 3 2)) + (should (> 6 1 0 -2 -3 -4 -8 -9 -999)) + (should-not (apply #'> '(3 8 3))) + (should-error (> 9 8 'foo)) + ;; Short circuits before getting to bad arg + (should-not (> 8 9 'foo))) + +(ert-deftest data-tests-<= () + (should-error (<=)) + (should (<= 1)) + (should (<= 2 3)) + (should (<= -6 -1 -1 0 0 0 2 3 4 8 999)) + (should-not (apply #'<= '(3 8 3 3))) + (should-error (<= 9 10 'foo)) + ;; Short circuits before getting to bad arg + (should-not (<= 9 8 'foo))) + +(ert-deftest data-tests->= () + (should-error (>=)) + (should (>= 1)) + (should (>= 3 2)) + (should (>= 666 1 0 0 -2 -3 -3 -3 -4 -8 -8 -9 -999)) + (should-not (apply #'>= '(3 8 3))) + (should-error (>= 9 8 'foo)) + ;; Short circuits before getting to bad arg + (should-not (>= 8 9 'foo))) + +;;; data-tests.el ends here + ------------------------------------------------------------ revno: 114199 committer: Stefan Monnier branch nick: trunk timestamp: Tue 2013-09-10 23:31:56 -0400 message: Use define-derived-mode (and derived-mode-p). * lisp/play/snake.el (snake-mode): * lisp/play/mpuz.el (mpuz-mode): * lisp/play/landmark.el (lm-mode): * lisp/play/blackbox.el (blackbox-mode): * lisp/play/5x5.el (5x5-mode): * lisp/obsolete/options.el (Edit-options-mode): * lisp/net/quickurl.el (quickurl-list-mode): * lisp/net/newst-treeview.el (newsticker-treeview-mode): * lisp/mail/rmailsum.el (rmail-summary-mode): * lisp/mail/mspools.el (mspools-mode): * lisp/locate.el (locate-mode): * lisp/ibuffer.el (ibuffer-mode): * lisp/emulation/ws-mode.el (wordstar-mode): * lisp/emacs-lisp/debug.el (debugger-mode): * lisp/array.el (array-mode): * lisp/net/eudc.el (eudc-mode): Use define-derived-mode. * lisp/net/mairix.el (mairix-searches-mode-font-lock-keywords): Move initialization into declaration. (mairix-searches-mode): Use define-derived-mode. * lisp/net/eudc-hotlist.el (eudc-hotlist-mode): Use define-derived-mode. (eudc-edit-hotlist): Use dolist. * lisp/man.el (Man-mode-syntax-table): Rename from man-mode-syntax-table. (Man-mode): Use define-derived-mode. * lisp/info.el (Info-edit-mode-map): Rename from Info-edit-map. (Info-edit-mode): Use define-derived-mode. (Info-cease-edit): Use Info-mode. * lisp/eshell/esh-mode.el (eshell-mode-syntax-table): Move initialization into declaration. (eshell-mode): Use define-derived-mode. * lisp/chistory.el (command-history-mode-map): Rename from command-history-map. (command-history-mode): Use define-derived-mode. * lisp/calc/calc.el (calc-trail-mode-map): New var. (calc-trail-mode): Use define-derived-mode. (calc-trail-buffer): Set calc-main-buffer manually. * lisp/bookmark.el (bookmark-insert-annotation): New function. (bookmark-edit-annotation): Use it. (bookmark-edit-annotation-mode): Make it a proper major mode. (bookmark-send-edited-annotation): Use derived-mode-p. * lisp/arc-mode.el (archive-mode): Move kill-all-local-variables a tiny bit closer to its ideal place. Use \' to match EOS. * lisp/cedet/semantic/grammar.el (semantic-grammar-mode): Use define-derived-mode. (semantic-grammar-mode-syntax-table): Rename from semantic-grammar-syntax-table. (semantic-grammar-mode-map): Rename from semantic-grammar-map. * lisp/cedet/data-debug.el (data-debug-mode-map): Rename from data-debug-map. (data-debug-mode): Use define-derived-mode. * lisp/gnus/score-mode.el (gnus-score-mode-map): Move initialization into declaration. (gnus-score-mode): Use define-derived-mode. * lisp/gnus/gnus-srvr.el (gnus-browse-mode): Use define-derived-mode. * lisp/gnus/gnus-kill.el (gnus-kill-file-mode-map): Move initialization into declaration. (gnus-kill-file-mode): Use define-derived-mode. (gnus-kill-file-edit-file, gnus-kill-file-enter-kill, gnus-kill): Use derived-mode-p. * lisp/gnus/gnus-group.el (gnus-group-mode): Use define-derived-mode. (gnus-group-setup-buffer, gnus-group-name-at-point) (gnus-group-make-web-group, gnus-group-enter-directory) (gnus-group-suspend): Use derived-mode-p. * lisp/gnus/gnus-cus.el (gnus-custom-mode): Use define-derived-mode. * lisp/gnus/gnus-bookmark.el (gnus-bookmark-bmenu-mode): Use define-derived-mode. * lisp/gnus/gnus-art.el (gnus-article-mode): Use define-derived-mode. (gnus-article-setup-buffer, gnus-article-prepare) (gnus-article-prepare-display, gnus-sticky-article) (gnus-kill-sticky-article-buffer, gnus-kill-sticky-article-buffers) (gnus-bind-safe-url-regexp, gnus-article-check-buffer) (gnus-article-read-summary-keys): Use derived-mode-p. diff: === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2013-09-11 01:43:07 +0000 +++ lisp/ChangeLog 2013-09-11 03:31:56 +0000 @@ -1,5 +1,47 @@ 2013-09-11 Stefan Monnier + * play/snake.el (snake-mode): + * play/mpuz.el (mpuz-mode): + * play/landmark.el (lm-mode): + * play/blackbox.el (blackbox-mode): + * play/5x5.el (5x5-mode): + * obsolete/options.el (Edit-options-mode): + * net/quickurl.el (quickurl-list-mode): + * net/newst-treeview.el (newsticker-treeview-mode): + * mail/rmailsum.el (rmail-summary-mode): + * mail/mspools.el (mspools-mode): + * locate.el (locate-mode): + * ibuffer.el (ibuffer-mode): + * emulation/ws-mode.el (wordstar-mode): + * emacs-lisp/debug.el (debugger-mode): + * array.el (array-mode): + * net/eudc.el (eudc-mode): Use define-derived-mode. + * net/mairix.el (mairix-searches-mode-font-lock-keywords): + Move initialization into declaration. + (mairix-searches-mode): Use define-derived-mode. + * net/eudc-hotlist.el (eudc-hotlist-mode): Use define-derived-mode. + (eudc-edit-hotlist): Use dolist. + * man.el (Man-mode-syntax-table): Rename from man-mode-syntax-table. + (Man-mode): Use define-derived-mode. + * info.el (Info-edit-mode-map): Rename from Info-edit-map. + (Info-edit-mode): Use define-derived-mode. + (Info-cease-edit): Use Info-mode. + * eshell/esh-mode.el (eshell-mode-syntax-table): Move initialization + into declaration. + (eshell-mode): Use define-derived-mode. + * chistory.el (command-history-mode-map): Rename from + command-history-map. + (command-history-mode): Use define-derived-mode. + * calc/calc.el (calc-trail-mode-map): New var. + (calc-trail-mode): Use define-derived-mode. + (calc-trail-buffer): Set calc-main-buffer manually. + * bookmark.el (bookmark-insert-annotation): New function. + (bookmark-edit-annotation): Use it. + (bookmark-edit-annotation-mode): Make it a proper major mode. + (bookmark-send-edited-annotation): Use derived-mode-p. + * arc-mode.el (archive-mode): Move kill-all-local-variables a tiny bit + closer to its ideal place. Use \' to match EOS. + * profiler.el (profiler-calltree-find): Use function-equal. 2013-09-10 Glenn Morris === modified file 'lisp/arc-mode.el' --- lisp/arc-mode.el 2013-09-06 15:02:40 +0000 +++ lisp/arc-mode.el 2013-09-11 03:31:56 +0000 @@ -683,9 +683,9 @@ ;; At present we cannot create archives from scratch (funcall (or (default-value 'major-mode) 'fundamental-mode)) (if (and (not force) archive-files) nil + (kill-all-local-variables) (let* ((type (archive-find-type)) (typename (capitalize (symbol-name type)))) - (kill-all-local-variables) (make-local-variable 'archive-subtype) (setq archive-subtype type) @@ -761,7 +761,7 @@ ((looking-at "..-l[hz][0-9ds]-") 'lzh) ((looking-at "....................[\334]\247\304\375") 'zoo) ((and (looking-at "\C-z") ; signature too simple, IMHO - (string-match "\\.[aA][rR][cC]$" + (string-match "\\.[aA][rR][cC]\\'" (or buffer-file-name (buffer-name)))) 'arc) ;; This pattern modeled on the BSD/GNU+Linux `file' command. === modified file 'lisp/array.el' --- lisp/array.el 2013-01-01 09:11:05 +0000 +++ lisp/array.el 2013-09-11 03:31:56 +0000 @@ -800,7 +800,7 @@ (put 'array-mode 'mode-class 'special) ;;;###autoload -(defun array-mode () +(define-derived-mode array-mode fundamental-mode "Array" "Major mode for editing arrays. Array mode is a specialized mode for editing arrays. An array is @@ -863,9 +863,6 @@ \\[array-display-local-variables] Display the current values of local variables. Entering array mode calls the function `array-mode-hook'." - - (interactive) - (kill-all-local-variables) (make-local-variable 'array-buffer-line) (make-local-variable 'array-buffer-column) (make-local-variable 'array-row) @@ -888,13 +885,9 @@ (+ (floor (1- array-max-column) array-columns-per-line) (if array-rows-numbered 2 1))) (message "") - (setq major-mode 'array-mode) - (setq mode-name "Array") (force-mode-line-update) (set (make-local-variable 'truncate-lines) t) - (setq overwrite-mode 'overwrite-mode-textual) - (use-local-map array-mode-map) - (run-mode-hooks 'array-mode-hook)) + (setq overwrite-mode 'overwrite-mode-textual)) === modified file 'lisp/bookmark.el' --- lisp/bookmark.el 2013-08-09 21:22:44 +0000 +++ lisp/bookmark.el 2013-09-11 03:31:56 +0000 @@ -862,31 +862,25 @@ map) "Keymap for editing an annotation of a bookmark.") - -(defun bookmark-edit-annotation-mode (bookmark-name-or-record) - "Mode for editing the annotation of bookmark BOOKMARK-NAME-OR-RECORD. -When you have finished composing, type \\[bookmark-send-annotation]. - -\\{bookmark-edit-annotation-mode-map}" - (interactive) - (kill-all-local-variables) - (make-local-variable 'bookmark-annotation-name) - (setq bookmark-annotation-name bookmark-name-or-record) - (use-local-map bookmark-edit-annotation-mode-map) - (setq major-mode 'bookmark-edit-annotation-mode - mode-name "Edit Bookmark Annotation") +(defun bookmark-insert-annotation (bookmark-name-or-record) (insert (funcall bookmark-edit-annotation-text-func bookmark-name-or-record)) (let ((annotation (bookmark-get-annotation bookmark-name-or-record))) (if (and annotation (not (string-equal annotation ""))) - (insert annotation))) - (run-mode-hooks 'text-mode-hook)) + (insert annotation)))) + +(define-derived-mode bookmark-edit-annotation-mode + text-mode "Edit Bookmark Annotation" + "Mode for editing the annotation of bookmarks. +When you have finished composing, type \\[bookmark-send-annotation]. + +\\{bookmark-edit-annotation-mode-map}") (defun bookmark-send-edited-annotation () "Use buffer contents as annotation for a bookmark. Lines beginning with `#' are ignored." (interactive) - (if (not (eq major-mode 'bookmark-edit-annotation-mode)) + (if (not (derived-mode-p 'bookmark-edit-annotation-mode)) (error "Not in bookmark-edit-annotation-mode")) (goto-char (point-min)) (while (< (point) (point-max)) @@ -906,7 +900,10 @@ (defun bookmark-edit-annotation (bookmark-name-or-record) "Pop up a buffer for editing bookmark BOOKMARK-NAME-OR-RECORD's annotation." (pop-to-buffer (generate-new-buffer-name "*Bookmark Annotation Compose*")) - (bookmark-edit-annotation-mode bookmark-name-or-record)) + (bookmark-insert-annotation bookmark-name-or-record) + (bookmark-edit-annotation-mode) + (set (make-local-variable 'bookmark-annotation-name) + bookmark-name-or-record)) (defun bookmark-buffer-name () === modified file 'lisp/calc/calc.el' --- lisp/calc/calc.el 2013-08-09 21:22:44 +0000 +++ lisp/calc/calc.el 2013-09-11 03:31:56 +0000 @@ -1387,7 +1387,12 @@ (calc-check-defines)) (setplist 'calc-define nil))))) -(defun calc-trail-mode (&optional buf) +(defvar calc-trail-mode-map + (let ((map (make-sparse-keymap))) + (set-keymap-parent map calc-mode-map) + map)) + +(define-derived-mode calc-trail-mode fundamental-mode "Calc Trail" "Calc Trail mode. This mode is used by the *Calc Trail* buffer, which records all results obtained by the GNU Emacs Calculator. @@ -1397,26 +1402,18 @@ This buffer uses the same key map as the *Calculator* buffer; calculator commands given here will actually operate on the *Calculator* stack." - (interactive) - (fundamental-mode) - (use-local-map calc-mode-map) - (setq major-mode 'calc-trail-mode) - (setq mode-name "Calc Trail") (setq truncate-lines t) (setq buffer-read-only t) (make-local-variable 'overlay-arrow-position) (make-local-variable 'overlay-arrow-string) - (when buf - (set (make-local-variable 'calc-main-buffer) buf)) (when (= (buffer-size) 0) (let ((buffer-read-only nil)) - (insert (propertize "Emacs Calculator Trail\n" 'face 'italic)))) - (run-mode-hooks 'calc-trail-mode-hook)) + (insert (propertize "Emacs Calculator Trail\n" 'face 'italic))))) (defun calc-create-buffer () "Create and initialize a buffer for the Calculator." (set-buffer (get-buffer-create "*Calculator*")) - (or (eq major-mode 'calc-mode) + (or (derived-mode-p 'calc-mode) (calc-mode)) (setq max-lisp-eval-depth (max max-lisp-eval-depth 1000)) (when calc-always-load-extensions @@ -1439,7 +1436,7 @@ (when (get-buffer-window "*Calc Keypad*") (calc-keypad) (set-buffer (window-buffer))) - (if (eq major-mode 'calc-mode) + (if (derived-mode-p 'calc-mode) (calc-quit) (let ((oldbuf (current-buffer))) (calc-create-buffer) @@ -1490,7 +1487,7 @@ (if (and (equal (buffer-name) "*Gnuplot Trail*") (> (recursion-depth) 0)) (exit-recursive-edit) - (if (eq major-mode 'calc-edit-mode) + (if (derived-mode-p 'calc-edit-mode) (calc-edit-finish arg) (if calc-was-keypad-mode (calc-keypad) @@ -1504,13 +1501,13 @@ (if (and (equal (buffer-name) "*Gnuplot Trail*") (> (recursion-depth) 0)) (exit-recursive-edit)) - (if (eq major-mode 'calc-edit-mode) + (if (derived-mode-p 'calc-edit-mode) (calc-edit-cancel) (if (and interactive calc-embedded-info (eq (current-buffer) (aref calc-embedded-info 0))) (calc-embedded nil) - (unless (eq major-mode 'calc-mode) + (unless (derived-mode-p 'calc-mode) (calc-create-buffer)) (run-hooks 'calc-end-hook) (if (integerp calc-undo-length) @@ -1631,10 +1628,10 @@ (if (math-lessp 1 time) (calc-record time "(t)")))) (or (memq 'no-align calc-command-flags) - (eq major-mode 'calc-trail-mode) + (derived-mode-p 'calc-trail-mode) (calc-align-stack-window)) (and (memq 'position-point calc-command-flags) - (if (eq major-mode 'calc-mode) + (if (derived-mode-p 'calc-mode) (progn (goto-char (point-min)) (forward-line (1- calc-final-point-line)) @@ -1664,7 +1661,7 @@ (setq calc-command-flags (cons f calc-command-flags)))) (defun calc-select-buffer () - (or (eq major-mode 'calc-mode) + (or (derived-mode-p 'calc-mode) (if calc-main-buffer (set-buffer calc-main-buffer) (let ((buf (get-buffer "*Calculator*"))) @@ -1801,7 +1798,7 @@ (and calc-embedded-info (calc-embedded-mode-line-change)))))) (defun calc-align-stack-window () - (if (eq major-mode 'calc-mode) + (if (derived-mode-p 'calc-mode) (progn (let ((win (get-buffer-window (current-buffer)))) (if win @@ -1988,7 +1985,7 @@ (defvar calc-any-evaltos nil) (defun calc-refresh (&optional align) (interactive) - (and (eq major-mode 'calc-mode) + (and (derived-mode-p 'calc-mode) (not calc-executing-macro) (let* ((buffer-read-only nil) (save-point (point)) @@ -2016,7 +2013,7 @@ (calc-align-stack-window) (goto-char save-point)) (if save-mark (set-mark save-mark)))) - (and calc-embedded-info (not (eq major-mode 'calc-mode)) + (and calc-embedded-info (not (derived-mode-p 'calc-mode)) (with-current-buffer (aref calc-embedded-info 1) (calc-refresh align))) (setq calc-refresh-count (1+ calc-refresh-count))) @@ -2078,12 +2075,13 @@ (null (buffer-name calc-trail-buffer))) (save-excursion (setq calc-trail-buffer (get-buffer-create "*Calc Trail*")) - (let ((buf (or (and (not (eq major-mode 'calc-mode)) + (let ((buf (or (and (not (derived-mode-p 'calc-mode)) (get-buffer "*Calculator*")) (current-buffer)))) (set-buffer calc-trail-buffer) - (or (eq major-mode 'calc-trail-mode) - (calc-trail-mode buf))))) + (unless (derived-mode-p 'calc-trail-mode) + (calc-trail-mode) + (set (make-local-variable 'calc-main-buffer) buf))))) (or (and calc-trail-pointer (eq (marker-buffer calc-trail-pointer) calc-trail-buffer)) (with-current-buffer calc-trail-buffer @@ -2152,7 +2150,7 @@ (defun calc-trail-here () (interactive) - (if (eq major-mode 'calc-trail-mode) + (if (derived-mode-p 'calc-trail-mode) (progn (beginning-of-line) (if (bobp) === modified file 'lisp/cedet/ChangeLog' --- lisp/cedet/ChangeLog 2013-09-05 00:22:45 +0000 +++ lisp/cedet/ChangeLog 2013-09-11 03:31:56 +0000 @@ -1,3 +1,12 @@ +2013-09-11 Stefan Monnier + + * semantic/grammar.el (semantic-grammar-mode): Use define-derived-mode. + (semantic-grammar-mode-syntax-table): Rename from + semantic-grammar-syntax-table. + (semantic-grammar-mode-map): Rename from semantic-grammar-map. + * data-debug.el (data-debug-mode-map): Rename from data-debug-map. + (data-debug-mode): Use define-derived-mode. + 2013-09-05 Glenn Morris * semantic/fw.el (semantic-make-local-hook): @@ -15,15 +24,15 @@ * semantic/decorate/mode.el (semantic-decoration-on-includes-p-default) - (semantic-decoration-on-includes-highlight-default): Declare for + (semantic-decoration-on-includes-highlight-default): Declare for byte compiler. * semantic/wisent/python.el (semantic/format): New require. 2013-07-27 Eric Ludlam - * lisp/cedet/semantic/edit.el (semantic-edits-splice-remove): Wrap - debug message removing middle tag in semantic-edits-verbose-flag + * lisp/cedet/semantic/edit.el (semantic-edits-splice-remove): + Wrap debug message removing middle tag in semantic-edits-verbose-flag check. 2013-07-27 David Engster @@ -69,8 +78,8 @@ `semantic/decorate/include' anymore. (semantic-toggle-decoration-style): Error if an unknown decoration style is toggled. - (define-semantic-decoration-style): Add new :load option. When - :load is specified, add autoload tokens for the definition + (define-semantic-decoration-style): Add new :load option. + When :load is specified, add autoload tokens for the definition functions so that code is loaded when the mode is used. (semantic-decoration-on-includes): New autoload definition for highlighting includes. @@ -94,8 +103,8 @@ * semantic/ctxt.el (semantic-ctxt-end-of-symbol): New. (semantic-ctxt-current-symbol-default): New. - * semantic/bovine/el.el (semantic-default-elisp-setup): Add - autoload cookie. Explain existence. + * semantic/bovine/el.el (semantic-default-elisp-setup): + Add autoload cookie. Explain existence. (footer): Add local variable for loaddefs. * semantic/db.el (semanticdb-file-table-object): Add new filter, @@ -120,7 +129,7 @@ * ede/cpp-root.el (ede-preprocessor-map): Protect against init problems. - * ede/proj.el (ede-proj-target): Added a new "custom" option for + * ede/proj.el (ede-proj-target): Add a new "custom" option for custom symbols representing a compiler or linker instead of restricting things to only the predefined compilers and linkers. @@ -198,15 +207,15 @@ 2013-04-27 David Engster * semantic/complete.el - (semantic-collector-calculate-completions-raw): If - `completionslist' is not set, refresh the cache if necessary and + (semantic-collector-calculate-completions-raw): + If `completionslist' is not set, refresh the cache if necessary and use it for completions. This fixes the `semantic-collector-buffer-deep' collector (bug#14265). 2013-03-26 Leo Liu - * semantic/senator.el (senator-copy-tag-to-register): Move - register handling logic from register.el. (Bug#14052) + * semantic/senator.el (senator-copy-tag-to-register): + Move register handling logic from register.el. (Bug#14052) 2013-03-21 Eric Ludlam @@ -223,17 +232,17 @@ * semantic/find.el (semantic-filter-tags-by-class): New function. - * semantic/tag-ls.el (semantic-tag-similar-p-default): Add - short-circuit in case tag1 and 2 are identical. + * semantic/tag-ls.el (semantic-tag-similar-p-default): + Add short-circuit in case tag1 and 2 are identical. * semantic/analyze/fcn.el - (semantic-analyze-dereference-metatype-stack): Use - `semantic-tag-similar-p' instead of 'eq' when comparing two tags + (semantic-analyze-dereference-metatype-stack): + Use `semantic-tag-similar-p' instead of 'eq' when comparing two tags during metatype evaluation in case they are the same, but not the same node. (Tweaked patch from Tomasz Gajewski) (Tiny change) - * semantic/db-find.el (semanticdb-partial-synchronize): Fix - require to semantic/db-typecache to be correct. + * semantic/db-find.el (semanticdb-partial-synchronize): + Fix require to semantic/db-typecache to be correct. (semanticdb-find-tags-external-children-of-type): Make this a brutish search by default. @@ -243,19 +252,19 @@ input tag as the place to start searching for externally defined methods. - * semantic/db-file.el (semanticdb-default-save-directory): Doc - fix: Add ref to default value. + * semantic/db-file.el (semanticdb-default-save-directory): + Doc fix: Add ref to default value. - * semantic/complete.el (semantic-complete-post-command-hook): When - detecting if cursor is outside completion area, do so if cursor + * semantic/complete.el (semantic-complete-post-command-hook): + When detecting if cursor is outside completion area, do so if cursor moves before start of overlay, or the original starting location of the overlay (i.e., if user deletes past beginning of the overlay region). (semantic-complete-inline-tag-engine): Initialize original start of `semantic-complete-inline-overlay'. - * semantic/bovine/c.el (semantic-c-describe-environment): Update - some section titles. Test semanticdb table before printing it. + * semantic/bovine/c.el (semantic-c-describe-environment): + Update some section titles. Test semanticdb table before printing it. (semantic-c-reset-preprocessor-symbol-map): Update `semantic-lex-spp-macro-symbol-obarray' outside the loop over all the files contributing to its value. @@ -271,8 +280,8 @@ * srecode/cpp.el (srecode-semantic-handle-:c): Replace all characters in FILENAME_SYMBOL that aren't valid CPP symbol chars. - * srecode/map.el (srecode-map-validate-file-for-mode): Force - semantic to load if it is not active in the template being added + * srecode/map.el (srecode-map-validate-file-for-mode): + Force semantic to load if it is not active in the template being added to the map. * srecode/srt.el: Add local variables for setting the autoload @@ -287,7 +296,7 @@ has both a version variable and a Version: comment, always use `call-next-method'. - * ede/cpp-root.el (ede-set-project-variables): Deleted. + * ede/cpp-root.el (ede-set-project-variables): Delete. `ede-preprocessor-map' does the job this function was attempting to do with :spp-table. (ede-preprocessor-map): Update file tests to provide better @@ -302,8 +311,8 @@ 2013-03-21 David Engster * semantic/bovine/c.el (semantic-get-local-variables): Also add a - new variable 'this' if we are in an inline member function. For - detecting this, we check overlays at point if there is a class + new variable 'this' if we are in an inline member function. + For detecting this, we check overlays at point if there is a class spanning the current function. Also, the variable 'this' has to be a pointer. @@ -350,14 +359,14 @@ 2013-03-21 Tomasz Gajewski (tiny change) - * ede/cpp-root.el (ede-project-autoload, initialize-instance): Fix - EDE file symbol to match rename. Fix ede-cpp-root symbol to + * ede/cpp-root.el (ede-project-autoload, initialize-instance): + Fix EDE file symbol to match rename. Fix ede-cpp-root symbol to include -project in name. 2013-03-21 Alex Ott - * cedet-files.el (cedet-files-list-recursively): New. Recursively - find files whose names are matching to given regex. + * cedet-files.el (cedet-files-list-recursively): New. + Recursively find files whose names are matching to given regex. * ede.el (ede-current-project): Rewrite to avoid imperative style. === modified file 'lisp/cedet/data-debug.el' --- lisp/cedet/data-debug.el 2013-06-25 16:13:49 +0000 +++ lisp/cedet/data-debug.el 2013-09-11 03:31:56 +0000 @@ -869,7 +869,8 @@ table) "Syntax table used in data-debug macro buffers.") -(defvar data-debug-map +(define-obsolete-variable-alias 'data-debug-map 'data-debug-mode-map "24.1") +(defvar data-debug-mode-map (let ((km (make-sparse-keymap))) (suppress-keymap km) (define-key km [mouse-2] 'data-debug-expand-or-contract-mouse) @@ -887,22 +888,15 @@ :group 'data-debug :type 'hook) -(defun data-debug-mode () +(define-derived-mode data-debug-mode fundamental-mode "DATA-DEBUG" "Major-mode for the Analyzer debugger. -\\{data-debug-map}" - (interactive) - (kill-all-local-variables) - (setq major-mode 'data-debug-mode - mode-name "DATA-DEBUG" - comment-start ";;" +\\{data-debug-mode-map}" + (setq comment-start ";;" comment-end "" buffer-read-only t) - (set (make-local-variable 'comment-start-skip) + (setq-local comment-start-skip "\\(\\(^\\|[^\\\\\n]\\)\\(\\\\\\\\\\)*\\);+ *") - (set-syntax-table data-debug-mode-syntax-table) - (use-local-map data-debug-map) - (run-hooks 'data-debug-hook) (buffer-disable-undo) (set (make-local-variable 'font-lock-global-modes) nil) (font-lock-mode -1) === modified file 'lisp/cedet/semantic/grammar.el' --- lisp/cedet/semantic/grammar.el 2013-06-01 18:04:59 +0000 +++ lisp/cedet/semantic/grammar.el 2013-09-11 03:31:56 +0000 @@ -860,7 +860,7 @@ ;; Use Unix EOLs, so that the file is portable to all platforms. (setq buffer-file-coding-system 'raw-text-unix) (erase-buffer) - (unless (eq major-mode 'emacs-lisp-mode) + (unless (derived-mode-p 'emacs-lisp-mode) (emacs-lisp-mode)) ;;;; Header + Prologue @@ -1102,7 +1102,9 @@ ;;;; Define major mode ;;;; -(defvar semantic-grammar-syntax-table +(define-obsolete-variable-alias 'semantic-grammar-syntax-table + 'semantic-grammar-mode-syntax-table "24.1") +(defvar semantic-grammar-mode-syntax-table (let ((table (make-syntax-table (standard-syntax-table)))) (modify-syntax-entry ?\: "." table) ;; COLON (modify-syntax-entry ?\> "." table) ;; GT @@ -1170,7 +1172,9 @@ semantic-grammar-mode-keywords-1 "Font Lock keywords used to highlight Semantic grammar buffers.") -(defvar semantic-grammar-map +(define-obsolete-variable-alias 'semantic-grammar-map + 'semantic-grammar-mode-map "24.1") +(defvar semantic-grammar-mode-map (let ((km (make-sparse-keymap))) (define-key km "|" 'semantic-grammar-electric-punctuation) @@ -1271,22 +1275,17 @@ (semantic-tag-start outer) (semantic-tag-end outer))))) -(defun semantic-grammar-mode () +(define-derived-mode semantic-grammar-mode + fundamental-mode "Semantic Grammar Framework" "Initialize a buffer for editing Semantic grammars. -\\{semantic-grammar-map}" - (interactive) - (kill-all-local-variables) - (setq major-mode 'semantic-grammar-mode - mode-name "Semantic Grammar Framework") +\\{semantic-grammar-mode-map}" (set (make-local-variable 'parse-sexp-ignore-comments) t) (set (make-local-variable 'comment-start) ";;") ;; Look within the line for a ; following an even number of backslashes ;; after either a non-backslash or the line beginning. (set (make-local-variable 'comment-start-skip) "\\(\\(^\\|[^\\\\\n]\\)\\(\\\\\\\\\\)*\\);+ *") - (set-syntax-table semantic-grammar-syntax-table) - (use-local-map semantic-grammar-map) (set (make-local-variable 'indent-line-function) 'semantic-grammar-indent) (set (make-local-variable 'fill-paragraph-function) @@ -1335,15 +1334,14 @@ (semantic-make-local-hook 'semantic-edits-new-change-functions) (add-hook 'semantic-edits-new-change-functions 'semantic-grammar-edits-new-change-hook-fcn - nil t) - (semantic-run-mode-hooks 'semantic-grammar-mode-hook)) + nil t)) ;;;; ;;;; Useful commands ;;;; (defvar semantic-grammar-skip-quoted-syntax-table - (let ((st (copy-syntax-table semantic-grammar-syntax-table))) + (let ((st (copy-syntax-table semantic-grammar-mode-syntax-table))) (modify-syntax-entry ?\' "$" st) st) "Syntax table to skip a whole quoted expression in grammar code. === modified file 'lisp/chistory.el' --- lisp/chistory.el 2013-01-01 09:11:05 +0000 +++ lisp/chistory.el 2013-09-11 03:31:56 +0000 @@ -121,7 +121,9 @@ (error "No command history") (command-history-mode))))) -(defvar command-history-map +(define-obsolete-variable-alias 'command-history-map + 'command-history-mode-map "24.1") +(defvar command-history-mode-map (let ((map (make-sparse-keymap))) (set-keymap-parent map lisp-mode-shared-map) (suppress-keymap map) @@ -132,21 +134,11 @@ map) "Keymap for `command-history-mode'.") -(defun command-history-mode () +(define-derived-mode command-history-mode fundamental-mode "Command History" "Major mode for listing and repeating recent commands. Keybindings: -\\{command-history-map}" - (interactive) - (Command-history-setup) - (setq major-mode 'command-history-mode) - (setq mode-name "Command History") - (use-local-map command-history-map) - (run-mode-hooks 'command-history-mode-hook)) - -(defun Command-history-setup () - (kill-all-local-variables) - (use-local-map command-history-map) +\\{command-history-mode-map}" (lisp-mode-variables nil) (set-syntax-table emacs-lisp-mode-syntax-table) (setq buffer-read-only t)) === modified file 'lisp/comint.el' --- lisp/comint.el 2013-08-29 19:55:58 +0000 +++ lisp/comint.el 2013-09-11 03:31:56 +0000 @@ -3793,25 +3793,21 @@ ;; comint-mode will take care of it. The following example, from shell.el, ;; is typical: ;; -;; (defvar shell-mode-map '()) -;; (cond ((not shell-mode-map) -;; (setq shell-mode-map (copy-keymap comint-mode-map)) -;; (define-key shell-mode-map "\C-c\C-f" 'shell-forward-command) -;; (define-key shell-mode-map "\C-c\C-b" 'shell-backward-command) -;; (define-key shell-mode-map "\t" 'completion-at-point) -;; (define-key shell-mode-map "\M-?" -;; 'comint-dynamic-list-filename-completions))) +;; (defvar shell-mode-map +;; (let ((map (make-sparse-keymap))) +;; (set-keymap-parent map comint-mode-map) +;; (define-key map "\C-c\C-f" 'shell-forward-command) +;; (define-key map "\C-c\C-b" 'shell-backward-command) +;; (define-key map "\t" 'completion-at-point) +;; (define-key map "\M-?" +;; 'comint-dynamic-list-filename-completions) +;; map)) ;; -;; (defun shell-mode () -;; (interactive) -;; (comint-mode) +;; (define-derived-mode shell-mode comint-mode "Shell" +;; "Doc." ;; (setq comint-prompt-regexp shell-prompt-pattern) -;; (setq major-mode 'shell-mode) -;; (setq mode-name "Shell") -;; (use-local-map shell-mode-map) ;; (setq-local shell-directory-stack nil) -;; (add-hook 'comint-input-filter-functions 'shell-directory-tracker) -;; (run-mode-hooks 'shell-mode-hook)) +;; (add-hook 'comint-input-filter-functions 'shell-directory-tracker)) ;; ;; ;; Completion for comint-mode users === modified file 'lisp/emacs-lisp/debug.el' --- lisp/emacs-lisp/debug.el 2013-08-15 17:21:19 +0000 +++ lisp/emacs-lisp/debug.el 2013-09-11 03:31:56 +0000 @@ -626,7 +626,7 @@ (put 'debugger-mode 'mode-class 'special) -(defun debugger-mode () +(define-derived-mode debugger-mode fundamental-mode "Debugger" "Mode for backtrace buffers, selected in debugger. \\ A line starts with `*' if exiting that frame will call the debugger. @@ -641,13 +641,9 @@ Complete list of commands: \\{debugger-mode-map}" - (kill-all-local-variables) - (setq major-mode 'debugger-mode) - (setq mode-name "Debugger") (setq truncate-lines t) (set-syntax-table emacs-lisp-mode-syntax-table) - (use-local-map debugger-mode-map) - (run-mode-hooks 'debugger-mode-hook)) + (use-local-map debugger-mode-map)) (defcustom debugger-record-buffer "*Debugger-record*" "Buffer name for expression values, for \\[debugger-record-expression]." === modified file 'lisp/emulation/ws-mode.el' --- lisp/emulation/ws-mode.el 2013-01-01 09:11:05 +0000 +++ lisp/emulation/ws-mode.el 2013-09-11 03:31:56 +0000 @@ -73,8 +73,7 @@ (define-key map "\C-x" 'save-buffers-kill-emacs) (define-key map "y" 'ws-delete-block) (define-key map "\C-y" 'ws-delete-block) - map) - "") + map)) (defvar wordstar-C-o-map (let ((map (make-keymap))) @@ -140,8 +139,7 @@ (define-key map "y" 'ws-kill-eol) (define-key map "\C-y" 'ws-kill-eol) (define-key map "\177" 'ws-kill-bol) - map) - "") + map)) (defvar wordstar-mode-map (let ((map (make-keymap))) @@ -170,17 +168,16 @@ (define-key map "\C-x" 'next-line) (define-key map "\C-y" 'kill-complete-line) (define-key map "\C-z" 'scroll-up-line) - map) - "") + map)) ;; wordstar-C-j-map not yet implemented -(defvar wordstar-C-j-map nil "") +(defvar wordstar-C-j-map nil) (put 'wordstar-mode 'mode-class 'special) ;;;###autoload -(defun wordstar-mode () +(define-derived-mode wordstar-mode fundamental-mode "WordStar" "Major mode with WordStar-like key bindings. BUGS: @@ -191,106 +188,7 @@ - Search and replace (C-q a) is only available in forward direction No key bindings beginning with ESC are installed, they will work -Emacs-like. - -The key bindings are: - - C-a backward-word - C-b fill-paragraph - C-c scroll-up-line - C-d forward-char - C-e previous-line - C-f forward-word - C-g delete-char - C-h backward-char - C-i indent-for-tab-command - C-j help-for-help - C-k ordstar-C-k-map - C-l ws-repeat-search - C-n open-line - C-p quoted-insert - C-r scroll-down-line - C-s backward-char - C-t kill-word - C-u keyboard-quit - C-v overwrite-mode - C-w scroll-down - C-x next-line - C-y kill-complete-line - C-z scroll-up - - C-k 0 ws-set-marker-0 - C-k 1 ws-set-marker-1 - C-k 2 ws-set-marker-2 - C-k 3 ws-set-marker-3 - C-k 4 ws-set-marker-4 - C-k 5 ws-set-marker-5 - C-k 6 ws-set-marker-6 - C-k 7 ws-set-marker-7 - C-k 8 ws-set-marker-8 - C-k 9 ws-set-marker-9 - C-k b ws-begin-block - C-k c ws-copy-block - C-k d save-buffers-kill-emacs - C-k f find-file - C-k h ws-show-markers - C-k i ws-indent-block - C-k k ws-end-block - C-k p ws-print-block - C-k q kill-emacs - C-k r insert-file - C-k s save-some-buffers - C-k t ws-mark-word - C-k u ws-exdent-block - C-k C-u keyboard-quit - C-k v ws-move-block - C-k w ws-write-block - C-k x kill-emacs - C-k y ws-delete-block - - C-o c wordstar-center-line - C-o b switch-to-buffer - C-o j justify-current-line - C-o k kill-buffer - C-o l list-buffers - C-o m auto-fill-mode - C-o r set-fill-column - C-o C-u keyboard-quit - C-o wd delete-other-windows - C-o wh split-window-right - C-o wo other-window - C-o wv split-window-below - - C-q 0 ws-find-marker-0 - C-q 1 ws-find-marker-1 - C-q 2 ws-find-marker-2 - C-q 3 ws-find-marker-3 - C-q 4 ws-find-marker-4 - C-q 5 ws-find-marker-5 - C-q 6 ws-find-marker-6 - C-q 7 ws-find-marker-7 - C-q 8 ws-find-marker-8 - C-q 9 ws-find-marker-9 - C-q a ws-query-replace - C-q b ws-to-block-begin - C-q c end-of-buffer - C-q d end-of-line - C-q f ws-search - C-q k ws-to-block-end - C-q l ws-undo - C-q p ws-last-cursorp - C-q r beginning-of-buffer - C-q C-u keyboard-quit - C-q w ws-last-error - C-q y ws-kill-eol - C-q DEL ws-kill-bol -" - (interactive) - (kill-all-local-variables) - (use-local-map wordstar-mode-map) - (setq mode-name "WordStar") - (setq major-mode 'wordstar-mode) - (run-mode-hooks 'wordstar-mode-hook)) +Emacs-like.") (defun wordstar-center-paragraph () === modified file 'lisp/eshell/esh-mode.el' --- lisp/eshell/esh-mode.el 2013-08-05 14:26:57 +0000 +++ lisp/eshell/esh-mode.el 2013-09-11 03:31:56 +0000 @@ -220,74 +220,66 @@ (defvar eshell-last-output-end nil) (defvar eshell-currently-handling-window nil) -(defvar eshell-mode-syntax-table nil) -(defvar eshell-mode-abbrev-table nil) (define-abbrev-table 'eshell-mode-abbrev-table ()) -(if (not eshell-mode-syntax-table) - (let ((i 0)) - (setq eshell-mode-syntax-table (make-syntax-table)) - (while (< i ?0) - (modify-syntax-entry i "_ " eshell-mode-syntax-table) - (setq i (1+ i))) - (setq i (1+ ?9)) - (while (< i ?A) - (modify-syntax-entry i "_ " eshell-mode-syntax-table) - (setq i (1+ i))) - (setq i (1+ ?Z)) - (while (< i ?a) - (modify-syntax-entry i "_ " eshell-mode-syntax-table) - (setq i (1+ i))) - (setq i (1+ ?z)) - (while (< i 128) - (modify-syntax-entry i "_ " eshell-mode-syntax-table) - (setq i (1+ i))) - (modify-syntax-entry ? " " eshell-mode-syntax-table) - (modify-syntax-entry ?\t " " eshell-mode-syntax-table) - (modify-syntax-entry ?\f " " eshell-mode-syntax-table) - (modify-syntax-entry ?\n "> " eshell-mode-syntax-table) - ;; Give CR the same syntax as newline, for selective-display. - (modify-syntax-entry ?\^m "> " eshell-mode-syntax-table) -;;; (modify-syntax-entry ?\; "< " eshell-mode-syntax-table) - (modify-syntax-entry ?` "' " eshell-mode-syntax-table) - (modify-syntax-entry ?' "' " eshell-mode-syntax-table) - (modify-syntax-entry ?, "' " eshell-mode-syntax-table) - ;; Used to be singlequote; changed for flonums. - (modify-syntax-entry ?. "_ " eshell-mode-syntax-table) - (modify-syntax-entry ?- "_ " eshell-mode-syntax-table) - (modify-syntax-entry ?| ". " eshell-mode-syntax-table) - (modify-syntax-entry ?# "' " eshell-mode-syntax-table) - (modify-syntax-entry ?\" "\" " eshell-mode-syntax-table) - (modify-syntax-entry ?\\ "/ " eshell-mode-syntax-table) - (modify-syntax-entry ?\( "() " eshell-mode-syntax-table) - (modify-syntax-entry ?\) ")( " eshell-mode-syntax-table) - (modify-syntax-entry ?\{ "(} " eshell-mode-syntax-table) - (modify-syntax-entry ?\} "){ " eshell-mode-syntax-table) - (modify-syntax-entry ?\[ "(] " eshell-mode-syntax-table) - (modify-syntax-entry ?\] ")[ " eshell-mode-syntax-table) - ;; All non-word multibyte characters should be `symbol'. - (if (featurep 'xemacs) - (map-char-table - (function - (lambda (key val) - (and (characterp key) - (>= (char-int key) 256) - (/= (char-syntax key) ?w) - (modify-syntax-entry key "_ " - eshell-mode-syntax-table)))) - (standard-syntax-table)) - (map-char-table - (function - (lambda (key val) - (and (if (consp key) - (and (>= (car key) 128) - (/= (char-syntax (car key)) ?w)) - (and (>= key 256) - (/= (char-syntax key) ?w))) - (modify-syntax-entry key "_ " - eshell-mode-syntax-table)))) - (standard-syntax-table))))) +(defvar eshell-mode-syntax-table + (let ((st (make-syntax-table)) + (i 0)) + (while (< i ?0) + (modify-syntax-entry i "_ " st) + (setq i (1+ i))) + (setq i (1+ ?9)) + (while (< i ?A) + (modify-syntax-entry i "_ " st) + (setq i (1+ i))) + (setq i (1+ ?Z)) + (while (< i ?a) + (modify-syntax-entry i "_ " st) + (setq i (1+ i))) + (setq i (1+ ?z)) + (while (< i 128) + (modify-syntax-entry i "_ " st) + (setq i (1+ i))) + (modify-syntax-entry ? " " st) + (modify-syntax-entry ?\t " " st) + (modify-syntax-entry ?\f " " st) + (modify-syntax-entry ?\n "> " st) + ;; Give CR the same syntax as newline, for selective-display. + (modify-syntax-entry ?\^m "> " st) + ;; (modify-syntax-entry ?\; "< " st) + (modify-syntax-entry ?` "' " st) + (modify-syntax-entry ?' "' " st) + (modify-syntax-entry ?, "' " st) + ;; Used to be singlequote; changed for flonums. + (modify-syntax-entry ?. "_ " st) + (modify-syntax-entry ?- "_ " st) + (modify-syntax-entry ?| ". " st) + (modify-syntax-entry ?# "' " st) + (modify-syntax-entry ?\" "\" " st) + (modify-syntax-entry ?\\ "/ " st) + (modify-syntax-entry ?\( "() " st) + (modify-syntax-entry ?\) ")( " st) + (modify-syntax-entry ?\{ "(} " st) + (modify-syntax-entry ?\} "){ " st) + (modify-syntax-entry ?\[ "(] " st) + (modify-syntax-entry ?\] ")[ " st) + ;; All non-word multibyte characters should be `symbol'. + (map-char-table + (if (featurep 'xemacs) + (lambda (key val) + (and (characterp key) + (>= (char-int key) 256) + (/= (char-syntax key) ?w) + (modify-syntax-entry key "_ " st))) + (lambda (key val) + (and (if (consp key) + (and (>= (car key) 128) + (/= (char-syntax (car key)) ?w)) + (and (>= key 256) + (/= (char-syntax key) ?w))) + (modify-syntax-entry key "_ " st)))) + (standard-syntax-table)))) ;;; User Functions: @@ -303,25 +295,18 @@ (run-hooks 'eshell-exit-hook)) ;;;###autoload -(defun eshell-mode () - "Emacs shell interactive mode. - -\\{eshell-mode-map}" - (kill-all-local-variables) - - (setq major-mode 'eshell-mode) - (setq mode-name "EShell") - (set (make-local-variable 'eshell-mode) t) - - (make-local-variable 'eshell-mode-map) - (setq eshell-mode-map (make-sparse-keymap)) +(define-derived-mode eshell-mode fundamental-mode "EShell" + "Emacs shell interactive mode." + (setq-local eshell-mode t) + + ;; FIXME: What the hell!? + (setq-local eshell-mode-map (make-sparse-keymap)) (use-local-map eshell-mode-map) (when eshell-status-in-mode-line (make-local-variable 'eshell-command-running-string) (let ((fmt (copy-sequence mode-line-format))) - (make-local-variable 'mode-line-format) - (setq mode-line-format fmt)) + (setq-local mode-line-format fmt)) (let ((mode-line-elt (memq 'mode-line-modified mode-line-format))) (if mode-line-elt (setcar mode-line-elt 'eshell-command-running-string)))) @@ -331,11 +316,9 @@ (define-key eshell-mode-map [(meta control ?l)] 'eshell-show-output) (define-key eshell-mode-map [(control ?a)] 'eshell-bol) - (set (make-local-variable 'eshell-command-prefix) - (make-symbol "eshell-command-prefix")) + (setq-local eshell-command-prefix (make-symbol "eshell-command-prefix")) (fset eshell-command-prefix (make-sparse-keymap)) - (set (make-local-variable 'eshell-command-map) - (symbol-function eshell-command-prefix)) + (setq-local eshell-command-map (symbol-function eshell-command-prefix)) (define-key eshell-mode-map [(control ?c)] eshell-command-prefix) ;; without this, find-tag complains about read-only text being @@ -359,7 +342,6 @@ (define-key eshell-command-map [(control ?y)] 'eshell-repeat-argument) (setq local-abbrev-table eshell-mode-abbrev-table) - (set-syntax-table eshell-mode-syntax-table) (set (make-local-variable 'dired-directory) default-directory) (set (make-local-variable 'list-buffers-directory) @@ -442,7 +424,6 @@ (if eshell-first-time-p (run-hooks 'eshell-first-time-mode-hook)) - (run-mode-hooks 'eshell-mode-hook) (run-hooks 'eshell-post-command-hook)) (put 'eshell-mode 'mode-class 'special) === modified file 'lisp/gnus/ChangeLog' --- lisp/gnus/ChangeLog 2013-08-28 08:38:28 +0000 +++ lisp/gnus/ChangeLog 2013-09-11 03:31:56 +0000 @@ -1,3 +1,27 @@ +2013-09-11 Stefan Monnier + + * score-mode.el (gnus-score-mode-map): Move initialization + into declaration. + (gnus-score-mode): Use define-derived-mode. + * gnus-srvr.el (gnus-browse-mode): Use define-derived-mode. + * gnus-kill.el (gnus-kill-file-mode-map): Move initialization + into declaration. + (gnus-kill-file-mode): Use define-derived-mode. + (gnus-kill-file-edit-file, gnus-kill-file-enter-kill, gnus-kill): + Use derived-mode-p. + * gnus-group.el (gnus-group-mode): Use define-derived-mode. + (gnus-group-setup-buffer, gnus-group-name-at-point) + (gnus-group-make-web-group, gnus-group-enter-directory) + (gnus-group-suspend): Use derived-mode-p. + * gnus-cus.el (gnus-custom-mode): Use define-derived-mode. + * gnus-bookmark.el (gnus-bookmark-bmenu-mode): Use define-derived-mode. + * gnus-art.el (gnus-article-mode): Use define-derived-mode. + (gnus-article-setup-buffer, gnus-article-prepare) + (gnus-article-prepare-display, gnus-sticky-article) + (gnus-kill-sticky-article-buffer, gnus-kill-sticky-article-buffers) + (gnus-bind-safe-url-regexp, gnus-article-check-buffer) + (gnus-article-read-summary-keys): Use derived-mode-p. + 2013-08-28 Katsumi Yamaoka * mm-decode.el (mm-temp-files-delete): Fix file deletion logic. @@ -177,15 +201,15 @@ 2013-07-10 David Engster * gnus-start.el (gnus-clean-old-newsrc): Always remove 'unexist' marks - if `gnus-newsrc-file-version' does not match `gnus-version'. This - fixes a bug in Emacs trunk where the 'unexist' marks were always + if `gnus-newsrc-file-version' does not match `gnus-version'. + This fixes a bug in Emacs trunk where the 'unexist' marks were always removed at startup because "Gnus v5.13" was considered smaller than "Ma Gnus v0.03". 2013-07-10 Tassilo Horn - * gnus.el (gnus-summary-line-format): Reference - `gnus-user-date-format-alist' for the &user-date; format, not + * gnus.el (gnus-summary-line-format): + Reference `gnus-user-date-format-alist' for the &user-date; format, not `gnus-summary-user-date-format-alist'. 2013-07-08 Lars Magne Ingebrigtsen @@ -467,7 +491,7 @@ * shr.el (shr-render-td): Support horizontal alignment. - * eww.el (eww-put-color): Removed. + * eww.el (eww-put-color): Remove. (eww-colorize-region): Use `add-face-text-property'. * shr.el (shr-add-font): Append face data, so that we get the correct @@ -522,7 +546,7 @@ 2013-06-16 RĂ¼diger Sonderfeld - * shr.el (shr-dom-to-xml): Fixed function call. + * shr.el (shr-dom-to-xml): Fix function call. * eww.el (eww): New group. (eww-header-line-format): New custom variable. @@ -558,8 +582,8 @@ (auth-source-netrc-parse): Refactor and improve netrc parser to support single-quoted strings and multiline entries. (auth-source-netrc-parse-next-interesting) - (auth-source-netrc-parse-one, auth-source-netrc-parse-entries): New - functions to support parser. + (auth-source-netrc-parse-one, auth-source-netrc-parse-entries): + New functions to support parser. 2013-06-14 Lars Magne Ingebrigtsen @@ -707,8 +731,8 @@ * registry.el (initialize-instance, registry-lookup) (registry-lookup-breaks-before-lexbind, registry-lookup-secondary) (registry-lookup-secondary-value, registry-search, registry-delete) - (registry-insert, registry-reindex, registry-size, registry-prune): Do - not wrap methods in `eval-and-compile'. This breaks due to latest + (registry-insert, registry-reindex, registry-size, registry-prune): + Do not wrap methods in `eval-and-compile'. This breaks due to latest changes in EIEIO (introduction of eieio-core.el). 2013-05-30 Glenn Morris @@ -988,8 +1012,8 @@ 2013-03-26 Andrew Cohen * nnir.el: Major rewrite. Cleaner separation between searches and group - management. Marks are now shown in nnir summary buffers. Rudimentary - support for real (i.e. not ephemeral) nnir groups. + management. Marks are now shown in nnir summary buffers. + Rudimentary support for real (i.e. not ephemeral) nnir groups. (gnus-summary-make-nnir-group): New function for initiating searches from a summary buffer. @@ -1018,8 +1042,8 @@ 2013-02-22 David Engster * gnus-registry.el (gnus-registry-save): Provide class name when - calling `eieio-persistent-read' to avoid "unsafe call" warning. Use - `condition-case' to stay compatible with older EIEIO versions which + calling `eieio-persistent-read' to avoid "unsafe call" warning. + Use `condition-case' to stay compatible with older EIEIO versions which only accept one argument. 2013-02-17 Daiki Ueno @@ -5295,7 +5319,7 @@ a creation default, pass the whole port list down. It will be completed. - * auth-source.el (auth-source-search): Updated docs to talk about + * auth-source.el (auth-source-search): Update docs to talk about multiple creation choices. (auth-source-netrc-create): Accept a list as a value (from the search parameters) and do completion on that list. Keep a separate netrc line @@ -5362,7 +5386,7 @@ (gnus-summary-exit): Kill the correct article buffer on exit from a `C-d' group. - * gnus-start.el (gnus-use-backend-marks): Removed, since it duplicates + * gnus-start.el (gnus-use-backend-marks): Remove, since it duplicates gnus-propagate-marks. * gnus-sum.el (gnus-summary-exit-no-update): Restore the group conf @@ -18399,7 +18423,7 @@ 2005-11-19 Kevin Greiner - * gnus-sum.el (gnus-fetch-old-headers): Updated docs to warn that + * gnus-sum.el (gnus-fetch-old-headers): Update docs to warn that it can seriously impact performance as it bypasses the agent's local caches. === modified file 'lisp/gnus/gnus-art.el' --- lisp/gnus/gnus-art.el 2013-07-25 23:40:51 +0000 +++ lisp/gnus/gnus-art.el 2013-09-11 03:31:56 +0000 @@ -3683,7 +3683,7 @@ (walk-windows (lambda (w) (set-buffer (window-buffer w)) - (when (eq major-mode 'gnus-article-mode) + (when (derived-mode-p 'gnus-article-mode) (let ((old-line (count-lines (point-min) (point))) (old-column (- (point) (line-beginning-position))) (window-start (window-start w)) @@ -4455,7 +4455,7 @@ (defvar bookmark-make-record-function) (defvar shr-put-image-function) -(defun gnus-article-mode () +(define-derived-mode gnus-article-mode fundamental-mode "Article" "Major mode for displaying an article. All normal editing commands are switched off. @@ -4470,13 +4470,8 @@ \\[gnus-article-mail]\t Send a reply to the address near point \\[gnus-article-describe-briefly]\t Describe the current mode briefly \\[gnus-info-find-node]\t Go to the Gnus info node" - (interactive) - (kill-all-local-variables) (gnus-simplify-mode-line) - (setq mode-name "Article") - (setq major-mode 'gnus-article-mode) (make-local-variable 'minor-mode-alist) - (use-local-map gnus-article-mode-map) (when (gnus-visual-p 'article-menu 'menu) (gnus-article-make-menu-bar) (when gnus-summary-tool-bar-map @@ -4504,9 +4499,7 @@ (buffer-disable-undo) (setq buffer-read-only t show-trailing-whitespace nil) - (set-syntax-table gnus-article-mode-syntax-table) - (mm-enable-multibyte) - (gnus-run-mode-hooks 'gnus-article-mode-hook)) + (mm-enable-multibyte)) (defun gnus-article-setup-buffer () "Initialize the article buffer." @@ -4554,7 +4547,7 @@ (setq gnus-article-mime-handle-alist nil) (buffer-disable-undo) (setq buffer-read-only t) - (unless (eq major-mode 'gnus-article-mode) + (unless (derived-mode-p 'gnus-article-mode) (gnus-article-mode)) (setq truncate-lines gnus-article-truncate-lines) (current-buffer)) @@ -4603,7 +4596,7 @@ If ALL-HEADERS is non-nil, no headers are hidden." (save-excursion ;; Make sure we start in a summary buffer. - (unless (eq major-mode 'gnus-summary-mode) + (unless (derived-mode-p 'gnus-summary-mode) (set-buffer gnus-summary-buffer)) (setq gnus-summary-buffer (current-buffer)) (let* ((gnus-article (if header (mail-header-number header) article)) @@ -4714,7 +4707,7 @@ (let ((gnus-article-buffer (current-buffer)) buffer-read-only (inhibit-read-only t)) - (unless (eq major-mode 'gnus-article-mode) + (unless (derived-mode-p 'gnus-article-mode) (gnus-article-mode)) (setq buffer-read-only nil gnus-article-wash-types nil @@ -4776,7 +4769,7 @@ "*")) (if (and (gnus-buffer-live-p new-art-buf-name) (with-current-buffer new-art-buf-name - (eq major-mode 'gnus-sticky-article-mode))) + (derived-mode-p 'gnus-sticky-article-mode))) (switch-to-buffer new-art-buf-name) (setq new-art-buf-name (rename-buffer new-art-buf-name t))) (gnus-sticky-article-mode)) @@ -4792,7 +4785,7 @@ (unless buffer (setq buffer (current-buffer))) (with-current-buffer buffer - (when (eq major-mode 'gnus-sticky-article-mode) + (when (derived-mode-p 'gnus-sticky-article-mode) (gnus-kill-buffer buffer)))) (defun gnus-kill-sticky-article-buffers (arg) @@ -4801,11 +4794,11 @@ (interactive "P") (dolist (buf (gnus-buffers)) (with-current-buffer buf - (when (eq major-mode 'gnus-sticky-article-mode) - (if (not arg) - (gnus-kill-buffer buf) - (when (yes-or-no-p (concat "Kill buffer " (buffer-name buf) "? ")) - (gnus-kill-buffer buf))))))) + (when (derived-mode-p 'gnus-sticky-article-mode) + (if (not arg) + (gnus-kill-buffer buf) + (when (yes-or-no-p (concat "Kill buffer " (buffer-name buf) "? ")) + (gnus-kill-buffer buf))))))) ;;; ;;; Gnus MIME viewing functions @@ -4893,7 +4886,7 @@ (defmacro gnus-bind-safe-url-regexp (&rest body) "Bind `mm-w3m-safe-url-regexp' according to `gnus-safe-html-newsgroups'." `(let ((mm-w3m-safe-url-regexp - (let ((group (if (and (eq major-mode 'gnus-article-mode) + (let ((group (if (and (derived-mode-p 'gnus-article-mode) (gnus-buffer-live-p gnus-article-current-summary)) (with-current-buffer gnus-article-current-summary @@ -6477,7 +6470,7 @@ (defun gnus-article-check-buffer () "Beep if not in an article buffer." - (unless (equal major-mode 'gnus-article-mode) + (unless (derived-mode-p 'gnus-article-mode) (error "Command invoked outside of a Gnus article buffer"))) (defun gnus-article-read-summary-keys (&optional arg key not-restore-window) @@ -6592,7 +6585,7 @@ new-sum-point (window-live-p win) (with-current-buffer (window-buffer win) - (eq major-mode 'gnus-summary-mode))) + (derived-mode-p 'gnus-summary-mode))) (set-window-point win new-sum-point) (set-window-start win new-sum-start) (set-window-hscroll win new-sum-hscroll)))) === modified file 'lisp/gnus/gnus-bookmark.el' --- lisp/gnus/gnus-bookmark.el 2013-01-02 16:13:04 +0000 +++ lisp/gnus/gnus-bookmark.el 2013-09-11 03:31:56 +0000 @@ -190,7 +190,7 @@ "Set a bookmark for this article." (interactive) (gnus-bookmark-maybe-load-default-file) - (if (or (not (eq major-mode 'gnus-summary-mode)) + (if (or (not (derived-mode-p 'gnus-summary-mode)) (not gnus-article-current)) (error "Please select an article in the Gnus summary buffer") (let* ((group (car gnus-article-current)) @@ -473,7 +473,7 @@ ;; Been to lazy to use gnus-bookmark-save... (defalias 'gnus-bookmark-bmenu-save 'gnus-bookmark-write-file) -(defun gnus-bookmark-bmenu-mode () +(define-derived-mode gnus-bookmark-bmenu-mode fundamental-mode "Bookmark Menu" "Major mode for editing a list of Gnus bookmarks. Each line describes one of the bookmarks in Gnus. Letters do not insert themselves; instead, they are commands. @@ -497,13 +497,8 @@ in another buffer. \\[gnus-bookmark-bmenu-show-all-annotations] -- show the annotations of all bookmarks in another buffer. \\[gnus-bookmark-bmenu-edit-annotation] -- edit the annotation for the current bookmark." - (kill-all-local-variables) - (use-local-map gnus-bookmark-bmenu-mode-map) (setq truncate-lines t) - (setq buffer-read-only t) - (setq major-mode 'gnus-bookmark-bmenu-mode) - (setq mode-name "Bookmark Menu") - (gnus-run-mode-hooks 'gnus-bookmark-bmenu-mode-hook)) + (setq buffer-read-only t)) ;; avoid compilation warnings (defvar gnus-bookmark-bmenu-toggle-infos nil) === modified file 'lisp/gnus/gnus-cus.el' --- lisp/gnus/gnus-cus.el 2013-01-01 09:11:05 +0000 +++ lisp/gnus/gnus-cus.el 2013-09-11 03:31:56 +0000 @@ -33,7 +33,7 @@ ;;; Widgets: -(defun gnus-custom-mode () +(define-derived-mode gnus-custom-mode fundamental-mode "Gnus Customize" "Major mode for editing Gnus customization buffers. The following commands are available: @@ -45,9 +45,6 @@ Entry to this mode calls the value of `gnus-custom-mode-hook' if that value is non-nil." - (kill-all-local-variables) - (setq major-mode 'gnus-custom-mode - mode-name "Gnus Customize") (use-local-map widget-keymap) ;; Emacs stuff: (when (and (facep 'custom-button-face) @@ -63,8 +60,7 @@ (set (make-local-variable 'widget-push-button-prefix) "") (set (make-local-variable 'widget-push-button-suffix) "") (set (make-local-variable 'widget-link-prefix) "") - (set (make-local-variable 'widget-link-suffix) "")) - (gnus-run-mode-hooks 'gnus-custom-mode-hook)) + (set (make-local-variable 'widget-link-suffix) ""))) ;;; Group Customization: === modified file 'lisp/gnus/gnus-group.el' --- lisp/gnus/gnus-group.el 2013-08-02 13:34:22 +0000 +++ lisp/gnus/gnus-group.el 2013-09-11 03:31:56 +0000 @@ -1105,7 +1105,7 @@ (set (make-local-variable 'tool-bar-map) map)))) gnus-group-tool-bar-map) -(defun gnus-group-mode () +(define-derived-mode gnus-group-mode fundamental-mode "Group" "Major mode for reading news. All normal editing commands are switched off. @@ -1122,17 +1122,12 @@ The following commands are available: \\{gnus-group-mode-map}" - (interactive) - (kill-all-local-variables) (when (gnus-visual-p 'group-menu 'menu) (gnus-group-make-menu-bar) (gnus-group-make-tool-bar)) (gnus-simplify-mode-line) - (setq major-mode 'gnus-group-mode) - (setq mode-name "Group") (gnus-group-set-mode-line) (setq mode-line-process nil) - (use-local-map gnus-group-mode-map) (buffer-disable-undo) (setq truncate-lines t) (setq buffer-read-only t @@ -1143,8 +1138,7 @@ (when gnus-use-undo (gnus-undo-mode 1)) (when gnus-slave - (gnus-slave-mode)) - (gnus-run-mode-hooks 'gnus-group-mode-hook)) + (gnus-slave-mode))) (defun gnus-update-group-mark-positions () (save-excursion @@ -1193,7 +1187,7 @@ (defun gnus-group-setup-buffer () (set-buffer (gnus-get-buffer-create gnus-group-buffer)) - (unless (eq major-mode 'gnus-group-mode) + (unless (derived-mode-p 'gnus-group-mode) (gnus-group-mode))) (defun gnus-group-name-charset (method group) @@ -2147,7 +2141,7 @@ (defun gnus-group-name-at-point () "Return a group name from around point if it exists, or nil." - (if (eq major-mode 'gnus-group-mode) + (if (derived-mode-p 'gnus-group-mode) (let ((group (gnus-group-group-name))) (when group (gnus-group-decoded-name group))) @@ -3114,7 +3108,7 @@ (gnus-group-read-ephemeral-group group method t (cons (current-buffer) - (if (eq major-mode 'gnus-summary-mode) 'summary 'group)))))) + (if (derived-mode-p 'gnus-summary-mode) 'summary 'group)))))) (defvar nnrss-group-alist) (eval-when-compile @@ -3229,7 +3223,7 @@ (unless (gnus-group-read-ephemeral-group name method t (cons (current-buffer) - (if (eq major-mode 'gnus-summary-mode) + (if (derived-mode-p 'gnus-summary-mode) 'summary 'group))) (error "Couldn't enter %s" dir)))) @@ -4319,7 +4313,7 @@ (unless (or (eq buf group-buf) (eq buf gnus-dribble-buffer) (with-current-buffer buf - (eq major-mode 'message-mode))) + (derived-mode-p 'message-mode))) (gnus-kill-buffer buf))) (setq gnus-backlog-articles nil) (gnus-kill-gnus-frames) === modified file 'lisp/gnus/gnus-kill.el' --- lisp/gnus/gnus-kill.el 2013-01-01 09:11:05 +0000 +++ lisp/gnus/gnus-kill.el 2013-09-11 03:31:56 +0000 @@ -75,20 +75,20 @@ ;;; Gnus Kill File Mode ;;; -(defvar gnus-kill-file-mode-map nil) - -(unless gnus-kill-file-mode-map - (gnus-define-keymap (setq gnus-kill-file-mode-map - (copy-keymap emacs-lisp-mode-map)) - "\C-c\C-k\C-s" gnus-kill-file-kill-by-subject - "\C-c\C-k\C-a" gnus-kill-file-kill-by-author - "\C-c\C-k\C-t" gnus-kill-file-kill-by-thread - "\C-c\C-k\C-x" gnus-kill-file-kill-by-xref - "\C-c\C-a" gnus-kill-file-apply-buffer - "\C-c\C-e" gnus-kill-file-apply-last-sexp - "\C-c\C-c" gnus-kill-file-exit)) - -(defun gnus-kill-file-mode () +(defvar gnus-kill-file-mode-map + (let ((map (make-sparse-keymap))) + (set-keymap-parent map emacs-lisp-mode-map) + (gnus-define-keymap map + "\C-c\C-k\C-s" gnus-kill-file-kill-by-subject + "\C-c\C-k\C-a" gnus-kill-file-kill-by-author + "\C-c\C-k\C-t" gnus-kill-file-kill-by-thread + "\C-c\C-k\C-x" gnus-kill-file-kill-by-xref + "\C-c\C-a" gnus-kill-file-apply-buffer + "\C-c\C-e" gnus-kill-file-apply-last-sexp + "\C-c\C-c" gnus-kill-file-exit) + map)) + +(define-derived-mode gnus-kill-file-mode emacs-lisp-mode "Kill" "Major mode for editing kill files. If you are using this mode - you probably shouldn't. Kill files @@ -151,15 +151,7 @@ than `D' should be used for articles which should really be deleted. Entry to this mode calls emacs-lisp-mode-hook and -gnus-kill-file-mode-hook with no arguments, if that value is non-nil." - (interactive) - (kill-all-local-variables) - (use-local-map gnus-kill-file-mode-map) - (set-syntax-table emacs-lisp-mode-syntax-table) - (setq major-mode 'gnus-kill-file-mode) - (setq mode-name "Kill") - (lisp-mode-variables nil) - (gnus-run-mode-hooks 'emacs-lisp-mode-hook 'gnus-kill-file-mode-hook)) +gnus-kill-file-mode-hook with no arguments, if that value is non-nil.") (defun gnus-kill-file-edit-file (newsgroup) "Begin editing a kill file for NEWSGROUP. @@ -175,10 +167,10 @@ (let ((buffer (find-file-noselect file))) (cond ((get-buffer-window buffer) (pop-to-buffer buffer)) - ((eq major-mode 'gnus-group-mode) + ((derived-mode-p 'gnus-group-mode) (gnus-configure-windows 'group) ;Take all windows. (pop-to-buffer buffer)) - ((eq major-mode 'gnus-summary-mode) + ((derived-mode-p 'gnus-summary-mode) (gnus-configure-windows 'article) (pop-to-buffer gnus-article-buffer) (bury-buffer gnus-article-buffer) @@ -201,7 +193,7 @@ ;; REGEXP: The string to kill. (save-excursion (let (string) - (unless (eq major-mode 'gnus-kill-file-mode) + (unless (derived-mode-p 'gnus-kill-file-mode) (gnus-kill-set-kill-buffer)) (unless dont-move (goto-char (point-max))) @@ -520,7 +512,7 @@ (setq kill-list (cdr kill-list)))) (gnus-execute field kill-list command nil (not all)))))) (switch-to-buffer old-buffer) - (when (and (eq major-mode 'gnus-kill-file-mode) regexp (not silent)) + (when (and (derived-mode-p 'gnus-kill-file-mode) regexp (not silent)) (gnus-pp-gnus-kill (nconc (list 'gnus-kill field (if (consp regexp) (list 'quote regexp) regexp)) === modified file 'lisp/gnus/gnus-srvr.el' --- lisp/gnus/gnus-srvr.el 2013-01-02 16:13:04 +0000 +++ lisp/gnus/gnus-srvr.el 2013-09-11 03:31:56 +0000 @@ -244,6 +244,7 @@ The following commands are available: \\{gnus-server-mode-map}" + ;; FIXME: Use define-derived-mode. (interactive) (when (gnus-visual-p 'server-menu 'menu) (gnus-server-make-menu-bar)) @@ -869,7 +870,7 @@ (gnus-message 5 "Connecting to %s...done" (nth 1 method)) t)))) -(defun gnus-browse-mode () +(define-derived-mode gnus-browse-mode fundamental-mode "Browse Server" "Major mode for browsing a foreign server. All normal editing commands are switched off. @@ -884,20 +885,14 @@ 2) `\\[gnus-browse-read-group]' to read a group ephemerally. 3) `\\[gnus-browse-exit]' to return to the group buffer." - (interactive) - (kill-all-local-variables) (when (gnus-visual-p 'browse-menu 'menu) (gnus-browse-make-menu-bar)) (gnus-simplify-mode-line) - (setq major-mode 'gnus-browse-mode) - (setq mode-name "Browse Server") (setq mode-line-process nil) - (use-local-map gnus-browse-mode-map) (buffer-disable-undo) (setq truncate-lines t) (gnus-set-default-directory) - (setq buffer-read-only t) - (gnus-run-mode-hooks 'gnus-browse-mode-hook)) + (setq buffer-read-only t)) (defun gnus-browse-read-group (&optional no-article number) "Enter the group at the current line. @@ -1022,7 +1017,7 @@ (defun gnus-browse-exit () "Quit browsing and return to the group buffer." (interactive) - (when (eq major-mode 'gnus-browse-mode) + (when (derived-mode-p 'gnus-browse-mode) (gnus-kill-buffer (current-buffer))) ;; Insert the newly subscribed groups in the group buffer. (with-current-buffer gnus-group-buffer === modified file 'lisp/gnus/score-mode.el' --- lisp/gnus/score-mode.el 2013-01-01 09:11:05 +0000 +++ lisp/gnus/score-mode.el 2013-09-11 03:31:56 +0000 @@ -40,13 +40,13 @@ (defvar gnus-score-edit-exit-function nil "Function run on exit from the score buffer.") -(defvar gnus-score-mode-map nil) -(unless gnus-score-mode-map - (setq gnus-score-mode-map (make-sparse-keymap)) - (set-keymap-parent gnus-score-mode-map emacs-lisp-mode-map) - (define-key gnus-score-mode-map "\C-c\C-c" 'gnus-score-edit-exit) - (define-key gnus-score-mode-map "\C-c\C-d" 'gnus-score-edit-insert-date) - (define-key gnus-score-mode-map "\C-c\C-p" 'gnus-score-pretty-print)) +(defvar gnus-score-mode-map + (let ((map (make-sparse-keymap))) + (set-keymap-parent map emacs-lisp-mode-map) + (define-key map "\C-c\C-c" 'gnus-score-edit-exit) + (define-key map "\C-c\C-d" 'gnus-score-edit-insert-date) + (define-key map "\C-c\C-p" 'gnus-score-pretty-print) + map)) (defvar score-mode-syntax-table (let ((table (copy-syntax-table lisp-mode-syntax-table))) @@ -58,21 +58,13 @@ (defvar score-mode-coding-system mm-universal-coding-system) ;;;###autoload -(defun gnus-score-mode () +(define-derived-mode gnus-score-mode emacs-lisp-mode "Score" "Mode for editing Gnus score files. This mode is an extended emacs-lisp mode. \\{gnus-score-mode-map}" - (interactive) - (kill-all-local-variables) - (use-local-map gnus-score-mode-map) (gnus-score-make-menu-bar) - (set-syntax-table score-mode-syntax-table) - (setq major-mode 'gnus-score-mode) - (setq mode-name "Score") - (lisp-mode-variables nil) - (make-local-variable 'gnus-score-edit-exit-function) - (gnus-run-mode-hooks 'emacs-lisp-mode-hook 'gnus-score-mode-hook)) + (make-local-variable 'gnus-score-edit-exit-function)) (defun gnus-score-make-menu-bar () (unless (boundp 'gnus-score-menu) === modified file 'lisp/ibuffer.el' --- lisp/ibuffer.el 2013-08-10 15:17:29 +0000 +++ lisp/ibuffer.el 2013-09-11 03:31:56 +0000 @@ -156,7 +156,7 @@ (null buffer-file-name)) italic) (30 (memq major-mode ibuffer-help-buffer-modes) font-lock-comment-face) - (35 (eq major-mode 'dired-mode) font-lock-function-name-face)) + (35 (derived-mode-p 'dired-mode) font-lock-function-name-face)) "An alist describing how to fontify buffers. Each element should be of the form (PRIORITY FORM FACE), where PRIORITY is an integer, FORM is an arbitrary form to evaluate in the @@ -2358,7 +2358,7 @@ ;; We switch to the buffer's window in order to be able ;; to modify the value of point (select-window (get-buffer-window buf 0)) - (or (eq major-mode 'ibuffer-mode) + (or (derived-mode-p 'ibuffer-mode) (ibuffer-mode)) (setq ibuffer-restore-window-config-on-quit other-window-p) (when shrink @@ -2383,7 +2383,7 @@ (message "Commands: m, u, t, RET, g, k, S, D, Q; q to quit; h for help")))))) (put 'ibuffer-mode 'mode-class 'special) -(defun ibuffer-mode () +(define-derived-mode ibuffer-mode special-mode "IBuffer" "A major mode for viewing a list of buffers. In Ibuffer, you can conveniently perform many operations on the currently open buffers, in addition to filtering your view to a @@ -2564,10 +2564,6 @@ You may rearrange filter groups by using the regular '\\[ibuffer-kill-line]' and '\\[ibuffer-yank]' pair. Yanked groups will be inserted before the group at point." - (kill-all-local-variables) - (use-local-map ibuffer-mode-map) - (setq major-mode 'ibuffer-mode) - (setq mode-name "Ibuffer") ;; Include state info next to the mode name. (set (make-local-variable 'mode-line-process) '(" by " @@ -2627,13 +2623,12 @@ (ibuffer-update-format) (when ibuffer-default-directory (setq default-directory ibuffer-default-directory)) - (add-hook 'change-major-mode-hook 'font-lock-defontify nil t) - (run-mode-hooks 'ibuffer-mode-hook)) + (add-hook 'change-major-mode-hook 'font-lock-defontify nil t)) ;;; Start of automatically extracted autoloads. -;;;### (autoloads nil "ibuf-ext" "ibuf-ext.el" "d06b2735a74954e0c6922a811de7608c") +;;;### (autoloads nil "ibuf-ext" "ibuf-ext.el" "85795a4045d20654599b73b88e8e1bc9") ;;; Generated autoloads from ibuf-ext.el (autoload 'ibuffer-auto-mode "ibuf-ext" "\ === modified file 'lisp/info.el' --- lisp/info.el 2013-09-06 20:43:49 +0000 +++ lisp/info.el 2013-09-11 03:31:56 +0000 @@ -790,7 +790,7 @@ (defun info-setup (file-or-node buffer) "Display Info node FILE-OR-NODE in BUFFER." - (if (and buffer (not (eq major-mode 'Info-mode))) + (if (and buffer (not (derived-mode-p 'Info-mode))) (Info-mode)) (if file-or-node ;; If argument already contains parentheses, don't add another set @@ -931,7 +931,7 @@ (info-initialize) (setq filename (Info-find-file filename)) ;; Go into Info buffer. - (or (eq major-mode 'Info-mode) (switch-to-buffer "*info*")) + (or (derived-mode-p 'Info-mode) (switch-to-buffer "*info*")) ;; Record the node we are leaving, if we were in one. (and (not no-going-back) Info-current-file @@ -961,7 +961,7 @@ "Go to an Info node FILENAME and NODENAME, re-reading disk contents. When *info* is already displaying FILENAME and NODENAME, the window position is preserved, if possible." - (or (eq major-mode 'Info-mode) (switch-to-buffer "*info*")) + (or (derived-mode-p 'Info-mode) (switch-to-buffer "*info*")) (let ((old-filename Info-current-file) (old-nodename Info-current-node) (window-selected (eq (selected-window) (get-buffer-window))) @@ -1065,7 +1065,7 @@ (defun Info-find-node-2 (filename nodename &optional no-going-back strict-case) (buffer-disable-undo (current-buffer)) - (or (eq major-mode 'Info-mode) + (or (derived-mode-p 'Info-mode) (Info-mode)) (widen) (setq Info-current-node nil) @@ -2212,7 +2212,7 @@ (interactive) ;; In case another window is currently selected (save-window-excursion - (or (eq major-mode 'Info-mode) (switch-to-buffer "*info*")) + (or (derived-mode-p 'Info-mode) (switch-to-buffer "*info*")) (Info-goto-node (Info-extract-pointer "next")))) (defun Info-prev () @@ -2220,7 +2220,7 @@ (interactive) ;; In case another window is currently selected (save-window-excursion - (or (eq major-mode 'Info-mode) (switch-to-buffer "*info*")) + (or (derived-mode-p 'Info-mode) (switch-to-buffer "*info*")) (Info-goto-node (Info-extract-pointer "prev[ious]*" "previous")))) (defun Info-up (&optional same-file) @@ -2229,7 +2229,7 @@ (interactive) ;; In case another window is currently selected (save-window-excursion - (or (eq major-mode 'Info-mode) (switch-to-buffer "*info*")) + (or (derived-mode-p 'Info-mode) (switch-to-buffer "*info*")) (let ((old-node Info-current-node) (old-file Info-current-file) (node (Info-extract-pointer "up")) p) @@ -4082,7 +4082,7 @@ (defun Info-menu-update () "Update the Info menu for the current node." (condition-case nil - (if (or (not (eq major-mode 'Info-mode)) + (if (or (not (derived-mode-p 'Info-mode)) (equal (list Info-current-file Info-current-node) Info-menu-last-node)) () @@ -4285,7 +4285,7 @@ ;; When an Info buffer is killed, make sure the associated tags buffer ;; is killed too. (defun Info-kill-buffer () - (and (eq major-mode 'Info-mode) + (and (derived-mode-p 'Info-mode) Info-tag-table-buffer (kill-buffer Info-tag-table-buffer))) @@ -4302,10 +4302,11 @@ (copy-marker (marker-position m))) (make-marker)))))) -(defvar Info-edit-map (let ((map (make-sparse-keymap))) - (set-keymap-parent map text-mode-map) - (define-key map "\C-c\C-c" 'Info-cease-edit) - map) +(define-obsolete-variable-alias 'Info-edit-map 'Info-edit-mode-map "24.1") +(defvar Info-edit-mode-map (let ((map (make-sparse-keymap))) + (set-keymap-parent map text-mode-map) + (define-key map "\C-c\C-c" 'Info-cease-edit) + map) "Local keymap used within `e' command of Info.") (make-obsolete-variable 'Info-edit-map @@ -4315,19 +4316,14 @@ ;; Info-edit mode is suitable only for specially formatted data. (put 'Info-edit-mode 'mode-class 'special) -(defun Info-edit-mode () +(define-derived-mode Info-edit-mode text-mode "Info Edit" "Major mode for editing the contents of an Info node. Like text mode with the addition of `Info-cease-edit' which returns to Info mode for browsing. \\{Info-edit-map}" - (use-local-map Info-edit-map) - (setq major-mode 'Info-edit-mode) - (setq mode-name "Info Edit") - (kill-local-variable 'mode-line-buffer-identification) (setq buffer-read-only nil) (force-mode-line-update) - (buffer-enable-undo (current-buffer)) - (run-mode-hooks 'Info-edit-mode-hook)) + (buffer-enable-undo (current-buffer))) (make-obsolete 'Info-edit-mode "editing Info nodes by hand is not recommended." "24.4") @@ -4352,11 +4348,7 @@ (and (buffer-modified-p) (y-or-n-p "Save the file? ") (save-buffer)) - (use-local-map Info-mode-map) - (setq major-mode 'Info-mode) - (setq mode-name "Info") - (Info-set-mode-line) - (setq buffer-read-only t) + (Info-mode) (force-mode-line-update) (and (marker-position Info-tag-table-marker) (buffer-modified-p) @@ -4469,7 +4461,7 @@ ;; Get Info running, and pop to it in another window. (save-window-excursion (info)) - (or (eq major-mode 'Info-mode) (pop-to-buffer "*info*")) + (or (derived-mode-p 'Info-mode) (pop-to-buffer "*info*")) ;; Bind Info-history to nil, to prevent the last Index node ;; visited by Info-find-emacs-command-nodes from being ;; pushed onto the history. @@ -5133,7 +5125,7 @@ NODESPEC is a string of the form: (file)node." ;; Set up a buffer we can use to fake-out Info. (with-current-buffer (get-buffer-create " *info-browse-tmp*") - (if (not (equal major-mode 'Info-mode)) + (if (not (derived-mode-p 'Info-mode)) (Info-mode)) ;; Get the node into this buffer (if (not (string-match "^(\\([^)]+\\))\\([^.]+\\)$" nodespec)) === modified file 'lisp/locate.el' --- lisp/locate.el 2013-02-13 09:42:31 +0000 +++ lisp/locate.el 2013-09-11 03:31:56 +0000 @@ -95,7 +95,7 @@ ;; ;; (defadvice dired-make-relative (before set-no-error activate) ;; "For locate mode and Windows, don't return errors" -;; (if (and (eq major-mode 'locate-mode) +;; (if (and (derived-mode-p 'locate-mode) ;; (memq system-type '(windows-nt ms-dos))) ;; (ad-set-arg 2 t) ;; )) @@ -448,7 +448,7 @@ ;; Define a mode for locate ;; Default directory is set to "/" so that dired commands, which ;; expect to be in a tree, will work properly -(defun locate-mode () +(define-derived-mode locate-mode special-mode "Locate" "Major mode for the `*Locate*' buffer made by \\[locate]. \\\ In that buffer, you can use almost all the usual dired bindings. @@ -463,39 +463,31 @@ do not work in subdirectories. \\{locate-mode-map}" - ;; Not to be called interactively. - (kill-all-local-variables) ;; Avoid clobbering this variable (make-local-variable 'dired-subdir-alist) - (use-local-map locate-mode-map) - (setq major-mode 'locate-mode - mode-name "Locate" - default-directory "/" + (setq default-directory "/" buffer-read-only t selective-display t) (dired-alist-add-1 default-directory (point-min-marker)) (set (make-local-variable 'dired-directory) "/") (set (make-local-variable 'dired-subdir-switches) locate-ls-subdir-switches) (setq dired-switches-alist nil) - (make-local-variable 'directory-listing-before-filename-regexp) ;; This should support both Unix and Windoze style names - (setq directory-listing-before-filename-regexp - (concat "^.\\(" - (make-string (1- locate-filename-indentation) ?\s) - "\\)\\|" - (default-value 'directory-listing-before-filename-regexp))) - (make-local-variable 'dired-actual-switches) - (setq dired-actual-switches "") - (make-local-variable 'dired-permission-flags-regexp) - (setq dired-permission-flags-regexp - (concat "^.\\(" - (make-string (1- locate-filename-indentation) ?\s) - "\\)\\|" - (default-value 'dired-permission-flags-regexp))) - (make-local-variable 'revert-buffer-function) - (setq revert-buffer-function 'locate-update) - (set (make-local-variable 'page-delimiter) "\n\n") - (run-mode-hooks 'locate-mode-hook)) + (setq-local directory-listing-before-filename-regexp + (concat "^.\\(" + (make-string (1- locate-filename-indentation) ?\s) + "\\)\\|" + (default-value + 'directory-listing-before-filename-regexp))) + (setq-local dired-actual-switches "") + (setq-local dired-permission-flags-regexp + (concat "^.\\(" + (make-string (1- locate-filename-indentation) ?\s) + "\\)\\|" + (default-value 'dired-permission-flags-regexp))) + + (setq-local revert-buffer-function #'locate-update) + (setq-local page-delimiter "\n\n")) (put 'locate-mode 'derived-mode-parent 'dired-mode) (defun locate-do-setup (search-string) === modified file 'lisp/mail/mspools.el' --- lisp/mail/mspools.el 2013-01-01 09:11:05 +0000 +++ lisp/mail/mspools.el 2013-09-11 03:31:56 +0000 @@ -344,19 +344,13 @@ (interactive) (kill-buffer mspools-buffer)) -(defun mspools-mode () +(define-derived-mode mspools-mode special-mode "MSpools" "Major mode for output from mspools-show. \\Move point to one of the items in this buffer, then use \\[mspools-visit-spool] to go to the spool that the current line refers to. \\[revert-buffer] to regenerate the list of spools. \\{mspools-mode-map}" - (kill-all-local-variables) - (make-local-variable 'revert-buffer-function) - (setq revert-buffer-function 'mspools-revert-buffer) - (use-local-map mspools-mode-map) - (setq major-mode 'mspools-mode) - (setq mode-name "MSpools") - (run-mode-hooks 'mspools-mode-hook)) + (setq-local revert-buffer-function 'mspools-revert-buffer)) (defun mspools-get-spool-files () "Find the list of spool files and display them in *spools* buffer." === modified file 'lisp/mail/rmailsum.el' --- lisp/mail/rmailsum.el 2013-08-05 14:26:57 +0000 +++ lisp/mail/rmailsum.el 2013-09-11 03:31:56 +0000 @@ -408,7 +408,7 @@ (unless rmail-buffer (error "No RMAIL buffer found")) (let (mesg was-in-summary sumbuf) - (if (eq major-mode 'rmail-summary-mode) + (if (derived-mode-p 'rmail-summary-mode) (setq was-in-summary t)) (with-current-buffer rmail-buffer (setq rmail-summary-buffer (rmail-new-summary-1 desc redo function args) @@ -1035,7 +1035,7 @@ ;; Rmail Summary mode is suitable only for specially formatted data. (put 'rmail-summary-mode 'mode-class 'special) -(defun rmail-summary-mode () +(define-derived-mode rmail-summary-mode special-mode "RMAIL Summary" "Rmail Summary Mode is invoked from Rmail Mode by using \\\\[rmail-summary]. As commands are issued in the summary buffer, they are applied to the corresponding mail messages in the rmail buffer. @@ -1058,10 +1058,6 @@ \\[rmail-summary-sort-by-correspondent] Sort by correspondent. \\[rmail-summary-sort-by-lines] Sort by lines. \\[rmail-summary-sort-by-labels] Sort by labels." - (interactive) - (kill-all-local-variables) - (setq major-mode 'rmail-summary-mode) - (setq mode-name "RMAIL Summary") (setq truncate-lines t) (setq buffer-read-only t) (set-syntax-table text-mode-syntax-table) @@ -1074,8 +1070,7 @@ (make-local-variable 'revert-buffer-function) (make-local-variable 'font-lock-defaults) (setq font-lock-defaults '(rmail-summary-font-lock-keywords t)) - (rmail-summary-enable) - (run-mode-hooks 'rmail-summary-mode-hook)) + (rmail-summary-enable)) ;; Summary features need to be disabled during edit mode. (defun rmail-summary-disable () === modified file 'lisp/man.el' --- lisp/man.el 2013-05-18 23:18:16 +0000 +++ lisp/man.el 2013-09-11 03:31:56 +0000 @@ -413,7 +413,7 @@ (defvar Man-topic-history nil "Topic read history.") -(defvar man-mode-syntax-table +(defvar Man-mode-syntax-table (let ((table (copy-syntax-table (standard-syntax-table)))) (modify-syntax-entry ?. "w" table) (modify-syntax-entry ?_ "w" table) @@ -1350,7 +1350,7 @@ (put 'Man-mode 'mode-class 'special) -(defun Man-mode () +(define-derived-mode Man-mode fundamental-mode "Man" "A mode for browsing Un*x manual pages. The following man commands are available in the buffer. Try @@ -1387,11 +1387,7 @@ The following key bindings are currently in effect in the buffer: \\{Man-mode-map}" - (interactive) - (kill-all-local-variables) - (setq major-mode 'Man-mode - mode-name "Man" - buffer-auto-save-file-name nil + (setq buffer-auto-save-file-name nil mode-line-buffer-identification (list (default-value 'mode-line-buffer-identification) " {" 'Man-page-mode-string "}") @@ -1399,8 +1395,6 @@ buffer-read-only t) (buffer-disable-undo) (auto-fill-mode -1) - (use-local-map Man-mode-map) - (set-syntax-table man-mode-syntax-table) (setq imenu-generic-expression (list (list nil Man-heading-regexp 0))) (set (make-local-variable 'outline-regexp) Man-heading-regexp) (set (make-local-variable 'outline-level) (lambda () 1)) @@ -1409,8 +1403,7 @@ (Man-build-page-list) (Man-strip-page-headers) (Man-unindent) - (Man-goto-page 1 t) - (run-mode-hooks 'Man-mode-hook)) + (Man-goto-page 1 t)) (defsubst Man-build-section-alist () "Build the list of manpage sections." === modified file 'lisp/net/eudc-hotlist.el' --- lisp/net/eudc-hotlist.el 2013-03-05 17:13:01 +0000 +++ lisp/net/eudc-hotlist.el 2013-09-11 03:31:56 +0000 @@ -44,7 +44,7 @@ (define-key map "x" 'kill-this-buffer) map)) -(defun eudc-hotlist-mode () +(define-derived-mode eudc-hotlist-mode fundamental-mode "EUDC-Servers" "Major mode used to edit the hotlist of servers. These are the special commands of this mode: @@ -54,18 +54,12 @@ t -- Transpose the server at point and the previous one q -- Commit the changes and quit. x -- Quit without committing the changes." - (interactive) - (kill-all-local-variables) - (setq major-mode 'eudc-hotlist-mode) - (setq mode-name "EUDC-Servers") - (use-local-map eudc-hotlist-mode-map) (when (featurep 'xemacs) (setq mode-popup-menu eudc-hotlist-menu) (when (featurep 'menubar) (set-buffer-menubar current-menubar) (add-submenu nil (cons "EUDC-Hotlist" (cdr (cdr eudc-hotlist-menu)))))) - (setq buffer-read-only t) - (run-mode-hooks 'eudc-hotlist-mode-hook)) + (setq buffer-read-only t)) ;;;###autoload (defun eudc-edit-hotlist () @@ -76,10 +70,8 @@ (switch-to-buffer (get-buffer-create "*EUDC Servers*")) (setq buffer-read-only nil) (erase-buffer) - (mapc (function - (lambda (entry) - (setq proto-col (max (length (car entry)) proto-col)))) - eudc-server-hotlist) + (dolist (entry eudc-server-hotlist) + (setq proto-col (max (length (car entry)) proto-col))) (setq proto-col (+ 3 proto-col)) (setq gap (make-string (- proto-col 6) ?\ )) (insert " EUDC Servers\n" @@ -89,17 +81,16 @@ "------" gap "--------\n" "\n") (setq eudc-hotlist-list-beginning (point)) - (mapc (lambda (entry) - (insert (car entry)) - (indent-to proto-col) - (insert (symbol-name (cdr entry)) "\n")) - eudc-server-hotlist) - (eudc-hotlist-mode))) + (dolist (entry eudc-server-hotlist) + (insert (car entry)) + (indent-to proto-col) + (insert (symbol-name (cdr entry)) "\n")) + (eudc-hotlist-mode))) (defun eudc-hotlist-add-server () "Add a new server to the list after current one." (interactive) - (if (not (eq major-mode 'eudc-hotlist-mode)) + (if (not (derived-mode-p 'eudc-hotlist-mode)) (error "Not in a EUDC hotlist edit buffer")) (let ((server (read-from-minibuffer "Server: ")) (protocol (completing-read "Protocol: " @@ -117,7 +108,7 @@ (defun eudc-hotlist-delete-server () "Delete the server at point from the list." (interactive) - (if (not (eq major-mode 'eudc-hotlist-mode)) + (if (not (derived-mode-p 'eudc-hotlist-mode)) (error "Not in a EUDC hotlist edit buffer")) (let ((buffer-read-only nil)) (save-excursion @@ -130,7 +121,7 @@ (defun eudc-hotlist-quit-edit () "Quit the hotlist editing mode and save changes to the hotlist." (interactive) - (if (not (eq major-mode 'eudc-hotlist-mode)) + (if (not (derived-mode-p 'eudc-hotlist-mode)) (error "Not in a EUDC hotlist edit buffer")) (let (hotlist) (goto-char eudc-hotlist-list-beginning) @@ -149,7 +140,7 @@ (defun eudc-hotlist-select-server () "Select the server at point as the current server." (interactive) - (if (not (eq major-mode 'eudc-hotlist-mode)) + (if (not (derived-mode-p 'eudc-hotlist-mode)) (error "Not in a EUDC hotlist edit buffer")) (save-excursion (beginning-of-line) @@ -163,7 +154,7 @@ (defun eudc-hotlist-transpose-servers () "Swap the order of the server with the previous one in the list." (interactive) - (if (not (eq major-mode 'eudc-hotlist-mode)) + (if (not (derived-mode-p 'eudc-hotlist-mode)) (error "Not in a EUDC hotlist edit buffer")) (let ((buffer-read-only nil)) (save-excursion === modified file 'lisp/net/eudc.el' --- lisp/net/eudc.el 2013-09-05 03:30:07 +0000 +++ lisp/net/eudc.el 2013-09-11 03:31:56 +0000 @@ -652,7 +652,7 @@ result)) -(defun eudc-mode () +(define-derived-mode eudc-mode special-mode "EUDC" "Major mode used in buffers displaying the results of directory queries. There is no sense in calling this command from a buffer other than one containing the results of a directory query. @@ -663,15 +663,9 @@ n -- Move to next record. p -- Move to previous record. b -- Insert record at point into the BBDB database." - (interactive) - (kill-all-local-variables) - (setq major-mode 'eudc-mode) - (setq mode-name "EUDC") - (use-local-map eudc-mode-map) (if (not (featurep 'xemacs)) (easy-menu-define eudc-emacs-menu eudc-mode-map "" (eudc-menu)) - (setq mode-popup-menu (eudc-menu))) - (run-mode-hooks 'eudc-mode-hook)) + (setq mode-popup-menu (eudc-menu)))) ;;}}} @@ -1084,7 +1078,7 @@ (defun eudc-move-to-next-record () "Move to next record, in a buffer displaying directory query results." (interactive) - (if (not (eq major-mode 'eudc-mode)) + (if (not (derived-mode-p 'eudc-mode)) (error "Not in a EUDC buffer") (let ((pt (next-overlay-change (point)))) (if (< pt (point-max)) @@ -1094,7 +1088,7 @@ (defun eudc-move-to-previous-record () "Move to previous record, in a buffer displaying directory query results." (interactive) - (if (not (eq major-mode 'eudc-mode)) + (if (not (derived-mode-p 'eudc-mode)) (error "Not in a EUDC buffer") (let ((pt (previous-overlay-change (point)))) (if (> pt (point-min)) @@ -1122,7 +1116,7 @@ (overlay-get (car (overlays-at (point))) 'eudc-record)) :help "Insert record at point into the BBDB database"] ["Insert All Records into BBDB" eudc-batch-export-records-to-bbdb - (and (eq major-mode 'eudc-mode) + (and (derived-mode-p 'eudc-mode) (or (featurep 'bbdb) (prog1 (locate-library "bbdb") (message "")))) :help "Insert all the records returned by a directory query into BBDB"] === modified file 'lisp/net/mairix.el' --- lisp/net/mairix.el 2013-01-01 09:11:05 +0000 +++ lisp/net/mairix.el 2013-09-11 03:31:56 +0000 @@ -757,31 +757,24 @@ map) "'mairix-searches-mode' keymap.") -(defvar mairix-searches-mode-font-lock-keywords) +(defvar mairix-searches-mode-font-lock-keywords + '(("^\\([0-9]+\\)" + (1 font-lock-constant-face)) + ("^[0-9 ]+\\(Name:\\) \\(.*\\)" + (1 font-lock-keyword-face) (2 font-lock-string-face)) + ("^[ ]+\\(Query:\\) \\(.*\\) , " + (1 font-lock-keyword-face) (2 font-lock-string-face)) + (", \\(Threads:\\) \\(.*\\)" + (1 font-lock-keyword-face) (2 font-lock-constant-face)) + ("^\\([A-Z].*\\)$" + (1 font-lock-comment-face)) + ("^[ ]+\\(Folder:\\) \\(.*\\)" + (1 font-lock-keyword-face) (2 font-lock-string-face)))) -(defun mairix-searches-mode () +(define-derived-mode mairix-searches-mode fundamental-mode "mairix-searches" "Major mode for editing mairix searches." - (interactive) - (kill-all-local-variables) - (setq major-mode 'mairix-searches-mode) - (setq mode-name "mairix-searches") - (set-syntax-table text-mode-syntax-table) - (use-local-map mairix-searches-mode-map) - (make-local-variable 'font-lock-defaults) - (setq mairix-searches-mode-font-lock-keywords - (list (list "^\\([0-9]+\\)" - '(1 font-lock-constant-face)) - (list "^[0-9 ]+\\(Name:\\) \\(.*\\)" - '(1 font-lock-keyword-face) '(2 font-lock-string-face)) - (list "^[ ]+\\(Query:\\) \\(.*\\) , " - '(1 font-lock-keyword-face) '(2 font-lock-string-face)) - (list ", \\(Threads:\\) \\(.*\\)" - '(1 font-lock-keyword-face) '(2 font-lock-constant-face)) - (list "^\\([A-Z].*\\)$" - '(1 font-lock-comment-face)) - (list "^[ ]+\\(Folder:\\) \\(.*\\)" - '(1 font-lock-keyword-face) '(2 font-lock-string-face)))) - (setq font-lock-defaults '(mairix-searches-mode-font-lock-keywords))) + :syntax-table text-mode-syntax-table + (setq-local font-lock-defaults '(mairix-searches-mode-font-lock-keywords))) (defun mairix-build-search-list () "Display saved searches in current buffer." === modified file 'lisp/net/newst-treeview.el' --- lisp/net/newst-treeview.el 2013-01-01 09:11:05 +0000 +++ lisp/net/newst-treeview.el 2013-09-11 03:31:56 +0000 @@ -1909,13 +1909,9 @@ map) "Mode map for newsticker treeview.") -(defun newsticker-treeview-mode () +(define-derived-mode newsticker-treeview-mode fundamental-mode "Newsticker TV" "Major mode for Newsticker Treeview. \\{newsticker-treeview-mode-map}" - (kill-all-local-variables) - (use-local-map newsticker-treeview-mode-map) - (setq major-mode 'newsticker-treeview-mode) - (setq mode-name "Newsticker TV") (if (boundp 'tool-bar-map) (set (make-local-variable 'tool-bar-map) newsticker-treeview-tool-bar-map)) === modified file 'lisp/net/quickurl.el' --- lisp/net/quickurl.el 2013-03-12 02:08:21 +0000 +++ lisp/net/quickurl.el 2013-09-11 03:31:56 +0000 @@ -429,18 +429,12 @@ (put 'quickurl-list-mode 'mode-class 'special) ;;;###autoload -(defun quickurl-list-mode () +(define-derived-mode quickurl-list-mode fundamental-mode "quickurl list" "A mode for browsing the quickurl URL list. The key bindings for `quickurl-list-mode' are: \\{quickurl-list-mode-map}" - (interactive) - (kill-all-local-variables) - (use-local-map quickurl-list-mode-map) - (setq major-mode 'quickurl-list-mode - mode-name "quickurl list") - (run-mode-hooks 'quickurl-list-mode-hook) (setq buffer-read-only t truncate-lines t)) === modified file 'lisp/obsolete/options.el' --- lisp/obsolete/options.el 2013-05-24 03:42:55 +0000 +++ lisp/obsolete/options.el 2013-09-11 03:31:56 +0000 @@ -88,7 +88,7 @@ ;; Edit Options mode is suitable only for specially formatted data. (put 'Edit-options-mode 'mode-class 'special) -(defun Edit-options-mode () +(define-derived-mode Edit-options-mode emacs-lisp-mode "Options" "\\\ Major mode for editing Emacs user option settings. Special commands are: @@ -100,17 +100,9 @@ Each variable description is a paragraph. For convenience, the characters \\[backward-paragraph] and \\[forward-paragraph] move back and forward by paragraphs." - (kill-all-local-variables) - (set-syntax-table emacs-lisp-mode-syntax-table) - (use-local-map Edit-options-mode-map) - (make-local-variable 'paragraph-separate) - (setq paragraph-separate "[^\^@-\^?]") - (make-local-variable 'paragraph-start) - (setq paragraph-start "\t") - (setq truncate-lines t) - (setq major-mode 'Edit-options-mode) - (setq mode-name "Options") - (run-mode-hooks 'Edit-options-mode-hook)) + (setq-local paragraph-separate "[^\^@-\^?]") + (setq-local paragraph-start "\t") + (setq-local truncate-lines t)) (defun Edit-options-set () (interactive) (Edit-options-modify === modified file 'lisp/play/5x5.el' --- lisp/play/5x5.el 2013-01-01 09:11:05 +0000 +++ lisp/play/5x5.el 2013-09-11 03:31:56 +0000 @@ -185,19 +185,8 @@ ;; Gameplay functions. -(put '5x5-mode 'mode-class 'special) - -(defun 5x5-mode () - "A mode for playing `5x5'. - -The key bindings for `5x5-mode' are: - -\\{5x5-mode-map}" - (kill-all-local-variables) - (use-local-map 5x5-mode-map) - (setq major-mode '5x5-mode - mode-name "5x5") - (run-mode-hooks '5x5-mode-hook) +(define-derived-mode 5x5-mode special-mode "5x5" + "A mode for playing `5x5'." (setq buffer-read-only t truncate-lines t) (buffer-disable-undo)) === modified file 'lisp/play/blackbox.el' --- lisp/play/blackbox.el 2013-01-01 09:11:05 +0000 +++ lisp/play/blackbox.el 2013-09-11 03:31:56 +0000 @@ -113,9 +113,8 @@ map)) ;; Blackbox mode is suitable only for specially formatted data. -(put 'blackbox-mode 'mode-class 'special) -(defun blackbox-mode () +(define-derived-mode blackbox-mode special-mode "Blackbox" "Major mode for playing blackbox. To learn how to play blackbox, see the documentation for function `blackbox'. @@ -124,13 +123,7 @@ \\[bb-romp] -- send in a ray from point, or toggle a ball at point \\[bb-done] -- end game and get score" - (interactive) - (kill-all-local-variables) - (use-local-map blackbox-mode-map) - (setq truncate-lines t) - (setq major-mode 'blackbox-mode) - (setq mode-name "Blackbox") - (run-mode-hooks 'blackbox-mode-hook)) + (setq truncate-lines t)) ;;;###autoload (defun blackbox (num) === modified file 'lisp/play/landmark.el' --- lisp/play/landmark.el 2013-08-05 14:26:57 +0000 +++ lisp/play/landmark.el 2013-09-11 03:31:56 +0000 @@ -233,10 +233,8 @@ (put 'landmark-mode 'intangible 1) ;; This one is for when they set view-read-only to t: Landmark cannot ;; allow View Mode to be activated in its buffer. -(put 'landmark-mode 'mode-class 'special) - -(defun landmark-mode () - "Major mode for playing Landmark against Emacs. +(define-derived-mode lm-mode special-mode "Lm" + "Major mode for playing Lm against Emacs. You and Emacs play in turn by marking a free square. You mark it with X and Emacs marks it with O. The winner is the first to get five contiguous marks horizontally, vertically or in diagonal. @@ -247,16 +245,9 @@ \\{landmark-mode-map} Entry to this mode calls the value of `landmark-mode-hook' if that value is non-nil. One interesting value is `turn-on-font-lock'." - (interactive) - (kill-all-local-variables) - (setq major-mode 'landmark-mode - mode-name "Landmark") - (landmark-display-statistics) - (use-local-map landmark-mode-map) - (make-local-variable 'font-lock-defaults) - (setq font-lock-defaults '(landmark-font-lock-keywords t) - buffer-read-only t) - (run-mode-hooks 'landmark-mode-hook)) + (lm-display-statistics) + (setq-local font-lock-defaults '(lm-font-lock-keywords t)) + (setq buffer-read-only t)) ;;;_ + THE SCORE TABLE. === modified file 'lisp/play/mpuz.el' --- lisp/play/mpuz.el 2013-01-01 09:11:05 +0000 +++ lisp/play/mpuz.el 2013-09-11 03:31:56 +0000 @@ -94,7 +94,9 @@ map) "Local keymap to use in Mult Puzzle.") -(defun mpuz-mode () + + +(define-derived-mode mpuz-mode fundamental-mode "Mult Puzzle" "Multiplication puzzle mode. You have to guess which letters stand for which digits in the @@ -106,13 +108,7 @@ To leave the game to do other editing work, just switch buffers. Then you may resume the game with M-x mpuz. You may abort a game by typing \\\\[mpuz-offer-abort]." - (interactive) - (kill-all-local-variables) - (setq major-mode 'mpuz-mode - mode-name "Mult Puzzle" - tab-width 30) - (use-local-map mpuz-mode-map) - (run-mode-hooks 'mpuz-mode-hook)) + (setq tab-width 30)) ;; Some variables for statistics === modified file 'lisp/play/snake.el' --- lisp/play/snake.el 2013-01-01 09:11:05 +0000 +++ lisp/play/snake.el 2013-09-11 03:31:56 +0000 @@ -353,21 +353,13 @@ (put 'snake-mode 'mode-class 'special) -(defun snake-mode () - "A mode for playing Snake. - -Snake mode keybindings: - \\{snake-mode-map} -" - (kill-all-local-variables) +(define-derived-mode snake-mode special-mode "Snake" + "A mode for playing Snake." (add-hook 'kill-buffer-hook 'gamegrid-kill-timer nil t) (use-local-map snake-null-map) - (setq major-mode 'snake-mode) - (setq mode-name "Snake") - (unless (featurep 'emacs) (setq mode-popup-menu '("Snake Commands" @@ -382,9 +374,7 @@ (setq gamegrid-use-glyphs snake-use-glyphs-flag) (setq gamegrid-use-color snake-use-color-flag) - (gamegrid-init (snake-display-options)) - - (run-mode-hooks 'snake-mode-hook)) + (gamegrid-init (snake-display-options))) ;;;###autoload (defun snake () ------------------------------------------------------------ revno: 114198 fixes bug: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=15332 committer: Stefan Monnier branch nick: trunk timestamp: Tue 2013-09-10 23:31:06 -0400 message: * keyboard.c (read_char): Fix last change. diff: === modified file 'src/keyboard.c' --- src/keyboard.c 2013-09-11 02:41:00 +0000 +++ src/keyboard.c 2013-09-11 03:31:06 +0000 @@ -2597,7 +2597,7 @@ if (/* There currently is something in the echo area. */ !NILP (echo_area_buffer[0]) && (/* It's an echo from a different kboard. */ - || echo_kboard != current_kboard + echo_kboard != current_kboard /* Or we explicitly allow overwriting whatever there is. */ || ok_to_echo_at_next_pause == NULL)) cancel_echoing (); ------------------------------------------------------------ revno: 114197 fixes bug: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=15332 committer: Stefan Monnier branch nick: trunk timestamp: Tue 2013-09-10 22:41:00 -0400 message: * src/keyboard.c (read_char): Don't break immediate_echo. diff: === modified file 'src/ChangeLog' --- src/ChangeLog 2013-09-10 15:30:10 +0000 +++ src/ChangeLog 2013-09-11 02:41:00 +0000 @@ -1,3 +1,7 @@ +2013-09-11 Stefan Monnier + + * keyboard.c (read_char): Don't break immediate_echo (bug#15332). + 2013-09-10 Stefan Monnier * eval.c (Feval): Document the new use of `lexical'. === modified file 'src/keyboard.c' --- src/keyboard.c 2013-09-09 12:15:45 +0000 +++ src/keyboard.c 2013-09-11 02:41:00 +0000 @@ -2596,9 +2596,7 @@ if (/* There currently is something in the echo area. */ !NILP (echo_area_buffer[0]) - && (/* And it's either not from echoing. */ - !EQ (echo_area_buffer[0], echo_message_buffer) - /* Or it's an echo from a different kboard. */ + && (/* It's an echo from a different kboard. */ || echo_kboard != current_kboard /* Or we explicitly allow overwriting whatever there is. */ || ok_to_echo_at_next_pause == NULL)) ------------------------------------------------------------ revno: 114196 committer: Stefan Monnier branch nick: trunk timestamp: Tue 2013-09-10 21:43:07 -0400 message: * lisp/profiler.el (profiler-calltree-find): Use function-equal. diff: === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2013-09-10 20:38:52 +0000 +++ lisp/ChangeLog 2013-09-11 01:43:07 +0000 @@ -1,3 +1,7 @@ +2013-09-11 Stefan Monnier + + * profiler.el (profiler-calltree-find): Use function-equal. + 2013-09-10 Glenn Morris * files.el (interpreter-mode-alist): Convert to regexps. === modified file 'lisp/profiler.el' --- lisp/profiler.el 2013-06-21 00:53:33 +0000 +++ lisp/profiler.el 2013-09-11 01:43:07 +0000 @@ -256,10 +256,9 @@ (defun profiler-calltree-find (tree entry) "Return a child tree of ENTRY under TREE." (let (result (children (profiler-calltree-children tree))) - ;; FIXME: Use `assoc'. (while (and children (null result)) (let ((child (car children))) - (when (equal (profiler-calltree-entry child) entry) + (when (function-equal (profiler-calltree-entry child) entry) (setq result child)) (setq children (cdr children)))) result)) ------------------------------------------------------------ revno: 114195 committer: Glenn Morris branch nick: trunk timestamp: Tue 2013-09-10 16:46:25 -0400 message: Tweak previous change diff: === modified file 'lisp/progmodes/python.el' --- lisp/progmodes/python.el 2013-09-10 20:38:52 +0000 +++ lisp/progmodes/python.el 2013-09-10 20:46:25 +0000 @@ -225,7 +225,7 @@ ;;;###autoload (add-to-list 'auto-mode-alist (cons (purecopy "\\.py\\'") 'python-mode)) ;;;###autoload -(add-to-list 'interpreter-mode-alist (cons (purecopy "\\`python[23.]*\\'") 'python-mode)) +(add-to-list 'interpreter-mode-alist (cons (purecopy "\\`python[0-9.]*\\'") 'python-mode)) (defgroup python nil "Python Language's flying circus support for Emacs." ------------------------------------------------------------ revno: 114194 fixes bug: http://debbugs.gnu.org/15306 committer: Glenn Morris branch nick: trunk timestamp: Tue 2013-09-10 16:38:52 -0400 message: Treat interpreter-mode-alist as alist of regexps, not literals Cf http://lists.gnu.org/archive/html/emacs-devel/2005-08/msg00472.html * lisp/files.el (interpreter-mode-alist): Convert to regexps. (set-auto-mode): Adapt for this. * lisp/progmodes/cperl-mode.el (cperl-clobber-mode-lists): Comment out unused variable. * lisp/progmodes/cc-mode.el (interpreter-mode-alist): * lisp/progmodes/python.el (interpreter-mode-alist): * lisp/progmodes/ruby-mode.el (interpreter-mode-alist): Convert to regexps. * lisp/progmodes/sh-script.el (sh-set-shell): No longer use interpreter-mode-alist to get list of shells. * etc/NEWS: Mention this. diff: === modified file 'etc/NEWS' --- etc/NEWS 2013-09-10 15:30:10 +0000 +++ etc/NEWS 2013-09-10 20:38:52 +0000 @@ -614,6 +614,14 @@ ** `visited-file-modtime' now returns -1 for nonexistent files. Formerly it returned a list (-1 LOW USEC PSEC), but this was ambiguous in the presence of files with negative time stamps. + +** The cars of the elements in `interpreter-mode-alist' are now treated +as regexps rather than literal strings. For the time being, any +element whose car does not start with "\\" is still treated as a +literal string, so this change should not cause any incompatibilities +if you have code that just adds elements to the list, only if you are +actually using interpreter-mode-alist for something. + * Lisp Changes in Emacs 24.4 === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2013-09-10 20:28:22 +0000 +++ lisp/ChangeLog 2013-09-10 20:38:52 +0000 @@ -1,5 +1,15 @@ 2013-09-10 Glenn Morris + * files.el (interpreter-mode-alist): Convert to regexps. + (set-auto-mode): Adapt for this. (Bug#15306) + * progmodes/cperl-mode.el (cperl-clobber-mode-lists): + Comment out unused variable. + * progmodes/cc-mode.el (interpreter-mode-alist): + * progmodes/python.el (interpreter-mode-alist): + * progmodes/ruby-mode.el (interpreter-mode-alist): Convert to regexps. + * progmodes/sh-script.el (sh-set-shell): + No longer use interpreter-mode-alist to get list of shells. + * progmodes/cc-mode.el (awk-mode): Remove duplicate autoload. 2013-09-10 Stefan Monnier === modified file 'lisp/files.el' --- lisp/files.el 2013-08-23 18:58:41 +0000 +++ lisp/files.el 2013-09-10 20:38:52 +0000 @@ -2447,48 +2447,43 @@ (mapcar (lambda (l) (cons (purecopy (car l)) (cdr l))) - '(("perl" . perl-mode) - ("perl5" . perl-mode) - ("miniperl" . perl-mode) - ("wish" . tcl-mode) - ("wishx" . tcl-mode) - ("tcl" . tcl-mode) - ("tclsh" . tcl-mode) - ("expect" . tcl-mode) - ("scm" . scheme-mode) - ("ash" . sh-mode) - ("bash" . sh-mode) - ("bash2" . sh-mode) - ("csh" . sh-mode) - ("dtksh" . sh-mode) - ("es" . sh-mode) - ("itcsh" . sh-mode) - ("jsh" . sh-mode) - ("ksh" . sh-mode) - ("oash" . sh-mode) - ("pdksh" . sh-mode) - ("rbash" . sh-mode) - ("rc" . sh-mode) - ("rpm" . sh-mode) - ("sh" . sh-mode) - ("sh5" . sh-mode) - ("tcsh" . sh-mode) - ("wksh" . sh-mode) - ("wsh" . sh-mode) - ("zsh" . sh-mode) - ("tail" . text-mode) - ("more" . text-mode) - ("less" . text-mode) - ("pg" . text-mode) - ("make" . makefile-gmake-mode) ; Debian uses this - ("guile" . scheme-mode) - ("clisp" . lisp-mode) - ("emacs" . emacs-lisp-mode))) + '(("\\`\\(mini\\)?perl5?\\'" . perl-mode) + ("\\`wishx?\\'" . tcl-mode) + ("\\`tcl\\(sh\\)?\\'" . tcl-mode) + ("\\`expect\\'" . tcl-mode) + ("\\`scm\\'" . scheme-mode) + ("\\`[acjkwz]sh\\'" . sh-mode) + ("\\`bash2?\\'" . sh-mode) + ("\\`dtksh\\'" . sh-mode) + ("\\`es\\'" . sh-mode) + ("\\`itcsh\\'" . sh-mode) + ("\\`oash\\'" . sh-mode) + ("\\`pdksh\\'" . sh-mode) + ("\\`rbash\\'" . sh-mode) + ("\\`rc\\'" . sh-mode) + ("\\`rpm\\'" . sh-mode) + ("\\`sh5?\\'" . sh-mode) + ("\\`tcsh\\'" . sh-mode) + ("\\`wksh\\'" . sh-mode) + ("\\`tail\\'" . text-mode) + ("\\`more\\'" . text-mode) + ("\\`less\\'" . text-mode) + ("\\`pg\\'" . text-mode) + ("\\`make\\'" . makefile-gmake-mode) ; Debian uses this + ("\\`guile\\'" . scheme-mode) + ("\\`clisp\\'" . lisp-mode) + ("\\`emacs\\'" . emacs-lisp-mode))) "Alist mapping interpreter names to major modes. This is used for files whose first lines match `auto-mode-interpreter-regexp'. -Each element looks like (INTERPRETER . MODE). -If INTERPRETER matches the name of the interpreter specified in the first line -of a script, mode MODE is enabled. +Each element looks like (REGEXP . MODE). +If REGEXP matches the name (minus any directory part) of the interpreter +specified in the first line of a script, enable major mode MODE. + +Emacs versions earlier than 24.4 treat the car of each element as a +literal string that must match the entire name, rather than a regexp. +For backwards compatibility, any REGEXP that does not begin with \"\\\\\" +continues to be treated in this way. This behavior may be removed in +future and should not be relied upon. See also `auto-mode-alist'.") @@ -2683,19 +2678,27 @@ ;; If we didn't, look for an interpreter specified in the first line. ;; As a special case, allow for things like "#!/bin/env perl", which ;; finds the interpreter anywhere in $PATH. - (unless done - (setq mode (save-excursion - (goto-char (point-min)) - (if (looking-at auto-mode-interpreter-regexp) - (match-string 2) - "")) - ;; Map interpreter name to a mode, signaling we're done at the - ;; same time. - done (assoc (file-name-nondirectory mode) - interpreter-mode-alist)) - ;; If we found an interpreter mode to use, invoke it now. - (if done - (set-auto-mode-0 (cdr done) keep-mode-if-same))) + (and (not done) + (setq mode (save-excursion + (goto-char (point-min)) + (if (looking-at auto-mode-interpreter-regexp) + (match-string 2)))) + ;; Map interpreter name to a mode, signaling we're done at the + ;; same time. + (setq done (assoc-default + (file-name-nondirectory mode) + ;; Backwards compat: if car of i-m-alist does not start + ;; with "\\", treat as literal string. + (mapcar (lambda (e) + (if (string-match-p "\\`\\\\" (car e)) + e + (cons + (format "\\`%s\\'" (regexp-quote (car e))) + (cdr e)))) + interpreter-mode-alist) + #'string-match-p)) + ;; If we found an interpreter mode to use, invoke it now. + (set-auto-mode-0 done keep-mode-if-same)) ;; Next try matching the buffer beginning against magic-mode-alist. (unless done (if (setq done (save-excursion === modified file 'lisp/progmodes/cc-mode.el' --- lisp/progmodes/cc-mode.el 2013-09-10 20:28:22 +0000 +++ lisp/progmodes/cc-mode.el 2013-09-10 20:38:52 +0000 @@ -1555,7 +1555,7 @@ (cons "Pike" (c-lang-const c-mode-menu pike))) ;;;###autoload (add-to-list 'auto-mode-alist '("\\.\\(u?lpc\\|pike\\|pmod\\(\\.in\\)?\\)\\'" . pike-mode)) -;;;###autoload (add-to-list 'interpreter-mode-alist '("pike" . pike-mode)) +;;;###autoload (add-to-list 'interpreter-mode-alist '("\\`pike\\'" . pike-mode)) ;;;###autoload (define-derived-mode pike-mode prog-mode "Pike" @@ -1589,10 +1589,7 @@ ;; Support for AWK ;;;###autoload (add-to-list 'auto-mode-alist '("\\.awk\\'" . awk-mode)) -;;;###autoload (add-to-list 'interpreter-mode-alist '("awk" . awk-mode)) -;;;###autoload (add-to-list 'interpreter-mode-alist '("mawk" . awk-mode)) -;;;###autoload (add-to-list 'interpreter-mode-alist '("nawk" . awk-mode)) -;;;###autoload (add-to-list 'interpreter-mode-alist '("gawk" . awk-mode)) +;;;###autoload (add-to-list 'interpreter-mode-alist '("\\`[gmn]?awk\\'" . awk-mode)) (c-define-abbrev-table 'awk-mode-abbrev-table '(("else" "else" c-electric-continued-statement 0) === modified file 'lisp/progmodes/cperl-mode.el' --- lisp/progmodes/cperl-mode.el 2013-06-19 07:24:44 +0000 +++ lisp/progmodes/cperl-mode.el 2013-09-10 20:38:52 +0000 @@ -412,15 +412,15 @@ "use cperl-vc-rcs-header or cperl-vc-sccs-header instead." "22.1") -(defcustom cperl-clobber-mode-lists - (not - (and - (boundp 'interpreter-mode-alist) - (assoc "miniperl" interpreter-mode-alist) - (assoc "\\.\\([pP][Llm]\\|al\\)$" auto-mode-alist))) - "*Whether to install us into `interpreter-' and `extension' mode lists." - :type 'boolean - :group 'cperl) +;;; (defcustom cperl-clobber-mode-lists +;;; (not +;;; (and +;;; (boundp 'interpreter-mode-alist) +;;; (assoc "miniperl" interpreter-mode-alist) +;;; (assoc "\\.\\([pP][Llm]\\|al\\)$" auto-mode-alist))) +;;; "*Whether to install us into `interpreter-' and `extension' mode lists." +;;; :type 'boolean +;;; :group 'cperl) (defcustom cperl-info-on-command-no-prompt nil "*Not-nil (and non-null) means not to prompt on C-h f. === modified file 'lisp/progmodes/python.el' --- lisp/progmodes/python.el 2013-09-09 16:26:38 +0000 +++ lisp/progmodes/python.el 2013-09-10 20:38:52 +0000 @@ -225,7 +225,7 @@ ;;;###autoload (add-to-list 'auto-mode-alist (cons (purecopy "\\.py\\'") 'python-mode)) ;;;###autoload -(add-to-list 'interpreter-mode-alist (cons (purecopy "python") 'python-mode)) +(add-to-list 'interpreter-mode-alist (cons (purecopy "\\`python[23.]*\\'") 'python-mode)) (defgroup python nil "Python Language's flying circus support for Emacs." === modified file 'lisp/progmodes/ruby-mode.el' --- lisp/progmodes/ruby-mode.el 2013-09-05 13:05:01 +0000 +++ lisp/progmodes/ruby-mode.el 2013-09-10 20:38:52 +0000 @@ -1968,8 +1968,7 @@ "\\)\\'")) 'ruby-mode)) ;;;###autoload -(dolist (name (list "ruby" "rbx" "jruby" "ruby1.9" "ruby1.8")) - (add-to-list 'interpreter-mode-alist (cons (purecopy name) 'ruby-mode))) +(add-to-list 'interpreter-mode-alist (cons (purecopy "\\`\\(rbx\\|j?ruby\\(1\\.[89]\\)?\\)\\'") 'ruby-mode)) (provide 'ruby-mode) === modified file 'lisp/progmodes/sh-script.el' --- lisp/progmodes/sh-script.el 2013-08-29 01:02:46 +0000 +++ lisp/progmodes/sh-script.el 2013-09-10 20:38:52 +0000 @@ -2170,11 +2170,18 @@ controls whether to query about making the visited file executable. Calls the value of `sh-set-shell-hook' if set." - (interactive (list (completing-read (format "Shell \(default %s\): " - sh-shell-file) - interpreter-mode-alist - (lambda (x) (eq (cdr x) 'sh-mode)) - nil nil nil sh-shell-file) + (interactive (list (completing-read + (format "Shell \(default %s\): " + sh-shell-file) + ;; This used to use interpreter-mode-alist, but that is + ;; no longer appropriate now that uses regexps. + ;; Maybe there could be a separate variable that lists + ;; the shells, used here and to construct i-mode-alist. + ;; But the following is probably good enough: + (append (mapcar (lambda (e) (symbol-name (car e))) + sh-ancestor-alist) + '("csh" "rc" "sh")) + nil nil nil nil sh-shell-file) (eq executable-query 'function) t)) (if (string-match "\\.exe\\'" shell) ------------------------------------------------------------ revno: 114193 committer: Glenn Morris branch nick: trunk timestamp: Tue 2013-09-10 16:28:22 -0400 message: * lisp/progmodes/cc-mode.el (awk-mode): Remove duplicate autoload. Autoload of define-derived-mode works just fine. diff: === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2013-09-10 17:13:48 +0000 +++ lisp/ChangeLog 2013-09-10 20:28:22 +0000 @@ -1,3 +1,7 @@ +2013-09-10 Glenn Morris + + * progmodes/cc-mode.el (awk-mode): Remove duplicate autoload. + 2013-09-10 Stefan Monnier * simple.el: Use set-temporary-overlay-map for universal-argument. === modified file 'lisp/progmodes/cc-mode.el' --- lisp/progmodes/cc-mode.el 2013-08-28 23:31:06 +0000 +++ lisp/progmodes/cc-mode.el 2013-09-10 20:28:22 +0000 @@ -1594,10 +1594,6 @@ ;;;###autoload (add-to-list 'interpreter-mode-alist '("nawk" . awk-mode)) ;;;###autoload (add-to-list 'interpreter-mode-alist '("gawk" . awk-mode)) -;;; Autoload directives must be on the top level, so we construct an -;;; autoload form instead. -;;;###autoload (autoload 'awk-mode "cc-mode" "Major mode for editing AWK code." t) - (c-define-abbrev-table 'awk-mode-abbrev-table '(("else" "else" c-electric-continued-statement 0) ("while" "while" c-electric-continued-statement 0)) ------------------------------------------------------------ revno: 114192 committer: Stefan Monnier branch nick: trunk timestamp: Tue 2013-09-10 13:13:48 -0400 message: * lisp/simple.el: Use set-temporary-overlay-map for universal-argument. (universal-argument-map): Don't use default-bindings. Bind switch-frame explicitly. Replace universal-argument-minus with a conditional binding. (universal-argument-num-events, saved-overriding-map): Remove. (restore-overriding-map): Remove. (universal-argument--mode): Rename from save&set-overriding-map, and rewrite. (universal-argument, universal-argument-more, negative-argument) (digit-argument): Adjust accordingly. (universal-argument-minus): Remove. (universal-argument-other-key): Remove. diff: === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2013-09-10 15:30:10 +0000 +++ lisp/ChangeLog 2013-09-10 17:13:48 +0000 @@ -1,5 +1,18 @@ 2013-09-10 Stefan Monnier + * simple.el: Use set-temporary-overlay-map for universal-argument. + (universal-argument-map): Don't use default-bindings. + Bind switch-frame explicitly. Replace universal-argument-minus with + a conditional binding. + (universal-argument-num-events, saved-overriding-map): Remove. + (restore-overriding-map): Remove. + (universal-argument--mode): Rename from save&set-overriding-map, + and rewrite. + (universal-argument, universal-argument-more, negative-argument) + (digit-argument): Adjust accordingly. + (universal-argument-minus): Remove. + (universal-argument-other-key): Remove. + * subr.el (with-demoted-errors): Add `format' argument. 2013-09-10 Michael Albinus === modified file 'lisp/simple.el' --- lisp/simple.el 2013-09-10 07:21:19 +0000 +++ lisp/simple.el 2013-09-10 17:13:48 +0000 @@ -3180,12 +3180,18 @@ nil) (defvar universal-argument-map - (let ((map (make-sparse-keymap))) - (define-key map [t] 'universal-argument-other-key) - (define-key map (vector meta-prefix-char t) 'universal-argument-other-key) - (define-key map [switch-frame] nil) + (let ((map (make-sparse-keymap)) + (universal-argument-minus + ;; For backward compatibility, minus with no modifiers is an ordinary + ;; command if digits have already been entered. + `(menu-item "" negative-argument + :filter ,(lambda (cmd) + (if (integerp prefix-arg) nil cmd))))) + (define-key map [switch-frame] + (lambda (e) (interactive "e") + (handle-switch-frame e) (universal-argument--mode))) (define-key map [?\C-u] 'universal-argument-more) - (define-key map [?-] 'universal-argument-minus) + (define-key map [?-] universal-argument-minus) (define-key map [?0] 'digit-argument) (define-key map [?1] 'digit-argument) (define-key map [?2] 'digit-argument) @@ -3206,30 +3212,12 @@ (define-key map [kp-7] 'digit-argument) (define-key map [kp-8] 'digit-argument) (define-key map [kp-9] 'digit-argument) - (define-key map [kp-subtract] 'universal-argument-minus) + (define-key map [kp-subtract] universal-argument-minus) map) "Keymap used while processing \\[universal-argument].") -(defvar universal-argument-num-events nil - "Number of argument-specifying events read by `universal-argument'. -`universal-argument-other-key' uses this to discard those events -from (this-command-keys), and reread only the final command.") - -(defvar saved-overriding-map t - "The saved value of `overriding-terminal-local-map'. -That variable gets restored to this value on exiting \"universal -argument mode\".") - -(defun save&set-overriding-map (map) - "Set `overriding-terminal-local-map' to MAP." - (when (eq saved-overriding-map t) - (setq saved-overriding-map overriding-terminal-local-map) - (setq overriding-terminal-local-map map))) - -(defun restore-overriding-map () - "Restore `overriding-terminal-local-map' to its saved value." - (setq overriding-terminal-local-map saved-overriding-map) - (setq saved-overriding-map t)) +(defun universal-argument--mode () + (set-temporary-overlay-map universal-argument-map)) (defun universal-argument () "Begin a numeric argument for the following command. @@ -3243,33 +3231,27 @@ These commands include \\[set-mark-command] and \\[start-kbd-macro]." (interactive) (setq prefix-arg (list 4)) - (setq universal-argument-num-events (length (this-command-keys))) - (save&set-overriding-map universal-argument-map)) + (universal-argument--mode)) -;; A subsequent C-u means to multiply the factor by 4 if we've typed -;; nothing but C-u's; otherwise it means to terminate the prefix arg. (defun universal-argument-more (arg) + ;; A subsequent C-u means to multiply the factor by 4 if we've typed + ;; nothing but C-u's; otherwise it means to terminate the prefix arg. (interactive "P") - (if (consp arg) - (setq prefix-arg (list (* 4 (car arg)))) - (if (eq arg '-) - (setq prefix-arg (list -4)) - (setq prefix-arg arg) - (restore-overriding-map))) - (setq universal-argument-num-events (length (this-command-keys)))) + (setq prefix-arg (if (consp arg) + (list (* 4 (car arg))) + (if (eq arg '-) + (list -4) + arg))) + (when (consp prefix-arg) (universal-argument--mode))) (defun negative-argument (arg) "Begin a negative numeric argument for the next command. \\[universal-argument] following digits or minus sign ends the argument." (interactive "P") - (cond ((integerp arg) - (setq prefix-arg (- arg))) - ((eq arg '-) - (setq prefix-arg nil)) - (t - (setq prefix-arg '-))) - (setq universal-argument-num-events (length (this-command-keys))) - (save&set-overriding-map universal-argument-map)) + (setq prefix-arg (cond ((integerp arg) (- arg)) + ((eq arg '-) nil) + (t '-))) + (universal-argument--mode)) (defun digit-argument (arg) "Part of the numeric argument for the next command. @@ -3279,37 +3261,15 @@ last-command-event (get last-command-event 'ascii-character))) (digit (- (logand char ?\177) ?0))) - (cond ((integerp arg) - (setq prefix-arg (+ (* arg 10) - (if (< arg 0) (- digit) digit)))) - ((eq arg '-) - ;; Treat -0 as just -, so that -01 will work. - (setq prefix-arg (if (zerop digit) '- (- digit)))) - (t - (setq prefix-arg digit)))) - (setq universal-argument-num-events (length (this-command-keys))) - (save&set-overriding-map universal-argument-map)) - -;; For backward compatibility, minus with no modifiers is an ordinary -;; command if digits have already been entered. -(defun universal-argument-minus (arg) - (interactive "P") - (if (integerp arg) - (universal-argument-other-key arg) - (negative-argument arg))) - -;; Anything else terminates the argument and is left in the queue to be -;; executed as a command. -(defun universal-argument-other-key (arg) - (interactive "P") - (setq prefix-arg arg) - (let* ((key (this-command-keys)) - (keylist (listify-key-sequence key))) - (setq unread-command-events - (append (nthcdr universal-argument-num-events keylist) - unread-command-events))) - (reset-this-command-lengths) - (restore-overriding-map)) + (setq prefix-arg (cond ((integerp arg) + (+ (* arg 10) + (if (< arg 0) (- digit) digit))) + ((eq arg '-) + ;; Treat -0 as just -, so that -01 will work. + (if (zerop digit) '- (- digit))) + (t + digit)))) + (universal-argument--mode)) (defvar filter-buffer-substring-functions nil ------------------------------------------------------------ revno: 114191 committer: Stefan Monnier branch nick: trunk timestamp: Tue 2013-09-10 11:30:10 -0400 message: * lisp/subr.el (with-demoted-errors): Add `format' argument. * src/eval.c (Feval): Document the new use of `lexical'. diff: === modified file 'etc/NEWS' --- etc/NEWS 2013-09-08 23:50:23 +0000 +++ etc/NEWS 2013-09-10 15:30:10 +0000 @@ -617,6 +617,9 @@ * Lisp Changes in Emacs 24.4 +** The second argument of `eval' can now be a lexical-environment. + +** `with-demoted-errors' takes an additional argument `format'. +++ ** New function `define-error'. === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2013-09-10 07:45:33 +0000 +++ lisp/ChangeLog 2013-09-10 15:30:10 +0000 @@ -1,3 +1,7 @@ +2013-09-10 Stefan Monnier + + * subr.el (with-demoted-errors): Add `format' argument. + 2013-09-10 Michael Albinus * net/tramp.el (tramp-cleanup): Remove. Functionality added to @@ -10,11 +14,11 @@ * net/tramp-adb.el (tramp-adb-maybe-open-connection): * net/tramp-sh.el (tramp-open-connection-setup-interactive-shell) (tramp-maybe-open-connection): - * net/tramp-smb.el (tramp-smb-maybe-open-connection): Use - `tramp-cleanup-connection'. + * net/tramp-smb.el (tramp-smb-maybe-open-connection): + Use `tramp-cleanup-connection'. - * net/tramp-sh.el (tramp-maybe-open-connection): Catch - 'uname-changed inside the progress reporter. + * net/tramp-sh.el (tramp-maybe-open-connection): + Catch 'uname-changed inside the progress reporter. 2013-09-10 Glenn Morris @@ -34,15 +38,15 @@ * net/tramp.el (tramp-find-method, tramp-find-user): Call `propertize' only if it is bound. It isn't for XEmacs. - (with-tramp-progress-reporter): Do not let-bind `result'. This - yields to scoping errors in XEmacs. + (with-tramp-progress-reporter): Do not let-bind `result'. + This yields to scoping errors in XEmacs. (tramp-handle-make-auto-save-file-name): New function, moved from tramp-sh.el. * net/tramp-adb.el (tramp-adb-file-name-handler-alist): Add handler for `make-auto-save-file-name'. - (tramp-adb--gnu-switches-to-ash): Use - `tramp-compat-replace-regexp-in-string'. + (tramp-adb--gnu-switches-to-ash): + Use `tramp-compat-replace-regexp-in-string'. * net/tramp-cache.el (tramp-cache-print): Call `substring-no-properties' only if it is bound. It isn't for XEmacs. @@ -50,8 +54,8 @@ * net/tramp-cmds.el (tramp-bug): Call `propertize' only if it is bound. It isn't for XEmacs. - * net/tramp-compat.el (tramp-compat-copy-file): Catch - `wrong-number-of-arguments' error. + * net/tramp-compat.el (tramp-compat-copy-file): + Catch `wrong-number-of-arguments' error. (tramp-compat-replace-regexp-in-string): New defun. * net/tramp-gvfs.el (tramp-gvfs-file-name-handler-alist): Add handler @@ -62,21 +66,21 @@ (tramp-gvfs-file-name): Use `tramp-compat-replace-regexp-in-string'. (tramp-synce-list-devices): Use `push' instead of `pushnew'. - * net/tramp-gw.el (tramp-gw-open-network-stream): Use - `tramp-compat-replace-regexp-in-string'. + * net/tramp-gw.el (tramp-gw-open-network-stream): + Use `tramp-compat-replace-regexp-in-string'. - * net/tramp-sh.el (tramp-sh-file-name-handler-alist): Call - `tramp-handle-make-auto-save-file-name'. + * net/tramp-sh.el (tramp-sh-file-name-handler-alist): + Call `tramp-handle-make-auto-save-file-name'. (tramp-sh-handle-make-auto-save-file-name): Move to tramp.el. (tramp-sh-file-gvfs-monitor-dir-process-filter) - (tramp-sh-file-inotifywait-process-filter): Use - `tramp-compat-replace-regexp-in-string'. + (tramp-sh-file-inotifywait-process-filter): + Use `tramp-compat-replace-regexp-in-string'. (tramp-compute-multi-hops): Use `push' instead of `pushnew'. * net/tramp-smb.el (tramp-smb-file-name-handler-alist): Add handler for `make-auto-save-file-name'. - (tramp-smb-handle-copy-directory): Call - `tramp-compat-replace-regexp-in-string'. + (tramp-smb-handle-copy-directory): + Call `tramp-compat-replace-regexp-in-string'. (tramp-smb-get-file-entries): Use `push' instead of `pushnew'. (tramp-smb-handle-copy-file): Improve error message. (tramp-smb-handle-rename-file): Rename directly only in case @@ -95,8 +99,8 @@ * progmodes/cc-langs.el (c-type-decl-suffix-key): Now matches ")" in Java Mode. (c-recognize-typeless-decls): Set the Java value to t. - * progmodes/cc-engine.el (c-forward-decl-or-cast-1): While - handling a "(", add a check for, effectively, Java, and handle a + * progmodes/cc-engine.el (c-forward-decl-or-cast-1): + While handling a "(", add a check for, effectively, Java, and handle a "typeless" declaration there. 2013-09-07 Roland Winkler === modified file 'lisp/subr.el' --- lisp/subr.el 2013-09-05 03:46:34 +0000 +++ lisp/subr.el 2013-09-10 15:30:10 +0000 @@ -3350,16 +3350,22 @@ (define-obsolete-function-alias 'condition-case-no-debug 'condition-case-unless-debug "24.1") -(defmacro with-demoted-errors (&rest body) +(defmacro with-demoted-errors (format &rest body) "Run BODY and demote any errors to simple messages. If `debug-on-error' is non-nil, run BODY without catching its errors. This is to be used around code which is not expected to signal an error -but which should be robust in the unexpected case that an error is signaled." - (declare (debug t) (indent 0)) - (let ((err (make-symbol "err"))) +but which should be robust in the unexpected case that an error is signaled. +For backward compatibility, if FORMAT is not a constant string, it +is assumed to be part of BODY, in which case the message format +used is \"Error: %S\"." + (declare (debug t) (indent 1)) + (let ((err (make-symbol "err")) + (format (if (and (stringp format) body) format + (prog1 "Error: %S" + (if format (push format body)))))) `(condition-case-unless-debug ,err - (progn ,@body) - (error (message "Error: %S" ,err) nil)))) + ,(macroexp-progn body) + (error (message ,format ,err) nil)))) (defmacro combine-after-change-calls (&rest body) "Execute BODY, but don't call the after-change functions till the end. === modified file 'src/ChangeLog' --- src/ChangeLog 2013-09-09 16:47:43 +0000 +++ src/ChangeLog 2013-09-10 15:30:10 +0000 @@ -1,3 +1,7 @@ +2013-09-10 Stefan Monnier + + * eval.c (Feval): Document the new use of `lexical'. + 2013-09-09 Dmitry Antipov Review and drop old frame resize hack. @@ -20,8 +24,8 @@ 2013-09-09 Dmitry Antipov Cleanup frame flushing. - * dispextern.h (struct redisplay_interface): Drop - flush_display_optional because flush_display is enough + * dispextern.h (struct redisplay_interface): + Drop flush_display_optional because flush_display is enough for X and flushing via RIF is just a no-op for others. * frame.h (flush_frame): New function. * dispnew.c (update_frame): === modified file 'src/eval.c' --- src/eval.c 2013-09-06 14:28:05 +0000 +++ src/eval.c 2013-09-10 15:30:10 +0000 @@ -2033,7 +2033,9 @@ DEFUN ("eval", Feval, Seval, 1, 2, 0, doc: /* Evaluate FORM and return its value. -If LEXICAL is t, evaluate using lexical scoping. */) +If LEXICAL is t, evaluate using lexical scoping. +LEXICAL can also be an actual lexical environment, in the form of an +alist mapping symbols to their value. */) (Lisp_Object form, Lisp_Object lexical) { ptrdiff_t count = SPECPDL_INDEX (); ------------------------------------------------------------ revno: 114190 committer: Glenn Morris branch nick: trunk timestamp: Tue 2013-09-10 06:21:34 -0400 message: Auto-commit of loaddefs files. diff: === modified file 'lisp/dired.el' --- lisp/dired.el 2013-09-07 10:21:22 +0000 +++ lisp/dired.el 2013-09-10 10:21:34 +0000 @@ -4352,7 +4352,7 @@ ;;;*** -;;;### (autoloads nil "dired-x" "dired-x.el" "1bf4009b81e55bf51947bc87b2c82994") +;;;### (autoloads nil "dired-x" "dired-x.el" "11fd4a8afa32507cc32d4a04d852587f") ;;; Generated autoloads from dired-x.el (autoload 'dired-jump "dired-x" "\ ------------------------------------------------------------ revno: 114189 committer: Glenn Morris branch nick: trunk timestamp: Tue 2013-09-10 06:17:40 -0400 message: Auto-commit of generated files. diff: === modified file 'autogen/configure' --- autogen/configure 2013-09-09 10:17:42 +0000 +++ autogen/configure 2013-09-10 10:17:40 +0000 @@ -8779,7 +8779,7 @@ fi -late_LDFLAGS=$LDFLAGS +late_LDFLAGS="$LDFLAGS" if test x$GCC = xyes; then LDFLAGS_NOCOMBRELOC="-Wl,-znocombreloc" else @@ -8812,7 +8812,7 @@ rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext -LDFLAGS=$late_LDFLAGS +LDFLAGS="$late_LDFLAGS" test "x$CANNOT_DUMP" = "x" && CANNOT_DUMP=no case "$opsys" in ------------------------------------------------------------ revno: 114188 committer: Michael Albinus branch nick: trunk timestamp: Tue 2013-09-10 09:45:33 +0200 message: * net/tramp.el (tramp-cleanup): Remove. Functionality added to `tramp-cleanup-connection'. * net/tramp-cmds.el (tramp-cleanup-connection): Add optional parameters KEEP-DEBUG and KEEP-PASSWORD. * net/tramp.el (tramp-file-name-handler): * net/tramp-adb.el (tramp-adb-maybe-open-connection): * net/tramp-sh.el (tramp-open-connection-setup-interactive-shell) (tramp-maybe-open-connection): * net/tramp-smb.el (tramp-smb-maybe-open-connection): Use `tramp-cleanup-connection'. * net/tramp-sh.el (tramp-maybe-open-connection): Catch 'uname-changed inside the progress reporter. diff: === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2013-09-10 07:21:19 +0000 +++ lisp/ChangeLog 2013-09-10 07:45:33 +0000 @@ -1,3 +1,21 @@ +2013-09-10 Michael Albinus + + * net/tramp.el (tramp-cleanup): Remove. Functionality added to + `tramp-cleanup-connection'. + + * net/tramp-cmds.el (tramp-cleanup-connection): Add optional + parameters KEEP-DEBUG and KEEP-PASSWORD. + + * net/tramp.el (tramp-file-name-handler): + * net/tramp-adb.el (tramp-adb-maybe-open-connection): + * net/tramp-sh.el (tramp-open-connection-setup-interactive-shell) + (tramp-maybe-open-connection): + * net/tramp-smb.el (tramp-smb-maybe-open-connection): Use + `tramp-cleanup-connection'. + + * net/tramp-sh.el (tramp-maybe-open-connection): Catch + 'uname-changed inside the progress reporter. + 2013-09-10 Glenn Morris * simple.el (read-minibuffer): Unbreak it. (Bug#15318) === modified file 'lisp/net/tramp-adb.el' --- lisp/net/tramp-adb.el 2013-09-08 15:04:10 +0000 +++ lisp/net/tramp-adb.el 2013-09-10 07:45:33 +0000 @@ -1153,11 +1153,11 @@ (read (current-buffer)))))) (when (and (stringp old-getprop) (not (string-equal old-getprop new-getprop))) - (tramp-cleanup vec) (tramp-message vec 3 "Connection reset, because remote host changed from `%s' to `%s'" old-getprop new-getprop) + (tramp-cleanup-connection vec t) (tramp-adb-maybe-open-connection vec))) ;; Change user if indicated. === modified file 'lisp/net/tramp-cmds.el' --- lisp/net/tramp-cmds.el 2013-09-08 15:04:10 +0000 +++ lisp/net/tramp-cmds.el 2013-09-10 07:45:33 +0000 @@ -55,9 +55,11 @@ (buffer-list)))) ;;;###tramp-autoload -(defun tramp-cleanup-connection (vec) +(defun tramp-cleanup-connection (vec &optional keep-debug keep-password) "Flush all connection related objects. -This includes password cache, file cache, connection cache, buffers. +This includes password cache, file cache, connection cache, +buffers. KEEP-DEBUG non-nil preserves the debug buffer. +KEEP-PASSWORD non-nil preserves the password cache. When called interactively, a Tramp connection has to be selected." (interactive ;; When interactive, select the Tramp remote identification. @@ -80,14 +82,15 @@ "Enter Tramp connection: " connections nil t (try-completion "" connections))) (when (and name (file-remote-p name)) - (with-parsed-tramp-file-name name nil v)))))) + (with-parsed-tramp-file-name name nil v)))) + nil nil)) (if (not vec) ;; Nothing to do. (message "No Tramp connection found.") ;; Flush password cache. - (tramp-clear-passwd vec) + (unless keep-password (tramp-clear-passwd vec)) ;; Flush file cache. (tramp-flush-directory-property vec "") @@ -101,7 +104,8 @@ ;; Remove buffers. (dolist (buf (list (get-buffer (tramp-buffer-name vec)) - (get-buffer (tramp-debug-buffer-name vec)) + (unless keep-debug + (get-buffer (tramp-debug-buffer-name vec))) (tramp-get-connection-property vec "process-buffer" nil))) (when (bufferp buf) (kill-buffer buf))))) === modified file 'lisp/net/tramp-sh.el' --- lisp/net/tramp-sh.el 2013-09-08 15:04:10 +0000 +++ lisp/net/tramp-sh.el 2013-09-10 07:45:33 +0000 @@ -3805,11 +3805,12 @@ vec "uname" (tramp-send-command-and-read vec "echo \\\"`uname -sr`\\\"")))) (when (and (stringp old-uname) (not (string-equal old-uname new-uname))) - (tramp-cleanup vec) (tramp-message vec 3 "Connection reset, because remote host changed from `%s' to `%s'" old-uname new-uname) + ;; We want to keep the password. + (tramp-cleanup-connection vec t t) (throw 'uname-changed (tramp-maybe-open-connection vec)))) ;; Check whether the remote host suffers from buggy @@ -4287,68 +4288,68 @@ connection if a previous connection has died for some reason." (tramp-check-proper-host vec) - (catch 'uname-changed - (let ((p (tramp-get-connection-process vec)) - (process-name (tramp-get-connection-property vec "process-name" nil)) - (process-environment (copy-sequence process-environment)) - (pos (with-current-buffer (tramp-get-connection-buffer vec) (point)))) - - ;; If Tramp opens the same connection within a short time frame, - ;; there is a problem. We shall signal this. - (unless (or (and p (processp p) (memq (process-status p) '(run open))) - (not (equal (butlast (append vec nil) 2) - (car tramp-current-connection))) - (> (tramp-time-diff - (current-time) (cdr tramp-current-connection)) - (or tramp-connection-min-time-diff 0))) - (throw 'suppress 'suppress)) - - ;; If too much time has passed since last command was sent, look - ;; whether process is still alive. If it isn't, kill it. When - ;; using ssh, it can sometimes happen that the remote end has - ;; hung up but the local ssh client doesn't recognize this until - ;; it tries to send some data to the remote end. So that's why - ;; we try to send a command from time to time, then look again - ;; whether the process is really alive. - (condition-case nil - (when (and (> (tramp-time-diff - (current-time) - (tramp-get-connection-property - p "last-cmd-time" '(0 0 0))) - 60) - p (processp p) (memq (process-status p) '(run open))) - (tramp-send-command vec "echo are you awake" t t) - (unless (and (memq (process-status p) '(run open)) - (tramp-wait-for-output p 10)) - ;; The error will be caught locally. - (tramp-error vec 'file-error "Awake did fail"))) - (file-error - (tramp-cleanup vec) - (setq p nil))) - - ;; New connection must be opened. - (condition-case err - (unless (and p (processp p) (memq (process-status p) '(run open))) - - ;; We call `tramp-get-buffer' in order to get a debug - ;; buffer for messages from the beginning. - (tramp-get-buffer vec) - - ;; If `non-essential' is non-nil, don't reopen a new connection. - (when (and (boundp 'non-essential) (symbol-value 'non-essential)) - (throw 'non-essential 'non-essential)) - - (with-tramp-progress-reporter - vec 3 - (if (zerop (length (tramp-file-name-user vec))) - (format "Opening connection for %s using %s" - (tramp-file-name-host vec) - (tramp-file-name-method vec)) - (format "Opening connection for %s@%s using %s" - (tramp-file-name-user vec) + (let ((p (tramp-get-connection-process vec)) + (process-name (tramp-get-connection-property vec "process-name" nil)) + (process-environment (copy-sequence process-environment)) + (pos (with-current-buffer (tramp-get-connection-buffer vec) (point)))) + + ;; If Tramp opens the same connection within a short time frame, + ;; there is a problem. We shall signal this. + (unless (or (and p (processp p) (memq (process-status p) '(run open))) + (not (equal (butlast (append vec nil) 2) + (car tramp-current-connection))) + (> (tramp-time-diff + (current-time) (cdr tramp-current-connection)) + (or tramp-connection-min-time-diff 0))) + (throw 'suppress 'suppress)) + + ;; If too much time has passed since last command was sent, look + ;; whether process is still alive. If it isn't, kill it. When + ;; using ssh, it can sometimes happen that the remote end has hung + ;; up but the local ssh client doesn't recognize this until it + ;; tries to send some data to the remote end. So that's why we + ;; try to send a command from time to time, then look again + ;; whether the process is really alive. + (condition-case nil + (when (and (> (tramp-time-diff + (current-time) + (tramp-get-connection-property + p "last-cmd-time" '(0 0 0))) + 60) + p (processp p) (memq (process-status p) '(run open))) + (tramp-send-command vec "echo are you awake" t t) + (unless (and (memq (process-status p) '(run open)) + (tramp-wait-for-output p 10)) + ;; The error will be caught locally. + (tramp-error vec 'file-error "Awake did fail"))) + (file-error + (tramp-cleanup-connection vec t) + (setq p nil))) + + ;; New connection must be opened. + (condition-case err + (unless (and p (processp p) (memq (process-status p) '(run open))) + + ;; We call `tramp-get-buffer' in order to get a debug buffer + ;; for messages from the beginning. + (tramp-get-buffer vec) + + ;; If `non-essential' is non-nil, don't reopen a new connection. + (when (and (boundp 'non-essential) (symbol-value 'non-essential)) + (throw 'non-essential 'non-essential)) + + (with-tramp-progress-reporter + vec 3 + (if (zerop (length (tramp-file-name-user vec))) + (format "Opening connection for %s using %s" (tramp-file-name-host vec) - (tramp-file-name-method vec))) + (tramp-file-name-method vec)) + (format "Opening connection for %s@%s using %s" + (tramp-file-name-user vec) + (tramp-file-name-host vec) + (tramp-file-name-method vec))) + (catch 'uname-changed ;; Start new process. (when (and p (processp p)) (delete-process p)) @@ -4503,13 +4504,13 @@ target-alist (cdr target-alist))) ;; Make initial shell settings. - (tramp-open-connection-setup-interactive-shell p vec)))) + (tramp-open-connection-setup-interactive-shell p vec))))) - ;; When the user did interrupt, we must cleanup. - (quit - (tramp-cleanup vec) - ;; Propagate the quit signal. - (signal (car err) (cdr err))))))) + ;; When the user did interrupt, we must cleanup. + (quit + (tramp-cleanup-connection vec t) + ;; Propagate the quit signal. + (signal (car err) (cdr err)))))) (defun tramp-send-command (vec command &optional neveropen nooutput) "Send the COMMAND to connection VEC. === modified file 'lisp/net/tramp-smb.el' --- lisp/net/tramp-smb.el 2013-09-08 15:04:10 +0000 +++ lisp/net/tramp-smb.el 2013-09-10 07:45:33 +0000 @@ -1726,8 +1726,10 @@ (search-forward-regexp tramp-smb-wrong-passwd-regexp nil t)) ;; Disable `auth-source' and `password-cache'. + (tramp-message + vec 3 "Retry connection with new password") (let (auth-sources) - (tramp-cleanup vec) + (tramp-cleanup-connection vec t) (tramp-smb-maybe-open-connection vec argument)) ;; Propagate the error. (signal (car err) (cdr err))))))))))))) === modified file 'lisp/net/tramp.el' --- lisp/net/tramp.el 2013-09-08 15:04:10 +0000 +++ lisp/net/tramp.el 2013-09-10 07:45:33 +0000 @@ -1712,19 +1712,6 @@ (replace-match "/" nil t name) name))) -(defun tramp-cleanup (vec) - "Cleanup connection VEC, but keep the debug buffer." - (with-current-buffer (tramp-get-debug-buffer vec) - ;; Keep the debug buffer. - (rename-buffer - (generate-new-buffer-name tramp-temp-buffer-name) 'unique) - (tramp-cleanup-connection vec) - (if (= (point-min) (point-max)) - (kill-buffer nil) - (rename-buffer (tramp-debug-buffer-name vec) 'unique)) - ;; We call `tramp-get-buffer' in order to keep the debug buffer. - (tramp-get-buffer vec))) - ;;; Config Manipulation Functions: ;;;###tramp-autoload @@ -2147,7 +2134,7 @@ (tramp-message v 1 "Suppress received in operation %s" (append (list operation) args)) - (tramp-cleanup v) + (tramp-cleanup-connection v t) (tramp-run-real-handler operation args))) (t result))) ------------------------------------------------------------ revno: 114187 fixes bug: http://debbugs.gnu.org/15318 committer: Glenn Morris branch nick: trunk timestamp: Tue 2013-09-10 00:21:19 -0700 message: * lisp/simple.el (read-minibuffer): Unbreak it. diff: === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2013-09-10 01:28:01 +0000 +++ lisp/ChangeLog 2013-09-10 07:21:19 +0000 @@ -1,5 +1,7 @@ 2013-09-10 Glenn Morris + * simple.el (read-minibuffer): Unbreak it. (Bug#15318) + * dired-x.el (dired-mark-sexp): Unbreak for systems where ls returns "alternate access method" in mode (eg "-rw-r--r--."). === modified file 'lisp/simple.el' --- lisp/simple.el 2013-08-28 21:19:54 +0000 +++ lisp/simple.el 2013-09-10 07:21:19 +0000 @@ -1231,7 +1231,7 @@ Such arguments are used as in `read-from-minibuffer'.)" ;; Used for interactive spec `x'. (read-from-minibuffer prompt initial-contents minibuffer-local-map - t minibuffer-history)) + t 'minibuffer-history)) (defun eval-minibuffer (prompt &optional initial-contents) "Return value of Lisp expression read using the minibuffer. ------------------------------------------------------------ revno: 114186 committer: Glenn Morris branch nick: trunk timestamp: Mon 2013-09-09 21:28:01 -0400 message: * lisp/dired-x.el (dired-mark-sexp): Unbreak for systems where ls returns "alternate access method" in mode (eg "-rw-r--r--."). It's still pretty broken though, eg http://debbugs.gnu.org/13575 diff: === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2013-09-08 23:15:17 +0000 +++ lisp/ChangeLog 2013-09-10 01:28:01 +0000 @@ -1,3 +1,8 @@ +2013-09-10 Glenn Morris + + * dired-x.el (dired-mark-sexp): Unbreak for systems where ls + returns "alternate access method" in mode (eg "-rw-r--r--."). + 2013-09-08 Glenn Morris * saveplace.el (load-save-place-alist-from-file): === modified file 'lisp/dired-x.el' --- lisp/dired-x.el 2013-09-06 21:12:22 +0000 +++ lisp/dired-x.el 2013-09-10 01:28:01 +0000 @@ -1459,6 +1459,9 @@ s nil)) (setq mode (buffer-substring (point) (+ mode-len (point)))) (forward-char mode-len) + ;; Skip any extended attributes marker ("." or "+"). + (or (looking-at " ") + (forward-char 1)) (setq nlink (read (current-buffer))) ;; Karsten Wenger fixed uid. (setq uid (buffer-substring (1+ (point))