commit 0e568838781a4a5f2970bff6245c4e41f31612cc (HEAD, refs/remotes/origin/master) Author: Stephen Gildea Date: Mon Sep 30 20:22:51 2019 -0700 Move undocumented time-stamp formats closer to format-time-string * time-stamp.el (time-stamp-string-preprocess): Update some undocumented formatting characters of time-stamp format for closer (still incomplete) alignment with format-time-string. They have displayed a warning since Emacs 20 (released in 1997), so it is unlikely anyone is using them. * time-stamp-tests.el: Update tests to match new expectations. diff --git a/lisp/time-stamp.el b/lisp/time-stamp.el index f6b0018579..4fb28b2fd3 100644 --- a/lisp/time-stamp.el +++ b/lisp/time-stamp.el @@ -72,7 +72,7 @@ Non-date items: %h mail host name Decimal digits between the % and the type character specify the -field width. Strings are truncated on the right; years on the left. +field width. Strings are truncated on the right. A leading zero in the field width zero-fills a number. For example, to get the format used by the `date' command, @@ -420,13 +420,9 @@ normally the current time is used." (defconst time-stamp-no-file "(no file)" "String to use when the buffer is not associated with a file.") -;;; FIXME This comment was written in 1996! -;;; time-stamp is transitioning to using the new, expanded capabilities -;;; of format-time-string. During the process, this function implements -;;; intermediate, compatible formats and complains about old, soon to -;;; be unsupported, formats. This function will get a lot (a LOT) shorter -;;; when the transition is complete and we can just pass most things -;;; straight through to format-time-string. +;;; time-stamp is transitioning to be compatible with format-time-string. +;;; During the process, this function implements +;;; intermediate, compatible formats. ;;; At all times, all the formats recommended in the doc string ;;; of time-stamp-format will work not only in the current version of ;;; Emacs, but in all versions that have been released within the past @@ -445,7 +441,7 @@ and all `time-stamp-format' compatibility." (result "") field-width field-result - alt-form change-case + alt-form change-case upcase (paren-level 0)) (while (< ind fmt-len) (setq cur-char (aref format ind)) @@ -455,7 +451,7 @@ and all `time-stamp-format' compatibility." (cond ((eq cur-char ?%) ;; eat any additional args to allow for future expansion - (setq alt-form nil change-case nil field-width "") + (setq alt-form nil change-case nil upcase nil field-width "") (while (progn (setq ind (1+ ind)) (setq cur-char (if (< ind fmt-len) @@ -491,39 +487,41 @@ and all `time-stamp-format' compatibility." (cond ((eq cur-char ?:) (setq alt-form t)) ((eq cur-char ?#) - (setq change-case t)))) + (setq change-case t)) + ((eq cur-char ?^) + (setq upcase t)) + ((eq cur-char ?-) + (setq field-width "1")) + ((eq cur-char ?_) + (setq field-width "2")))) (setq field-result (cond ((eq cur-char ?%) "%") ((eq cur-char ?a) ;day of week - (if change-case - (time-stamp--format "%#a" time) - (or alt-form (not (string-equal field-width "")) - (time-stamp-conv-warn "%a" "%:a")) - (if (and alt-form (not (string-equal field-width ""))) - "" ;discourage "%:3a" - (time-stamp--format "%A" time)))) + (if alt-form + (if (string-equal field-width "") + (time-stamp--format "%A" time) + "") ;discourage "%:3a" + (if (or change-case upcase) + (time-stamp--format "%#a" time) + (time-stamp--format "%a" time)))) ((eq cur-char ?A) - (if alt-form - (time-stamp--format "%A" time) - (or change-case (not (string-equal field-width "")) - (time-stamp-conv-warn "%A" "%#A")) - (time-stamp--format "%#A" time))) + (if (or change-case upcase (not (string-equal field-width ""))) + (time-stamp--format "%#A" time) + (time-stamp--format "%A" time))) ((eq cur-char ?b) ;month name - (if change-case - (time-stamp--format "%#b" time) - (or alt-form (not (string-equal field-width "")) - (time-stamp-conv-warn "%b" "%:b")) - (if (and alt-form (not (string-equal field-width ""))) - "" ;discourage "%:3b" - (time-stamp--format "%B" time)))) + (if alt-form + (if (string-equal field-width "") + (time-stamp--format "%B" time) + "") ;discourage "%:3b" + (if (or change-case upcase) + (time-stamp--format "%#b" time) + (time-stamp--format "%b" time)))) ((eq cur-char ?B) - (if alt-form - (time-stamp--format "%B" time) - (or change-case (not (string-equal field-width "")) - (time-stamp-conv-warn "%B" "%#B")) - (time-stamp--format "%#B" time))) + (if (or change-case upcase (not (string-equal field-width ""))) + (time-stamp--format "%#B" time) + (time-stamp--format "%B" time))) ((eq cur-char ?d) ;day of month, 1-31 (time-stamp-do-number cur-char alt-form field-width time)) ((eq cur-char ?H) ;hour, 0-23 @@ -535,9 +533,9 @@ and all `time-stamp-format' compatibility." ((eq cur-char ?M) ;minute, 0-59 (time-stamp-do-number cur-char alt-form field-width time)) ((eq cur-char ?p) ;am or pm - (or change-case - (time-stamp-conv-warn "%p" "%#p")) - (time-stamp--format "%#p" time)) + (if change-case + (time-stamp--format "%#p" time) + (time-stamp--format "%p" time))) ((eq cur-char ?P) ;AM or PM (time-stamp--format "%p" time)) ((eq cur-char ?S) ;seconds, 00-60 @@ -545,10 +543,10 @@ and all `time-stamp-format' compatibility." ((eq cur-char ?w) ;weekday number, Sunday is 0 (time-stamp--format "%w" time)) ((eq cur-char ?y) ;year - (or alt-form (not (string-equal field-width "")) - (time-stamp-conv-warn "%y" "%:y")) - (string-to-number (time-stamp--format "%Y" time))) - ((eq cur-char ?Y) ;4-digit year, new style + (if alt-form + (string-to-number (time-stamp--format "%Y" time)) + (string-to-number (time-stamp--format "%y" time)))) + ((eq cur-char ?Y) ;4-digit year (string-to-number (time-stamp--format "%Y" time))) ((eq cur-char ?z) ;time zone lower case (if change-case @@ -585,6 +583,11 @@ and all `time-stamp-format' compatibility." ((eq cur-char ?Q) ;(undocumented fully-qualified host) (system-name)) )) + (and (numberp field-result) + (not alt-form) + (string-equal field-width "") + ;; no width provided; set width for default + (setq field-width "02")) (let ((padded-result (format (format "%%%s%c" field-width @@ -595,12 +598,10 @@ and all `time-stamp-format' compatibility." initial-length (string-to-number field-width)))) (if (> initial-length desired-length) - ;; truncate strings on right, years on left + ;; truncate strings on right (if (stringp field-result) (substring padded-result 0 desired-length) - (if (eq cur-char ?y) - (substring padded-result (- desired-length)) - padded-result)) ;non-year numbers don't truncate + padded-result) ;numbers don't truncate padded-result)))) (t (char-to-string cur-char))))) @@ -612,9 +613,6 @@ and all `time-stamp-format' compatibility." ALT-FORM is whether `#' specified. FIELD-WIDTH is the string width specification or \"\". TIME is the time to convert." (let ((format-string (concat "%" (char-to-string format-char)))) - (and (not alt-form) (string-equal field-width "") - (time-stamp-conv-warn format-string - (format "%%:%c" format-char))) (if (and alt-form (not (string-equal field-width ""))) "" ;discourage "%:2d" and the like (string-to-number (time-stamp--format format-string time))))) @@ -632,7 +630,8 @@ The new forms being recommended now will continue to work then.") (defun time-stamp-conv-warn (old-form new-form) "Display a warning about a soon-to-be-obsolete format. -Suggests replacing OLD-FORM with NEW-FORM." +Suggests replacing OLD-FORM with NEW-FORM. +In use before 2019 changes; will be used again after those changes settle." (cond (time-stamp-conversion-warn (with-current-buffer (get-buffer-create "*Time-stamp-compatibility*") diff --git a/test/lisp/time-stamp-tests.el b/test/lisp/time-stamp-tests.el index f13fee76f0..d710564c36 100644 --- a/test/lisp/time-stamp-tests.el +++ b/test/lisp/time-stamp-tests.el @@ -46,7 +46,8 @@ (put 'with-time-stamp-test-env 'lisp-indent-hook 'defun) (defmacro time-stamp-should-warn (form) - "Similar to `should' but verifies that a format warning is generated." + "Similar to `should' but verifies that a format warning is generated. +In use before 2019 changes; will be used again after those changes settle." `(let ((warning-count 0)) (cl-letf (((symbol-function 'time-stamp-conv-warn) (lambda (_old _new) @@ -69,13 +70,12 @@ ;; implemented since 2001, documented since 2019 (should (equal (time-stamp-string "%#a" ref-time) "MON")) (should (equal (time-stamp-string "%:A" ref-time) "Monday")) - ;; warned since 1997, will change - (time-stamp-should-warn (equal - (time-stamp-string "%a" ref-time) "Monday")) - (time-stamp-should-warn (equal - (time-stamp-string "%^a" ref-time) "Monday")) - (time-stamp-should-warn (equal - (time-stamp-string "%A" ref-time) "MONDAY")))) + ;; allowed but undocumented since 2019 (warned 1997-2019) + (should (equal (time-stamp-string "%^A" ref-time) "MONDAY")) + ;; warned 1997-2019, changed in 2019 + (should (equal (time-stamp-string "%a" ref-time) "Mon")) + (should (equal (time-stamp-string "%^a" ref-time) "MON")) + (should (equal (time-stamp-string "%A" ref-time) "Monday")))) (ert-deftest time-stamp-test-month-name () "Test time-stamp formats for month name." @@ -89,13 +89,12 @@ ;; implemented since 2001, documented since 2019 (should (equal (time-stamp-string "%#b" ref-time) "JAN")) (should (equal (time-stamp-string "%:B" ref-time) "January")) - ;; warned since 1997, will change - (time-stamp-should-warn (equal - (time-stamp-string "%b" ref-time) "January")) - (time-stamp-should-warn (equal - (time-stamp-string "%^b" ref-time) "January")) - (time-stamp-should-warn (equal - (time-stamp-string "%B" ref-time) "JANUARY")))) + ;; allowed but undocumented since 2019 (warned 1997-2019) + (should (equal (time-stamp-string "%^B" ref-time) "JANUARY")) + ;; warned 1997-2019, changed in 2019 + (should (equal (time-stamp-string "%b" ref-time) "Jan")) + (should (equal (time-stamp-string "%^b" ref-time) "JAN")) + (should (equal (time-stamp-string "%B" ref-time) "January")))) (ert-deftest time-stamp-test-day-of-month () "Test time-stamp formats for day of month." @@ -111,11 +110,14 @@ ;; implemented since 1997, documented since 2019 (should (equal (time-stamp-string "%1d" ref-time) "2")) (should (equal (time-stamp-string "%1d" ref-time2) "18")) - ;; warned since 1997, will change - (time-stamp-should-warn (equal (time-stamp-string "%_d" ref-time) "2")) - (time-stamp-should-warn (equal (time-stamp-string "%_d" ref-time2) "18")) - (time-stamp-should-warn (equal (time-stamp-string "%d" ref-time) "2")) - (time-stamp-should-warn (equal (time-stamp-string "%d" ref-time2) "18")))) + ;; allowed but undocumented since 2019 (warned 1997-2019) + (should (equal (time-stamp-string "%-d" ref-time) "2")) + (should (equal (time-stamp-string "%-d" ref-time2) "18")) + ;; warned 1997-2019, changed in 2019 + (should (equal (time-stamp-string "%_d" ref-time) " 2")) + (should (equal (time-stamp-string "%_d" ref-time2) "18")) + (should (equal (time-stamp-string "%d" ref-time) "02")) + (should (equal (time-stamp-string "%d" ref-time2) "18")))) (ert-deftest time-stamp-test-hours-24 () "Test time-stamp formats for hour on a 24-hour clock." @@ -135,13 +137,17 @@ (should (equal (time-stamp-string "%1H" ref-time) "15")) (should (equal (time-stamp-string "%1H" ref-time2) "12")) (should (equal (time-stamp-string "%1H" ref-time3) "6")) - ;; warned since 1997, will change - (time-stamp-should-warn (equal (time-stamp-string "%_H" ref-time) "15")) - (time-stamp-should-warn (equal (time-stamp-string "%_H" ref-time2) "12")) - (time-stamp-should-warn (equal (time-stamp-string "%_H" ref-time3) "6")) - (time-stamp-should-warn (equal (time-stamp-string "%H" ref-time) "15")) - (time-stamp-should-warn (equal (time-stamp-string "%H" ref-time2) "12")) - (time-stamp-should-warn (equal (time-stamp-string "%H" ref-time3) "6")))) + ;; allowed but undocumented since 2019 (warned 1997-2019) + (should (equal (time-stamp-string "%-H" ref-time) "15")) + (should (equal (time-stamp-string "%-H" ref-time2) "12")) + (should (equal (time-stamp-string "%-H" ref-time3) "6")) + ;; warned 1997-2019, changed in 2019 + (should (equal (time-stamp-string "%_H" ref-time) "15")) + (should (equal (time-stamp-string "%_H" ref-time2) "12")) + (should (equal (time-stamp-string "%_H" ref-time3) " 6")) + (should (equal (time-stamp-string "%H" ref-time) "15")) + (should (equal (time-stamp-string "%H" ref-time2) "12")) + (should (equal (time-stamp-string "%H" ref-time3) "06")))) (ert-deftest time-stamp-test-hours-12 () "Test time-stamp formats for hour on a 12-hour clock." @@ -161,13 +167,17 @@ (should (equal (time-stamp-string "%1I" ref-time) "3")) (should (equal (time-stamp-string "%1I" ref-time2) "12")) (should (equal (time-stamp-string "%1I" ref-time3) "6")) - ;; warned since 1997, will change - (time-stamp-should-warn (equal (time-stamp-string "%_I" ref-time) "3")) - (time-stamp-should-warn (equal (time-stamp-string "%_I" ref-time2) "12")) - (time-stamp-should-warn (equal (time-stamp-string "%_I" ref-time3) "6")) - (time-stamp-should-warn (equal (time-stamp-string "%I" ref-time) "3")) - (time-stamp-should-warn (equal (time-stamp-string "%I" ref-time2) "12")) - (time-stamp-should-warn (equal (time-stamp-string "%I" ref-time3) "6")))) + ;; allowed but undocumented since 2019 (warned 1997-2019) + (should (equal (time-stamp-string "%-I" ref-time) "3")) + (should (equal (time-stamp-string "%-I" ref-time2) "12")) + (should (equal (time-stamp-string "%-I" ref-time3) "6")) + ;; warned 1997-2019, changed in 2019 + (should (equal (time-stamp-string "%_I" ref-time) " 3")) + (should (equal (time-stamp-string "%_I" ref-time2) "12")) + (should (equal (time-stamp-string "%_I" ref-time3) " 6")) + (should (equal (time-stamp-string "%I" ref-time) "03")) + (should (equal (time-stamp-string "%I" ref-time2) "12")) + (should (equal (time-stamp-string "%I" ref-time3) "06")))) (ert-deftest time-stamp-test-month-number () "Test time-stamp formats for month number." @@ -183,11 +193,14 @@ ;; implemented since 1997, documented since 2019 (should (equal (time-stamp-string "%1m" ref-time) "1")) (should (equal (time-stamp-string "%1m" ref-time2) "11")) - ;; warned since 1997, will change - (time-stamp-should-warn (equal (time-stamp-string "%_m" ref-time) "1")) - (time-stamp-should-warn (equal (time-stamp-string "%_m" ref-time2) "11")) - (time-stamp-should-warn (equal (time-stamp-string "%m" ref-time) "1")) - (time-stamp-should-warn (equal (time-stamp-string "%m" ref-time2) "11")))) + ;; allowed but undocumented since 2019 (warned 1997-2019) + (should (equal (time-stamp-string "%-m" ref-time) "1")) + (should (equal (time-stamp-string "%-m" ref-time2) "11")) + ;; warned 1997-2019, changed in 2019 + (should (equal (time-stamp-string "%_m" ref-time) " 1")) + (should (equal (time-stamp-string "%_m" ref-time2) "11")) + (should (equal (time-stamp-string "%m" ref-time) "01")) + (should (equal (time-stamp-string "%m" ref-time2) "11")))) (ert-deftest time-stamp-test-minute () "Test time-stamp formats for minute." @@ -203,11 +216,14 @@ ;; implemented since 1997, documented since 2019 (should (equal (time-stamp-string "%1M" ref-time) "4")) (should (equal (time-stamp-string "%1M" ref-time2) "14")) - ;; warned since 1997, will change - (time-stamp-should-warn (equal (time-stamp-string "%_M" ref-time) "4")) - (time-stamp-should-warn (equal (time-stamp-string "%_M" ref-time2) "14")) - (time-stamp-should-warn (equal (time-stamp-string "%M" ref-time) "4")) - (time-stamp-should-warn (equal (time-stamp-string "%M" ref-time2) "14")))) + ;; allowed but undocumented since 2019 (warned 1997-2019) + (should (equal (time-stamp-string "%-M" ref-time) "4")) + (should (equal (time-stamp-string "%-M" ref-time2) "14")) + ;; warned 1997-2019, changed in 2019 + (should (equal (time-stamp-string "%_M" ref-time) " 4")) + (should (equal (time-stamp-string "%_M" ref-time2) "14")) + (should (equal (time-stamp-string "%M" ref-time) "04")) + (should (equal (time-stamp-string "%M" ref-time2) "14")))) (ert-deftest time-stamp-test-second () "Test time-stamp formats for second." @@ -223,11 +239,14 @@ ;; implemented since 1997, documented since 2019 (should (equal (time-stamp-string "%1S" ref-time) "5")) (should (equal (time-stamp-string "%1S" ref-time2) "15")) - ;; warned since 1997, will change - (time-stamp-should-warn (equal (time-stamp-string "%_S" ref-time) "5")) - (time-stamp-should-warn (equal (time-stamp-string "%_S" ref-time2) "15")) - (time-stamp-should-warn (equal (time-stamp-string "%S" ref-time) "5")) - (time-stamp-should-warn (equal (time-stamp-string "%S" ref-time2) "15")))) + ;; allowed but undocumented since 2019 (warned 1997-2019) + (should (equal (time-stamp-string "%-S" ref-time) "5")) + (should (equal (time-stamp-string "%-S" ref-time2) "15")) + ;; warned 1997-2019, changed in 2019 + (should (equal (time-stamp-string "%_S" ref-time) " 5")) + (should (equal (time-stamp-string "%_S" ref-time2) "15")) + (should (equal (time-stamp-string "%S" ref-time) "05")) + (should (equal (time-stamp-string "%S" ref-time2) "15")))) (ert-deftest time-stamp-test-am-pm () "Test time-stamp formats for AM and PM strings." @@ -237,9 +256,9 @@ (should (equal (time-stamp-string "%#p" ref-time3) "am")) (should (equal (time-stamp-string "%P" ref-time) "PM")) (should (equal (time-stamp-string "%P" ref-time3) "AM")) - ;; warned since 1997, will change - (time-stamp-should-warn (equal (time-stamp-string "%p" ref-time) "pm")) - (time-stamp-should-warn (equal (time-stamp-string "%p" ref-time3) "am")))) + ;; warned 1997-2019, changed in 2019 + (should (equal (time-stamp-string "%p" ref-time) "PM")) + (should (equal (time-stamp-string "%p" ref-time3) "AM")))) (ert-deftest time-stamp-test-day-number-in-week () "Test time-stamp formats for day number in week." @@ -257,8 +276,8 @@ (should (equal (time-stamp-string "%:y" ref-time) "2006")) ;; implemented since 1997, documented since 2019 (should (equal (time-stamp-string "%Y" ref-time) "2006")) - ;; warned since 1997, will change - (time-stamp-should-warn (equal (time-stamp-string "%y" ref-time) "2006")))) + ;; warned 1997-2019, changed in 2019 + (should (equal (time-stamp-string "%y" ref-time) "06")))) (ert-deftest time-stamp-test-time-zone () "Test time-stamp formats for time zone." commit 8ba1ca54f31b556edcc24d497d132203cc0cb9c0 Author: Stephen Gildea Date: Mon Sep 30 20:06:16 2019 -0700 time-stamp doc: recommend formats closer to format-time-string * time-stamp.el (time-stamp-format, time-stamp-pattern): Update recommended (documented) formats. No code changes, just documentation. All recommended formats are compatible at least as far back as Emacs 22.1 (released in 2007) and are now closer to compatibility with format-time-string. * time-stamp-tests.el: Update test comments to match. diff --git a/etc/NEWS b/etc/NEWS index cb8b6fcac1..9a9e25bea9 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -1995,6 +1995,27 @@ and 'gravatar-force-default'. *** The built-in ada-mode is now deleted. The GNU ELPA package is a good replacement, even in very large source files. +** Some conversions recommended for 'time-stamp-format' have changed. +The new documented/recommended %-conversions are closer to those +used by 'format-time-string' and are compatible at least as far back +as Emacs 22.1 (released in 2007). + +Uppercase abbreviated day name of week: was %3A, now %#a +Full day name of week: was %:a, now %:A +Uppercase abbreviated month name: was %3B, now %#b +Full month name: was %:b, now %:B +Four-digit year: was %:y, now %Y +Lowercase timezone name: was %z, now %#Z +Fully-qualified host name: was %s, now %Q +Unqualified host name: (was none), now %q +Login name: was %u, now %l +User's full name: was %U, now %L + +Merely having (add-hook 'before-save-hook 'time-stamp) in your +Emacs init file does not expose you to this change. However, +if you set 'time-stamp-format' or 'time-stamp-pattern' with a +file-local variable, you may need to update the value. + * New Modes and Packages in Emacs 27.1 diff --git a/lisp/time-stamp.el b/lisp/time-stamp.el index 284d450155..f6b0018579 100644 --- a/lisp/time-stamp.el +++ b/lisp/time-stamp.el @@ -41,7 +41,7 @@ :group 'data :group 'extensions) -(defcustom time-stamp-format "%:y-%02m-%02d %02H:%02M:%02S %u" +(defcustom time-stamp-format "%Y-%02m-%02d %02H:%02M:%02S %l" "Format of the string inserted by \\[time-stamp]. This is a string, used verbatim except for character sequences beginning with %, as follows. The values of non-numeric formatted items depend @@ -49,26 +49,26 @@ on the locale setting recorded in `system-time-locale' and `locale-coding-system'. The examples here are for the default \(`C') locale. -%:a weekday name: `Monday'. %#A gives uppercase: `MONDAY' -%3a abbreviated weekday: `Mon'. %3A gives uppercase: `MON' -%:b month name: `January'. %#B gives uppercase: `JANUARY' -%3b abbreviated month: `Jan'. %3B gives uppercase: `JAN' +%:A weekday name: `Monday' %#A gives uppercase: `MONDAY' +%3a abbreviated weekday: `Mon' %#a gives uppercase: `MON' +%:B month name: `January' %#B gives uppercase: `JANUARY' +%3b abbreviated month: `Jan' %#b gives uppercase: `JAN' %02d day of month %02H 24-hour clock hour %02I 12-hour clock hour %02m month number %02M minute -%#p `am' or `pm'. %P gives uppercase: `AM' or `PM' +%#p `am' or `pm' %P gives uppercase: `AM' or `PM' %02S seconds %w day number of week, Sunday is 0 -%02y 2-digit year: `03' %:y 4-digit year: `2003' -%z time zone name: `est'. %Z gives uppercase: `EST' +%02y 2-digit year: `03' %Y 4-digit year: `2003' +%#Z lowercase time zone name: `est' %Z gives uppercase: `EST' Non-date items: %% a literal percent character: `%' %f file name without directory %F gives absolute pathname -%s system name -%u user's login name %U user's full name +%l login name %L full name of logged-in user +%q unqualified host name %Q fully-qualified host name %h mail host name Decimal digits between the % and the type character specify the @@ -76,16 +76,15 @@ field width. Strings are truncated on the right; years on the left. A leading zero in the field width zero-fills a number. For example, to get the format used by the `date' command, -use \"%3a %3b %2d %02H:%02M:%02S %Z %:y\". +use \"%3a %3b %2d %02H:%02M:%02S %Z %Y\". -In the future these formats will be aligned more with `format-time-string'. -Because of this transition, the default padding for numeric formats will -change in a future version. Therefore either a padding width should be -specified, or the : modifier should be used to explicitly request the -historical default." +The default padding of some formats has changed to be more compatible +with format-time-string. To be compatible with older versions of Emacs, +specify a padding width (as shown) or use the : modifier to request the +transitional behavior (again, as shown)." :type 'string :group 'time-stamp - :version "20.1") + :version "27.1") ;;;###autoload(put 'time-stamp-format 'safe-local-variable 'stringp) (defcustom time-stamp-active t @@ -227,13 +226,13 @@ Examples: \"-10/\" (sets only `time-stamp-line-limit') \"-9/^Last modified: %%$\" (sets `time-stamp-line-limit', -`time-stamp-start', `time-stamp-end' and `time-stamp-format') +`time-stamp-start' and `time-stamp-end') -\"@set Time-stamp: %:b %:d, %:y$\" (sets `time-stamp-start', -`time-stamp-end' and `time-stamp-format') +\"@set Time-stamp: %:B %1d, %Y$\" (sets `time-stamp-start', +`time-stamp-format' and `time-stamp-end') -\"newcommand{\\\\\\\\timestamp}{%%}\" (sets `time-stamp-start', -`time-stamp-end' and `time-stamp-format') +\"newcommand{\\\\\\\\timestamp}{%%}\" (sets `time-stamp-start' +and `time-stamp-end') Do not change `time-stamp-pattern' `time-stamp-line-limit', `time-stamp-start', or `time-stamp-end' for yourself or you will be diff --git a/test/lisp/time-stamp-tests.el b/test/lisp/time-stamp-tests.el index 452d83ddba..f13fee76f0 100644 --- a/test/lisp/time-stamp-tests.el +++ b/test/lisp/time-stamp-tests.el @@ -63,9 +63,10 @@ ;; implemented and documented since 1997 (should (equal (time-stamp-string "%3a" ref-time) "Mon")) (should (equal (time-stamp-string "%#A" ref-time) "MONDAY")) + ;; documented 1997-2019 (should (equal (time-stamp-string "%3A" ref-time) "MON")) (should (equal (time-stamp-string "%:a" ref-time) "Monday")) - ;; implemented since 2001, undocumented future formats + ;; implemented since 2001, documented since 2019 (should (equal (time-stamp-string "%#a" ref-time) "MON")) (should (equal (time-stamp-string "%:A" ref-time) "Monday")) ;; warned since 1997, will change @@ -82,9 +83,10 @@ ;; implemented and documented since 1997 (should (equal (time-stamp-string "%3b" ref-time) "Jan")) (should (equal (time-stamp-string "%#B" ref-time) "JANUARY")) + ;; documented 1997-2019 (should (equal (time-stamp-string "%3B" ref-time) "JAN")) (should (equal (time-stamp-string "%:b" ref-time) "January")) - ;; implemented since 2001, undocumented future formats + ;; implemented since 2001, documented since 2019 (should (equal (time-stamp-string "%#b" ref-time) "JAN")) (should (equal (time-stamp-string "%:B" ref-time) "January")) ;; warned since 1997, will change @@ -103,10 +105,10 @@ (should (equal (time-stamp-string "%2d" ref-time2) "18")) (should (equal (time-stamp-string "%02d" ref-time) "02")) (should (equal (time-stamp-string "%02d" ref-time2) "18")) - ;; implemented and documented since 1997 + ;; documented 1997-2019 (should (equal (time-stamp-string "%:d" ref-time) "2")) (should (equal (time-stamp-string "%:d" ref-time2) "18")) - ;; implemented since 1997, undocumented future format + ;; implemented since 1997, documented since 2019 (should (equal (time-stamp-string "%1d" ref-time) "2")) (should (equal (time-stamp-string "%1d" ref-time2) "18")) ;; warned since 1997, will change @@ -125,11 +127,11 @@ (should (equal (time-stamp-string "%02H" ref-time) "15")) (should (equal (time-stamp-string "%02H" ref-time2) "12")) (should (equal (time-stamp-string "%02H" ref-time3) "06")) - ;; implemented and documented since 1997 + ;; documented 1997-2019 (should (equal (time-stamp-string "%:H" ref-time) "15")) (should (equal (time-stamp-string "%:H" ref-time2) "12")) (should (equal (time-stamp-string "%:H" ref-time3) "6")) - ;; implemented since 1997, undocumented future format + ;; implemented since 1997, documented since 2019 (should (equal (time-stamp-string "%1H" ref-time) "15")) (should (equal (time-stamp-string "%1H" ref-time2) "12")) (should (equal (time-stamp-string "%1H" ref-time3) "6")) @@ -151,11 +153,11 @@ (should (equal (time-stamp-string "%02I" ref-time) "03")) (should (equal (time-stamp-string "%02I" ref-time2) "12")) (should (equal (time-stamp-string "%02I" ref-time3) "06")) - ;; implemented and documented since 1997 + ;; documented 1997-2019 (should (equal (time-stamp-string "%:I" ref-time) "3")) ;PM (should (equal (time-stamp-string "%:I" ref-time2) "12")) ;PM (should (equal (time-stamp-string "%:I" ref-time3) "6")) ;AM - ;; implemented since 1997, undocumented future format + ;; implemented since 1997, documented since 2019 (should (equal (time-stamp-string "%1I" ref-time) "3")) (should (equal (time-stamp-string "%1I" ref-time2) "12")) (should (equal (time-stamp-string "%1I" ref-time3) "6")) @@ -175,10 +177,10 @@ (should (equal (time-stamp-string "%2m" ref-time2) "11")) (should (equal (time-stamp-string "%02m" ref-time) "01")) (should (equal (time-stamp-string "%02m" ref-time2) "11")) - ;; implemented and documented since 1997 + ;; documented 1997-2019 (should (equal (time-stamp-string "%:m" ref-time) "1")) (should (equal (time-stamp-string "%:m" ref-time2) "11")) - ;; implemented since 1997, undocumented future format + ;; implemented since 1997, documented since 2019 (should (equal (time-stamp-string "%1m" ref-time) "1")) (should (equal (time-stamp-string "%1m" ref-time2) "11")) ;; warned since 1997, will change @@ -195,10 +197,10 @@ (should (equal (time-stamp-string "%2M" ref-time2) "14")) (should (equal (time-stamp-string "%02M" ref-time) "04")) (should (equal (time-stamp-string "%02M" ref-time2) "14")) - ;; implemented and documented since 1997 + ;; documented 1997-2019 (should (equal (time-stamp-string "%:M" ref-time) "4")) (should (equal (time-stamp-string "%:M" ref-time2) "14")) - ;; implemented since 1997, undocumented future format + ;; implemented since 1997, documented since 2019 (should (equal (time-stamp-string "%1M" ref-time) "4")) (should (equal (time-stamp-string "%1M" ref-time2) "14")) ;; warned since 1997, will change @@ -215,10 +217,10 @@ (should (equal (time-stamp-string "%2S" ref-time2) "15")) (should (equal (time-stamp-string "%02S" ref-time) "05")) (should (equal (time-stamp-string "%02S" ref-time2) "15")) - ;; implemented and documented since 1997 + ;; documented 1997-2019 (should (equal (time-stamp-string "%:S" ref-time) "5")) (should (equal (time-stamp-string "%:S" ref-time2) "15")) - ;; implemented since 1997, undocumented future format + ;; implemented since 1997, documented since 2019 (should (equal (time-stamp-string "%1S" ref-time) "5")) (should (equal (time-stamp-string "%1S" ref-time2) "15")) ;; warned since 1997, will change @@ -251,9 +253,9 @@ (with-time-stamp-test-env ;; implemented and documented since 1995 (should (equal (time-stamp-string "%02y" ref-time) "06")) - ;; implemented and documented since 1997 + ;; documented 1997-2019 (should (equal (time-stamp-string "%:y" ref-time) "2006")) - ;; implemented since 1997, undocumented future format + ;; implemented since 1997, documented since 2019 (should (equal (time-stamp-string "%Y" ref-time) "2006")) ;; warned since 1997, will change (time-stamp-should-warn (equal (time-stamp-string "%y" ref-time) "2006")))) @@ -263,8 +265,9 @@ (with-time-stamp-test-env ;; implemented and documented since 1995 (should (equal (time-stamp-string "%Z" ref-time) "GMT")) + ;; documented 1995-2019 (should (equal (time-stamp-string "%z" ref-time) "gmt")) - ;; implemented since 1997, undocumented future format + ;; implemented since 1997, documented since 2019 (should (equal (time-stamp-string "%#Z" ref-time) "gmt")))) (ert-deftest time-stamp-test-non-date-conversions () @@ -277,14 +280,15 @@ (should (equal (time-stamp-string "%F" ref-time) "/emacs/test/time-stamped-file")) (should (equal (time-stamp-string "%h" ref-time) "test-mail-host-name")) + ;; documented 1995-2019 (should (equal (time-stamp-string "%s" ref-time) "test-system-name.example.org")) (should (equal (time-stamp-string "%U" ref-time) "Time Stamp Tester")) (should (equal (time-stamp-string "%u" ref-time) "test-logname")) - ;; implemented since 2001, undocumented future formats + ;; implemented since 2001, documented since 2019 (should (equal (time-stamp-string "%L" ref-time) "Time Stamp Tester")) (should (equal (time-stamp-string "%l" ref-time) "test-logname")) - ;; implemented since 2007, undocumented future formats + ;; implemented since 2007, documented since 2019 (should (equal (time-stamp-string "%Q" ref-time) "test-system-name.example.org")) (should (equal commit 24a3288278d9c152cc16b256287563c4b14d7238 Author: Juanma Barranquero Date: Tue Oct 1 04:33:28 2019 +0200 Bump up max_specpdl_size to 1600 * src/eval.c (init_eval_once): Set max_specpdl_size to 1600. * doc/lispref/variables.texi (Local Variables): Document it. diff --git a/doc/lispref/variables.texi b/doc/lispref/variables.texi index d62a5aa3af..b49874f9eb 100644 --- a/doc/lispref/variables.texi +++ b/doc/lispref/variables.texi @@ -303,7 +303,7 @@ that Lisp avoids infinite recursion on an ill-defined function. @code{max-lisp-eval-depth} provides another limit on depth of nesting. @xref{Definition of max-lisp-eval-depth,, Eval}. -The default value is 1500. Entry to the Lisp debugger increases the +The default value is 1600. Entry to the Lisp debugger increases the value, if there is little room left, to make sure the debugger itself has room to execute. @end defopt diff --git a/src/eval.c b/src/eval.c index 2bfc16eae0..4bc96f96f2 100644 --- a/src/eval.c +++ b/src/eval.c @@ -219,7 +219,7 @@ void init_eval_once (void) { /* Don't forget to update docs (lispref node "Local Variables"). */ - max_specpdl_size = 1500; /* 1300 is not enough for cl-generic.el. */ + max_specpdl_size = 1600; /* 1500 is not enough for cl-generic.el. */ max_lisp_eval_depth = 800; Vrun_hooks = Qnil; pdumper_do_now_and_after_load (init_eval_once_for_pdumper); commit 5fe2538d0b3ee59f0f302d97b275f9433e679708 Author: Eric Abrahamsen Date: Mon Sep 30 12:30:31 2019 -0700 Update calling convention for nnmaildir-close-server * lisp/gnus/nnmaildir.el (nnmaildir-close-server): To take an optional "defs" arg, as changed in 2712187. diff --git a/lisp/gnus/nnmaildir.el b/lisp/gnus/nnmaildir.el index 3ffdc4630d..0133fc6ce2 100644 --- a/lisp/gnus/nnmaildir.el +++ b/lisp/gnus/nnmaildir.el @@ -1754,7 +1754,7 @@ This variable is set by `nnmaildir-request-article'.") (delete-file file)))) t))) -(defun nnmaildir-close-server (&optional server) +(defun nnmaildir-close-server (&optional server _defs) "Close SERVER, or the current maildir server." (when (nnmaildir--prepare server nil) (setq server nnmaildir--cur-server commit 2e08014859773a8989d785e2b3f6c16294eb0190 Author: Stefan Monnier Date: Mon Sep 30 15:08:41 2019 -0400 * lisp/gnus/mm-uu.el: Use lexical-binding and cl-defstruct (mm-uu-type-alist): Make functions visible to byte-compiler. (mm-uu-entry): New defstruct. (mm-uu-configure): Use mapconcat. (mm-uu-dissect): Avoid setq on `func`. diff --git a/lisp/gnus/mm-uu.el b/lisp/gnus/mm-uu.el index 981bf8ea3e..fec3986ded 100644 --- a/lisp/gnus/mm-uu.el +++ b/lisp/gnus/mm-uu.el @@ -1,4 +1,4 @@ -;;; mm-uu.el --- Return uu stuff as mm handles +;;; mm-uu.el --- Return uu stuff as mm handles -*- lexical-binding:t -*- ;; Copyright (C) 1998-2019 Free Software Foundation, Inc. @@ -29,6 +29,7 @@ (require 'mm-decode) (require 'mailcap) (require 'mml2015) +(eval-when-compile (require 'cl-lib)) (autoload 'uudecode-decode-region "uudecode") (autoload 'uudecode-decode-region-external "uudecode") @@ -90,124 +91,126 @@ This can be either \"inline\" or \"attachment\".") :group 'gnus-article-mime) (defvar mm-uu-type-alist - '((postscript + `((postscript "^%!PS-" "^%%EOF$" - mm-uu-postscript-extract + ,#'mm-uu-postscript-extract nil) (uu ;; Maybe we should have a more strict test here. "^begin[ \t]+0?[0-7][0-7][0-7][ \t]+" "^end[ \t]*$" - mm-uu-uu-extract - mm-uu-uu-filename) + ,#'mm-uu-uu-extract + ,#'mm-uu-uu-filename) (binhex "^:.\\{63,63\\}$" ":$" - mm-uu-binhex-extract + ,#'mm-uu-binhex-extract nil - mm-uu-binhex-filename) + ,#'mm-uu-binhex-filename) (yenc "^=ybegin.*size=[0-9]+.*name=.*$" "^=yend.*size=[0-9]+" - mm-uu-yenc-extract - mm-uu-yenc-filename) + ,#'mm-uu-yenc-extract + ,#'mm-uu-yenc-filename) (shar "^#! */bin/sh" "^exit 0$" - mm-uu-shar-extract) + ,#'mm-uu-shar-extract) (forward ;; Thanks to Edward J. Sabol and ;; Peter von der Ahé "^-+ \\(Start of \\)?Forwarded message" "^-+ End \\(of \\)?forwarded message" - mm-uu-forward-extract + ,#'mm-uu-forward-extract nil - mm-uu-forward-test) + ,#'mm-uu-forward-test) (gnatsweb "^----gnatsweb-attachment----" nil - mm-uu-gnatsweb-extract) + ,#'mm-uu-gnatsweb-extract) (pgp-signed "^-----BEGIN PGP SIGNED MESSAGE-----" "^-----END PGP SIGNATURE-----" - mm-uu-pgp-signed-extract + ,#'mm-uu-pgp-signed-extract nil nil) (pgp-encrypted "^-----BEGIN PGP MESSAGE-----" "^-----END PGP MESSAGE-----" - mm-uu-pgp-encrypted-extract + ,#'mm-uu-pgp-encrypted-extract nil nil) (pgp-key "^-----BEGIN PGP PUBLIC KEY BLOCK-----" "^-----END PGP PUBLIC KEY BLOCK-----" - mm-uu-pgp-key-extract - mm-uu-gpg-key-skip-to-last + ,#'mm-uu-pgp-key-extract + ,#'mm-uu-gpg-key-skip-to-last nil) (emacs-sources "^;;;?[ \t]*[^ \t]+\\.el[ \t]*--" "^;;;?[ \t]*\\([^ \t]+\\.el\\)[ \t]+ends here" - mm-uu-emacs-sources-extract + ,#'mm-uu-emacs-sources-extract nil - mm-uu-emacs-sources-test) + ,#'mm-uu-emacs-sources-test) (diff "^Index: " nil - mm-uu-diff-extract + ,#'mm-uu-diff-extract nil - mm-uu-diff-test) + ,#'mm-uu-diff-test) (diff "^=== modified file " nil - mm-uu-diff-extract + ,#'mm-uu-diff-extract nil - mm-uu-diff-test) + ,#'mm-uu-diff-test) (git-format-patch "^diff --git " "^-- " - mm-uu-diff-extract + ,#'mm-uu-diff-extract nil - mm-uu-diff-test) + ,#'mm-uu-diff-test) (message-marks ;; Text enclosed with tags similar to `message-mark-insert-begin' and ;; `message-mark-insert-end'. Don't use those variables to avoid ;; dependency on `message.el'. "^-+[8<>]*-\\{9,\\}[a-z ]+-\\{9,\\}[a-z ]+-\\{9,\\}[8<>]*-+$" "^-+[8<>]*-\\{9,\\}[a-z ]+-\\{9,\\}[a-z ]+-\\{9,\\}[8<>]*-+$" - (lambda () (mm-uu-verbatim-marks-extract 0 0 1 -1)) + ,(lambda () (mm-uu-verbatim-marks-extract 0 0 1 -1)) nil) ;; Omitting [a-z8<] leads to false positives (bogus signature separators ;; and mailing list banners). (insert-marks "^ *\\(-\\|_\\)\\{30,\\}.*[a-z8<].*\\(-\\|_\\)\\{30,\\} *$" "^ *\\(-\\|_\\)\\{30,\\}.*[a-z8<].*\\(-\\|_\\)\\{30,\\} *$" - (lambda () (mm-uu-verbatim-marks-extract 0 0 1 -1)) + ,(lambda () (mm-uu-verbatim-marks-extract 0 0 1 -1)) nil) (verbatim-marks ;; slrn-style verbatim marks, see ;; http://slrn.sourceforge.net/docs/slrn-manual-6.html#process_verbatim_marks "^#v\\+" "^#v\\-$" - (lambda () (mm-uu-verbatim-marks-extract 0 0)) + ,(lambda () (mm-uu-verbatim-marks-extract 0 0)) nil) (LaTeX "^\\([\\\\%][^\n]+\n\\)*\\\\documentclass.*[[{%]" "^\\\\end{document}" - mm-uu-latex-extract + ,#'mm-uu-latex-extract nil - mm-uu-latex-test) + ,#'mm-uu-latex-test) (org-src-code-block "^[ \t]*#\\+begin_" "^[ \t]*#\\+end_" - mm-uu-org-src-code-block-extract) + ,#'mm-uu-org-src-code-block-extract) (org-meta-line "^[ \t]*#\\+[[:alpha:]]+: " "$" - mm-uu-org-src-code-block-extract)) + ,#'mm-uu-org-src-code-block-extract)) "A list of specifications for non-MIME attachments. -Each element consist of the following entries: label, -start-regexp, end-regexp, extract-function, test-function. +Each element consist of a `mm-uu-entry'. +The functions in the last 3 slots of this type can make use of the following +dynamically-scoped variables: +`file-name', `start-point', and `end-point'. After modifying this list you must run \\[mm-uu-configure]. @@ -230,23 +233,11 @@ To disable dissecting shar codes, for instance, add ;; functions -(defsubst mm-uu-type (entry) - (car entry)) - -(defsubst mm-uu-beginning-regexp (entry) - (nth 1 entry)) - -(defsubst mm-uu-end-regexp (entry) - (nth 2 entry)) - -(defsubst mm-uu-function-extract (entry) - (nth 3 entry)) - -(defsubst mm-uu-function-1 (entry) - (nth 4 entry)) - -(defsubst mm-uu-function-2 (entry) - (nth 5 entry)) +(cl-defstruct (mm-uu-entry + (:conc-name mm-uu-) + (:constructor nil) + (:type list)) + type beginning-regexp end-regexp function-extract function-1 function-2) (defcustom mm-uu-hide-markers (< 16 (length (defined-colors))) "If non-nil, hide verbatim markers. @@ -309,15 +300,15 @@ apply the face `mm-uu-extract'." "Configure detection of non-MIME attachments." (interactive) (if symbol (set-default symbol value)) - (setq mm-uu-beginning-regexp nil) - (mapcar (lambda (mm-uu-entry) - (if (mm-uu-configure-p (mm-uu-type mm-uu-entry) 'disabled) - nil - (setq mm-uu-beginning-regexp - (concat mm-uu-beginning-regexp - (if mm-uu-beginning-regexp "\\|") - (mm-uu-beginning-regexp mm-uu-entry))))) - mm-uu-type-alist)) + (setq mm-uu-beginning-regexp + (mapconcat #'mm-uu-beginning-regexp + (delq nil (mapcar + (lambda (entry) + (if (mm-uu-configure-p (mm-uu-type entry) + 'disabled) + nil entry)) + mm-uu-type-alist)) + "\\|"))) (mm-uu-configure) @@ -481,7 +472,7 @@ apply the face `mm-uu-extract'." (narrow-to-region (point) end-point) (mm-dissect-buffer t))) -(defun mm-uu-pgp-signed-test (&rest rest) +(defun mm-uu-pgp-signed-test (&rest _) (and mml2015-use (mml2015-clear-verify-function) @@ -495,7 +486,7 @@ apply the face `mm-uu-extract'." (defvar gnus-newsgroup-charset) -(defun mm-uu-pgp-signed-extract-1 (handles ctl) +(defun mm-uu-pgp-signed-extract-1 (_handles _ctl) (let ((buf (mm-uu-copy-to-buffer (point-min) (point-max)))) (with-current-buffer buf (if (mm-uu-pgp-signed-test) @@ -530,7 +521,7 @@ apply the face `mm-uu-extract'." mm-security-handle))) mm-security-handle)) -(defun mm-uu-pgp-encrypted-test (&rest rest) +(defun mm-uu-pgp-encrypted-test (&rest _) (and mml2015-use (mml2015-clear-decrypt-function) @@ -542,7 +533,7 @@ apply the face `mm-uu-extract'." (y-or-n-p "Decrypt pgp encrypted part? ") (message "")))))) -(defun mm-uu-pgp-encrypted-extract-1 (handles ctl) +(defun mm-uu-pgp-encrypted-extract-1 (_handles _ctl) (let ((buf (mm-uu-copy-to-buffer (point-min) (point-max))) (first t) charset) @@ -599,6 +590,9 @@ apply the face `mm-uu-extract'." mm-security-handle)) (defun mm-uu-gpg-key-skip-to-last () + ;; FIXME: Don't use mm-uu-entry (we know which entry it is anyway!). + ;; FIXME: Move it to function-2 so it doesn't need to check + ;; mm-uu-configure-p. (let ((point (point)) (end-regexp (mm-uu-end-regexp mm-uu-entry)) (beginning-regexp (mm-uu-beginning-regexp mm-uu-entry))) @@ -623,7 +617,7 @@ MIME-TYPE specifies a MIME type and parameters, which defaults to the value of `mm-uu-text-plain-type'." (let ((case-fold-search t) (mm-uu-text-plain-type (or mime-type mm-uu-text-plain-type)) - text-start start-point end-point file-name result mm-uu-entry func) + text-start start-point end-point file-name result mm-uu-entry) (save-excursion (goto-char (point-min)) (cond @@ -644,8 +638,7 @@ value of `mm-uu-text-plain-type'." beginning-regexp) (setq mm-uu-entry (car alist)) (pop alist)))) - (if (setq func (mm-uu-function-1 mm-uu-entry)) - (funcall func)) + (funcall (or (mm-uu-function-1 mm-uu-entry) #'ignore)) (forward-line);; in case of failure (when (and (not (mm-uu-configure-p (mm-uu-type mm-uu-entry) 'disabled)) (let ((end-regexp (mm-uu-end-regexp mm-uu-entry))) @@ -655,8 +648,8 @@ value of `mm-uu-text-plain-type'." (re-search-forward end-regexp nil t) (forward-line) (setq end-point (point))))) - (or (not (setq func (mm-uu-function-2 mm-uu-entry))) - (funcall func))) + (funcall (or (mm-uu-function-2 mm-uu-entry) + (lambda () t)))) (if (and (> start-point text-start) (progn (goto-char text-start) commit 9e9bd502ad8ec4e8156f823b048c0b3366ed16b4 Author: Eli Zaretskii Date: Mon Sep 30 21:59:58 2019 +0300 Fix quoting in gnutls.c comments and strings * src/gnutls.c (gnutls_make_error, emacs_gnutls_global_init) (Fgnutls_symmetric_encrypt, Fgnutls_symmetric_decrypt) (Fgnutls_hash_mac, Fgnutls_hash_digest): Fix quoting in doc strings and comments. diff --git a/src/gnutls.c b/src/gnutls.c index d43534b5ae..5f412b5004 100644 --- a/src/gnutls.c +++ b/src/gnutls.c @@ -894,7 +894,7 @@ emacs_gnutls_handle_error (gnutls_session_t session, int err) } /* convert an integer error to a Lisp_Object; it will be either a - known symbol like `gnutls_e_interrupted' and `gnutls_e_again' or + known symbol like 'gnutls_e_interrupted' and 'gnutls_e_again' or simply the integer value of the error. GNUTLS_E_SUCCESS is mapped to Qt. */ static Lisp_Object @@ -1529,7 +1529,7 @@ returned as the :certificate entry. */) } /* Initialize global GnuTLS state to defaults. - Call `gnutls-global-deinit' when GnuTLS usage is no longer needed. + Call 'gnutls-global-deinit' when GnuTLS usage is no longer needed. Return zero on success. */ Lisp_Object emacs_gnutls_global_init (void) @@ -1560,7 +1560,7 @@ gnutls_ip_address_p (char *string) # if 0 /* Deinitialize global GnuTLS state. - See also `gnutls-global-init'. */ + See also 'gnutls-global-init'. */ static Lisp_Object emacs_gnutls_global_deinit (void) { @@ -2470,11 +2470,10 @@ The KEY can be specified as a buffer or string or in other ways (see Info node `(elisp)Format of GnuTLS Cryptography Inputs'). The KEY will be wiped after use if it's a string. -The IV and INPUT and the optional AEAD_AUTH can be specified as a -buffer or string or in other ways (see Info node `(elisp)Format of -GnuTLS Cryptography Inputs'). +The IV and INPUT and the optional AEAD_AUTH can also be specified as a +buffer or string or in other ways. -The alist of symmetric ciphers can be obtained with `gnutls-ciphers`. +The alist of symmetric ciphers can be obtained with `gnutls-ciphers'. The CIPHER may be a string or symbol matching a key in that alist, or a plist with the :cipher-id numeric property, or the number itself. @@ -2497,11 +2496,10 @@ The KEY can be specified as a buffer or string or in other ways (see Info node `(elisp)Format of GnuTLS Cryptography Inputs'). The KEY will be wiped after use if it's a string. -The IV and INPUT and the optional AEAD_AUTH can be specified as a -buffer or string or in other ways (see Info node `(elisp)Format of -GnuTLS Cryptography Inputs'). +The IV and INPUT and the optional AEAD_AUTH can also be specified as a +buffer or string or in other ways. -The alist of symmetric ciphers can be obtained with `gnutls-ciphers`. +The alist of symmetric ciphers can be obtained with `gnutls-ciphers'. The CIPHER may be a string or symbol matching a key in that alist, or a plist with the `:cipher-id' numeric property, or the number itself. @@ -2592,10 +2590,10 @@ The KEY can be specified as a buffer or string or in other ways (see Info node `(elisp)Format of GnuTLS Cryptography Inputs'). The KEY will be wiped after use if it's a string. -The INPUT can be specified as a buffer or string or in other -ways (see Info node `(elisp)Format of GnuTLS Cryptography Inputs'). +The INPUT can also be specified as a buffer or string or in other +ways. -The alist of MAC algorithms can be obtained with `gnutls-macs`. The +The alist of MAC algorithms can be obtained with `gnutls-macs'. The HASH-METHOD may be a string or symbol matching a key in that alist, or a plist with the `:mac-algorithm-id' numeric property, or the number itself. */) @@ -2690,7 +2688,7 @@ Return nil on error. The INPUT can be specified as a buffer or string or in other ways (see Info node `(elisp)Format of GnuTLS Cryptography Inputs'). -The alist of digest algorithms can be obtained with `gnutls-digests`. +The alist of digest algorithms can be obtained with `gnutls-digests'. The DIGEST-METHOD may be a string or symbol matching a key in that alist, or a plist with the `:digest-algorithm-id' numeric property, or the number itself. */) commit 5746202c182a9c69c732beb29b8507a6e6364799 Author: Lars Ingebrigtsen Date: Mon Sep 30 17:39:38 2019 +0200 Make doc-view error message more informative * lisp/doc-view.el (doc-view-initiate-display): Make error message clearer (bug#3827). diff --git a/lisp/doc-view.el b/lisp/doc-view.el index 9fe177a184..f75421e7b5 100644 --- a/lisp/doc-view.el +++ b/lisp/doc-view.el @@ -1715,11 +1715,11 @@ If BACKWARD is non-nil, jump to the previous match." (substitute-command-keys (concat "Type \\[doc-view-toggle-display] to toggle between " "editing or viewing the document.")))) - (message - "%s" - (concat "No PNG support is available, or some conversion utility for " - (file-name-extension doc-view--buffer-file-name) - " files is missing.")) + (if (image-type-available-p 'png) + (message "Conversion utility \"%s\" not available for %s" + doc-view-ghostscript-program + (file-name-extension doc-view--buffer-file-name)) + (message "PNG support not available; can't view document")) (if (and (executable-find doc-view-pdftotext-program) (y-or-n-p "Unable to render file. View extracted text instead? ")) commit e7ee756f54834bda7ab2d862d7832a77de909b8e Author: Lars Ingebrigtsen Date: Mon Sep 30 17:13:10 2019 +0200 Fix problem with non-ASCII MML description strings * lisp/gnus/mml.el (mml-insert-tag): Quote non-ASCII parameters. (mml-insert-mime-headers): Make it possible to have non-ASCII descriptions (bug#37555). diff --git a/lisp/gnus/mml.el b/lisp/gnus/mml.el index 7fd78d7b9c..5b31da2870 100644 --- a/lisp/gnus/mml.el +++ b/lisp/gnus/mml.el @@ -923,11 +923,13 @@ type detected." (unless (eq encoding '7bit) (insert (format "Content-Transfer-Encoding: %s\n" encoding))) (when (setq description (cdr (assq 'description cont))) - (insert "Content-Description: ") - (setq description (prog1 - (point) - (insert description "\n"))) - (mail-encode-encoded-word-region description (point))))) + (insert "Content-Description: " + ;; The current buffer is unibyte, so do the description + ;; encoding in a temporary buffer. + (with-temp-buffer + (insert description "\n") + (mail-encode-encoded-word-region (point-min) (point-max)) + (buffer-string)))))) (defun mml-parameter-string (cont types) (let ((string "") @@ -1339,7 +1341,7 @@ If not set, `default-directory' will be used." (value (pop plist))) (when value ;; Quote VALUE if it contains suspicious characters. - (when (string-match "[\"'\\~/*;() \t\n]" value) + (when (string-match "[\"'\\~/*;() \t\n[:multibyte:]]" value) (setq value (with-output-to-string (let (print-escape-nonascii) (prin1 value))))) commit ab980bd7f5f9ec396ec84254bece6048f36ad8ff Author: Lars Ingebrigtsen Date: Mon Sep 30 16:47:48 2019 +0200 Mention locale-related complications in format-time-string doc string * src/timefns.c (Fformat_time_string): Mention that the width in specifiers like %NX is often in bytes, not characters (bug#20258). diff --git a/src/timefns.c b/src/timefns.c index 330d5623f0..9509b6b63e 100644 --- a/src/timefns.c +++ b/src/timefns.c @@ -1437,8 +1437,12 @@ A %-sequence can contain optional flags, field width, and a modifier `^' Use upper case characters if possible. `#' Use opposite case characters if possible. -A field width N is an unsigned decimal integer with a leading digit nonzero. -%NX is like %X, but takes up at least N positions. +A field width N is an unsigned decimal integer with a leading digit +nonzero. %NX is like %X, but takes up at least N positions. The +field width is (on GNU/Linux and some other systems) in measured in +bytes, not characters. It depends on the locale what the width (in +characters) %NX will end up being, especially when there are non-ASCII +characters in %X. The modifiers are: commit 224c51075dde7f571e996578d15b5a10eeae43ca Author: Lars Ingebrigtsen Date: Mon Sep 30 15:51:42 2019 +0200 Fix recent mm-uu.el typo * lisp/gnus/mm-uu.el (mm-uu-pgp-signed-extract-1): Fix typo in mm-uu introduced by previous patch. diff --git a/lisp/gnus/mm-uu.el b/lisp/gnus/mm-uu.el index 6143b41bbc..981bf8ea3e 100644 --- a/lisp/gnus/mm-uu.el +++ b/lisp/gnus/mm-uu.el @@ -509,7 +509,7 @@ apply the face `mm-uu-extract'." 'iso-8859-1))) (funcall (mml2015-clear-verify-function)))) (when (and mml2015-use (null (mml2015-clear-verify-function))) - (mml2015--status + (mm-sec-status 'gnus-details (format-message "Clear verification not supported by `%s'.\n" mml2015-use)))