commit 766ec1f9e08e6f2c7c22b514a6f2e65f79341023 (HEAD, refs/remotes/origin/master) Author: Stephen Gildea Date: Fri Nov 8 10:42:30 2024 -0800 time-stamp: minor adjustments to %P and modifier characters * lisp/time-stamp.el (time-stamp-string-preprocess): %P variations; allow (and ignore) "*", "E", and "O" as modifier characters. (time-stamp-inserts-lines): safe-local-variable only if booleanp diff --git a/lisp/time-stamp.el b/lisp/time-stamp.el index 1b95396e744..a02c1d4532d 100644 --- a/lisp/time-stamp.el +++ b/lisp/time-stamp.el @@ -223,7 +223,7 @@ for generating repeated time stamps. These variables are best changed with file-local variables. If you were to change `time-stamp-end' or `time-stamp-inserts-lines' in your init file, you would be incompatible with other people's files.") -;;;###autoload(put 'time-stamp-inserts-lines 'safe-local-variable 'symbolp) +;;;###autoload(put 'time-stamp-inserts-lines 'safe-local-variable 'booleanp) (defvar time-stamp-count 1 ;Do not change! @@ -519,7 +519,8 @@ and all `time-stamp-format' compatibility." (setq cur-char (if (< ind fmt-len) (aref format ind) ?\0)) - (or (eq ?. cur-char) + (or (eq ?. cur-char) (eq ?* cur-char) + (eq ?E cur-char) (eq ?O cur-char) (eq ?, cur-char) (eq ?: cur-char) (eq ?@ cur-char) (eq ?- cur-char) (eq ?+ cur-char) (eq ?_ cur-char) (eq ?\s cur-char) (eq ?# cur-char) (eq ?^ cur-char) @@ -602,12 +603,18 @@ and all `time-stamp-format' compatibility." (time-stamp-do-number cur-char alt-form field-width time)) ((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 + ((eq cur-char ?p) ;AM or PM (if change-case - (time-stamp--format "%#p" time) - (time-stamp--format "%p" time))) + (time-stamp--format "%#p" time) + (if upcase + (time-stamp--format "%^p" time) + (time-stamp--format "%p" time)))) ((eq cur-char ?P) ;AM or PM - (time-stamp--format "%p" time)) + (if change-case + (time-stamp--format "%#p" time) + (if upcase + "" ;discourage inconsistent "%^P" + (time-stamp--format "%p" time)))) ((eq cur-char ?S) ;seconds, 00-60 (time-stamp-do-number cur-char alt-form field-width time)) ((eq cur-char ?w) ;weekday number, Sunday is 0 diff --git a/test/lisp/time-stamp-tests.el b/test/lisp/time-stamp-tests.el index 36889257724..b05904ad017 100644 --- a/test/lisp/time-stamp-tests.el +++ b/test/lisp/time-stamp-tests.el @@ -504,18 +504,32 @@ (ert-deftest time-stamp-format-am-pm () "Test time-stamp formats for AM and PM strings." (with-time-stamp-test-env - (let ((pm (format-time-string "%#p" ref-time1 t)) - (am (format-time-string "%#p" ref-time3 t)) - (PM (format-time-string "%p" ref-time1 t)) - (AM (format-time-string "%p" ref-time3 t))) + (let ((pm (format-time-string "%P" ref-time1 t)) + (am (format-time-string "%P" ref-time3 t)) + (Pm (format-time-string "%p" ref-time1 t)) + (Am (format-time-string "%p" ref-time3 t)) + (PM (format-time-string "%^p" ref-time1 t)) + (AM (format-time-string "%^p" ref-time3 t))) ;; implemented and documented since 1997 (should (equal (time-stamp-string "%#p" ref-time1) pm)) (should (equal (time-stamp-string "%#p" ref-time3) am)) - (should (equal (time-stamp-string "%P" ref-time1) PM)) - (should (equal (time-stamp-string "%P" ref-time3) AM)) + (should (equal (time-stamp-string "%P" ref-time1) Pm)) + (should (equal (time-stamp-string "%P" ref-time3) Am)) + ;; implemented since 1997 + (should (equal (time-stamp-string "%^#p" ref-time1) pm)) + (should (equal (time-stamp-string "%^#p" ref-time3) am)) ;; warned 1997-2019, changed in 2019 - (should (equal (time-stamp-string "%p" ref-time1) PM)) - (should (equal (time-stamp-string "%p" ref-time3) AM))))) + (should (equal (time-stamp-string "%p" ref-time1) Pm)) + (should (equal (time-stamp-string "%p" ref-time3) Am)) + ;; changed in 2024 + (should (equal (time-stamp-string "%^p" ref-time1) PM)) + (should (equal (time-stamp-string "%^p" ref-time3) AM)) + (should (equal (time-stamp-string "%#P" ref-time1) pm)) + (should (equal (time-stamp-string "%#P" ref-time3) am)) + (should (equal (time-stamp-string "%^#P" ref-time1) pm)) + (should (equal (time-stamp-string "%^#P" ref-time3) am)) + (should (equal (time-stamp-string "%^P" ref-time1) "")) + (should (equal (time-stamp-string "%^P" ref-time3) ""))))) (ert-deftest time-stamp-format-day-number-in-week () "Test time-stamp formats for day number in week." @@ -528,7 +542,7 @@ "Test time-stamp format %Z." (with-time-stamp-test-env (let ((UTC-abbr (format-time-string "%Z" ref-time1 t)) - (utc-abbr (format-time-string "%#Z" ref-time1 t))) + (utc-abbr (format-time-string "%#Z" ref-time1 t))) ;; implemented and documented since 1995 (should (equal (time-stamp-string "%Z" ref-time1) UTC-abbr)) ;; implemented since 1997, documented since 2019 @@ -596,7 +610,7 @@ (with-time-stamp-test-env (let ((May (format-time-string "%B" ref-time3 t))) ;; allowed modifiers - (should (equal (time-stamp-string "%.,@+ (stuff)B" ref-time3) May)) + (should (equal (time-stamp-string "%.,@+*EO (stuff)B" ref-time3) May)) ;; parens nest (should (equal (time-stamp-string "%(st(u)ff)B" ref-time3) May)) ;; escaped parens do not change the nesting level @@ -703,7 +717,7 @@ (should-not (safe-local-variable-p 'time-stamp-format '(a list))) (should (safe-local-variable-p 'time-stamp-time-zone "a string")) (should-not (safe-local-variable-p 'time-stamp-time-zone 0.5)) - (should (safe-local-variable-p 'time-stamp-line-limit 8)) + (should (safe-local-variable-p 'time-stamp-line-limit -10)) (should-not (safe-local-variable-p 'time-stamp-line-limit "a string")) (should (safe-local-variable-p 'time-stamp-start "a string")) (should-not (safe-local-variable-p 'time-stamp-start 17)) @@ -961,6 +975,7 @@ the other expected results for hours greater than 99 with non-zero seconds." ("+000030" formatz-mod-del-colons) ("+100:00") ("+100:00:30")) + ;; Tests that minus with padding pads with spaces. (formatz-generate-tests ("%-12z") ("+00 " formatz-mod-pad-r12) @@ -968,6 +983,7 @@ the other expected results for hours greater than 99 with non-zero seconds." ("+000030 " formatz-mod-del-colons formatz-mod-pad-r12) ("+100:00 " formatz-mod-pad-r12) ("+100:00:30 " formatz-mod-pad-r12)) + ;; Tests that 0 after other digits becomes padding of ten, not zero flag. (formatz-generate-tests ("%-10z") ("+00 " formatz-mod-pad-r10) commit 551d1a2cd73bb3df2cad0f1f5b5d1628bb138483 Author: Philip Kaludercic Date: Sat Oct 26 09:39:00 2024 +0200 ; Insert "Stealing lock" at the beginning of a message * lisp/vc/vc.el (vc-steal-lock): Use 'mail-text' instead of jumping to 'point-max', to avoid inserting the message after signatures. (Bug#74027) diff --git a/lisp/vc/vc.el b/lisp/vc/vc.el index 194b181f3e9..dd6079d22ab 100644 --- a/lisp/vc/vc.el +++ b/lisp/vc/vc.el @@ -1738,6 +1738,8 @@ Type \\[vc-next-action] to check in changes.") (format "%d files" (length files)) "this file")))) +(declare-function mail-text "sendmail" ()) +(declare-function message-goto-body "message" (&optional interactive)) (defun vc-steal-lock (file rev owner) "Steal the lock on FILE." (let (file-description) @@ -1758,7 +1760,10 @@ Type \\[vc-next-action] to check in changes.") ;; goes wrong, we don't want to send any mail. (compose-mail owner (format "Stolen lock on %s" file-description)) (setq default-directory (expand-file-name "~/")) - (goto-char (point-max)) + (cond + ((eq mail-user-agent 'sendmail-user-agent) + (mail-text)) + ((message-goto-body))) (insert (format "I stole the lock on %s, " file-description) (current-time-string) commit 11954a3a0ac67d02c18441658c1f250c9ced75de Author: Stefan Kangas Date: Fri Nov 8 14:21:12 2024 +0100 Update special attributes for Python 3.13 * lisp/progmodes/python.el (python-font-lock-keywords-level-2) (python--treesit-special-attributes): Update special attributes, making it current for Python 3.13. diff --git a/lisp/progmodes/python.el b/lisp/progmodes/python.el index 283a545bfb4..2438029bfdd 100644 --- a/lisp/progmodes/python.el +++ b/lisp/progmodes/python.el @@ -718,10 +718,11 @@ class declarations.") "aiter" "anext" "ascii" "breakpoint" "bytearray" "bytes" "exec" ;; Special attributes: ;; https://docs.python.org/3/reference/datamodel.html - "__annotations__" "__closure__" "__code__" - "__defaults__" "__dict__" "__doc__" "__globals__" - "__kwdefaults__" "__name__" "__module__" "__package__" - "__qualname__" + "__annotations__" "__bases__" "__closure__" "__code__" + "__defaults__" "__dict__" "__doc__" "__firstlineno__" + "__globals__" "__kwdefaults__" "__name__" "__module__" + "__mro__" "__package__" "__qualname__" + "__static_attributes__" "__type_params__" ;; Extras: "__all__") symbol-end) . font-lock-builtin-face)) @@ -1034,10 +1035,12 @@ It makes underscores and dots word constituent chars.") ">>" ">>=" "|" "|=" "~" "@" "@=")) (defvar python--treesit-special-attributes - '("__annotations__" "__closure__" "__code__" - "__defaults__" "__dict__" "__doc__" "__globals__" - "__kwdefaults__" "__name__" "__module__" "__package__" - "__qualname__" "__all__")) + '("__annotations__" "__bases__" "__closure__" "__code__" + "__defaults__" "__dict__" "__doc__" "__firstlineno__" + "__globals__" "__kwdefaults__" "__name__" "__module__" + "__mro__" "__package__" "__qualname__" + "__static_attributes__" "__type_params__" + "__all__")) (defvar python--treesit-exceptions '(;; Python 2 and 3: