commit 725256d0030aa72617dc8963e7582e53f9e02674 (HEAD, refs/remotes/origin/master) Author: Stefan Kangas Date: Tue Apr 28 10:36:34 2020 +0200 Use lexical-binding in most vc tests * test/lisp/vc/add-log-tests.el: * test/lisp/vc/diff-mode-tests.el: * test/lisp/vc/ediff-ptch-tests.el: * test/lisp/vc/smerge-mode-tests.el: * test/lisp/vc/vc-hg-tests.el: * test/lisp/vc/vc-tests.el: Use lexical-binding. * test/lisp/vc/add-log-tests.el (add-log-current-defun-deftest): Silence byte-compiler. diff --git a/test/lisp/vc/add-log-tests.el b/test/lisp/vc/add-log-tests.el index fc928b02c3..f256945ee4 100644 --- a/test/lisp/vc/add-log-tests.el +++ b/test/lisp/vc/add-log-tests.el @@ -1,4 +1,4 @@ -;;; add-log-tests.el --- Test suite for add-log. +;;; add-log-tests.el --- Test suite for add-log. -*- lexical-binding:t -*- ;; Copyright (C) 2013-2020 Free Software Foundation, Inc. @@ -25,12 +25,12 @@ (require 'ert) (require 'add-log) -(defmacro add-log-current-defun-deftest (name doc major-mode +(defmacro add-log-current-defun-deftest (name doc mode content marker expected-defun) "Generate an ert test for mode-own `add-log-current-defun-function'. -Run `add-log-current-defun' at the point where MARKER specifies in a -buffer which content is CONTENT under MAJOR-MODE. Then it compares the -result with EXPECTED-DEFUN." +Run `add-log-current-defun' at the point where MARKER specifies +in a buffer which content is CONTENT under major mode MODE. Then +it compares the result with EXPECTED-DEFUN." (let ((xname (intern (concat "add-log-current-defun-test-" (symbol-name name) )))) @@ -39,7 +39,7 @@ result with EXPECTED-DEFUN." (with-temp-buffer (insert ,content) (goto-char (point-min)) - (funcall ',major-mode) + (funcall ',mode) (should (equal (when (search-forward ,marker nil t) (replace-match "" nil t) (add-log-current-defun)) diff --git a/test/lisp/vc/diff-mode-tests.el b/test/lisp/vc/diff-mode-tests.el index 26e9f26fe2..e497ed204d 100644 --- a/test/lisp/vc/diff-mode-tests.el +++ b/test/lisp/vc/diff-mode-tests.el @@ -1,3 +1,5 @@ +;;; diff-mode-tests.el --- Tests for diff-mode.el -*- lexical-binding:t -*- + ;; Copyright (C) 2017-2020 Free Software Foundation, Inc. ;; Author: Dima Kogan diff --git a/test/lisp/vc/ediff-ptch-tests.el b/test/lisp/vc/ediff-ptch-tests.el index ab44e23033..a3a592bb62 100644 --- a/test/lisp/vc/ediff-ptch-tests.el +++ b/test/lisp/vc/ediff-ptch-tests.el @@ -1,4 +1,4 @@ -;;; ediff-ptch-tests.el --- Tests for ediff-ptch.el +;;; ediff-ptch-tests.el --- Tests for ediff-ptch.el -*- lexical-binding:t -*- ;; Copyright (C) 2016-2020 Free Software Foundation, Inc. diff --git a/test/lisp/vc/smerge-mode-tests.el b/test/lisp/vc/smerge-mode-tests.el index c76fc17240..5b15a0931d 100644 --- a/test/lisp/vc/smerge-mode-tests.el +++ b/test/lisp/vc/smerge-mode-tests.el @@ -1,3 +1,5 @@ +;;; smerge-mode-tests.el --- Tests for smerge-mode.el -*- lexical-binding:t -*- + ;; Copyright (C) 2017-2020 Free Software Foundation, Inc. ;; Maintainer: emacs-devel@gnu.org diff --git a/test/lisp/vc/vc-hg-tests.el b/test/lisp/vc/vc-hg-tests.el index 01d197574f..e4a20bbf2d 100644 --- a/test/lisp/vc/vc-hg-tests.el +++ b/test/lisp/vc/vc-hg-tests.el @@ -1,4 +1,4 @@ -;;; vc-hg-tests.el --- tests for vc/vc-hg.el +;;; vc-hg-tests.el --- tests for vc/vc-hg.el -*- lexical-binding:t -*- ;; Copyright (C) 2016-2020 Free Software Foundation, Inc. diff --git a/test/lisp/vc/vc-tests.el b/test/lisp/vc/vc-tests.el index 43d24486ed..ff85e2f904 100644 --- a/test/lisp/vc/vc-tests.el +++ b/test/lisp/vc/vc-tests.el @@ -1,4 +1,4 @@ -;;; vc-tests.el --- Tests of different backends of vc.el +;;; vc-tests.el --- Tests of different backends of vc.el -*- lexical-binding:t -*- ;; Copyright (C) 2014-2020 Free Software Foundation, Inc. commit e49d3a45cd4a0554aa98c45f0976ed513c500951 Author: Paul Eggert Date: Mon Apr 27 15:46:37 2020 -0700 Improve multibyte_length performance * src/character.h (multibyte_length): Merge tests so that there are fewer conditional branches. This improved CPU speed of ‘make compile-always’ by about 1.5% on my platform. diff --git a/src/character.h b/src/character.h index d4d7750442..af5023f77c 100644 --- a/src/character.h +++ b/src/character.h @@ -317,30 +317,30 @@ multibyte_length (unsigned char const *p, unsigned char const *pend, return 1; if (!check || p + 1 < pend) { - /* The 'unsigned int' avoids int overflow in the 5-byte case. */ - unsigned int d = p[1]; - - if (TRAILING_CODE_P (d)) + unsigned char d = p[1]; + int w = ((d & 0xC0) << 2) + c; + if ((allow_8bit ? 0x2C0 : 0x2C2) <= w && w <= 0x2DF) + return 2; + if (!check || p + 2 < pend) { - if (allow_8bit ? (c & 0xE0) == 0xC0 : 0xC2 <= c && c <= 0xDF) - return 2; - if ((!check || p + 2 < pend) - && TRAILING_CODE_P (p[2])) + unsigned char e = p[2]; + w += (e & 0xC0) << 4; + int w1 = w | ((d & 0x20) >> 2); + if (0xAE1 <= w1 && w1 <= 0xAEF) + return 3; + if (!check || p + 3 < pend) { - if ((c & 0xF0) == 0xE0 && ((c & 0x0F) | (d & 0x20))) - return 3; - if ((!check || p + 3 < pend) && TRAILING_CODE_P (p[3])) + unsigned char f = p[3]; + w += (f & 0xC0) << 6; + int w2 = w | ((d & 0x30) >> 3); + if (0x2AF1 <= w2 && w2 <= 0x2AF7) + return 4; + if (!check || p + 4 < pend) { - if ((c & 0xF8) == 0xF0 && ((c & 0x07) | (d & 0x30))) - return 4; - if (c == 0xF8 && (!check || p + 4 < pend) - && TRAILING_CODE_P (p[4])) - { - unsigned int w = ((d << 24) + (p[2] << 16) - + (p[3] << 8) + p[4]); - if (0x88808080 <= w && w <= 0x8FBFBDBF) - return 5; - } + int_fast64_t lw = w + ((p[4] & 0xC0) << 8), + w3 = (lw << 24) + (d << 16) + (e << 8) + f; + if (0xAAF8888080 <= w3 && w3 <= 0xAAF88FBFBD) + return 5; } } } commit 199f146aee3a692a69d80135752d88cae0fe8c49 Author: Stefan Monnier Date: Mon Apr 27 18:36:28 2020 -0400 * lisp/jit-lock.el: Don't use `make-variable-buffer-local` on hooks. (jit-lock-functions): Clarify that it's a hook. (jit-lock-unregister): Adjust accordingly. diff --git a/lisp/jit-lock.el b/lisp/jit-lock.el index c0c9cac23e..8b3384ae82 100644 --- a/lisp/jit-lock.el +++ b/lisp/jit-lock.el @@ -147,9 +147,10 @@ If 0, then fontification is only deferred while there is input pending." (defvar-local jit-lock-mode nil "Non-nil means Just-in-time Lock mode is active.") -(defvar-local jit-lock-functions nil - "Functions to do the actual fontification. -They are called with two arguments: the START and END of the region to fontify.") +(defvar jit-lock-functions nil + "Special hook run to do the actual fontification. +The functions are called with two arguments: +the START and END of the region to fontify.") (defvar-local jit-lock-context-unfontify-pos nil "Consider text after this position as contextually unfontified. @@ -341,7 +342,8 @@ If non-nil, CONTEXTUAL means that a contextual fontification would be useful." "Unregister FUN as a fontification function. Only applies to the current buffer." (remove-hook 'jit-lock-functions fun t) - (unless jit-lock-functions (jit-lock-mode nil))) + (when (member jit-lock-functions '(nil '(t))) + (jit-lock-mode nil))) (defun jit-lock-refontify (&optional beg end) "Force refontification of the region BEG..END (default whole buffer)." commit 1be8485d67ef36b1d50496008be47be3050cc1bd Author: Stefan Kangas Date: Mon Apr 27 18:27:24 2020 +0200 Use lexical-binding in calendar tests * test/lisp/calendar/icalendar-tests.el: * test/lisp/calendar/parse-time-tests.el: Use lexical-binding. * test/lisp/calendar/icalendar-tests.el (icalendar--format-ical-event) (icalendar--decode-isodatetime, icalendar-tests--do-test-import) (icalendar-tests--decode-isodatetime): Silence byte-compiler. diff --git a/test/lisp/calendar/icalendar-tests.el b/test/lisp/calendar/icalendar-tests.el index 986255250d..d496878205 100644 --- a/test/lisp/calendar/icalendar-tests.el +++ b/test/lisp/calendar/icalendar-tests.el @@ -1,4 +1,4 @@ -;; icalendar-tests.el --- Test suite for icalendar.el +;; icalendar-tests.el --- Test suite for icalendar.el -*- lexical-binding:t -*- ;; Copyright (C) 2005, 2008-2020 Free Software Foundation, Inc. @@ -419,11 +419,11 @@ END:VEVENT "))) (should (string= "SUM sum DES des LOC loc ORG org" (icalendar--format-ical-event event))) - (setq icalendar-import-format (lambda (&rest ignore) + (setq icalendar-import-format (lambda (&rest _ignore) "helloworld")) (should (string= "helloworld" (icalendar--format-ical-event event))) (setq icalendar-import-format - (lambda (e) + (lambda (event) (format "-%s-%s-%s-%s-%s-%s-%s-" (icalendar--get-event-property event 'SUMMARY) (icalendar--get-event-property event 'DESCRIPTION) @@ -465,8 +465,7 @@ END:VEVENT (ert-deftest icalendar--decode-isodatetime () "Test `icalendar--decode-isodatetime'." - (let ((tz (getenv "TZ")) - result) + (let ((tz (getenv "TZ"))) (unwind-protect (progn ;; Use Eastern European Time (UTC+2, UTC+3 daylight saving) @@ -886,7 +885,7 @@ During import test the timezone is set to Central European Time." (icalendar-tests--do-test-import input expected-american))))) (setenv "TZ" timezone)))) -(defun icalendar-tests--do-test-import (input expected-output) +(defun icalendar-tests--do-test-import (_input expected-output) "Actually perform import test. Argument INPUT input icalendar string. Argument EXPECTED-OUTPUT expected diary string." @@ -2347,7 +2346,7 @@ END:VCALENDAR (let ((time (icalendar--decode-isodatetime string day zone))) (format-time-string "%FT%T%z" (encode-time time) 0))) -(defun icalendar-tests--decode-isodatetime (ical-string) +(defun icalendar-tests--decode-isodatetime (_ical-string) (should (equal (icalendar-test--format "20040917T050910-0200") "2004-09-17T03:09:10+0000")) (should (equal (icalendar-test--format "20040917T050910") diff --git a/test/lisp/calendar/parse-time-tests.el b/test/lisp/calendar/parse-time-tests.el index 4924e8b072..e1801a5730 100644 --- a/test/lisp/calendar/parse-time-tests.el +++ b/test/lisp/calendar/parse-time-tests.el @@ -1,4 +1,4 @@ -;; parse-time-tests.el --- Test suite for parse-time.el +;; parse-time-tests.el --- Test suite for parse-time.el -*- lexical-binding:t -*- ;; Copyright (C) 2016-2020 Free Software Foundation, Inc.