commit 5d1e62e32989399fd2a073cc8efc07f869a1b438 (HEAD, refs/remotes/origin/master) Author: Glenn Morris Date: Sat Apr 23 17:59:06 2016 -0700 When autoload-timestamps is nil, use a dummy timestamp rather than "t". * lisp/emacs-lisp/autoload.el (autoload--non-timestamp): New constant. (autoload-generate-file-autoloads, autoload-find-destination) (update-directory-autoloads): Use autoload--non-timestamp. diff --git a/lisp/emacs-lisp/autoload.el b/lisp/emacs-lisp/autoload.el index 14e584d..1ab3de5 100644 --- a/lisp/emacs-lisp/autoload.el +++ b/lisp/emacs-lisp/autoload.el @@ -87,6 +87,12 @@ that text will be copied verbatim to `generated-autoload-file'.") (defconst generate-autoload-section-continuation ";;;;;; " "String to add on each continuation of the section header form.") +;; In some ways it would be nicer to use a value that is recognisably +;; not a time-value, eg t, but that can cause issues if an older Emacs +;; that does not expect non-time-values loads the file. +(defconst autoload--non-timestamp '(0 0 0 0) + "Value to insert when `autoload-timestamps' is nil.") + (defvar autoload-timestamps nil ; experimental, see bug#22213 "Non-nil means insert a timestamp for each input file into the output. We use these in incremental updates of the output file to decide @@ -657,7 +663,7 @@ FILE's modification time." nil nil 'emacs-mule-unix) (if autoload-timestamps (nth 5 (file-attributes relfile)) - t))) + autoload--non-timestamp))) (insert ";;; Generated autoloads from " relfile "\n"))) (insert generate-autoload-section-trailer)))) (or noninteractive @@ -755,11 +761,6 @@ removes any prior now out-of-date autoload entries." (if (and (or (null existing-buffer) (not (buffer-modified-p existing-buffer))) (cond - ;; last-time is the time-stamp (specifying - ;; the last time we looked at the file) and - ;; the file hasn't been changed since. - ((listp last-time) - (not (time-less-p last-time file-time))) ;; FIXME? Arguably we should throw a ;; user error, or some kind of warning, ;; if we were called from update-file-autoloads, @@ -768,8 +769,15 @@ removes any prior now out-of-date autoload entries." ;; file modtime in such a case, ;; if there are multiple input files ;; contributing to the output. - ((and output-time (eq t last-time)) + ((and output-time + (member last-time + (list t autoload--non-timestamp))) (not (time-less-p output-time file-time))) + ;; last-time is the time-stamp (specifying + ;; the last time we looked at the file) and + ;; the file hasn't been changed since. + ((listp last-time) + (not (time-less-p last-time file-time))) ;; last-time is an MD5 checksum instead. ((stringp last-time) (equal last-time @@ -854,7 +862,7 @@ write its autoloads into the specified file instead." ;; Remove the obsolete section. (autoload-remove-section (match-beginning 0)) (setq last-time (nth 4 form)) - (if (equal t last-time) + (if (member last-time (list t autoload--non-timestamp)) (setq last-time output-time)) (dolist (file file) (let ((file-time (nth 5 (file-attributes file)))) @@ -872,7 +880,9 @@ write its autoloads into the specified file instead." ;; Remove the obsolete section. (autoload-remove-section (match-beginning 0))) ((not (time-less-p (let ((oldtime (nth 4 form))) - (if (equal t oldtime) + (if (member oldtime + (list + t autoload--non-timestamp)) output-time oldtime)) (nth 5 (file-attributes file)))) @@ -909,7 +919,7 @@ write its autoloads into the specified file instead." (autoload-insert-section-header (current-buffer) nil nil no-autoloads (if autoload-timestamps no-autoloads-time - t)) + autoload--non-timestamp)) (insert generate-autoload-section-trailer))) (let ((version-control 'never)) commit b4c135f1217a0da26b792981b2132bca69d72145 Author: Glenn Morris Date: Sat Apr 23 10:46:08 2016 -0700 * test/lisp/xt-mouse-tests.el: Move from test/automated/. diff --git a/test/automated/xt-mouse-tests.el b/test/automated/xt-mouse-tests.el deleted file mode 100644 index c7e835c..0000000 --- a/test/automated/xt-mouse-tests.el +++ /dev/null @@ -1,110 +0,0 @@ -;;; xt-mouse-tests.el --- Test suite for xt-mouse. -*- lexical-binding: t; -*- - -;; Copyright (C) 2016 Free Software Foundation, Inc. - -;; Author: Philipp Stephani - -;; 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 'xt-mouse) - -(defmacro with-xterm-mouse-mode (&rest body) - "Run BODY with `xterm-mouse-mode' temporarily enabled." - (declare (indent 0)) - ;; Make the frame huge so that the test input events below don't hit - ;; the menu bar. - `(cl-letf (((frame-width nil) 2000) - ((frame-height nil) 2000) - ;; Reset XTerm parameters so that the tests don't get - ;; confused. - ((terminal-parameter nil 'xterm-mouse-x) nil) - ((terminal-parameter nil 'xterm-mouse-y) nil) - ((terminal-parameter nil 'xterm-mouse-last-down) nil) - ((terminal-parameter nil 'xterm-mouse-last-click) nil)) - (if xterm-mouse-mode - (progn ,@body) - (unwind-protect - (progn - ;; `xterm-mouse-mode' doesn't work in the initial - ;; terminal. Since we can't create a second terminal in - ;; batch mode, fake it temporarily. - (cl-letf (((symbol-function 'terminal-name) - (lambda (&optional _terminal) "fake-terminal"))) - (xterm-mouse-mode)) - ,@body) - (xterm-mouse-mode 0))))) - -(ert-deftest xt-mouse-tracking-basic () - (should (equal (xterm-mouse-tracking-enable-sequence) - "\e[?1000h\e[?1002h\e[?1006h")) - (should (equal (xterm-mouse-tracking-disable-sequence) - "\e[?1006l\e[?1002l\e[?1000l")) - (with-xterm-mouse-mode - (should xterm-mouse-mode) - (should (terminal-parameter nil 'xterm-mouse-mode)) - (should-not (terminal-parameter nil 'xterm-mouse-utf-8)) - (let* ((unread-command-events (append "\e[M%\xD9\x81" - "\e[M'\xD9\x81" nil)) - (key (read-key))) - (should (consp key)) - (cl-destructuring-bind (event-type position . rest) key - (should (equal event-type 'S-mouse-2)) - (should (consp position)) - (cl-destructuring-bind (_ _ xy . rest) position - (should (equal xy '(184 . 95)))))))) - -(ert-deftest xt-mouse-tracking-utf-8 () - (let ((xterm-mouse-utf-8 t)) - (should (equal (xterm-mouse-tracking-enable-sequence) - "\e[?1000h\e[?1002h\e[?1005h\e[?1006h")) - (should (equal (xterm-mouse-tracking-disable-sequence) - "\e[?1006l\e[?1005l\e[?1002l\e[?1000l")) - (with-xterm-mouse-mode - (should xterm-mouse-mode) - (should (terminal-parameter nil 'xterm-mouse-mode)) - (should (terminal-parameter nil 'xterm-mouse-utf-8)) - ;; The keyboard driver doesn't decode bytes in - ;; `unread-command-events'. - (let* ((unread-command-events (append "\e[M%\u0640\u0131" - "\e[M'\u0640\u0131" nil)) - (key (read-key))) - (should (consp key)) - (cl-destructuring-bind (event-type position . rest) key - (should (equal event-type 'S-mouse-2)) - (should (consp position)) - (cl-destructuring-bind (_ _ xy . rest) position - (should (equal xy '(1567 . 271))))))))) - -(ert-deftest xt-mouse-tracking-sgr () - (with-xterm-mouse-mode - (should xterm-mouse-mode) - (should (terminal-parameter nil 'xterm-mouse-mode)) - (should-not (terminal-parameter nil 'xterm-mouse-utf-8)) - (let* ((unread-command-events (append "\e[<5;1569;273;M" - "\e[<5;1569;273;m" nil)) - (key (read-key))) - (should (consp key)) - (cl-destructuring-bind (event-type position . rest) key - (should (equal event-type 'S-mouse-2)) - (should (consp position)) - (cl-destructuring-bind (_ _ xy . rest) position - (should (equal xy '(1568 . 271)))))))) - -;;; xt-mouse-tests.el ends here diff --git a/test/lisp/xt-mouse-tests.el b/test/lisp/xt-mouse-tests.el new file mode 100644 index 0000000..c7e835c --- /dev/null +++ b/test/lisp/xt-mouse-tests.el @@ -0,0 +1,110 @@ +;;; xt-mouse-tests.el --- Test suite for xt-mouse. -*- lexical-binding: t; -*- + +;; Copyright (C) 2016 Free Software Foundation, Inc. + +;; Author: Philipp Stephani + +;; 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 'xt-mouse) + +(defmacro with-xterm-mouse-mode (&rest body) + "Run BODY with `xterm-mouse-mode' temporarily enabled." + (declare (indent 0)) + ;; Make the frame huge so that the test input events below don't hit + ;; the menu bar. + `(cl-letf (((frame-width nil) 2000) + ((frame-height nil) 2000) + ;; Reset XTerm parameters so that the tests don't get + ;; confused. + ((terminal-parameter nil 'xterm-mouse-x) nil) + ((terminal-parameter nil 'xterm-mouse-y) nil) + ((terminal-parameter nil 'xterm-mouse-last-down) nil) + ((terminal-parameter nil 'xterm-mouse-last-click) nil)) + (if xterm-mouse-mode + (progn ,@body) + (unwind-protect + (progn + ;; `xterm-mouse-mode' doesn't work in the initial + ;; terminal. Since we can't create a second terminal in + ;; batch mode, fake it temporarily. + (cl-letf (((symbol-function 'terminal-name) + (lambda (&optional _terminal) "fake-terminal"))) + (xterm-mouse-mode)) + ,@body) + (xterm-mouse-mode 0))))) + +(ert-deftest xt-mouse-tracking-basic () + (should (equal (xterm-mouse-tracking-enable-sequence) + "\e[?1000h\e[?1002h\e[?1006h")) + (should (equal (xterm-mouse-tracking-disable-sequence) + "\e[?1006l\e[?1002l\e[?1000l")) + (with-xterm-mouse-mode + (should xterm-mouse-mode) + (should (terminal-parameter nil 'xterm-mouse-mode)) + (should-not (terminal-parameter nil 'xterm-mouse-utf-8)) + (let* ((unread-command-events (append "\e[M%\xD9\x81" + "\e[M'\xD9\x81" nil)) + (key (read-key))) + (should (consp key)) + (cl-destructuring-bind (event-type position . rest) key + (should (equal event-type 'S-mouse-2)) + (should (consp position)) + (cl-destructuring-bind (_ _ xy . rest) position + (should (equal xy '(184 . 95)))))))) + +(ert-deftest xt-mouse-tracking-utf-8 () + (let ((xterm-mouse-utf-8 t)) + (should (equal (xterm-mouse-tracking-enable-sequence) + "\e[?1000h\e[?1002h\e[?1005h\e[?1006h")) + (should (equal (xterm-mouse-tracking-disable-sequence) + "\e[?1006l\e[?1005l\e[?1002l\e[?1000l")) + (with-xterm-mouse-mode + (should xterm-mouse-mode) + (should (terminal-parameter nil 'xterm-mouse-mode)) + (should (terminal-parameter nil 'xterm-mouse-utf-8)) + ;; The keyboard driver doesn't decode bytes in + ;; `unread-command-events'. + (let* ((unread-command-events (append "\e[M%\u0640\u0131" + "\e[M'\u0640\u0131" nil)) + (key (read-key))) + (should (consp key)) + (cl-destructuring-bind (event-type position . rest) key + (should (equal event-type 'S-mouse-2)) + (should (consp position)) + (cl-destructuring-bind (_ _ xy . rest) position + (should (equal xy '(1567 . 271))))))))) + +(ert-deftest xt-mouse-tracking-sgr () + (with-xterm-mouse-mode + (should xterm-mouse-mode) + (should (terminal-parameter nil 'xterm-mouse-mode)) + (should-not (terminal-parameter nil 'xterm-mouse-utf-8)) + (let* ((unread-command-events (append "\e[<5;1569;273;M" + "\e[<5;1569;273;m" nil)) + (key (read-key))) + (should (consp key)) + (cl-destructuring-bind (event-type position . rest) key + (should (equal event-type 'S-mouse-2)) + (should (consp position)) + (cl-destructuring-bind (_ _ xy . rest) position + (should (equal xy '(1568 . 271)))))))) + +;;; xt-mouse-tests.el ends here