commit 1c25d3712e52cf91f7ca38984aa409e62bd35511 (HEAD, refs/remotes/origin/master) Author: Phillip Lord Date: Mon Nov 30 21:22:49 2015 +0000 Improve documentation and clean up. * test/Makefile.in: Improve documentation, use EMACS variable correctly, and clean up makefile rules. diff --git a/test/Makefile.in b/test/Makefile.in index 4d8a802..b2360fb 100644 --- a/test/Makefile.in +++ b/test/Makefile.in @@ -125,6 +125,10 @@ endef $(foreach test,${TESTS},$(eval $(call test_template,${test}))) +## Include dependencies between test files and the files they test. +## We do this without the file and eval directly, but then we would +## have to run Emacs for every make invocation, and it might not be +## available during clean. -include make-test-deps.mk ## Re-run all the tests every time. @@ -141,6 +145,7 @@ check-maybe: ${LOGFILES} clean mostlyclean: -rm -f ${LOGFILES} ${LOGSAVEFILES} + -rm make-test-deps.mk bootstrap-clean: clean -rm -f ${ELCFILES} @@ -151,7 +156,7 @@ distclean: clean maintainer-clean: distclean bootstrap-clean make-test-deps.mk: $(ELFILES) make-test-deps.emacs-lisp - ../src/emacs --batch -l make-test-deps.emacs-lisp \ + $(EMACS) --batch -l make-test-deps.emacs-lisp \ --eval "(make-test-deps \"`pwd`\")" \ 2> $@ # Makefile ends here. commit f9ebad588a069bab2fde317f7470951acfec5363 Author: Phillip Lord Date: Sun Nov 29 10:05:07 2015 +0000 Update file headers for name change. * (test/src/decompress-tests.el, test/src/alloc-tests.el): Update headers. diff --git a/test/src/alloc-tests.el b/test/src/alloc-tests.el index 218df05..c0fe0f3 100644 --- a/test/src/alloc-tests.el +++ b/test/src/alloc-tests.el @@ -1,4 +1,4 @@ -;;; finalizer-tests.el --- Finalizer tests -*- lexical-binding: t -*- +;;; alloc-tests.el --- alloc tests -*- lexical-binding: t -*- ;; Copyright (C) 2015 Free Software Foundation, Inc. diff --git a/test/src/decompress-tests.el b/test/src/decompress-tests.el index c6c084d..1eea673 100644 --- a/test/src/decompress-tests.el +++ b/test/src/decompress-tests.el @@ -1,4 +1,4 @@ -;;; zlib-tests.el --- Test suite for zlib. +;;; decompress-tests.el --- Test suite for decompress. ;; Copyright (C) 2013-2015 Free Software Foundation, Inc. @@ -40,6 +40,6 @@ (buffer-string)) "foo\n")))) -(provide 'zlib-tests) +(provide 'decompress-tests) -;;; zlib-tests.el ends here. +;;; decompress-tests.el ends here. commit 063985518f1092a9eb4b696aaec816ae9280f260 Author: Phillip Lord Date: Sun Nov 29 10:02:33 2015 +0000 Test files renamed to new scheme. * (finalizer-tests.el): Now renamed alloc-tests.el * (zlib-tests.el): Now renamed decompress-tests.el. diff --git a/test/src/alloc-tests.el b/test/src/alloc-tests.el new file mode 100644 index 0000000..218df05 --- /dev/null +++ b/test/src/alloc-tests.el @@ -0,0 +1,33 @@ +;;; finalizer-tests.el --- Finalizer tests -*- lexical-binding: t -*- + +;; Copyright (C) 2015 Free Software Foundation, Inc. + +;; Author: Daniel Colascione +;; Keywords: + +;; This file is part of GNU Emacs. + +;; GNU Emacs 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. + +;; GNU Emacs 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 GNU Emacs. If not, see . + +;;; Commentary: + +;; + +;;; Code: + +(require 'ert) +(require 'cl-lib) + +(ert-deftest finalizer-object-type () + (should (equal (type-of (make-finalizer nil)) 'finalizer))) diff --git a/test/src/decompress-tests.el b/test/src/decompress-tests.el new file mode 100644 index 0000000..c6c084d --- /dev/null +++ b/test/src/decompress-tests.el @@ -0,0 +1,45 @@ +;;; zlib-tests.el --- Test suite for zlib. + +;; Copyright (C) 2013-2015 Free Software Foundation, Inc. + +;; Author: Lars Ingebrigtsen + +;; This file is part of GNU Emacs. + +;; GNU Emacs 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. + +;; GNU Emacs 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 GNU Emacs. If not, see . + +;;; Code: + +(require 'ert) + +(defvar zlib-tests-data-directory + (expand-file-name "data/decompress" (getenv "EMACS_TEST_DIRECTORY")) + "Directory containing zlib test data.") + +(ert-deftest zlib--decompress () + "Test decompressing a gzipped file." + (when (and (fboundp 'zlib-available-p) + (zlib-available-p)) + (should (string= + (with-temp-buffer + (set-buffer-multibyte nil) + (insert-file-contents-literally + (expand-file-name "foo.gz" zlib-tests-data-directory)) + (zlib-decompress-region (point-min) (point-max)) + (buffer-string)) + "foo\n")))) + +(provide 'zlib-tests) + +;;; zlib-tests.el ends here. diff --git a/test/src/finalizer-tests.el b/test/src/finalizer-tests.el deleted file mode 100644 index 218df05..0000000 --- a/test/src/finalizer-tests.el +++ /dev/null @@ -1,33 +0,0 @@ -;;; finalizer-tests.el --- Finalizer tests -*- lexical-binding: t -*- - -;; Copyright (C) 2015 Free Software Foundation, Inc. - -;; Author: Daniel Colascione -;; Keywords: - -;; This file is part of GNU Emacs. - -;; GNU Emacs 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. - -;; GNU Emacs 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 GNU Emacs. If not, see . - -;;; Commentary: - -;; - -;;; Code: - -(require 'ert) -(require 'cl-lib) - -(ert-deftest finalizer-object-type () - (should (equal (type-of (make-finalizer nil)) 'finalizer))) diff --git a/test/src/zlib-tests.el b/test/src/zlib-tests.el deleted file mode 100644 index c6c084d..0000000 --- a/test/src/zlib-tests.el +++ /dev/null @@ -1,45 +0,0 @@ -;;; zlib-tests.el --- Test suite for zlib. - -;; Copyright (C) 2013-2015 Free Software Foundation, Inc. - -;; Author: Lars Ingebrigtsen - -;; This file is part of GNU Emacs. - -;; GNU Emacs 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. - -;; GNU Emacs 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 GNU Emacs. If not, see . - -;;; Code: - -(require 'ert) - -(defvar zlib-tests-data-directory - (expand-file-name "data/decompress" (getenv "EMACS_TEST_DIRECTORY")) - "Directory containing zlib test data.") - -(ert-deftest zlib--decompress () - "Test decompressing a gzipped file." - (when (and (fboundp 'zlib-available-p) - (zlib-available-p)) - (should (string= - (with-temp-buffer - (set-buffer-multibyte nil) - (insert-file-contents-literally - (expand-file-name "foo.gz" zlib-tests-data-directory)) - (zlib-decompress-region (point-min) (point-max)) - (buffer-string)) - "foo\n")))) - -(provide 'zlib-tests) - -;;; zlib-tests.el ends here. commit 0baf45dbe3dfeb9f5fc03a3213ceeccb170643cf Author: Phillip Lord Date: Sat Nov 28 23:13:24 2015 +0000 Tests now depend on source files * test/Makefile.in: Include dependences from tests to source files. * test/make-test-deps.emacs-lisp: New file * .gitignore: Ignore generated make include file diff --git a/.gitignore b/.gitignore index e83760b..6821791 100644 --- a/.gitignore +++ b/.gitignore @@ -153,6 +153,8 @@ test/manual/etags/srclist test/manual/etags/regexfile test/manual/etags/ETAGS test/manual/etags/CTAGS +# Generated by test/make-test-deps.emacs-lisp +test/make-test-deps.mk # ctags, etags. TAGS diff --git a/test/Makefile.in b/test/Makefile.in index d3a8eb9..4d8a802 100644 --- a/test/Makefile.in +++ b/test/Makefile.in @@ -125,6 +125,7 @@ endef $(foreach test,${TESTS},$(eval $(call test_template,${test}))) +-include make-test-deps.mk ## Re-run all the tests every time. check: @@ -149,4 +150,8 @@ distclean: clean maintainer-clean: distclean bootstrap-clean +make-test-deps.mk: $(ELFILES) make-test-deps.emacs-lisp + ../src/emacs --batch -l make-test-deps.emacs-lisp \ + --eval "(make-test-deps \"`pwd`\")" \ + 2> $@ # Makefile ends here. diff --git a/test/make-test-deps.emacs-lisp b/test/make-test-deps.emacs-lisp new file mode 100644 index 0000000..563b3bf --- /dev/null +++ b/test/make-test-deps.emacs-lisp @@ -0,0 +1,89 @@ +;; -*- emacs-lisp -*- + +;; The contents of this file are subject to the GPL License, Version 3.0. +;; +;; Copyright (C) 2015, Free Software Foundation +;; +;; 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 . + +;;; Commentary: + +;; This file generates dependencies between test files and the files +;; that they test. + +;; It has an .emacs-lisp extension because it makes the Makefile easier! + +(require 'seq) + +(defun make-test-deps (directory) + (message + "%s" + (concat + (make-test-deps-lisp directory) + (make-test-deps-src directory)))) + +(defun make-test-deps-lisp (directory) + (mapconcat + (lambda (stem) + (format "%s-tests.log: ../%s.elc\n" stem stem)) + (make-test-test-files directory "lisp") "")) + +(defun make-test-deps-src (directory) + (mapconcat + (lambda (stem) + (format "%s-tests.log: ../%s.o\n" stem stem)) + (make-test-test-files directory "src") "")) + +(defun make-test-test-files (stem dir) + (make-test-munge-files + stem + (directory-files-recursively dir ".*-tests.el$"))) + +(defun make-test-munge-files (stem files) + (make-test-sans-suffix + (make-test-de-stem + stem + (make-test-no-legacy + (make-test-no-test-dir + (make-test-no-resources + files)))))) + +(defun make-test-sans-suffix (files) + (mapcar + (lambda (file) + (substring file 0 -9)) + files)) + +(defun make-test-de-stem (stem files) + (mapcar + (lambda (file) + (substring + file + (+ 1 (length stem)))) + files)) + +(defun make-test-no-legacy (list) + (make-test-remove list "legacy/")) + +(defun make-test-no-resources (list) + (make-test-remove list "-resources/")) + +(defun make-test-no-test-dir (list) + (make-test-remove list "-tests/")) + +(defun make-test-remove (list match) + (seq-remove + (lambda (file) + (string-match-p match file)) + list)) commit cbfb129555482c582fe875766680bf8179c0588c Author: Stefan Monnier Date: Mon Nov 30 10:52:12 2015 -0500 * lisp/progmodes/which-func.el: Improve disabling the mode Use lexical-binding. (which-func-modes, which-func-non-auto-modes, which-func-maxout) (which-func, which-func-format): Remove redundant :group arg. (which-func-try-to-enable): New function. (which-func-ff-hook, which-function-mode): Use it. (mode-line-misc-info): Add ourselves here instead of in bindings.el. * lisp/bindings.el (mode-line-misc-info): Remove which-func-mode entry. diff --git a/lisp/bindings.el b/lisp/bindings.el index 8560871..e2d0f52 100644 --- a/lisp/bindings.el +++ b/lisp/bindings.el @@ -430,11 +430,9 @@ Major modes that edit things other than ordinary files may change this (make-variable-buffer-local 'mode-line-buffer-identification) (defvar mode-line-misc-info - '((which-func-mode ("" which-func-format " ")) - (global-mode-string ("" global-mode-string " "))) + '((global-mode-string ("" global-mode-string " "))) "Mode line construct for miscellaneous information. -By default, this shows the information specified by -`which-func-mode' and `global-mode-string'.") +By default, this shows the information specified by `global-mode-string'.") (put 'mode-line-misc-info 'risky-local-variable t) (defvar mode-line-end-spaces '(:eval (unless (display-graphic-p) "-%-")) diff --git a/lisp/progmodes/which-func.el b/lisp/progmodes/which-func.el index a8c2813..7e289b3 100644 --- a/lisp/progmodes/which-func.el +++ b/lisp/progmodes/which-func.el @@ -1,4 +1,4 @@ -;;; which-func.el --- print current function in mode line +;;; which-func.el --- print current function in mode line -*- lexical-binding:t -*- ;; Copyright (C) 1994, 1997-1998, 2001-2015 Free Software Foundation, ;; Inc. @@ -80,7 +80,6 @@ "List of major modes for which Which Function mode should be used. For other modes it is disabled. If this is equal to t, then Which Function mode is enabled in any major mode that supports it." - :group 'which-func :version "24.3" ; explicit list -> t :type '(choice (const :tag "All modes" t) (repeat (symbol :tag "Major mode")))) @@ -91,13 +90,11 @@ This means that Which Function mode won't really do anything until you use Imenu, in these modes. Note that files larger than `which-func-maxout' behave in this way too; Which Function mode doesn't do anything until you use Imenu." - :group 'which-func :type '(repeat (symbol :tag "Major mode"))) (defcustom which-func-maxout 500000 "Don't automatically compute the Imenu menu if buffer is this big or bigger. Zero means compute the Imenu menu regardless of size." - :group 'which-func :type 'integer) (defvar which-func-keymap @@ -137,8 +134,7 @@ Zero means compute the Imenu menu regardless of size." :foreground "Blue1") (t :foreground "LightSkyBlue")) - "Face used to highlight mode line function names." - :group 'which-func) + "Face used to highlight mode line function names.") (defcustom which-func-format `("[" @@ -152,7 +148,6 @@ mouse-3: go to end") "]") "Format for displaying the function in the mode line." :version "24.2" ; added mouse-face; 24point2 is correct - :group 'which-func :type 'sexp) ;;;###autoload (put 'which-func-format 'risky-local-variable t) @@ -193,14 +188,16 @@ This makes a difference only if `which-function-mode' is non-nil.") (add-hook 'find-file-hook 'which-func-ff-hook t) +(defun which-func-try-to-enable () + (unless (or (not which-function-mode) + (local-variable-p 'which-func-mode)) + (setq which-func-mode (or (eq which-func-modes t) + (member major-mode which-func-modes))))) + (defun which-func-ff-hook () "File find hook for Which Function mode. It creates the Imenu index for the buffer, if necessary." - (unless (local-variable-p 'which-func-mode) - (setq which-func-mode - (and which-function-mode - (or (eq which-func-modes t) - (member major-mode which-func-modes))))) + (which-func-try-to-enable) (condition-case err (if (and which-func-mode @@ -239,6 +236,13 @@ It creates the Imenu index for the buffer, if necessary." (defvar which-func-update-timer nil) +(unless (or (assq 'which-func-mode mode-line-misc-info) + (assq 'which-function-mode mode-line-misc-info)) + (add-to-list 'mode-line-misc-info + '(which-function-mode ;Only display if mode is enabled. + (which-func-mode ;Only display if buffer supports it. + ("" which-func-format " "))))) + ;; This is the name people would normally expect. ;;;###autoload (define-minor-mode which-function-mode @@ -254,17 +258,12 @@ in certain major modes." (when (timerp which-func-update-timer) (cancel-timer which-func-update-timer)) (setq which-func-update-timer nil) - (if which-function-mode - ;;Turn it on - (progn - (setq which-func-update-timer - (run-with-idle-timer idle-update-delay t #'which-func-update)) - (dolist (buf (buffer-list)) - (with-current-buffer buf - (unless (local-variable-p 'which-func-mode) - (setq which-func-mode - (or (eq which-func-modes t) - (member major-mode which-func-modes))))))))) + (when which-function-mode + ;;Turn it on. + (setq which-func-update-timer + (run-with-idle-timer idle-update-delay t #'which-func-update)) + (dolist (buf (buffer-list)) + (with-current-buffer buf (which-func-try-to-enable))))) (defvar which-function-imenu-failed nil "Locally t in a buffer if `imenu--make-index-alist' found nothing there.") commit c77b816bc3d8fc242b95c04859803ffff5bb8210 Author: Stefan Monnier Date: Mon Nov 30 08:02:55 2015 -0500 * lisp/calculator.el (calculator-define-key): Silence warning ...about unknown calculator-mode-map. diff --git a/lisp/calculator.el b/lisp/calculator.el index f2e6a88..1d3715b 100644 --- a/lisp/calculator.el +++ b/lisp/calculator.el @@ -379,38 +379,6 @@ Used for repeating operations in calculator-repR/L.") ;;;--------------------------------------------------------------------- ;;; Key bindings -(defun calculator-define-key (key cmd &optional map) - ;; arranges for unbound alphabetic keys to be used as their un/shifted - ;; versions if those are bound (mimics the usual Emacs global - ;; bindings) - (let* ((key (if (stringp key) (kbd key) key)) - (map (or map calculator-mode-map)) - (omap (keymap-parent map))) - (define-key map key cmd) - ;; "other" map, used for case-flipped bindings - (unless omap - (setq omap (make-sparse-keymap)) - (suppress-keymap omap t) - (set-keymap-parent map omap)) - (let ((m omap)) - ;; bind all case-flipped versions - (dotimes (i (length key)) - (let* ((c (aref key i)) - (k (vector c)) - (b (lookup-key m k)) - (defkey (lambda (x) - (define-key m k x) - (when (and (characterp c) - (or (<= ?A c ?Z) (<= ?a c ?z))) - (define-key m (vector (logxor 32 c)) x))))) - (cond ((= i (1- (length key))) - ;; prefer longer sequences - (unless (keymapp b) (funcall defkey cmd))) - ((keymapp b) (setq m b)) - (t (let ((sub (make-sparse-keymap))) - (funcall defkey sub) - (setq m sub))))))))) - (defvar calculator-mode-map (let ((map (make-sparse-keymap))) (suppress-keymap map t) @@ -594,6 +562,38 @@ Used for repeating operations in calculator-repR/L.") map) "The calculator key map.") +(defun calculator-define-key (key cmd &optional map) + ;; Arranges for unbound alphabetic keys to be used as their un/shifted + ;; versions if those are bound (mimics the usual Emacs global + ;; bindings). + (let* ((key (if (stringp key) (kbd key) key)) + (map (or map calculator-mode-map)) + (omap (keymap-parent map))) + (define-key map key cmd) + ;; "other" map, used for case-flipped bindings + (unless omap + (setq omap (make-sparse-keymap)) + (suppress-keymap omap t) + (set-keymap-parent map omap)) + (let ((m omap)) + ;; Bind all case-flipped versions. + (dotimes (i (length key)) + (let* ((c (aref key i)) + (k (vector c)) + (b (lookup-key m k)) + (defkey (lambda (x) + (define-key m k x) + (when (and (characterp c) + (or (<= ?A c ?Z) (<= ?a c ?z))) + (define-key m (vector (logxor 32 c)) x))))) + (cond ((= i (1- (length key))) + ;; Prefer longer sequences. + (unless (keymapp b) (funcall defkey cmd))) + ((keymapp b) (setq m b)) + (t (let ((sub (make-sparse-keymap))) + (funcall defkey sub) + (setq m sub))))))))) + ;;;--------------------------------------------------------------------- ;;; Startup and mode stuff