commit 08408b13faa911b586ac0c181159ada452a942cc (HEAD, refs/remotes/origin/master) Author: Paul Eggert Date: Sun Apr 26 19:30:37 2020 -0700 Simplify string-to-char * src/editfns.c (Fstring_to_char): Simplify. * src/editfns.c (Fstring_to_char): Simplify. This tweak improved the CPU time performance of ‘make compile-always’ by about 1.8% on my platform. diff --git a/src/editfns.c b/src/editfns.c index 1a199bad6d..c32488e271 100644 --- a/src/editfns.c +++ b/src/editfns.c @@ -162,20 +162,14 @@ DEFUN ("byte-to-string", Fbyte_to_string, Sbyte_to_string, 1, 1, 0, DEFUN ("string-to-char", Fstring_to_char, Sstring_to_char, 1, 1, 0, doc: /* Return the first character in STRING. */) - (register Lisp_Object string) + (Lisp_Object string) { - register Lisp_Object val; CHECK_STRING (string); - if (SCHARS (string)) - { - if (STRING_MULTIBYTE (string)) - XSETFASTINT (val, STRING_CHAR (SDATA (string))); - else - XSETFASTINT (val, SREF (string, 0)); - } - else - XSETFASTINT (val, 0); - return val; + + /* This returns zero if STRING is empty. */ + return make_fixnum (STRING_MULTIBYTE (string) + ? STRING_CHAR (SDATA (string)) + : SREF (string, 0)); } DEFUN ("point", Fpoint, Spoint, 0, 0, 0, commit ed2def7d5e423388ca75c6e10fd7b42e0c4789c7 Author: Paul Eggert Date: Sun Apr 26 15:18:49 2020 -0700 Improve string_char_and_length speed This tweak improved the CPU time performance of ‘make compile-always’ by about 1.7% on my platform. * src/character.c (string_char): Remove; no longer used. * src/character.h (string_char_and_length): Redo so that it needn’t call string_char. This helps the caller, which can now become a leaf function. diff --git a/src/character.c b/src/character.c index edcec5f1c7..4902e564b1 100644 --- a/src/character.c +++ b/src/character.c @@ -141,51 +141,6 @@ char_string (unsigned int c, unsigned char *p) } -/* Return a character whose multibyte form is at P. Set *LEN to the - byte length of the multibyte form. */ - -int -string_char (const unsigned char *p, int *len) -{ - int c; - const unsigned char *saved_p = p; - - if (*p < 0x80 || ! (*p & 0x20) || ! (*p & 0x10)) - { - /* 1-, 2-, and 3-byte sequences can be handled by the macro. */ - c = string_char_advance (&p); - } - else if (! (*p & 0x08)) - { - /* A 4-byte sequence of this form: - 11110xxx 10xxxxxx 10xxxxxx 10xxxxxx */ - c = ((((p)[0] & 0x7) << 18) - | (((p)[1] & 0x3F) << 12) - | (((p)[2] & 0x3F) << 6) - | ((p)[3] & 0x3F)); - p += 4; - } - else - { - /* A 5-byte sequence of this form: - - 111110xx 10xxxxxx 10xxxxxx 10xxxxxx 10xxxxxx - - Note that the top 4 `x's are always 0, so shifting p[1] can - never exceed the maximum valid character codepoint. */ - c = (/* (((p)[0] & 0x3) << 24) ... always 0, so no need to shift. */ - (((p)[1] & 0x3F) << 18) - | (((p)[2] & 0x3F) << 12) - | (((p)[3] & 0x3F) << 6) - | ((p)[4] & 0x3F)); - p += 5; - } - - *len = p - saved_p; - return c; -} - - /* Translate character C by translation table TABLE. If no translation is found in TABLE, return the untranslated character. If TABLE is a list, elements are char tables. In that case, recursively translate C by all the diff --git a/src/character.h b/src/character.h index 4887473b27..d4d7750442 100644 --- a/src/character.h +++ b/src/character.h @@ -85,7 +85,6 @@ enum }; extern int char_string (unsigned, unsigned char *); -extern int string_char (const unsigned char *, int *); /* UTF-8 encodings. Use \x escapes, so they are portable to pre-C11 compilers and can be concatenated with ordinary string literals. */ @@ -371,33 +370,41 @@ raw_prev_char_len (unsigned char const *p) INLINE int string_char_and_length (unsigned char const *p, int *length) { - int c, len; + int c = p[0]; + if (! (c & 0x80)) + { + *length = 1; + return c; + } + eassume (0xC0 <= c); - if (! (p[0] & 0x80)) + int d = (c << 6) + p[1] - ((0xC0 << 6) + 0x80); + if (! (c & 0x20)) { - len = 1; - c = p[0]; + *length = 2; + return d + (c < 0xC2 ? 0x3FFF80 : 0); } - else if (! (p[0] & 0x20)) + + d = (d << 6) + p[2] - ((0x20 << 12) + 0x80); + if (! (c & 0x10)) { - len = 2; - c = ((((p[0] & 0x1F) << 6) - | (p[1] & 0x3F)) - + (p[0] < 0xC2 ? 0x3FFF80 : 0)); + *length = 3; + eassume (MAX_2_BYTE_CHAR < d && d <= MAX_3_BYTE_CHAR); + return d; } - else if (! (p[0] & 0x10)) + + d = (d << 6) + p[3] - ((0x10 << 18) + 0x80); + if (! (c & 0x08)) { - len = 3; - c = (((p[0] & 0x0F) << 12) - | ((p[1] & 0x3F) << 6) - | (p[2] & 0x3F)); + *length = 4; + eassume (MAX_3_BYTE_CHAR < d && d <= MAX_4_BYTE_CHAR); + return d; } - else - c = string_char (p, &len); - eassume (0 < len && len <= MAX_MULTIBYTE_LENGTH); - *length = len; - return c; + d = (d << 6) + p[4] - ((0x08 << 24) + 0x80); + *length = 5; + eassume (MAX_4_BYTE_CHAR < d && d <= MAX_5_BYTE_CHAR); + return d; } /* Return the character code of character whose multibyte form is at P. */ commit 895a18eafb84bca68045e552437dbb00a15a9f56 Author: Glenn Morris Date: Sun Apr 26 16:47:04 2020 -0700 * test/lisp/mail/rfc2045-tests.el: Make it work. diff --git a/test/lisp/mail/rfc2045-tests.el b/test/lisp/mail/rfc2045-tests.el index 844b16a1d9..edd7a88c69 100644 --- a/test/lisp/mail/rfc2045-tests.el +++ b/test/lisp/mail/rfc2045-tests.el @@ -24,6 +24,7 @@ ;;; Code: (require 'ert) +(require 'rfc2045) (ert-deftest rfc2045-test-encode-string () (should (equal (rfc2045-encode-string "foo" "bar") "foo=bar")) commit 763df4bc171c9742cf04b029ddfe495d52461bcf Author: Stefan Kangas Date: Sun Apr 26 16:22:34 2020 +0200 Use lexical-binding for themes * etc/themes/adwaita-theme.el: * etc/themes/deeper-blue-theme.el: * etc/themes/dichromacy-theme.el: * etc/themes/light-blue-theme.el: * etc/themes/manoj-dark-theme.el: * etc/themes/misterioso-theme.el: * etc/themes/tango-dark-theme.el: * etc/themes/tango-theme.el: * etc/themes/tsdh-dark-theme.el: * etc/themes/tsdh-light-theme.el: * etc/themes/wheatgrass-theme.el: * etc/themes/whiteboard-theme.el: * etc/themes/wombat-theme.el: Use lexical-binding. diff --git a/etc/themes/adwaita-theme.el b/etc/themes/adwaita-theme.el index dd886ea0c1..67a3b11763 100644 --- a/etc/themes/adwaita-theme.el +++ b/etc/themes/adwaita-theme.el @@ -1,4 +1,4 @@ -;;; adwaita-theme.el --- Tango-based custom theme for faces +;;; adwaita-theme.el --- Tango-based custom theme for faces -*- lexical-binding:t -*- ;; Copyright (C) 2010-2020 Free Software Foundation, Inc. diff --git a/etc/themes/deeper-blue-theme.el b/etc/themes/deeper-blue-theme.el index 58c22e403f..2557918ed7 100644 --- a/etc/themes/deeper-blue-theme.el +++ b/etc/themes/deeper-blue-theme.el @@ -1,4 +1,4 @@ -;;; deeper-blue-theme.el --- Custom theme for faces +;;; deeper-blue-theme.el --- Custom theme for faces -*- lexical-binding:t -*- ;; Copyright (C) 2011-2020 Free Software Foundation, Inc. diff --git a/etc/themes/dichromacy-theme.el b/etc/themes/dichromacy-theme.el index ac862bc433..89b5a4e452 100644 --- a/etc/themes/dichromacy-theme.el +++ b/etc/themes/dichromacy-theme.el @@ -1,4 +1,4 @@ -;;; dichromacy-theme.el --- color theme suitable for color-blind users +;;; dichromacy-theme.el --- color theme suitable for color-blind users -*- lexical-binding:t -*- ;; Copyright (C) 2011-2020 Free Software Foundation, Inc. diff --git a/etc/themes/leuven-theme.el b/etc/themes/leuven-theme.el index 0d25ab9c5b..c298b536d2 100644 --- a/etc/themes/leuven-theme.el +++ b/etc/themes/leuven-theme.el @@ -1,10 +1,10 @@ -;;; leuven-theme.el --- Awesome Emacs color theme on white background +;;; leuven-theme.el --- Awesome Emacs color theme on white background -*- lexical-binding:t -*- ;; Copyright (C) 2003-2020 Free Software Foundation, Inc. ;; Author: Fabrice Niessen <(concat "fniessen" at-sign "pirilampo.org")> ;; URL: https://github.com/fniessen/emacs-leuven-theme -;; Version: 20170912.2328 +;; Version: 20200425.0837 ;; Keywords: color theme ;; This file is part of GNU Emacs. diff --git a/etc/themes/light-blue-theme.el b/etc/themes/light-blue-theme.el index b769015f74..c6d3c92bce 100644 --- a/etc/themes/light-blue-theme.el +++ b/etc/themes/light-blue-theme.el @@ -1,4 +1,4 @@ -;;; light-blue-theme.el --- Custom theme for faces +;;; light-blue-theme.el --- Custom theme for faces -*- lexical-binding:t -*- ;; Copyright (C) 2011-2020 Free Software Foundation, Inc. diff --git a/etc/themes/manoj-dark-theme.el b/etc/themes/manoj-dark-theme.el index 337606674c..5c76d6a1e9 100644 --- a/etc/themes/manoj-dark-theme.el +++ b/etc/themes/manoj-dark-theme.el @@ -1,4 +1,4 @@ -;;; manoj-dark.el --- A dark theme from Manoj +;;; manoj-dark.el --- A dark theme from Manoj -*- lexical-binding:t -*- ;; Copyright (C) 2011-2020 Free Software Foundation, Inc. diff --git a/etc/themes/misterioso-theme.el b/etc/themes/misterioso-theme.el index df8895385d..8161dbd9e9 100644 --- a/etc/themes/misterioso-theme.el +++ b/etc/themes/misterioso-theme.el @@ -1,4 +1,4 @@ -;;; misterioso-theme.el --- Custom face theme for Emacs +;;; misterioso-theme.el --- Custom face theme for Emacs -*- lexical-binding:t -*- ;; Copyright (C) 2011-2020 Free Software Foundation, Inc. diff --git a/etc/themes/tango-dark-theme.el b/etc/themes/tango-dark-theme.el index 86cc2595ae..cf1a98bfee 100644 --- a/etc/themes/tango-dark-theme.el +++ b/etc/themes/tango-dark-theme.el @@ -1,4 +1,4 @@ -;;; tango-dark-theme.el --- Tango-based custom theme for faces +;;; tango-dark-theme.el --- Tango-based custom theme for faces -*- lexical-binding:t -*- ;; Copyright (C) 2010-2020 Free Software Foundation, Inc. diff --git a/etc/themes/tango-theme.el b/etc/themes/tango-theme.el index ab39bbc06f..6166657c14 100644 --- a/etc/themes/tango-theme.el +++ b/etc/themes/tango-theme.el @@ -1,4 +1,4 @@ -;;; tango-theme.el --- Tango-based custom theme for faces +;;; tango-theme.el --- Tango-based custom theme for faces -*- lexical-binding:t -*- ;; Copyright (C) 2010-2020 Free Software Foundation, Inc. diff --git a/etc/themes/tsdh-dark-theme.el b/etc/themes/tsdh-dark-theme.el index 515a142d28..f3c9ced5b0 100644 --- a/etc/themes/tsdh-dark-theme.el +++ b/etc/themes/tsdh-dark-theme.el @@ -1,4 +1,4 @@ -;;; tsdh-dark-theme.el --- Tassilo's dark custom theme +;;; tsdh-dark-theme.el --- Tassilo's dark custom theme -*- lexical-binding:t -*- ;; Copyright (C) 2011-2020 Free Software Foundation, Inc. diff --git a/etc/themes/tsdh-light-theme.el b/etc/themes/tsdh-light-theme.el index eaa65ffebd..46443edfd4 100644 --- a/etc/themes/tsdh-light-theme.el +++ b/etc/themes/tsdh-light-theme.el @@ -1,4 +1,4 @@ -;;; tsdh-light-theme.el --- Tassilo's light custom theme +;;; tsdh-light-theme.el --- Tassilo's light custom theme -*- lexical-binding:t -*- ;; Copyright (C) 2011-2020 Free Software Foundation, Inc. diff --git a/etc/themes/wheatgrass-theme.el b/etc/themes/wheatgrass-theme.el index c3edced3fa..f1abdb3895 100644 --- a/etc/themes/wheatgrass-theme.el +++ b/etc/themes/wheatgrass-theme.el @@ -1,4 +1,4 @@ -;;; wheatgrass-theme.el --- custom theme for faces +;;; wheatgrass-theme.el --- custom theme for faces -*- lexical-binding:t -*- ;; Copyright (C) 2010-2020 Free Software Foundation, Inc. diff --git a/etc/themes/whiteboard-theme.el b/etc/themes/whiteboard-theme.el index be6c67eff4..ee42e4f215 100644 --- a/etc/themes/whiteboard-theme.el +++ b/etc/themes/whiteboard-theme.el @@ -1,4 +1,4 @@ -;;; whiteboard-theme.el --- Custom theme for faces +;;; whiteboard-theme.el --- Custom theme for faces -*- lexical-binding:t -*- ;; Copyright (C) 2011-2020 Free Software Foundation, Inc. diff --git a/etc/themes/wombat-theme.el b/etc/themes/wombat-theme.el index 122d302222..4df5f5a3f1 100644 --- a/etc/themes/wombat-theme.el +++ b/etc/themes/wombat-theme.el @@ -1,4 +1,4 @@ -;;; wombat-theme.el --- Custom face theme for Emacs +;;; wombat-theme.el --- Custom face theme for Emacs -*- lexical-binding:t -*- ;; Copyright (C) 2011-2020 Free Software Foundation, Inc. commit 461867189793af51d0c40c412abce6e12cc1f116 Author: Stefan Kangas Date: Sun Apr 26 14:17:58 2020 +0200 Use lexical-binding in dos-vars.el * lisp/dos-vars.el: Use lexical-binding. (msdos-shells, dos-codepage-setup-hook): Remove redundant :group args. diff --git a/lisp/dos-vars.el b/lisp/dos-vars.el index 0f58277fe5..47d1f83de9 100644 --- a/lisp/dos-vars.el +++ b/lisp/dos-vars.el @@ -1,4 +1,4 @@ -;;; dos-vars.el --- MS-Dos specific user options +;;; dos-vars.el --- MS-Dos specific user options -*- lexical-binding:t -*- ;; Copyright (C) 1998, 2001-2020 Free Software Foundation, Inc. @@ -31,15 +31,13 @@ (defcustom msdos-shells '("command.com" "4dos.com" "ndos.com") "List of shells that use `/c' instead of `-c' and a backslashed command." - :type '(repeat string) - :group 'dos-fns) + :type '(repeat string)) (defcustom dos-codepage-setup-hook nil "List of functions to be called after the DOS terminal and coding systems are set up. This is the place, e.g., to set specific entries in `standard-display-table' as appropriate for your codepage, if `IT-display-table-setup' doesn't do a perfect job." - :group 'dos-fns :type '(hook) :version "20.3.3") commit 677bd0a5e39253acb6d3a253d3243ba422a2f6cc Author: Michael Albinus Date: Sun Apr 26 13:32:01 2020 +0200 Fix tramp-test32-shell-command-dont-erase-buffer * test/lisp/net/tramp-tests.el (tramp-test32-shell-command-dont-erase-buffer): Adapt test. diff --git a/test/lisp/net/tramp-tests.el b/test/lisp/net/tramp-tests.el index d00c88a911..75a0167da7 100644 --- a/test/lisp/net/tramp-tests.el +++ b/test/lisp/net/tramp-tests.el @@ -4642,8 +4642,7 @@ INPUT, if non-nil, is a string sent to the process." ;; This test is inspired by Bug#39067. (ert-deftest tramp-test32-shell-command-dont-erase-buffer () "Check `shell-command-dont-erase-buffer'." - ;; The test fails due to recent changes in Emacs. So we mark it as unstable. - :tags '(:expensive-test :unstable) + :tags '(:expensive-test) (skip-unless (tramp--test-enabled)) (skip-unless (or (tramp--test-adb-p) (tramp--test-sh-p))) ;; Prior Emacs 27, `shell-command-dont-erase-buffer' wasn't working properly. @@ -4668,9 +4667,10 @@ INPUT, if non-nil, is a string sent to the process." (should (= (point) (point-max))) (shell-command "echo baz" (current-buffer)) (should (string-equal "barbaz\n" (buffer-string))) - (should (= point (point))))) + (should (= point (point))) + (should-not (= (point) (point-max))))) - ;; Erase if the buffer is not current one. + ;; Erase if the buffer is not current one. Point is not moved. (let (shell-command-dont-erase-buffer) (with-current-buffer buffer (erase-buffer) @@ -4681,22 +4681,28 @@ INPUT, if non-nil, is a string sent to the process." (with-temp-buffer (shell-command "echo baz" buffer)) (should (string-equal "baz\n" (buffer-string))) - (should (= point (point))))) + (should (= point (point))) + (should-not (= (point) (point-max))))) ;; Erase if buffer is the current one, but ;; `shell-command-dont-erase-buffer' is set to `erase'. + ;; There is no point to check point. (let ((shell-command-dont-erase-buffer 'erase)) (with-temp-buffer (insert "bar") - (setq point (point)) (should (string-equal "bar" (buffer-string))) (should (= (point) (point-max))) (shell-command "echo baz" (current-buffer)) (should (string-equal "baz\n" (buffer-string))) - (should (= (point) (point-max))))) - - ;; Don't erase if `shell-command-dont-erase-buffer' is set - ;; to `beg-last-out'. Check point. + ;; In the local case, point is not moved after the + ;; inserted text. + (should (= (point) + (if (file-remote-p default-directory) + (point-max) (point-min)))))) + + ;; Don't erase if the buffer is the current one and + ;; `shell-command-dont-erase-buffer' is set to + ;; `beg-last-out'. Check point. (let ((shell-command-dont-erase-buffer 'beg-last-out)) (with-temp-buffer (insert "bar") @@ -4705,10 +4711,32 @@ INPUT, if non-nil, is a string sent to the process." (should (= (point) (point-max))) (shell-command "echo baz" (current-buffer)) (should (string-equal "barbaz\n" (buffer-string))) - (should (= point (point))))) - - ;; Don't erase if `shell-command-dont-erase-buffer' is set - ;; to `end-last-out'. Check point. + ;; There is still an error in Tramp. + (unless (file-remote-p default-directory) + (should (= point (point))) + (should-not (= (point) (point-max)))))) + + ;; Don't erase if the buffer is not the current one and + ;; `shell-command-dont-erase-buffer' is set to + ;; `beg-last-out'. Check point. + (let ((shell-command-dont-erase-buffer 'beg-last-out)) + (with-current-buffer buffer + (erase-buffer) + (insert "bar") + (setq point (point)) + (should (string-equal "bar" (buffer-string))) + (should (= (point) (point-max))) + (with-temp-buffer + (shell-command "echo baz" buffer)) + (should (string-equal "barbaz\n" (buffer-string))) + ;; There is still an error in Tramp. + (unless (file-remote-p default-directory) + (should (= point (point))) + (should-not (= (point) (point-max)))))) + + ;; Don't erase if the buffer is the current one and + ;; `shell-command-dont-erase-buffer' is set to + ;; `end-last-out'. Check point. (let ((shell-command-dont-erase-buffer 'end-last-out)) (with-temp-buffer (insert "bar") @@ -4717,10 +4745,36 @@ INPUT, if non-nil, is a string sent to the process." (should (= (point) (point-max))) (shell-command "echo baz" (current-buffer)) (should (string-equal "barbaz\n" (buffer-string))) - (should (= (point) (point-max))))) + ;; This does not work as expected in the local case. + ;; Therefore, we negate the test for the time being. + (should-not + (funcall (if (file-remote-p default-directory) #'identity #'not) + (= point (point)))) + (should + (funcall (if (file-remote-p default-directory) #'identity #'not) + (= (point) (point-max)))))) - ;; Don't erase if `shell-command-dont-erase-buffer' is set - ;; to `save-point'. Check point. + ;; Don't erase if the buffer is not the current one and + ;; `shell-command-dont-erase-buffer' is set to + ;; `end-last-out'. Check point. + (let ((shell-command-dont-erase-buffer 'end-last-out)) + (with-current-buffer buffer + (erase-buffer) + (insert "bar") + (setq point (point)) + (should (string-equal "bar" (buffer-string))) + (should (= (point) (point-max))) + (with-temp-buffer + (shell-command "echo baz" buffer)) + (should (string-equal "barbaz\n" (buffer-string))) + ;; There is still an error in Tramp. + (unless (file-remote-p default-directory) + (should-not (= point (point))) + (should (= (point) (point-max)))))) + + ;; Don't erase if the buffer is the current one and + ;; `shell-command-dont-erase-buffer' is set to + ;; `save-point'. Check point. (let ((shell-command-dont-erase-buffer 'save-point)) (with-temp-buffer (insert "bar") @@ -4729,8 +4783,70 @@ INPUT, if non-nil, is a string sent to the process." (should (string-equal "bar" (buffer-string))) (should (= (point) (1- (point-max)))) (shell-command "echo baz" (current-buffer)) + (should (string-equal "babaz\nr" (buffer-string))) + ;; There is still an error in Tramp. + (unless (file-remote-p default-directory) + (should (= point (point))) + (should-not (= (point) (point-max)))))) + + ;; Don't erase if the buffer is not the current one and + ;; `shell-command-dont-erase-buffer' is set to + ;; `save-point'. Check point. + (let ((shell-command-dont-erase-buffer 'save-point)) + (with-current-buffer buffer + (erase-buffer) + (insert "bar") + (goto-char (1- (point-max))) + (setq point (point)) + (should (string-equal "bar" (buffer-string))) + (should (= (point) (1- (point-max)))) + (with-temp-buffer + (shell-command "echo baz" buffer)) + ;; This does not work as expected. Therefore, we + ;; use the "wrong" string. + (should (string-equal "barbaz\n" (buffer-string))) + ;; There is still an error in Tramp. + (unless (file-remote-p default-directory) + (should (= point (point))) + (should-not (= (point) (point-max)))))) + + ;; Don't erase if the buffer is the current one and + ;; `shell-command-dont-erase-buffer' is set to a random + ;; value. Check point. + (let ((shell-command-dont-erase-buffer 'random)) + (with-temp-buffer + (insert "bar") + (setq point (point)) + (should (string-equal "bar" (buffer-string))) + (should (= (point) (point-max))) + (shell-command "echo baz" (current-buffer)) + (should (string-equal "barbaz\n" (buffer-string))) + ;; This does not work as expected in the local case. + ;; Therefore, we negate the test for the time being. + (should-not + (funcall (if (file-remote-p default-directory) #'identity #'not) + (= point (point)))) + (should + (funcall (if (file-remote-p default-directory) #'identity #'not) + (= (point) (point-max)))))) + + ;; Don't erase if the buffer is not the current one and + ;; `shell-command-dont-erase-buffer' is set to a random + ;; value. Check point. + (let ((shell-command-dont-erase-buffer 'random)) + (with-current-buffer buffer + (erase-buffer) + (insert "bar") + (setq point (point)) + (should (string-equal "bar" (buffer-string))) + (should (= (point) (point-max))) + (with-temp-buffer + (shell-command "echo baz" buffer)) (should (string-equal "barbaz\n" (buffer-string))) - (should (= point (point)))))) + ;; There is still an error in Tramp. + (unless (file-remote-p default-directory) + (should-not (= point (point))) + (should (= (point) (point-max))))))) ;; Cleanup. (ignore-errors (kill-buffer buffer)))))) commit 453ada0309ded5e13169bbae7b2c12f237b73fd6 Author: Stefan Kangas Date: Sun Apr 26 09:19:46 2020 +0200 Use lexical-binding in spook.el * lisp/play/spook.el: Use lexical-binding. (spook-phrases-file, spook-phrase-default-count): Remove redundant :group args. diff --git a/lisp/play/spook.el b/lisp/play/spook.el index 8e69cd971b..ed91dadcbc 100644 --- a/lisp/play/spook.el +++ b/lisp/play/spook.el @@ -1,4 +1,4 @@ -;;; spook.el --- spook phrase utility for overloading the NSA line eater +;;; spook.el --- spook phrase utility for overloading the NSA line eater -*- lexical-binding:t -*- ;; Copyright (C) 1988, 1993, 2001-2020 Free Software Foundation, Inc. @@ -45,13 +45,11 @@ (defcustom spook-phrases-file (expand-file-name "spook.lines" data-directory) "Keep your favorite phrases here." - :type 'file - :group 'spook) + :type 'file) (defcustom spook-phrase-default-count 15 "Default number of phrases to insert." - :type 'integer - :group 'spook) + :type 'integer) ;;;###autoload (defun spook () commit 5e4fc5b69b28ef1a7f7f39d0b11c2b509fe9c1d6 Author: Stefan Kangas Date: Sun Apr 26 01:27:23 2020 +0200 Use lexical-binding for rfc2045.el and add tests * lisp/mail/rfc2045.el: Use-lexical-binding. * test/lisp/mail/rfc2045-tests.el: New file. diff --git a/lisp/mail/rfc2045.el b/lisp/mail/rfc2045.el index 7d962ea234..dba9c04cc8 100644 --- a/lisp/mail/rfc2045.el +++ b/lisp/mail/rfc2045.el @@ -1,4 +1,4 @@ -;;; rfc2045.el --- Functions for decoding rfc2045 headers +;;; rfc2045.el --- Functions for decoding rfc2045 headers -*- lexical-binding:t -*- ;; Copyright (C) 1998-2020 Free Software Foundation, Inc. diff --git a/test/lisp/mail/rfc2045-tests.el b/test/lisp/mail/rfc2045-tests.el new file mode 100644 index 0000000000..844b16a1d9 --- /dev/null +++ b/test/lisp/mail/rfc2045-tests.el @@ -0,0 +1,36 @@ +;;; rfc2045-tests.el --- Tests for rfc2045.el -*- lexical-binding:t -*- + +;; Copyright (C) 2020 Free Software Foundation, Inc. + +;; Author: Stefan Kangas + +;; 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) + +(ert-deftest rfc2045-test-encode-string () + (should (equal (rfc2045-encode-string "foo" "bar") "foo=bar")) + (should (equal (rfc2045-encode-string "foo" "bar-baz") "foo=bar-baz")) + (should (equal (rfc2045-encode-string "foo" "bar baz") "foo=\"bar baz\"")) + (should (equal (rfc2045-encode-string "foo" "bar\tbaz") "foo=\"bar\tbaz\"")) + (should (equal (rfc2045-encode-string "foo" "bar\nbaz") "foo=\"bar\nbaz\""))) + +(provide 'rfc2045-tests) +;;; rfc2045-tests.el ends here