commit 7dcc05987160cabc0c063bc285d34cdb2c3c600f (HEAD, refs/remotes/origin/master) Author: Stephen Gildea Date: Sat Dec 14 10:46:15 2024 -0800 ; * test/lisp/time-stamp-tests.el: make checkdoc happier diff --git a/test/lisp/time-stamp-tests.el b/test/lisp/time-stamp-tests.el index 69b14839aec..4492bd12f1a 100644 --- a/test/lisp/time-stamp-tests.el +++ b/test/lisp/time-stamp-tests.el @@ -25,7 +25,7 @@ (require 'time-stamp) (defmacro with-time-stamp-test-env (&rest body) - "Evaluate BODY with some standard time-stamp test variables bound." + "Evaluate BODY with some standard `time-stamp' test variables bound." (declare (indent 0) (debug t)) `(let ((user-login-name "test-logname") (user-full-name "100%d Tester") ;verify "%" passed unchanged @@ -55,7 +55,7 @@ ,@body)) (defmacro with-time-stamp-system-name (name &rest body) - "Force `system-name' to return NAME while evaluating BODY." + "Force function `system-name' to return NAME while evaluating BODY." (declare (indent 1) (debug t)) `(cl-letf (((symbol-function 'system-name) (lambda () ,name))) @@ -77,7 +77,7 @@ ;;; Tests of customization variables (ert-deftest time-stamp-custom-time-zone () - "Test that setting time-stamp-time-zone affects the format." + "Test that setting `time-stamp-time-zone' affects the format." (with-time-stamp-test-env (let ((time-stamp-time-zone "PST8")) (should (equal (time-stamp-string "%H %Z" ref-time1) "07 PST"))) @@ -139,7 +139,7 @@ (iter-yield-from (time-stamp-test-pattern-multiply))) (ert-deftest time-stamp-custom-pattern () - "Test that time-stamp-pattern is parsed correctly." + "Test that `time-stamp-pattern' is parsed correctly." (iter-do (pattern-parts (time-stamp-test-pattern-all)) (cl-destructuring-bind (line-limit1 start1 whole-format end1) pattern-parts (cl-letf @@ -197,7 +197,7 @@ "Updated in: <\t 2006 \t>"))))))) (ert-deftest time-stamp-custom-inserts-lines () - "Test that time-stamp inserts lines or not, as directed." + "Test that `time-stamp' inserts lines or not, as directed." (with-time-stamp-test-env (let ((time-stamp-start "Updated on:") ;; the newline in the format will insert a line if we let it @@ -221,7 +221,7 @@ (should (equal (buffer-string) buffer-expected-2line))))))) (ert-deftest time-stamp-custom-end () - "Test that time-stamp finds the end pattern on the correct line." + "Test that `time-stamp' finds the end pattern on the correct line." (with-time-stamp-test-env (let ((time-stamp-start "Updated on: <") (time-stamp-format "%Y-%m-%d") @@ -241,7 +241,7 @@ (should (equal (buffer-string) buffer-expected-time-stamped))))))) (ert-deftest time-stamp-custom-count () - "Test that time-stamp updates no more than time-stamp-count templates." + "Test that `time-stamp' updates no more than `time-stamp-count' templates." (with-time-stamp-test-env (let ((time-stamp-start "TS: <") (time-stamp-format "%Y-%m-%d") @@ -289,97 +289,97 @@ ;;; Tests of time-stamp-string formatting (ert-deftest time-stamp-format-day-of-week () - "Test time-stamp formats for named day of week." + "Test `time-stamp' formats for named day of week." (with-time-stamp-test-env - (let* ((Mon (format-time-string "%a" ref-time1 t)) - (MON (format-time-string "%^a" ref-time1 t)) - (Monday (format-time-string "%A" ref-time1 t)) - (MONDAY (format-time-string "%^A" ref-time1 t)) - (p4-Mon (string-pad Mon 4 ?\s t)) - (p4-MON (string-pad MON 4 ?\s t)) - (p10-Monday (string-pad Monday 10 ?\s t)) - (p10-MONDAY (string-pad MONDAY 10 ?\s t))) - ;; implemented and recommended since 1997 - (should (equal (time-stamp-string "%#A" ref-time1) MONDAY)) - (should (equal (time-stamp-string "%#10A" ref-time1) p10-MONDAY)) - ;; implemented since 1997, recommended 1997-2024 - (should (equal (time-stamp-string "%3a" ref-time1) Mon)) - ;; recommended 1997-2019 - (should (equal (time-stamp-string "%:a" ref-time1) Monday)) - ;; recommended 1997-2019, warned since 2024, will change - (time-stamp-should-warn - (should (equal (time-stamp-string "%3A" ref-time1) MON))) - (time-stamp-should-warn - (should (equal (time-stamp-string "%10A" ref-time1) p10-MONDAY))) - ;; implemented since 2001, recommended since 2019 - (should (equal (time-stamp-string "%#a" ref-time1) MON)) - (should (equal (time-stamp-string "%#3a" ref-time1) MON)) - (should (equal (time-stamp-string "%#4a" ref-time1) p4-MON)) - ;; implemented since 2001, recommended 2019-2024 - (should (equal (time-stamp-string "%:A" ref-time1) Monday)) - ;; broken 2019-2024 - (should (equal (time-stamp-string "%:10A" ref-time1) p10-Monday)) - ;; broken in 2019, changed in 2024 - (should (equal (time-stamp-string "%-A" ref-time1) Monday)) - (should (equal (time-stamp-string "%_A" ref-time1) Monday)) - ;; allowed but not recommended since 2019 (warned 1997-2019) - (should (equal (time-stamp-string "%^A" ref-time1) MONDAY)) - ;; warned 1997-2019, changed in 2019, recommended (with caveat) since 2024 - (should (equal (time-stamp-string "%a" ref-time1) Mon)) - (should (equal (time-stamp-string "%4a" ref-time1) p4-Mon)) - (should (equal (time-stamp-string "%04a" ref-time1) p4-Mon)) - (should (equal (time-stamp-string "%A" ref-time1) Monday)) - ;; warned 1997-2019, changed in 2019 - (should (equal (time-stamp-string "%^a" ref-time1) MON)) - (should (equal (time-stamp-string "%^4a" ref-time1) p4-MON))))) + (let* ((Mon (format-time-string "%a" ref-time1 t)) + (MON (format-time-string "%^a" ref-time1 t)) + (Monday (format-time-string "%A" ref-time1 t)) + (MONDAY (format-time-string "%^A" ref-time1 t)) + (p4-Mon (string-pad Mon 4 ?\s t)) + (p4-MON (string-pad MON 4 ?\s t)) + (p10-Monday (string-pad Monday 10 ?\s t)) + (p10-MONDAY (string-pad MONDAY 10 ?\s t))) + ;; implemented and recommended since 1997 + (should (equal (time-stamp-string "%#A" ref-time1) MONDAY)) + (should (equal (time-stamp-string "%#10A" ref-time1) p10-MONDAY)) + ;; implemented since 1997, recommended 1997-2024 + (should (equal (time-stamp-string "%3a" ref-time1) Mon)) + ;; recommended 1997-2019 + (should (equal (time-stamp-string "%:a" ref-time1) Monday)) + ;; recommended 1997-2019, warned since 2024, will change + (time-stamp-should-warn + (should (equal (time-stamp-string "%3A" ref-time1) MON))) + (time-stamp-should-warn + (should (equal (time-stamp-string "%10A" ref-time1) p10-MONDAY))) + ;; implemented since 2001, recommended since 2019 + (should (equal (time-stamp-string "%#a" ref-time1) MON)) + (should (equal (time-stamp-string "%#3a" ref-time1) MON)) + (should (equal (time-stamp-string "%#4a" ref-time1) p4-MON)) + ;; implemented since 2001, recommended 2019-2024 + (should (equal (time-stamp-string "%:A" ref-time1) Monday)) + ;; broken 2019-2024 + (should (equal (time-stamp-string "%:10A" ref-time1) p10-Monday)) + ;; broken in 2019, changed in 2024 + (should (equal (time-stamp-string "%-A" ref-time1) Monday)) + (should (equal (time-stamp-string "%_A" ref-time1) Monday)) + ;; allowed but not recommended since 2019 (warned 1997-2019) + (should (equal (time-stamp-string "%^A" ref-time1) MONDAY)) + ;; warned 1997-2019, changed in 2019, recommended (with caveat) since 2024 + (should (equal (time-stamp-string "%a" ref-time1) Mon)) + (should (equal (time-stamp-string "%4a" ref-time1) p4-Mon)) + (should (equal (time-stamp-string "%04a" ref-time1) p4-Mon)) + (should (equal (time-stamp-string "%A" ref-time1) Monday)) + ;; warned 1997-2019, changed in 2019 + (should (equal (time-stamp-string "%^a" ref-time1) MON)) + (should (equal (time-stamp-string "%^4a" ref-time1) p4-MON))))) (ert-deftest time-stamp-format-month-name () - "Test time-stamp formats for month name." + "Test `time-stamp' formats for month name." (with-time-stamp-test-env - (let* ((Jan (format-time-string "%b" ref-time1 t)) - (JAN (format-time-string "%^b" ref-time1 t)) - (January (format-time-string "%B" ref-time1 t)) - (JANUARY (format-time-string "%^B" ref-time1 t)) - (p4-Jan (string-pad Jan 4 ?\s t)) - (p4-JAN (string-pad JAN 4 ?\s t)) - (p10-January (string-pad January 10 ?\s t)) - (p10-JANUARY (string-pad JANUARY 10 ?\s t))) - ;; implemented and recommended since 1997 - (should (equal (time-stamp-string "%#B" ref-time1) JANUARY)) - (should (equal (time-stamp-string "%#10B" ref-time1) p10-JANUARY)) - ;; implemented since 1997, recommended 1997-2024 - (should (equal (time-stamp-string "%3b" ref-time1) Jan)) - ;; recommended 1997-2019 - (should (equal (time-stamp-string "%:b" ref-time1) January)) - ;; recommended 1997-2019, warned since 2024, will change - (time-stamp-should-warn - (should (equal (time-stamp-string "%3B" ref-time1) JAN))) - (time-stamp-should-warn - (should (equal (time-stamp-string "%10B" ref-time1) p10-JANUARY))) - ;; implemented since 2001, recommended since 2019 - (should (equal (time-stamp-string "%#b" ref-time1) JAN)) - (should (equal (time-stamp-string "%#3b" ref-time1) JAN)) - (should (equal (time-stamp-string "%#4b" ref-time1) p4-JAN)) - ;; implemented since 2001, recommended 2019-2024 - (should (equal (time-stamp-string "%:B" ref-time1) January)) - ;; broken 2019-2024 - (should (equal (time-stamp-string "%:10B" ref-time1) p10-January)) - ;; broken in 2019, changed in 2024 - (should (equal (time-stamp-string "%-B" ref-time1) January)) - (should (equal (time-stamp-string "%_B" ref-time1) January)) - ;; allowed but not recommended since 2019 (warned 1997-2019) - (should (equal (time-stamp-string "%^B" ref-time1) JANUARY)) - ;; warned 1997-2019, changed in 2019, recommended (with caveat) since 2024 - (should (equal (time-stamp-string "%b" ref-time1) Jan)) - (should (equal (time-stamp-string "%4b" ref-time1) p4-Jan)) - (should (equal (time-stamp-string "%04b" ref-time1) p4-Jan)) - (should (equal (time-stamp-string "%B" ref-time1) January)) - ;; warned 1997-2019, changed in 2019 - (should (equal (time-stamp-string "%^b" ref-time1) JAN)) - (should (equal (time-stamp-string "%^4b" ref-time1) p4-JAN))))) + (let* ((Jan (format-time-string "%b" ref-time1 t)) + (JAN (format-time-string "%^b" ref-time1 t)) + (January (format-time-string "%B" ref-time1 t)) + (JANUARY (format-time-string "%^B" ref-time1 t)) + (p4-Jan (string-pad Jan 4 ?\s t)) + (p4-JAN (string-pad JAN 4 ?\s t)) + (p10-January (string-pad January 10 ?\s t)) + (p10-JANUARY (string-pad JANUARY 10 ?\s t))) + ;; implemented and recommended since 1997 + (should (equal (time-stamp-string "%#B" ref-time1) JANUARY)) + (should (equal (time-stamp-string "%#10B" ref-time1) p10-JANUARY)) + ;; implemented since 1997, recommended 1997-2024 + (should (equal (time-stamp-string "%3b" ref-time1) Jan)) + ;; recommended 1997-2019 + (should (equal (time-stamp-string "%:b" ref-time1) January)) + ;; recommended 1997-2019, warned since 2024, will change + (time-stamp-should-warn + (should (equal (time-stamp-string "%3B" ref-time1) JAN))) + (time-stamp-should-warn + (should (equal (time-stamp-string "%10B" ref-time1) p10-JANUARY))) + ;; implemented since 2001, recommended since 2019 + (should (equal (time-stamp-string "%#b" ref-time1) JAN)) + (should (equal (time-stamp-string "%#3b" ref-time1) JAN)) + (should (equal (time-stamp-string "%#4b" ref-time1) p4-JAN)) + ;; implemented since 2001, recommended 2019-2024 + (should (equal (time-stamp-string "%:B" ref-time1) January)) + ;; broken 2019-2024 + (should (equal (time-stamp-string "%:10B" ref-time1) p10-January)) + ;; broken in 2019, changed in 2024 + (should (equal (time-stamp-string "%-B" ref-time1) January)) + (should (equal (time-stamp-string "%_B" ref-time1) January)) + ;; allowed but not recommended since 2019 (warned 1997-2019) + (should (equal (time-stamp-string "%^B" ref-time1) JANUARY)) + ;; warned 1997-2019, changed in 2019, recommended (with caveat) since 2024 + (should (equal (time-stamp-string "%b" ref-time1) Jan)) + (should (equal (time-stamp-string "%4b" ref-time1) p4-Jan)) + (should (equal (time-stamp-string "%04b" ref-time1) p4-Jan)) + (should (equal (time-stamp-string "%B" ref-time1) January)) + ;; warned 1997-2019, changed in 2019 + (should (equal (time-stamp-string "%^b" ref-time1) JAN)) + (should (equal (time-stamp-string "%^4b" ref-time1) p4-JAN))))) (ert-deftest time-stamp-format-day-of-month () - "Test time-stamp formats for day of month." + "Test `time-stamp' formats for day of month." (with-time-stamp-test-env ;; implemented since 1995, recommended until 2024 (should (equal (time-stamp-string "%2d" ref-time1) " 2")) @@ -402,7 +402,7 @@ (should (equal (time-stamp-string "%d" ref-time2) "18")))) (ert-deftest time-stamp-format-hours-24 () - "Test time-stamp formats for hour on a 24-hour clock." + "Test `time-stamp' formats for hour on a 24-hour clock." (with-time-stamp-test-env ;; implemented since 1995, recommended until 2024 (should (equal (time-stamp-string "%2H" ref-time1) "15")) @@ -432,7 +432,7 @@ (should (equal (time-stamp-string "%H" ref-time3) "06")))) (ert-deftest time-stamp-format-hours-12 () - "Test time-stamp formats for hour on a 12-hour clock." + "Test `time-stamp' formats for hour on a 12-hour clock." (with-time-stamp-test-env ;; implemented since 1995, recommended until 2024 (should (equal (time-stamp-string "%2I" ref-time1) " 3")) @@ -462,7 +462,7 @@ (should (equal (time-stamp-string "%I" ref-time3) "06")))) (ert-deftest time-stamp-format-month-number () - "Test time-stamp formats for month number." + "Test `time-stamp' formats for month number." (with-time-stamp-test-env ;; implemented since 1995, recommended until 2024 (should (equal (time-stamp-string "%2m" ref-time1) " 1")) @@ -485,7 +485,7 @@ (should (equal (time-stamp-string "%m" ref-time2) "11")))) (ert-deftest time-stamp-format-minute () - "Test time-stamp formats for minute." + "Test `time-stamp' formats for minute." (with-time-stamp-test-env ;; implemented since 1995, recommended until 2024 (should (equal (time-stamp-string "%2M" ref-time1) " 4")) @@ -508,7 +508,7 @@ (should (equal (time-stamp-string "%M" ref-time2) "14")))) (ert-deftest time-stamp-format-second () - "Test time-stamp formats for second." + "Test `time-stamp' formats for second." (with-time-stamp-test-env ;; implemented since 1995, recommended until 2024 (should (equal (time-stamp-string "%2S" ref-time1) " 5")) @@ -531,7 +531,7 @@ (should (equal (time-stamp-string "%S" ref-time2) "15")))) (ert-deftest time-stamp-format-year-2digit () - "Test time-stamp formats for %y." + "Test `time-stamp' formats for %y." (with-time-stamp-test-env ;; implemented since 1995, recommended 1995-2024 (should (equal (time-stamp-string "%02y" ref-time1) "06")) @@ -559,7 +559,7 @@ (equal (time-stamp-string "%4y" ref-time1) "2006")))) (ert-deftest time-stamp-format-year-4digit () - "Test time-stamp format %Y." + "Test `time-stamp' format %Y." (with-time-stamp-test-env ;; implemented since 1997, recommended since 2019 (should (equal (time-stamp-string "%Y" ref-time1) "2006")) @@ -568,7 +568,7 @@ (should (equal (time-stamp-string "%02Y" ref-time1) "2006")))) (ert-deftest time-stamp-format-am-pm () - "Test time-stamp formats for AM and PM strings." + "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)) @@ -599,14 +599,14 @@ (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." + "Test `time-stamp' formats for day number in week." (with-time-stamp-test-env (should (equal (time-stamp-string "%w" ref-time1) "1")) (should (equal (time-stamp-string "%w" ref-time2) "5")) (should (equal (time-stamp-string "%w" ref-time3) "0")))) (ert-deftest time-stamp-format-time-zone-name () - "Test time-stamp format %Z." + "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))) @@ -619,7 +619,7 @@ (should (equal (time-stamp-string "%^#Z" ref-time1) utc-abbr))))) (ert-deftest time-stamp-format-time-zone-offset () - "Test time-stamp legacy format %z and spot-test new offset format %5z." + "Test `time-stamp' legacy format %z and spot-test new offset format %5z." (with-time-stamp-test-env (let ((utc-abbr (format-time-string "%#Z" ref-time1 t))) ;; recommended 1995-2019, warned since 2019, will change @@ -644,7 +644,7 @@ (should (equal (time-stamp-string "%9::z" ref-time1) "+00:00:00")))) (ert-deftest time-stamp-format-non-date-conversions () - "Test time-stamp formats for non-date items." + "Test `time-stamp' formats for non-date items." (with-time-stamp-test-env (with-time-stamp-system-name "test-system-name.example.org" ;; implemented and recommended since 1995 @@ -682,22 +682,22 @@ (ert-deftest time-stamp-format-ignored-modifiers () "Test additional args allowed (but ignored) to allow for future expansion." (with-time-stamp-test-env - (let ((May (format-time-string "%B" ref-time3 t))) - ;; allowed modifiers - (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 - (should (equal (time-stamp-string "%(st\\)u\\(ff)B" ref-time3) May)) - ;; incorrectly nested parens do not crash us - (should-not (equal (time-stamp-string "%(stuffB" ref-time3) May)) - (should-not (equal (time-stamp-string "%)B" ref-time3) May)) - ;; unterminated format does not crash us - (should-not (equal (time-stamp-string "%" ref-time3) May)) - ;; not all punctuation is allowed - (should-not (equal (time-stamp-string "%&B" ref-time3) May)) - (should-not (equal (time-stamp-string "%/B" ref-time3) May)) - (should-not (equal (time-stamp-string "%;B" ref-time3) May))))) + (let ((May (format-time-string "%B" ref-time3 t))) + ;; allowed modifiers + (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 + (should (equal (time-stamp-string "%(st\\)u\\(ff)B" ref-time3) May)) + ;; incorrectly nested parens do not crash us + (should-not (equal (time-stamp-string "%(stuffB" ref-time3) May)) + (should-not (equal (time-stamp-string "%)B" ref-time3) May)) + ;; unterminated format does not crash us + (should-not (equal (time-stamp-string "%" ref-time3) May)) + ;; not all punctuation is allowed + (should-not (equal (time-stamp-string "%&B" ref-time3) May)) + (should-not (equal (time-stamp-string "%/B" ref-time3) May)) + (should-not (equal (time-stamp-string "%;B" ref-time3) May))))) (ert-deftest time-stamp-format-non-conversions () "Test that without a %, the text is copied literally." @@ -740,7 +740,7 @@ (should (equal (time-stamp-string "%H:%M%%%S" ref-time1) "15:04%05"))))) (ert-deftest time-stamp-format-string-width () - "Test time-stamp string width modifiers." + "Test `time-stamp' string width modifiers." (with-time-stamp-test-env (let ((UTC-abbr (format-time-string "%Z" ref-time1 t))) (should (equal (time-stamp-string "%1%" ref-time3) "%")) @@ -764,14 +764,14 @@ ;;; Tests of helper functions (ert-deftest time-stamp-helper-string-defaults () - "Test that time-stamp-string defaults its format to time-stamp-format." + "Test that `time-stamp-string' defaults its format to `time-stamp-format'." (with-time-stamp-test-env (should (equal (time-stamp-string nil ref-time1) (time-stamp-string time-stamp-format ref-time1))) (should (equal (time-stamp-string 'not-a-string ref-time1) nil)))) (ert-deftest time-stamp-helper-zone-type-p () - "Test time-stamp-zone-type-p." + "Test `time-stamp-zone-type-p'." (should (time-stamp-zone-type-p t)) (should (time-stamp-zone-type-p nil)) (should (time-stamp-zone-type-p 'wall)) @@ -812,13 +812,13 @@ FORMAT must be time format \"%z\" or some variation thereof. ZONE is as the ZONE argument of the `format-time-string' function. This function is called by 99% of the `time-stamp' \"%z\" unit tests." (with-time-stamp-test-env - (let ((time-stamp-time-zone zone)) - ;; Call your favorite time formatter here. - ;; For narrower-scope unit testing, - ;; instead of calling time-stamp-string here, - ;; we could directly call (format-time-offset format zone) - (time-stamp-string format) - ))) + (let ((time-stamp-time-zone zone)) + ;; Call your favorite time formatter here. + ;; For narrower-scope unit testing, + ;; instead of calling time-stamp-string here, + ;; we could directly call (format-time-offset format zone) + (time-stamp-string format) + ))) (defun format-time-offset (format offset-secs) "Use FORMAT to format the time zone represented by OFFSET-SECS. @@ -853,14 +853,15 @@ and is called by some low-level `time-stamp' \"%z\" unit tests." trailing-string))) (defun fz-make+zone (h &optional m s) - "Create a non-negative offset." + "Create a non-negative offset from interval H M S." (declare (pure t)) (let ((m (or m 0)) (s (or s 0))) (+ (* 3600 h) (* 60 m) s))) (defun fz-make-zone (h &optional m s) - "Create a negative offset. The arguments are all non-negative." + "Create a negative offset. +The interval arguments H M and S are all non-negative." (declare (pure t)) (- (fz-make+zone h m s))) @@ -1071,7 +1072,7 @@ the other expected results for hours greater than 99 with non-zero seconds." ;; The legacy exception for %z in time-stamp will need to remain ;; through at least 2024 and Emacs 28. (ert-deftest formatz-%z-spotcheck () - "Spot-check internal implementation of time-stamp format %z." + "Spot-check internal implementation of `time-stamp' format %z." (should (equal (format-time-offset "%z" (fz-make+zone 0)) "+0000")) (should (equal (format-time-offset "%z" (fz-make+zone 0 30)) "+0030")) (should (equal (format-time-offset "%z" (fz-make+zone 0 0 30)) "+000030")) commit 33532c58992fc44afa5369678cb53252ec7dc3ac Author: Stephen Gildea Date: Sat Dec 14 10:23:04 2024 -0800 time-stamp: fix search end, more compatibility suggestions * lisp/time-stamp.el (time-stamp): Use a marker for the search end limit so we don't insert past it. (time-stamp-conv-warn): Include a second suggested conversion that might be what was intended. Include a link to variable 'time-stamp-format'. * test/lisp/time-stamp-tests.el: more tests diff --git a/lisp/time-stamp.el b/lisp/time-stamp.el index c9f451cb8cc..b8cc3b63127 100644 --- a/lisp/time-stamp.el +++ b/lisp/time-stamp.el @@ -374,20 +374,21 @@ The time stamp is updated only if `time-stamp-active' is non-nil." (cond ((> line-limit 0) (goto-char (setq start (point-min))) (forward-line line-limit) - (setq search-limit (point))) + (setq search-limit (point-marker))) ((< line-limit 0) - (goto-char (setq search-limit (point-max))) + (goto-char (setq search-limit (point-max-marker))) (forward-line line-limit) (setq start (point))) (t ;0 => no limit (use with care!) (setq start (point-min)) - (setq search-limit (point-max)))))) + (setq search-limit (point-max-marker)))))) (while (and start (< start search-limit) (> ts-count 0)) (setq start (time-stamp-once start search-limit ts-start ts-end ts-format format-lines end-lines)) - (setq ts-count (1- ts-count)))) + (setq ts-count (1- ts-count))) + (set-marker search-limit nil)) nil) (defun time-stamp-once (start search-limit ts-start ts-end @@ -598,7 +599,8 @@ and all `time-stamp-format' compatibility." (string-equal field-width "")) (time-stamp--format "%A" time) (time-stamp-conv-warn (format "%%%sA" field-width) - (format "%%#%sA" field-width)) + (format "%%#%sA" field-width) + (format "%%:%sA" field-width)) (time-stamp--format "%#A" time))))) ((eq cur-char ?b) ;month name (if (> alt-form 0) @@ -623,7 +625,8 @@ and all `time-stamp-format' compatibility." (string-equal field-width "")) (time-stamp--format "%B" time) (time-stamp-conv-warn (format "%%%sB" field-width) - (format "%%#%sB" field-width)) + (format "%%#%sB" field-width) + (format "%%:%sB" field-width)) (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)) @@ -686,7 +689,7 @@ and all `time-stamp-format' compatibility." (not flag-pad-with-spaces) (not flag-pad-with-zeros) (= field-width-num 0)) - (time-stamp-conv-warn "%z" "%#Z") + (time-stamp-conv-warn "%z" "%#Z" "%5z") (time-stamp--format "%#Z" time)) (t (time-stamp-formatz-from-parsed-options flag-minimize @@ -766,20 +769,34 @@ to change in the future to be compatible with `format-time-string'. The new forms being recommended now will continue to work then.") -(defun time-stamp-conv-warn (old-form new-form) +(defun time-stamp-conv-warn (old-form new-form &optional standard-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 (same effect, but stable) +or (if provided) STANDARD-FORM (the effect the user may have expected +if they didn't read the documentation)." (cond (time-stamp-conversion-warn (with-current-buffer (get-buffer-create "*Time-stamp-compatibility*") (goto-char (point-max)) - (if (bobp) - (progn - (insert - "The formats recognized in time-stamp-format will change in a future release\n" - "to be more compatible with the format-time-string function.\n\n" - "The following obsolescent time-stamp-format construct(s) were found:\n\n"))) - (insert "\"" old-form "\" -- use " new-form "\n")) + (cond + ((bobp) + (insert + (substitute-quotes + (concat + "The conversions recognized in `time-stamp-format' will change in a future\n" + "release to be more compatible with the function `format-time-string'.\n" + (cond + (standard-form + (concat + "Conversions that are changing are ambiguous and should be replaced by\n" + "stable conversions that makes your intention clear.\n"))) + "\n" + "The following obsolescent `time-stamp-format' conversion(s) were found:\n\n"))))) + (insert old-form " -- use " new-form) + (if standard-form + (insert " or " standard-form)) + (insert "\n") + (help-make-xrefs)) (display-buffer "*Time-stamp-compatibility*")))) diff --git a/test/lisp/time-stamp-tests.el b/test/lisp/time-stamp-tests.el index 7cf8f995c13..69b14839aec 100644 --- a/test/lisp/time-stamp-tests.el +++ b/test/lisp/time-stamp-tests.el @@ -36,7 +36,7 @@ (ref-time3 '(21377 34956)) ;Sunday, May 25, 2014, 06:07:08 AM (time-stamp-time-zone t)) ;use UTC (cl-letf (((symbol-function 'time-stamp-conv-warn) - (lambda (old-format _new) + (lambda (old-format _new &optional _newer) (ert-fail (format "Unexpected format warning for '%s'" old-format))))) ;; Not all reference times are used in all tests; @@ -66,7 +66,7 @@ (declare (debug t)) `(let ((warning-count 0)) (cl-letf (((symbol-function 'time-stamp-conv-warn) - (lambda (_old _new) + (lambda (_old _new &optional _newer) (setq warning-count (1+ warning-count))))) (should ,form) (if (not (= warning-count 1)) @@ -264,6 +264,28 @@ (time-stamp) (should (equal (buffer-string) buffer-expected-twice))))))) +(ert-deftest time-stamp-custom-limit () + "Test that `time-stamp' can expand two templates near the line limit." + (with-time-stamp-test-env + (let ((time-stamp-start "TS: ") + (time-stamp-format "%Y-%m-%d") + (time-stamp-end "$") + (time-stamp-count 2) + (time-stamp-line-limit 1) ;changed later in the test + (buffer-starts-as "TS: \nTS: ") + (buffer-expected-1 "TS: 2006-01-02\nTS: ") + (buffer-expected-2 "TS: 2006-01-02\nTS: 2006-01-02")) + (with-time-stamp-test-time ref-time1 + (with-temp-buffer + (insert buffer-starts-as) + (time-stamp) + (should (equal (buffer-string) buffer-expected-1))) + (with-temp-buffer + (insert buffer-starts-as) + (setq time-stamp-line-limit 2) + (time-stamp) + (should (equal (buffer-string) buffer-expected-2))))))) + ;;; Tests of time-stamp-string formatting (ert-deftest time-stamp-format-day-of-week () @@ -728,6 +750,10 @@ (should (equal (time-stamp-string "%03d" ref-time3) "025")) (should (equal (time-stamp-string "%3d" ref-time3) " 25")) (should (equal (time-stamp-string "%_3d" ref-time3) " 25")) + (should (equal (time-stamp-string "%99z" ref-time1) + (time-stamp-string "%100z" ref-time1))) + (should (equal (time-stamp-string "%099Y" ref-time1) + (time-stamp-string "%0100Y" ref-time1))) ;; since 2024 (should (equal (time-stamp-string "%0d" ref-time1) "02")) (should (equal (time-stamp-string "%0d" ref-time2) "18")) @@ -839,7 +865,7 @@ and is called by some low-level `time-stamp' \"%z\" unit tests." (- (fz-make+zone h m s))) (defmacro formatz-should-equal (zone expect) - "Format ZONE and compares it to EXPECT. + "Format ZONE and compare it to EXPECT. Use the free variables `form-string' and `pattern-mod'. The functions in `pattern-mod' are composed left to right." (declare (debug t)) commit 567566ca081d059bfadd9684a3d35c371fa746a3 Merge: fd021c07606 6942599dbb2 Author: Eli Zaretskii Date: Sat Dec 14 09:39:59 2024 -0500 Merge from origin/emacs-30 6942599dbb2 ; * etc/PROBLEMS: Document problem with menu-bar backgrou... 488801baf7d * lisp/time-stamp.el: Limit field width to two digits. 34bedcd58d7 ; * lisp/progmodes/executable.el: Remove stale comment (b... 327d3e56f6e ; * etc/TODO: Add an item for improving defgroups. 7ae9ccae0ca ; * lisp/net/rcirc.el (rcirc-next-active-buffer): Doc fix... 3e51be94ae6 ; Fix :version tag in browse-url dffd4a50c64 Revert "Attempt to install package first when upgrading" fbcb357b9db Fix 'gnus-select-method' custom type 6fd5e02cb9b Fix typo in maps.texi 872a7336dc0 ; * etc/DEBUG: Mention "handle SIGINT" on MS-Windows. b4bcbabf95c * doc/misc/tramp.texi (FUSE-based methods): Fix sshfs ref... f8da72b41cd Improve gnus.texi indexing 4a090bd7eab ; * lisp/net/eww.el (eww-browse-with-external-browser): F... 59fa0b1dd6e ; Improve doc strings in compile.el 3d8e49c41a6 Attempt to install package first when upgrading # Conflicts: # lisp/net/browse-url.el # lisp/net/eww.el commit fd021c07606264a73cd4c1f6fa6fe80a756defe0 Author: Daniel Mendler Date: Sun Dec 8 20:05:07 2024 +0100 New customization variable `completion-eager-display' The customization option can be set to t or nil, to respectively always or never show the *Completions* buffer eagerly at the beginning of a completion session. Furthermore the option can be set to the value auto. In this case the *Completions* buffer will only be shown if requested by the completion table. Completion tables can use the `eager-display' completion metadata to do so. (Bug#74616, Bug#74617) * lisp/minibuffer.el (completion-eager-display): New customization variable. (completion-metadata): Update docstring, document the new `eager-display' completion metadata. (completion-extra-properties): Update docstring, document the new `:eager-display' completion metadata. (completion-category-overrides): Add `eager-display' to the custom type specification. (completing-read-default): Handle the `completion-eager-display' customization variable and the `eager-display' completion metadata. (completion-table-with-metadata): New function to create a completion table with metadata. (minibuffer-complete-defaults, minibuffer-complete-history): Use it. * lisp/ffap.el (ffap-menu-ask): Add `ffap-menu' completion category and `eager-display' completion metadata. Use `completion-table-with-metadata'. * lisp/imenu.el (imenu-eager-completion-buffer): Correct docstring, which had been inverted. (imenu--completion-buffer): Add `eager-display' completion metadata. Use `completion-table-with-metadata'. * lisp/tmm.el (tmm-prompt): Add `tmm' completion category and `eager-display' completion metadata. Use `completion-table-with-metadata'. Add keymap setup. (tmm-add-prompt): Remove keymap setup. (tmm-goto-completions): Call `tmm-add-prompt' to ensure that a *Completions* buffer is shown. (tmm--completion-table): Remove unused internal function. * etc/NEWS: Announce the change. diff --git a/etc/NEWS b/etc/NEWS index fc424342fe8..48546a2d916 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -102,6 +102,14 @@ files and features. ** Minibuffer and Completions ++++ +*** New user option 'completion-eager-display'. +This option configures whether completion commands should display +the *Completions* buffer immediately. When the variable is set to t all +completion commands show *Completions* immediately, respectively nil +disables the eager display for all commands. The default setting auto +enables eager completion only if requested by the command. + +++ *** New user option 'completion-pcm-leading-wildcard'. This option configures how the partial-completion style does completion. diff --git a/lisp/ffap.el b/lisp/ffap.el index 180fe408104..d3110f824a6 100644 --- a/lisp/ffap.el +++ b/lisp/ffap.el @@ -1739,14 +1739,15 @@ Function CONT is applied to the entry chosen by the user." alist)))))) ;; minibuffer with completion buffer: (t - (let ((minibuffer-setup-hook 'minibuffer-completion-help)) - ;; Bug: prompting may assume unique strings, no "". - (setq choice - (completing-read - (format-prompt title (car (car alist))) - alist nil t - ;; (cons (car (car alist)) 0) - nil))) + ;; Bug: prompting may assume unique strings, no "". + (setq choice + (completing-read + (format-prompt title (car (car alist))) + (completion-table-with-metadata + alist '((category . ffap-menu) (eager-display . t))) + nil t + ;; (cons (car (car alist)) 0) + nil)) (sit-for 0) ; redraw original screen ;; Convert string to its entry, or else the default: (setq choice (or (assoc choice alist) (car alist))))) diff --git a/lisp/imenu.el b/lisp/imenu.el index 2d64970bfcf..ba1ba5fcd00 100644 --- a/lisp/imenu.el +++ b/lisp/imenu.el @@ -100,7 +100,7 @@ If `on-mouse' use a popup menu when `imenu' was invoked with the mouse." (other :tag "Always" t))) (defcustom imenu-eager-completion-buffer t - "If non-nil, eagerly pop up the completion buffer." + "If nil, eagerly pop up the completion buffer." :type 'boolean :version "22.1") @@ -767,27 +767,25 @@ Return one of the entries in index-alist or nil." (imenu--in-alist name prepared-index-alist) ;; Default to `name' if it's in the alist. name)))) - ;; Display the completion buffer. (minibuffer-with-setup-hook - (lambda () - (setq-local minibuffer-allow-text-properties t) - (setq-local completion-extra-properties - `( :category imenu - ,@(when (eq imenu-flatten 'annotation) - `(:annotation-function - ,(lambda (s) (get-text-property - 0 'imenu-section s)))) - ,@(when (eq imenu-flatten 'group) - `(:group-function - ,(lambda (s transform) - (if transform s - (get-text-property - 0 'imenu-section s))))))) - (unless imenu-eager-completion-buffer - (minibuffer-completion-help))) - (setq name (completing-read prompt - prepared-index-alist - nil t nil 'imenu--history-list name))) + (lambda () (setq-local minibuffer-allow-text-properties t)) + (setq name (completing-read + prompt + (completion-table-with-metadata + prepared-index-alist + `((category . imenu) + (eager-display . ,(not imenu-eager-completion-buffer)) + ,@(when (eq imenu-flatten 'annotation) + `((annotation-function + . ,(lambda (s) (get-text-property + 0 'imenu-section s))))) + ,@(when (eq imenu-flatten 'group) + `((group-function + . ,(lambda (s transform) + (if transform s + (get-text-property + 0 'imenu-section s)))))))) + nil t nil 'imenu--history-list name))) (when (stringp name) (or (get-text-property 0 'imenu-choice name) diff --git a/lisp/minibuffer.el b/lisp/minibuffer.el index 1337fbe17ea..dfc62c25f38 100644 --- a/lisp/minibuffer.el +++ b/lisp/minibuffer.el @@ -138,6 +138,9 @@ This metadata is an alist. Currently understood keys are: of completions. Can operate destructively. - `cycle-sort-function': function to sort entries when cycling. Works like `display-sort-function'. +- `eager-display': non-nil to request eager display of the + completion candidates. Can also be a function which is invoked + after minibuffer setup. The metadata of a completion table should be constant between two boundaries." (let ((metadata (if (functionp table) (funcall table string pred 'metadata)))) @@ -277,6 +280,15 @@ case sensitive instead." (let ((completion-ignore-case (not dont-fold))) (complete-with-action action table string pred)))) +(defun completion-table-with-metadata (table metadata) + "Return new completion TABLE with METADATA. +METADATA should be an alist of completion metadata. See +`completion-metadata' for a list of supported metadata." + (lambda (string pred action) + (if (eq action 'metadata) + `(metadata . ,metadata) + (complete-with-action action table string pred)))) + (defun completion-table-subvert (table s1 s2) "Return a completion table from TABLE with S1 replaced by S2. The result is a completion table which completes strings of the @@ -1031,6 +1043,25 @@ If the current buffer is not a minibuffer, erase its entire contents." (defvar completion-show-inline-help t "If non-nil, print helpful inline messages during completion.") +(defcustom completion-eager-display 'auto + "Whether completion commands should display *Completions* buffer eagerly. + +If the variable is set to t, completion commands show the *Completions* +buffer always immediately. Setting the variable to nil disables the +eager *Completions* display for all commands. + +For the value `auto', completion commands show the *Completions* buffer +immediately only if requested by the completion command. Completion +tables can request eager display via the `eager-display' metadata. + +See also the variables `completion-category-overrides' and +`completion-extra-properties' for the `eager-display' completion +metadata." + :type '(choice (const :tag "Never show *Completions* eagerly" nil) + (const :tag "Always show *Completions* eagerly" t) + (const :tag "If requested by the completion command" auto)) + :version "31.1") + (defcustom completion-auto-help t "Non-nil means automatically provide help for invalid completion input. If the value is t, the *Completions* buffer is displayed whenever completion @@ -1247,7 +1278,11 @@ overrides the default specified in `completion-category-defaults'." (cons :tag "Completion Affixation" (const :tag "Select one value from the menu." affixation-function) - (choice (function :tag "Custom function")))))) + (choice (function :tag "Custom function"))) + (cons :tag "Eager display" + (const :tag "Select one value from the menu." + eager-display) + boolean)))) (defun completion--category-override (category tag) (or (assq tag (cdr (assq category completion-category-overrides))) @@ -2499,6 +2534,8 @@ These include: `:cycle-sort-function': Function to sort entries when cycling. +`:eager-display': Show the *Completions* buffer eagerly. + See more information about these functions above in `completion-metadata'. @@ -4815,7 +4852,17 @@ See `completing-read' for the meaning of the arguments." (setq-local minibuffer--require-match require-match) (setq-local minibuffer--original-buffer buffer) ;; Copy the value from original buffer to the minibuffer. - (setq-local completion-ignore-case c-i-c)) + (setq-local completion-ignore-case c-i-c) + ;; Show the completion help eagerly if + ;; `completion-eager-display' is t or if eager display + ;; has been requested by the completion table. + (when completion-eager-display + (let* ((md (completion-metadata (or initial-input "") + collection predicate)) + (fun (completion-metadata-get md 'eager-display))) + (when (or fun (eq completion-eager-display t)) + (funcall (if (functionp fun) + fun #'minibuffer-completion-help)))))) (read-from-minibuffer prompt initial-input keymap nil hist def inherit-input-method)))) (when (and (equal result "") def) @@ -5005,11 +5052,9 @@ instead of the default completion table." (lambda () (get-buffer-window "*Completions*" 0)))) (completion-in-region (minibuffer--completion-prompt-end) (point-max) - (lambda (string pred action) - (if (eq action 'metadata) - '(metadata (display-sort-function . identity) - (cycle-sort-function . identity)) - (complete-with-action action completions string pred))))))) + (completion-table-with-metadata + completions '((display-sort-function . identity) + (cycle-sort-function . identity))))))) (defun minibuffer-complete-defaults () "Complete minibuffer defaults as far as possible. @@ -5025,11 +5070,9 @@ instead of the completion table." (lambda () (get-buffer-window "*Completions*" 0)))) (completion-in-region (minibuffer--completion-prompt-end) (point-max) - (lambda (string pred action) - (if (eq action 'metadata) - '(metadata (display-sort-function . identity) - (cycle-sort-function . identity)) - (complete-with-action action completions string pred)))))) + (completion-table-with-metadata + completions '((display-sort-function . identity) + (cycle-sort-function . identity)))))) (define-key minibuffer-local-map [?\C-x up] 'minibuffer-complete-history) (define-key minibuffer-local-map [?\C-x down] 'minibuffer-complete-defaults) diff --git a/lisp/tmm.el b/lisp/tmm.el index 632e55e47a8..45afbe4a3c2 100644 --- a/lisp/tmm.el +++ b/lisp/tmm.el @@ -119,12 +119,6 @@ is displayed with the `highlight' face to help identify it. The '((t :inherit shadow)) "Face used for inactive menu items.") -(defun tmm--completion-table (items) - (lambda (string pred action) - (if (eq action 'metadata) - '(metadata (display-sort-function . identity)) - (complete-with-action action items string pred)))) - (defvar tmm--history nil) ;;;###autoload @@ -222,7 +216,9 @@ is used to go back through those sub-menus." (setq out (if default-item (car (nth index-of-default tmm-km-list)) - (minibuffer-with-setup-hook #'tmm-add-prompt + (minibuffer-with-setup-hook + (lambda () + (setq tmm-old-mb-map (tmm-define-keys t))) ;; tmm-km-list is reversed, because history ;; needs it in LIFO order. But default list ;; needs it in non-reverse order, so that the @@ -233,7 +229,12 @@ is used to go back through those sub-menus." (completing-read-default (concat gl-str " (up/down to change, PgUp to menu): ") - (tmm--completion-table tmm-km-list) nil t nil + (completion-table-with-metadata + tmm-km-list '((category . tmm) + (eager-display . tmm-add-prompt) + (display-sort-function . identity) + (cycle-sort-function . identity))) + nil t nil 'tmm--history (reverse tmm--history))))))) (if (and (stringp out) (string= "^" out)) ;; A fake choice to please the destructuring later. @@ -402,7 +403,6 @@ Stores a list of all the shortcuts in the free variable `tmm-short-cuts'." (defun tmm-add-prompt () (unless tmm-c-prompt (error "No active menu entries")) - (setq tmm-old-mb-map (tmm-define-keys t)) (or tmm-completion-prompt (add-hook 'completion-setup-hook #'tmm-completion-delete-prompt 'append)) @@ -458,6 +458,7 @@ Stores a list of all the shortcuts in the free variable `tmm-short-cuts'." (defun tmm-goto-completions () "Jump to the completions buffer." (interactive) + (tmm-add-prompt) (setq tmm-c-prompt (buffer-substring (minibuffer-prompt-end) (point-max))) ;; Clear minibuffer old contents before using *Completions* buffer for ;; selection. commit 64981660c912e5ab79c1143d9879d9ee7a0b93bf Author: Lin Sun Date: Wed Dec 11 06:51:21 2024 +0000 Restore 'imenu-create-index-function' on exiting semantic * lisp/cedet/semantic.el: Restore the 'imenu-create-index-function' on exiting. * lisp/cedet/semantic/bovine/make.el: * lisp/cedet/semantic/bovine/scm.el: * lisp/cedet/semantic/html.el: * lisp/cedet/semantic/texi.el: * lisp/cedet/semantic/wisent/java-tags.el: * lisp/cedet/semantic/wisent/javascript.el: * lisp/cedet/semantic/wisent/python.el: * lisp/cedet/srecode/template.el: Store the original 'imenu-create-index-function' before changing it. (Bug#74803) diff --git a/lisp/cedet/semantic.el b/lisp/cedet/semantic.el index 3c3ae2ac160..1b7931f0c35 100644 --- a/lisp/cedet/semantic.el +++ b/lisp/cedet/semantic.el @@ -997,6 +997,9 @@ The following modes are more targeted at people who want to see :type `(set ,@(mapcar (lambda (c) (list 'const c)) semantic-submode-list))) +(defvar-local semantic--create-index-function-origin nil + "The original `imenu-create-index-function' before semantic.") + ;;;###autoload (define-minor-mode semantic-mode "Toggle parser features (Semantic mode). @@ -1070,7 +1073,13 @@ Semantic mode. (setq semantic--buffer-cache nil) ;; Make sure we run the setup function if Semantic gets ;; re-activated. - (setq semantic-new-buffer-fcn-was-run nil))) + (setq semantic-new-buffer-fcn-was-run nil) + ;; restore the original `imenu-create-index-function' + (unless (eq semantic--create-index-function-origin + imenu-create-index-function) + (setq imenu-create-index-function + (or semantic--create-index-function-origin + (default-value 'imenu-create-index-function)))))) ;;; Autoload some functions that are not in semantic/loaddefs diff --git a/lisp/cedet/semantic/bovine/make.el b/lisp/cedet/semantic/bovine/make.el index a95f7da27cf..b8f31d21028 100644 --- a/lisp/cedet/semantic/bovine/make.el +++ b/lisp/cedet/semantic/bovine/make.el @@ -226,6 +226,7 @@ Uses default implementation, and also gets a list of filenames." (?+ ".") (?\\ ".") ) + semantic--create-index-function-origin imenu-create-index-function imenu-create-index-function #'semantic-create-imenu-index ) (setq semantic-lex-analyzer #'semantic-make-lexer) diff --git a/lisp/cedet/semantic/bovine/scm.el b/lisp/cedet/semantic/bovine/scm.el index 6d19acf0282..e31019e8bf2 100644 --- a/lisp/cedet/semantic/bovine/scm.el +++ b/lisp/cedet/semantic/bovine/scm.el @@ -102,6 +102,7 @@ syntax as specified by the syntax table." (function . "Functions") (include . "Loads") (package . "DefineModule")) + semantic--create-index-function-origin imenu-create-index-function imenu-create-index-function #'semantic-create-imenu-index ) (setq semantic-lex-analyzer #'semantic-scheme-lexer) diff --git a/lisp/cedet/semantic/html.el b/lisp/cedet/semantic/html.el index 120b2108709..d00d5633e2c 100644 --- a/lisp/cedet/semantic/html.el +++ b/lisp/cedet/semantic/html.el @@ -238,6 +238,7 @@ tag with greater section value than LEVEL is found." ;; This will use our parser. (setq semantic-parser-name "HTML" semantic--parse-table t + semantic--create-index-function-origin imenu-create-index-function imenu-create-index-function #'semantic-create-imenu-index semantic-command-separation-character ">" semantic-type-relation-separator-character '(":") diff --git a/lisp/cedet/semantic/texi.el b/lisp/cedet/semantic/texi.el index 6374d995d0a..2b341249a54 100644 --- a/lisp/cedet/semantic/texi.el +++ b/lisp/cedet/semantic/texi.el @@ -445,6 +445,7 @@ that start with that symbol." (setq semantic-parser-name "TEXI" ;; Setup a dummy parser table to enable parsing! semantic--parse-table t + semantic--create-index-function-origin imenu-create-index-function imenu-create-index-function #'semantic-create-imenu-index semantic-command-separation-character "@" semantic-type-relation-separator-character '(":") diff --git a/lisp/cedet/semantic/wisent/java-tags.el b/lisp/cedet/semantic/wisent/java-tags.el index ed62d2c3a9c..ebb899221cc 100644 --- a/lisp/cedet/semantic/wisent/java-tags.el +++ b/lisp/cedet/semantic/wisent/java-tags.el @@ -113,6 +113,7 @@ Use the alternate LALR(1) parser." semantic-tag-expand-function #'semantic-java-expand-tag ;; Environment semantic-imenu-summary-function #'semantic-format-tag-prototype + semantic--create-index-function-origin imenu-create-index-function imenu-create-index-function #'semantic-create-imenu-index semantic-type-relation-separator-character '(".") semantic-command-separation-character ";" diff --git a/lisp/cedet/semantic/wisent/javascript.el b/lisp/cedet/semantic/wisent/javascript.el index 7a1a8637aae..9420323c7e1 100644 --- a/lisp/cedet/semantic/wisent/javascript.el +++ b/lisp/cedet/semantic/wisent/javascript.el @@ -135,6 +135,7 @@ This is currently needed for the mozrepl omniscient database." semantic-tag-expand-function #'wisent-javascript-jv-expand-tag ;; Environment semantic-imenu-summary-function #'semantic-format-tag-name + semantic--create-index-function-origin imenu-create-index-function imenu-create-index-function #'semantic-create-imenu-index semantic-command-separation-character ";" )) diff --git a/lisp/cedet/semantic/wisent/python.el b/lisp/cedet/semantic/wisent/python.el index 73f08beaa28..a4205bede50 100644 --- a/lisp/cedet/semantic/wisent/python.el +++ b/lisp/cedet/semantic/wisent/python.el @@ -514,6 +514,7 @@ Shortens `code' tags, but passes through for others." ;; Semantic to take over from the one provided by python. ;; The python one, if it uses the senator advice, will hang ;; Emacs unrecoverably. + semantic--create-index-function-origin imenu-create-index-function imenu-create-index-function #'semantic-create-imenu-index ;; I need a python guru to update this list: diff --git a/lisp/cedet/srecode/template.el b/lisp/cedet/srecode/template.el index 2417f1f7ef6..8b7fbf73979 100644 --- a/lisp/cedet/srecode/template.el +++ b/lisp/cedet/srecode/template.el @@ -53,6 +53,7 @@ ;; Parsing ;; Environment semantic-imenu-summary-function #'semantic-format-tag-name + semantic--create-index-function-origin imenu-create-index-function imenu-create-index-function #'semantic-create-imenu-index semantic-command-separation-character "\n" semantic-lex-comment-regex ";;" commit ed1f3b8488e18143d658e4f1aca8d21a3b84e2b2 Author: Daniel Mendler Date: Wed Dec 11 07:36:16 2024 +0100 Add `browse-url-qutebrowser' The browser launcher supports the NEW-WINDOW argument and `browse-url-qutebrowser-new-window-is-tab' to open tabs. Furthermore opening new URLs is sped up via Unix socket IPC if available. * lisp/net/browse-url.el (browse-url-qutebrowser-send): Function to send command to Qutebrowser via IPC. (browse-url-qutebrowser): New browser launcher. Use `browse-url-qutebrowser-send'. (browse-url-qutebrowser-program, browse-url-qutebrowser-arguments) (browse-url-qutebrowser-new-window-is-tab): New customizables. (browse-url-mozilla-new-window-is-tab) (browse-url-firefox-new-window-is-tab) (browse-url-epiphany-new-window-is-tab): Improve docstrings. * etc/NEWS: Announce the change. (Bug#74781) diff --git a/etc/NEWS b/etc/NEWS index d96e49402ba..fc424342fe8 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -294,6 +294,12 @@ modal editing packages. * Changes in Specialized Modes and Packages in Emacs 31.1 +** Browse URL + +*** New function 'browse-url-qutebrowser' for the Qutebrowser. +For better integration with the Qutebrowser, set +'browse-url(-secondary)-browser-function' to 'browse-url-qutebrowser'. + ** CL-Lib +++ *** 'cl-labels' now also accepts (FUNC EXP) bindings, like 'cl-flet'. diff --git a/lisp/net/browse-url.el b/lisp/net/browse-url.el index de2fa9c2bfb..10165465921 100644 --- a/lisp/net/browse-url.el +++ b/lisp/net/browse-url.el @@ -140,6 +140,7 @@ ;;; Code: (require 'url) +(require 'xdg) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; Variables @@ -342,6 +343,16 @@ Defaults to the value of `browse-url-epiphany-arguments' at the time `browse-url' is loaded." :type '(repeat (string :tag "Argument"))) +(defcustom browse-url-qutebrowser-program "qutebrowser" + "The name by which to invoke Qutebrowser." + :type 'string + :version "31.1") + +(defcustom browse-url-qutebrowser-arguments nil + "A list of strings to pass to Qutebrowser when it starts up." + :type '(repeat (string :tag "Argument")) + :version "31.1") + (defcustom browse-url-webpositive-program "WebPositive" "The name by which to invoke WebPositive." :type 'string @@ -360,33 +371,45 @@ Defaults to the value of `browse-url-epiphany-arguments' at the time (make-obsolete-variable 'browse-url-gnome-moz-arguments nil "25.1") (defcustom browse-url-mozilla-new-window-is-tab nil - "Whether to open up new windows in a tab or a new window. + "Whether to open up new Mozilla windows in a tab or a new window. If non-nil, then open the URL in a new tab rather than a new window if -`browse-url-mozilla' is asked to open it in a new window." +`browse-url-mozilla' is asked to open it in a new window via the +NEW-WINDOW argument." :type 'boolean) (make-obsolete-variable 'browse-url-mozilla-new-window-is-tab nil "29.1") (defcustom browse-url-firefox-new-window-is-tab nil - "Whether to open up new windows in a tab or a new window. + "Whether to open up new Firefox windows in a tab or a new window. If non-nil, then open the URL in a new tab rather than a new window if -`browse-url-firefox' is asked to open it in a new window." +`browse-url-firefox' is asked to open it in a new window via the +NEW-WINDOW argument." :type 'boolean) (defcustom browse-url-conkeror-new-window-is-buffer nil - "Whether to open up new windows in a buffer or a new window. + "Whether to open up new Conkeror windows in a buffer or a new window. If non-nil, then open the URL in a new buffer rather than a new window if -`browse-url-conkeror' is asked to open it in a new window." +`browse-url-conkeror' is asked to open it in a new window via the +NEW-WINDOW argument." :version "25.1" :type 'boolean) (make-obsolete-variable 'browse-url-conkeror-new-window-is-buffer nil "28.1") (defcustom browse-url-epiphany-new-window-is-tab nil - "Whether to open up new windows in a tab or a new window. + "Whether to open up new Epiphany windows in a tab or a new window. If non-nil, then open the URL in a new tab rather than a new window if -`browse-url-epiphany' is asked to open it in a new window." +`browse-url-epiphany' is asked to open it in a new window via the +NEW-WINDOW argument." :type 'boolean) +(defcustom browse-url-qutebrowser-new-window-is-tab nil + "Whether to open up new Qutebrowser windows in a tab or a new window. +If non-nil, then open the URL in a new tab rather than a new window if +`browse-url-qutebrowser' is asked to open it in a new window via the +NEW-WINDOW argument." + :type 'boolean + :version "31.1") + (defcustom browse-url-new-window-flag nil "Non-nil means always open a new browser window with appropriate browsers. Passing an interactive argument to \\[browse-url], or specific browser @@ -1291,6 +1314,60 @@ used instead of `browse-url-new-window-flag'." browse-url-epiphany-program (append browse-url-epiphany-startup-arguments (list url)))))) +(defun browse-url-qutebrowser-send (cmd) + "Send CMD to Qutebrowser via IPC." + (let* ((dir (xdg-runtime-dir)) + (sock (and dir (expand-file-name + (format "qutebrowser/ipc-%s" (md5 (user-login-name))) + dir)))) + (unless (file-exists-p sock) + (error "No Qutebrowser IPC socket found")) + (let ((proc + (make-network-process + :name "qutebrowser" + :family 'local + :service sock + :coding 'utf-8))) + (unwind-protect + (process-send-string + proc + (concat + (json-serialize `( :args [,cmd] + :target_arg :null + :protocol_version 1)) + "\n")) + (delete-process proc))))) + +(defun browse-url-qutebrowser (url &optional new-window) + "Ask the Qutebrowser WWW browser to load URL. +Default to the URL around or before point. + +When called interactively, if variable `browse-url-new-window-flag' is +non-nil, load the document in a new Qutebrowser window, otherwise use a +random existing one. A non-nil interactive prefix argument reverses +the effect of `browse-url-new-window-flag'. + +If `browse-url-qutebrowser-new-window-is-tab' is non-nil, then whenever a +document would otherwise be loaded in a new window, it is loaded in a +new tab in an existing window instead. + +When called non-interactively, optional second argument NEW-WINDOW is +used instead of `browse-url-new-window-flag'." + (interactive (browse-url-interactive-arg "URL: ")) + (let ((cmd (concat ":open " + (and (browse-url-maybe-new-window new-window) + (if browse-url-qutebrowser-new-window-is-tab + "-t " "-w ")) + (browse-url-encode-url url)))) + (condition-case nil + (browse-url-qutebrowser-send cmd) + (error + (apply #'start-process (concat "qutebrowser " url) nil + browse-url-qutebrowser-program + (append browse-url-qutebrowser-arguments (list cmd))))))) + +(function-put 'browse-url-qutebrowser 'browse-url-browser-kind 'external) + (defvar url-handler-regexp) ;;;###autoload commit 6942599dbb24c1a469e3d3708df83692b49e4af8 Author: Eli Zaretskii Date: Sat Dec 14 11:57:04 2024 +0200 ; * etc/PROBLEMS: Document problem with menu-bar background (bug#74028). diff --git a/etc/PROBLEMS b/etc/PROBLEMS index 30506b3c87a..8de12a78613 100644 --- a/etc/PROBLEMS +++ b/etc/PROBLEMS @@ -1588,6 +1588,12 @@ https://debbugs.gnu.org/cgi/bugreport.cgi?bug=22000, https://debbugs.gnu.org/cgi/bugreport.cgi?bug=22898 and https://lists.gnu.org/r/emacs-devel/2016-07/msg00154.html. +*** In Emacs built with GTK+ toolkit, menu-bar background becomes transparent. + +This happens when 'alpha-background' is less than 100. This is due a +GTK limitation, for which no workaround is currently known, +unfortunately. + *** Metacity: Resizing Emacs or ALT-Tab causes X to be unresponsive. This happens sometimes when using Metacity. Resizing Emacs or ALT-Tab:bing commit 83245d2269be357db2fff8baa17adb4b05f97aed Author: Michael Albinus Date: Sat Dec 14 09:37:17 2024 +0100 Fix xt-mouse-tests.el in interactive mode * test/lisp/xt-mouse-tests.el (with-xterm-mouse-mode): Run only when noninteractive. diff --git a/test/lisp/xt-mouse-tests.el b/test/lisp/xt-mouse-tests.el index f64b3aed73e..0610b6f94c5 100644 --- a/test/lisp/xt-mouse-tests.el +++ b/test/lisp/xt-mouse-tests.el @@ -30,32 +30,33 @@ (defmacro with-xterm-mouse-mode (&rest body) "Run BODY with `xterm-mouse-mode' temporarily enabled." (declare (indent 0)) - `(let ((width (frame-width)) - (height (frame-height))) - (unwind-protect - (progn - ;; Make the frame huge so that the test input events below - ;; don't hit the menu bar. - (set-frame-width nil (max width 2000)) - (set-frame-height nil (max height 2000)) - (cl-letf (;; Reset XTerm parameters so that the tests don't - ;; get confused. - ((terminal-parameter nil 'xterm-mouse-x) nil) - ((terminal-parameter nil 'xterm-mouse-y) nil) - ((terminal-parameter nil 'xterm-mouse-last-down) nil) - ((terminal-parameter nil 'xterm-mouse-last-click) nil)) - (unwind-protect - (progn - ;; `xterm-mouse-mode' doesn't work in the initial - ;; terminal. Since we can't create a second - ;; terminal in batch mode, fake it temporarily. - (cl-letf (((symbol-function 'terminal-name) - (lambda (&optional _terminal) "fake-terminal"))) - (xterm-mouse-mode 1)) - ,@body) - (xterm-mouse-mode 0)))) - (set-frame-width nil width) - (set-frame-height nil height)))) + (when noninteractive + `(let ((width (frame-width)) + (height (frame-height))) + (unwind-protect + (progn + ;; Make the frame huge so that the test input events below + ;; don't hit the menu bar. + (set-frame-width nil (max width 2000)) + (set-frame-height nil (max height 2000)) + (cl-letf (;; Reset XTerm parameters so that the tests don't + ;; get confused. + ((terminal-parameter nil 'xterm-mouse-x) nil) + ((terminal-parameter nil 'xterm-mouse-y) nil) + ((terminal-parameter nil 'xterm-mouse-last-down) nil) + ((terminal-parameter nil 'xterm-mouse-last-click) nil)) + (unwind-protect + (progn + ;; `xterm-mouse-mode' doesn't work in the initial + ;; terminal. Since we can't create a second + ;; terminal in batch mode, fake it temporarily. + (cl-letf (((symbol-function 'terminal-name) + (lambda (&optional _terminal) "fake-terminal"))) + (xterm-mouse-mode 1)) + ,@body) + (xterm-mouse-mode 0)))) + (set-frame-width nil width) + (set-frame-height nil height))))) (ert-deftest xt-mouse-tracking-basic () (should (equal (xterm-mouse-tracking-enable-sequence) commit 2719dccbe5797dd8fcf1ce013df2ff71161b6f55 Author: Jared Finder Date: Sat Dec 14 09:30:43 2024 +0100 Fix for xt-mouse-tests.el broken in prior commit xt-mouse-tests not turning on xterm-mouse-mode if it was already on did not work with xterm-mouse-mode being set to t by default. It turns out that xt-mouse-tests already does not report proper results when called inside a running Emacs session so the code path is not useful anyways. * test/lisp/xt-mouse-tests.el (with-xterm-mouse-mode): Always turn on xterm-mouse-mode, even if it is already on. diff --git a/test/lisp/xt-mouse-tests.el b/test/lisp/xt-mouse-tests.el index cfc8042f796..f64b3aed73e 100644 --- a/test/lisp/xt-mouse-tests.el +++ b/test/lisp/xt-mouse-tests.el @@ -25,6 +25,8 @@ (require 'xt-mouse) +;; FIXME: this doesn't work when called inside a non-batch mode Emacs +;; session. (defmacro with-xterm-mouse-mode (&rest body) "Run BODY with `xterm-mouse-mode' temporarily enabled." (declare (indent 0)) @@ -42,18 +44,16 @@ ((terminal-parameter nil 'xterm-mouse-y) nil) ((terminal-parameter nil 'xterm-mouse-last-down) nil) ((terminal-parameter nil 'xterm-mouse-last-click) nil)) - (if xterm-mouse-mode - ,(macroexp-progn body) - (unwind-protect - (progn - ;; `xterm-mouse-mode' doesn't work in the initial - ;; terminal. Since we can't create a second - ;; terminal in batch mode, fake it temporarily. - (cl-letf (((symbol-function 'terminal-name) - (lambda (&optional _terminal) "fake-terminal"))) - (xterm-mouse-mode)) - ,@body) - (xterm-mouse-mode 0))))) + (unwind-protect + (progn + ;; `xterm-mouse-mode' doesn't work in the initial + ;; terminal. Since we can't create a second + ;; terminal in batch mode, fake it temporarily. + (cl-letf (((symbol-function 'terminal-name) + (lambda (&optional _terminal) "fake-terminal"))) + (xterm-mouse-mode 1)) + ,@body) + (xterm-mouse-mode 0)))) (set-frame-width nil width) (set-frame-height nil height)))) commit 488801baf7de64cc3ad8747c7a0c9f5869afb4e2 Author: Stephen Gildea Date: Fri Dec 13 08:53:54 2024 -0800 * lisp/time-stamp.el: Limit field width to two digits. diff --git a/lisp/time-stamp.el b/lisp/time-stamp.el index 8c28920d219..69c059f6254 100644 --- a/lisp/time-stamp.el +++ b/lisp/time-stamp.el @@ -561,6 +561,8 @@ and all `time-stamp-format' compatibility." (setq field-width "1" flag-minimize t)) ((eq cur-char ?_) (setq field-width "2" flag-pad-with-spaces t)))) + (if (> (string-to-number field-width) 99) + (setq field-width (if flag-pad-with-zeros "099" "99"))) (setq field-result (cond ((eq cur-char ?%) commit 34bedcd58d74f733631ec78afc7bda9a068c714f Author: Eli Zaretskii Date: Fri Dec 13 14:11:13 2024 +0200 ; * lisp/progmodes/executable.el: Remove stale comment (bug#74846). diff --git a/lisp/progmodes/executable.el b/lisp/progmodes/executable.el index cb4a5eedb80..97baf86e017 100644 --- a/lisp/progmodes/executable.el +++ b/lisp/progmodes/executable.el @@ -43,10 +43,9 @@ ;; It also allows debugging scripts, with an adaptation of compile, as far ;; as interpreters give out meaningful error messages. -;; Modes that use this should nconc `executable-map' to the end of their own -;; keymap and `executable-font-lock-keywords' to the end of their own font -;; lock keywords. Their mode-setting commands should call -;; `executable-set-magic'. +;; Modes that use this should nconc `executable-font-lock-keywords' to +;; the end of their own font lock keywords. Their mode-setting commands +;; should call `executable-set-magic'. ;;; Code: commit 327d3e56f6ecd9e5c49405c87ebb8b78b96d8293 Author: Eli Zaretskii Date: Thu Dec 12 18:03:19 2024 +0200 ; * etc/TODO: Add an item for improving defgroups. diff --git a/etc/TODO b/etc/TODO index b60e1198a0a..56ec890a7d5 100644 --- a/etc/TODO +++ b/etc/TODO @@ -35,6 +35,24 @@ is not always true. * High Priority Items +** Overhaul the customization groups. +The goal is to present new Emacs users with a reasonable and useful +hierarchy of customization groups, thus allowing them to easily find a +customization options they are looking for, by going down this +hierarchy. + +The current customization groups (see "M-x customize-group RET RET") and +their hierarchy are sporadic and do not systematically cover all the +areas and domains of Emacs features. They need to be extensively +re-thought and overhauled. One idea is to take the top-level chapters +of the Emacs user manual and use those as customization groups, then +define sub-groups using the sections. Sub-sections could then be used +where a third level of groups makes sense. The place to define this +hierarchy is mainly in cus-edit.el. + +Once the two- or three-level hierarchy of defgroups is defined, all the +defcustom's should be audited and their groups redefined if necessary. + ** Things related to elpa.gnu.org. We need to figure out how to best include GNU ELPA packages in the Emacs tarball before doing any of the items below. commit 7ae9ccae0caa58dcf67869e8daa1b1301dce2119 Author: Scott Bell Date: Tue Dec 10 12:02:54 2024 -0700 ; * lisp/net/rcirc.el (rcirc-next-active-buffer): Doc fix (bug#74773). diff --git a/lisp/net/rcirc.el b/lisp/net/rcirc.el index 2a713de83c2..5da1ed13b6f 100644 --- a/lisp/net/rcirc.el +++ b/lisp/net/rcirc.el @@ -2448,7 +2448,8 @@ This function does not alter the INPUT string." (defun rcirc-next-active-buffer (arg) "Switch to the next rcirc buffer with activity. -With prefix ARG, go to the next low priority buffer with activity." +With prefix ARG, go to the next low priority buffer with activity. +When there are no buffers with activity, bury all rcirc buffers." (interactive "P") (let* ((pair (rcirc-split-activity rcirc-activity)) (lopri (car pair)) commit 3e51be94ae6312b05d4f2a811faeee7328b152cb Author: Stefan Kangas Date: Wed Dec 11 22:40:22 2024 +0100 ; Fix :version tag in browse-url * lisp/net/browse-url.el (browse-url-button-regexp): Fix :version tag. diff --git a/lisp/net/browse-url.el b/lisp/net/browse-url.el index 3048b8f6c22..1a51d2bdaac 100644 --- a/lisp/net/browse-url.el +++ b/lisp/net/browse-url.el @@ -252,7 +252,7 @@ be used instead." "\\)")) "\\)") "Regular expression that matches URLs." - :version "27.1" + :version "30.1" :type 'regexp) (defcustom browse-url-browser-display nil commit dffd4a50c64db5141997ad91e04d9e2107d968b5 Author: Philip Kaludercic Date: Tue Dec 10 22:12:34 2024 +0100 Revert "Attempt to install package first when upgrading" This reverts commit 3d8e49c41a66a7f05cb96f84e2a10f0f308ac9ca. diff --git a/lisp/emacs-lisp/package.el b/lisp/emacs-lisp/package.el index 33d74cc7663..53d04b0d5ec 100644 --- a/lisp/emacs-lisp/package.el +++ b/lisp/emacs-lisp/package.el @@ -2272,16 +2272,12 @@ had been enabled." ;; `pkg-desc' will be nil when the package is an "active built-in". (if (and pkg-desc (package-vc-p pkg-desc)) (package-vc-upgrade pkg-desc) + (when pkg-desc + (package-delete pkg-desc 'force 'dont-unselect)) (package-install package ;; An active built-in has never been "selected" ;; before. Mark it as installed explicitly. - (and pkg-desc 'dont-select)) - ;; We delete the old package via the descriptor after installing - ;; the new package to avoid losing the package if there issues - ;; during installation (Bug#74556). - (when pkg-desc - (cl-assert (package-desc-dir pkg-desc)) - (package-delete pkg-desc 'force 'dont-unselect))))) + (and pkg-desc 'dont-select))))) (defun package--upgradeable-packages (&optional include-builtins) ;; Initialize the package system to get the list of package commit fbcb357b9db1e7d4dd32c1f2b7b01950e66b9b34 Author: Robert Pluim Date: Tue Dec 10 14:56:21 2024 +0100 Fix 'gnus-select-method' custom type * lisp/gnus/gnus.el (gnus-redefine-select-method-widget): Cater for the 'gnus-search-engine' configuration variable, which takes 2 args instead of 1. (Bug#74759) diff --git a/lisp/gnus/gnus.el b/lisp/gnus/gnus.el index f1fc129a505..1334fa26afa 100644 --- a/lisp/gnus/gnus.el +++ b/lisp/gnus/gnus.el @@ -1402,9 +1402,14 @@ this variable. I think." (string :tag "Address") (repeat :tag "Options" :inline t - (list :format "%v" - variable - (sexp :tag "Value")))))) + (radio + (list :tag "Single var" :format "%v" + variable + (sexp :tag "Value")) + (list :tag "Multiple var" :format "%v" + variable + variable + (sexp :tag "Value"))))))) (gnus-redefine-select-method-widget) commit 6fd5e02cb9bc888cf454f8e5e8daf3203ae7a13f Author: Chu Date: Tue Dec 10 11:10:34 2024 +0800 Fix typo in maps.texi * doc/lispref/maps.texi (Standard Keymaps): Fix typo. (Bug#74761) Copyright-paperwork-exempt: yes diff --git a/doc/lispref/maps.texi b/doc/lispref/maps.texi index 6ae98da49c7..f1a7fe258d5 100644 --- a/doc/lispref/maps.texi +++ b/doc/lispref/maps.texi @@ -30,7 +30,7 @@ A sparse keymap for subcommands of the prefix @kbd{C-x a}.@* @xref{Defining Abbrevs,,, emacs, The GNU Emacs Manual}. @item button-buffer-map -A sparse keymap useful for buffers containing buffers.@* +A sparse keymap useful for buffers containing buttons.@* You may want to use this as a parent keymap. @xref{Buttons}. @item button-map commit 872a7336dc083c6f28acb292cf389f0f14b0f354 Author: Eli Zaretskii Date: Mon Dec 9 20:23:40 2024 +0200 ; * etc/DEBUG: Mention "handle SIGINT" on MS-Windows. diff --git a/etc/DEBUG b/etc/DEBUG index 06544674e5d..e16a21f3824 100644 --- a/etc/DEBUG +++ b/etc/DEBUG @@ -283,7 +283,10 @@ breakpoints in advance. GDB 13.1 changed the way C-c and C-BREAK are handled on Windows, so with those newer versions, you don't need the "set new-console 1" setting to be able to interrupt Emacs by typing C-c or C-BREAK into the console window from which you started Emacs -and where you interact with GDB. +and where you interact with GDB. Instead, make sure that SIGINT will +stop Emacs under the debugger: + + (gdb) handle SIGINT stop nopass ** Examining Lisp object values. commit b4bcbabf95c5cf4d4175bfb78e56e717d21a1034 Author: Michael Albinus Date: Mon Dec 9 15:50:59 2024 +0100 * doc/misc/tramp.texi (FUSE-based methods): Fix sshfs reference. diff --git a/doc/misc/tramp.texi b/doc/misc/tramp.texi index 3af478052ed..94e06ce6af3 100644 --- a/doc/misc/tramp.texi +++ b/doc/misc/tramp.texi @@ -1530,10 +1530,10 @@ for accessing the system storage, you should use it. @vindex tramp-sshfs-program On local hosts which have installed the @command{sshfs} client for -mounting a file system based on @command{sftp}, this method can be -used, see -@uref{https://github.com/libfuse/sshfs/blob/master/README.rst/}. If -the @command{sshfs} program isn't found in your @env{PATH} environment +mounting a file system based on the @command{sftp} subsystem of +@command{ssh}, this method can be used, see +@uref{https://github.com/libfuse/sshfs/blob/master/README.md}. If the +@command{sshfs} program isn't found in your @env{PATH} environment variable, you can tell @value{tramp} its absolute path via the user option @code{tramp-sshfs-program}. commit f8da72b41cda77088231a03da2e0879a79c5f12e Author: Stefan Kangas Date: Sun Dec 8 14:51:50 2024 +0100 Improve gnus.texi indexing * doc/misc/gnus.texi (Common Variables): Improve indexing. diff --git a/doc/misc/gnus.texi b/doc/misc/gnus.texi index 71d548f3cee..200b68d2059 100644 --- a/doc/misc/gnus.texi +++ b/doc/misc/gnus.texi @@ -14374,6 +14374,8 @@ where you would put a @samp{SOCKS} wrapper for instance. @vindex nntp-address The address of the @acronym{NNTP} server. +@cindex nntps +@cindex snews @item nntp-port-number @vindex nntp-port-number Port number to connect to the @acronym{NNTP} server. The default is commit 4a090bd7eabebb366f56eb1c8f01ae59bcd3323d Author: Eli Zaretskii Date: Sun Dec 8 07:58:41 2024 +0200 ; * lisp/net/eww.el (eww-browse-with-external-browser): Fix typo. diff --git a/lisp/net/eww.el b/lisp/net/eww.el index f9db0559853..6217f7674b7 100644 --- a/lisp/net/eww.el +++ b/lisp/net/eww.el @@ -2090,7 +2090,7 @@ Interactively, EVENT is the value of `last-nonmenu-event'." (defun eww-browse-with-external-browser (&optional url) "Browse the current URL with an external browser. -The browser to used is specified by the +The browser to use is specified by the `browse-url-secondary-browser-function' variable." (interactive nil eww-mode) (funcall browse-url-secondary-browser-function commit 59fa0b1dd6eba2d3fcc2568d79b3586638dbed04 Author: Eli Zaretskii Date: Sun Dec 8 07:47:07 2024 +0200 ; Improve doc strings in compile.el * lisp/progmodes/compile.el (compilation-transform-file-match-alist) (compilation-error-regexp-alist): Doc fixes. diff --git a/lisp/progmodes/compile.el b/lisp/progmodes/compile.el index 241b29c65b0..b76dd3bd298 100644 --- a/lisp/progmodes/compile.el +++ b/lisp/progmodes/compile.el @@ -61,16 +61,18 @@ If nil, use Emacs default." (defcustom compilation-transform-file-match-alist '(("/bin/[a-z]*sh\\'" nil)) - "Alist of regexp/replacements to alter file names in compilation errors. -If the replacement is nil, the file will not be considered an error -after all. If not nil, it should be a regexp replacement string. + "Alist of regexp/replacements to alter file names in compiler messages. +If the replacement is nil, the matching message will not be considered +an error or warning. If not nil, it should be a replacement string +for the matched regexp. -When a replacement regexp is specified, the value of the file name used -to locate the error is changed, but the compilation buffer still -displays the original value. +If a non-nil replacement is specified, the value of the matched file name +used to locate the warning or error is modified using the replacement, but +the compilation buffer still displays the original value. -For example, to prepend a subdirectory \"bar/\" to all file names, add -an entry matching \"\\\\=`\" and a replacement regexp of \"bar/\", i.e.: +For example, to prepend a subdirectory \"bar/\" to all file names in +compiler messages, add an entry matching \"\\\\=`\" and a replacement +string of \"bar/\", i.e.: (\"\\\\=`\" \"bar/\") @@ -803,10 +805,10 @@ Alternatively, FACE can evaluate to a property list of the form (face FACE PROP1 VAL1 PROP2 VAL2 ...), in which case all the listed text properties PROP# are given values VAL# as well. -After identifying errors and warnings determined by this +After identifying compilation errors and warnings determined by this variable, the `compilation-transform-file-match-alist' variable is then consulted. It allows further transformations of the -matched file names, and weeding out false positives." +matched file names, and ignoring false positives." :type '(repeat (choice (symbol :tag "Predefined symbol") (sexp :tag "Error specification"))) :link `(file-link :tag "example file" commit 3d8e49c41a66a7f05cb96f84e2a10f0f308ac9ca Author: Philip Kaludercic Date: Sat Dec 7 20:02:00 2024 +0100 Attempt to install package first when upgrading * lisp/emacs-lisp/package.el (package-upgrade): Swap the 'package-install' and the 'package-delete' invocations. (Bug#74556) diff --git a/lisp/emacs-lisp/package.el b/lisp/emacs-lisp/package.el index 53d04b0d5ec..33d74cc7663 100644 --- a/lisp/emacs-lisp/package.el +++ b/lisp/emacs-lisp/package.el @@ -2272,12 +2272,16 @@ had been enabled." ;; `pkg-desc' will be nil when the package is an "active built-in". (if (and pkg-desc (package-vc-p pkg-desc)) (package-vc-upgrade pkg-desc) - (when pkg-desc - (package-delete pkg-desc 'force 'dont-unselect)) (package-install package ;; An active built-in has never been "selected" ;; before. Mark it as installed explicitly. - (and pkg-desc 'dont-select))))) + (and pkg-desc 'dont-select)) + ;; We delete the old package via the descriptor after installing + ;; the new package to avoid losing the package if there issues + ;; during installation (Bug#74556). + (when pkg-desc + (cl-assert (package-desc-dir pkg-desc)) + (package-delete pkg-desc 'force 'dont-unselect))))) (defun package--upgradeable-packages (&optional include-builtins) ;; Initialize the package system to get the list of package