commit 1298d1db189bf434e54a792d3a6746237881f251 (HEAD, refs/remotes/origin/master) Author: Protesilaos Stavrou Date: Sat Feb 18 09:36:18 2023 +0200 Rename 'display-time-time-and-date-indicator' to 'display-time-date-and-time' (bug#61567) * etc/NEWS: * lisp/time.el (display-time-time-and-date-indicator) (display-time-date-and-time, display-time-string-forms): Update symbol. diff --git a/etc/NEWS b/etc/NEWS index db42041ec6d..bcce416ebc1 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -57,7 +57,7 @@ This allows the user to customize the prompt that is appended by "(yes or no) ". --- -** New face 'display-time-time-and-date-indicator'. +** New face 'display-time-date-and-time'. This is used for displaying the time and date components of 'display-time-mode'. diff --git a/lisp/time.el b/lisp/time.el index 030aef9d49b..522bec46ac6 100644 --- a/lisp/time.el +++ b/lisp/time.el @@ -139,7 +139,7 @@ display-time-mail-face :version "22.1" :type '(choice (const :tag "None" nil) face)) -(defface display-time-time-and-date-indicator nil +(defface display-time-date-and-time nil "Face for `display-time-format'." :group 'mode-line-faces :version "30.1") @@ -184,7 +184,7 @@ display-time-string-forms (format-time-string (or display-time-format (if display-time-24hr-format "%H:%M" "%-I:%M%p")) now) - 'face 'display-time-time-and-date-indicator + 'face 'display-time-date-and-time 'help-echo (format-time-string "%a %b %e, %Y" now)) load (if mail commit 2c7e87c73a90effab66fa7c783855199880315d3 Author: Stefan Kangas Date: Fri Feb 17 22:50:13 2023 +0100 Use more recent public_suffix_list.dat where possible * lisp/url/url-domsuf.el (url-domsuf--public-suffix-file): New function to look for a more recent version of public_suffix_list.dat on the system than the one that is shipped with Emacs. (url-domsuf-parse-file): Use above new function. * test/lisp/url/url-domsuf-tests.el (url-domsuf--public-suffix-file): New test. diff --git a/lisp/url/url-domsuf.el b/lisp/url/url-domsuf.el index 74d46f1c037..671885e418f 100644 --- a/lisp/url/url-domsuf.el +++ b/lisp/url/url-domsuf.el @@ -30,14 +30,26 @@ (defvar url-domsuf-domains nil) +(defun url-domsuf--public-suffix-file () + "Look for and return a file name for a recent \"public_suffix_list.dat\". +Emacs ships with a copy of this file, but some systems might have +a newer version available. Look for it in some standard +locations, and if a newer file was found, then return that." + (car (sort + (seq-filter + #'file-readable-p + (list (expand-file-name "publicsuffix.txt.gz" data-directory) + (expand-file-name "publicsuffix.txt" data-directory) + ;; Debian and Fedora + "/usr/share/publicsuffix/public_suffix_list.dat" + ;; FreeBSD port + "/usr/local/share/public_suffix_list/public_suffix_list.dat")) + #'file-newer-than-file-p))) + (defun url-domsuf-parse-file () (with-temp-buffer (with-auto-compression-mode - (insert-file-contents - (let* ((suffixfile (expand-file-name "publicsuffix.txt" data-directory)) - (compressed-file (concat suffixfile ".gz"))) - (or (and (file-readable-p compressed-file) compressed-file) - suffixfile)))) + (insert-file-contents (url-domsuf--public-suffix-file))) (let ((domains nil) domain exception) (while (not (eobp)) diff --git a/test/lisp/url/url-domsuf-tests.el b/test/lisp/url/url-domsuf-tests.el index 09fd6240065..8dbf65dae44 100644 --- a/test/lisp/url/url-domsuf-tests.el +++ b/test/lisp/url/url-domsuf-tests.el @@ -24,6 +24,10 @@ (require 'url-domsuf) (require 'ert) +(ert-deftest url-domsuf--public-suffix-file () + ;; We should always have a file, since it ships with Emacs. + (should (file-readable-p (url-domsuf--public-suffix-file)))) + (defun url-domsuf-tests--run () (should-not (url-domsuf-cookie-allowed-p "com")) (should (url-domsuf-cookie-allowed-p "foo.bar.bd")) commit b37cb465fe03f115c46862f20fb5852e67999c59 Author: Ulrich Müller Date: Thu Feb 16 20:09:22 2023 +0100 ; Adjust limit for eclipse in calendar; rename a function * lisp/calendar/lunar.el (lunar-check-for-eclipse): Renamed from 'eclipse-check'; thanks to Michael Heerdegen for the suggestion. Add missing documentation string. Slightly adjust the upper limit for the distance from the node. (bug#61460) * test/lisp/calendar/lunar-tests.el (lunar-test-check-for-eclipse): Update accordingly. diff --git a/lisp/calendar/lunar.el b/lisp/calendar/lunar.el index 1f827ca34b0..4f8f34d954f 100644 --- a/lisp/calendar/lunar.el +++ b/lisp/calendar/lunar.el @@ -94,7 +94,7 @@ lunar-phase (* -0.0016528 time time) (* -0.00000239 time time time)) 360.0)) - (eclipse (eclipse-check moon-lat phase)) + (eclipse (lunar-check-for-eclipse moon-lat phase)) (adjustment (if (memq phase '(0 2)) (+ (* (- 0.1734 (* 0.000393 time)) @@ -154,19 +154,22 @@ lunar-phase ;; from "Astronomy with your Personal Computer", Subroutine Eclipse ;; Line 7000 Peter Duffett-Smith Cambridge University Press 1990 -(defun eclipse-check (moon-lat phase) +(defun lunar-check-for-eclipse (moon-lat phase) + "Check if a solar or lunar eclipse can occur for MOON-LAT and PHASE. +MOON-LAT is the argument of latitude. PHASE is the lunar phase: +0 new moon, 1 first quarter, 2 full moon, 3 last quarter. +Return a string describing the eclipse (empty if no eclipse)." (let* ((node-dist (mod moon-lat 180)) ;; Absolute angular distance from the ascending or descending ;; node, whichever is nearer. (node-dist (min node-dist (- 180 node-dist))) - (phase-name (cond ((= phase 0) "Solar") - ((= phase 2) "Lunar") - (t "")))) - (cond - ((string= phase-name "") "") - ((< node-dist 13.9) (concat "** " phase-name " Eclipse **")) - ((< node-dist 21.2) (concat "** " phase-name " Eclipse possible **")) - (t "")))) + (type (cond ((= phase 0) "Solar") + ((= phase 2) "Lunar")))) + (cond ((not type) "") + ;; Limits 13.9° and 21.0° from Meeus (1991), page 350. + ((< node-dist 13.9) (concat "** " type " Eclipse **")) + ((< node-dist 21.0) (concat "** " type " Eclipse possible **")) + (t "")))) (defconst lunar-cycles-per-year 12.3685 ; 365.25/29.530588853 "Mean number of lunar cycles per 365.25 day year.") diff --git a/test/lisp/calendar/lunar-tests.el b/test/lisp/calendar/lunar-tests.el index baae9282628..e19965d1034 100644 --- a/test/lisp/calendar/lunar-tests.el +++ b/test/lisp/calendar/lunar-tests.el @@ -41,10 +41,10 @@ lunar-test-phase (should (equal (lunar-phase 1) '((1 8 1900) "05:40" 1 ""))))) -(ert-deftest lunar-test-eclipse-check () +(ert-deftest lunar-test-check-for-eclipse () (with-lunar-test - (should (equal (eclipse-check 10.0 1) "")) - (should (equal (eclipse-check 10.0 2) "** Lunar Eclipse **")))) + (should (equal (lunar-check-for-eclipse 10.0 1) "")) + (should (equal (lunar-check-for-eclipse 10.0 2) "** Lunar Eclipse **")))) (ert-deftest lunar-test-phase-list () (with-lunar-test commit fcf2f7aeada365eeb1b3bcc9288b59cdb70fc02a Author: Alan Mackenzie Date: Fri Feb 17 17:31:17 2023 +0000 Make the byte compiler give correct warning positions in eval-and-compile This fixes bug #61579. * lisp/emacs-lisp/bytecomp.el (byte-compile-initial-environment): Remove a spurious `byte-run-strip-symbol-position' from the core form of the eval-and-compile element. diff --git a/lisp/emacs-lisp/bytecomp.el b/lisp/emacs-lisp/bytecomp.el index e8a8fe37756..a0e124bcf1b 100644 --- a/lisp/emacs-lisp/bytecomp.el +++ b/lisp/emacs-lisp/bytecomp.el @@ -530,10 +530,9 @@ byte-compile-initial-macro-environment ;; or byte-compile-file-form. (let* ((print-symbols-bare t) ; Possibly redundant binding. (expanded - (byte-run-strip-symbol-positions - (macroexpand--all-toplevel - form - macroexpand-all-environment)))) + (macroexpand--all-toplevel + form + macroexpand-all-environment))) (eval expanded lexical-binding) expanded))))) (with-suppressed-warnings commit a5ad897b35fd5f9079977b12d69da253cbcfcb8a Author: Stefan Kangas Date: Fri Feb 17 17:49:53 2023 +0100 Use substitute-command-keys more in Calc help * lisp/calc/calc-ext.el (calc-do-prefix-help): * lisp/calc/calc-help.el (calc-help-prefix, calc-help-for-help) (calc-h-prefix-help, calc-inverse-prefix-help) (calc-hyperbolic-prefix-help, calc-inv-hyp-prefix-help) (calc-f-prefix-help, calc-s-prefix-help, calc-r-prefix-help) (calc-j-prefix-help, calc-a-prefix-help, calc-b-prefix-help) (calc-c-prefix-help, calc-d-prefix-help, calc-g-prefix-help) (calc-k-prefix-help, calc-m-prefix-help, calc-t-prefix-help) (calc-u-prefix-help, calc-l-prefix-help, calc-v-prefix-help): * lisp/calc/calc-misc.el (calc-dispatch-help, calc-help): * lisp/calc/calc.el (calc-do-dispatch): Use substitute-command keys. diff --git a/lisp/calc/calc-ext.el b/lisp/calc/calc-ext.el index bb0ecd2c84f..52c0fa4f69f 100644 --- a/lisp/calc/calc-ext.el +++ b/lisp/calc/calc-ext.el @@ -1297,12 +1297,13 @@ calc-do-prefix-help 0)) (let ((msg (nth calc-prefix-help-phase msgs))) (message "%s" (if msg - (concat group ": " msg ":" + (concat group ": " (substitute-command-keys msg) ":" (make-string (- (apply #'max (mapcar #'length msgs)) (length msg)) ?\s) - " [MORE]" + (substitute-command-keys + " [\\`?'=MORE]") (if key (concat " " (char-to-string key) "-") diff --git a/lisp/calc/calc-help.el b/lisp/calc/calc-help.el index d0052472836..6b3e5cd64b1 100644 --- a/lisp/calc/calc-help.el +++ b/lisp/calc/calc-help.el @@ -39,8 +39,11 @@ calc-help-prefix (or calc-dispatch-help (sit-for echo-keystrokes)) (let ((key (calc-read-key-sequence (if calc-dispatch-help - "Calc Help options: Help, Info, Tutorial, Summary; Key, Function; ?=more" - (format "%s (Type ? for a list of Calc Help options)" + (substitute-command-keys + (concat "Calc Help options: \\`h'elp, \\`i'nfo, \\`t'utorial, " + "\\`s'ummary; \\`k'ey, \\`f'unction; \\`?'=more")) + (format (substitute-command-keys + "%s (Type \\`?' for a list of Calc Help options)") (key-description (this-command-keys)))) calc-help-map))) (setq key (lookup-key calc-help-map key)) @@ -76,7 +79,10 @@ calc-help-for-help (describe-function 'calc-help-for-help) (select-window (get-buffer-window "*Help*")) (while (progn - (message "Calc Help options: Help, Info, ... press SPC, DEL to scroll, C-g to cancel") + (message (substitute-command-keys + (concat + "Calc Help options: \\`h'elp, \\`i'nfo, ... press " + "\\`SPC', \\`DEL' to scroll, \\`C-g' to cancel"))) (memq (setq key (read-event)) '(? ?\C-h ?\C-? ?\C-v ?\M-v))) (condition-case nil @@ -453,47 +459,47 @@ calc-full-help (defun calc-h-prefix-help () (interactive) (calc-do-prefix-help - '("Help; Bindings; Info, Tutorial, Summary; News" - "describe: Key, C (briefly), Function, Variable") + '("\\`h'elp; \\`b'indings; \\`i'nfo, \\`t'utorial, \\`s'ummary; \\`n'ews" + "describe: \\`k'ey, \\`c' (briefly), \\`f'unction, \\`v'ariable") "help" ?h)) (defun calc-inverse-prefix-help () (interactive) (calc-do-prefix-help - '("I + S (arcsin), C (arccos), T (arctan); Q (square)" - "I + E (ln), L (exp), B (alog: B^X); f E (lnp1), f L (expm1)" - "I + F (ceiling), R (truncate); a S (invert func)" - "I + a m (match-not); c h (from-hms); k n (prev prime)" - "I + f G (gamma-Q); f e (erfc); k B (etc., lower-tail dists)" - "I + V S (reverse sort); V G (reverse grade)" - "I + v s (remove subvec); v h (tail)" - "I + t + (alt sum), t M (mean with error)" - "I + t S (pop std dev), t C (pop covar)") + '("\\`I' + \\`S' (arcsin), \\`C' (arccos), \\`T' (arctan); \\`Q' (square)" + "\\`I' + \\`E' (ln), \\`L' (exp), \\`B' (alog: B^X); \\`f E' (lnp1), \\`f L' (expm1)" + "\\`I' + \\`F' (ceiling), \\`R' (truncate); \\`a S' (invert func)" + "\\`I' + \\`a m' (match-not); \\`c h' (from-hms); \\`k n' (prev prime)" + "\\`I' + \\`f G' (gamma-Q); \\`f e' (erfc); \\`k B' (etc., lower-tail dists)" + "\\`I' + \\`V S' (reverse sort); \\`V G' (reverse grade)" + "\\`I' + \\`v s' (remove subvec); \\`v h' (tail)" + "\\`I' + \\`t' + (alt sum), \\`t M' (mean with error)" + "\\`I' + \\`t S' (pop std dev), \\`t C' (pop covar)") "inverse" nil)) (defun calc-hyperbolic-prefix-help () (interactive) (calc-do-prefix-help - '("H + S (sinh), C (cosh), T (tanh); E (exp10), L (log10)" - "H + F (float floor), R (float round); P (constant \"e\")" - "H + a d (total derivative); k c (permutations)" - "H + k b (bern-poly), k e (euler-poly); k s (stirling-2)" - "H + f G (gamma-g), f B (beta-B); v h (rhead), v k (rcons)" - "H + v e (expand w/filler); V H (weighted histogram)" - "H + a S (general solve eqn), j I (general isolate)" - "H + a R (widen/root), a N (widen/min), a X (widen/max)" - "H + t M (median), t S (variance), t C (correlation coef)" - "H + c f/F/c (pervasive float/frac/clean)") + '("\\`H' + \\`S' (sinh), \\`C' (cosh), \\`T' (tanh); \\`E' (exp10), \\`L' (log10)" + "\\`H' + \\`F' (float floor), \\`R' (float round); \\`P' (constant \"e\")" + "\\`H' + \\`a d' (total derivative); \\`k c' (permutations)" + "\\`H' + \\`k b' (bern-poly), \\`k e' (euler-poly); \\`k s' (stirling-2)" + "\\`H' + \\`f G' (gamma-g), \\`f B' (beta-B); \\`v h' (rhead), \\`v k' (rcons)" + "\\`H' + \\`v e' (expand w/filler); \\`V H' (weighted histogram)" + "\\`H' + \\`a S' (general solve eqn), \\`j I' (general isolate)" + "\\`H' + \\`a R' (widen/root), \\`a N' (widen/min), \\`a X' (widen/max)" + "\\`H' + \\`t M' (median), \\`t S' (variance), \\`t C' (correlation coef)" + "\\`H' + \\`c' \\`f'/\\`F'/\\`c' (pervasive float/frac/clean)") "hyperbolic" nil)) (defun calc-inv-hyp-prefix-help () (interactive) (calc-do-prefix-help - '("I H + S (arcsinh), C (arccosh), T (arctanh)" - "I H + E (log10), L (exp10); f G (gamma-G)" - "I H + F (float ceiling), R (float truncate)" - "I H + t S (pop variance)" - "I H + a S (general invert func); v h (rtail)") + '("\\`I H' + \\`S' (arcsinh), \\`C' (arccosh), \\`T' (arctanh)" + "\\`I H' + \\`E' (log10), \\`L' (exp10); \\`f G' (gamma-G)" + "\\`I H' + \\`F' (float ceiling), \\`R' (float truncate)" + "\\`I H' + \\`t S' (pop variance)" + "\\`I H' + \\`a S' (general invert func); \\`v h' (rtail)") "inverse-hyperbolic" nil)) (defun calc-option-prefix-help () @@ -505,10 +511,10 @@ calc-option-prefix-help (defun calc-f-prefix-help () (interactive) (calc-do-prefix-help - '("miN, maX; Hypot; Im, Re; Sign; [, ] (incr/decr)" - "Gamma, Beta, Erf, besselJ, besselY" - "SHIFT + int-sQrt; Int-log, Exp(x)-1, Ln(x+1); arcTan2" - "SHIFT + Abssqr; Mantissa, eXponent, Scale" + '("mi\\`n', ma\\`x'; \\`h'ypot; \\`i'm, \\`r'e; \\`s'ign; \\`[', \\`]' (incr/decr)" + "\\`g'amma, \\`b'eta, \\`e'rf, bessel\\`j', bessel\\`y'" + "int-s\\`Q'rt; \\`I'nt-log, \\`E'xp(x)-1, \\`L'n(x+1); arc\\`T'an2" + "\\`A'bssqr; \\`M'antissa, e\\`X'ponent, \\`S'cale" "SHIFT + incomplete: Gamma-P, Beta-I") "functions" ?f)) @@ -516,165 +522,165 @@ calc-f-prefix-help (defun calc-s-prefix-help () (interactive) (calc-do-prefix-help - '("Store, inTo, Xchg, Unstore; Recall, 0-9; : (:=); = (=>)" - "Let; Copy, K=copy constant; Declare; Insert, Perm; Edit" - "Negate, +, -, *, /, ^, &, |, [, ]; Map" - "SHIFT + Decls, GenCount, TimeZone, Holidays; IntegLimit" - "SHIFT + LineStyles, PointStyles, plotRejects; Units" - "SHIFT + Eval-, AlgSimp-, ExtSimp-, FitRules") + '("\\`s'tore, in\\`t'o, \\`x'chg, \\`u'nstore; \\`r'ecall, \\`0'-\\`9'; \\`:' (:=); \\`=' (=>)" + "\\`l'et; \\`c'opy, \\`k'=copy constant; \\`d'eclare; \\`i'nsert, \\`p'erm; \\`e'dit" + "\\`n'egate, \\`+', \\`-', \\`*', \\`/', \\`^', \\`&', \\`|', \\`[', \\`]'; Map" + "\\`D'ecls, \\`G'enCount, \\`T'imeZone, \\`H'olidays; \\`I'ntegLimit" + "\\`L'ineStyles, \\`P'ointStyles, plot\\`R'ejects; \\`U'nits" + "\\`E'val-, \\`A'lgSimp-, e\\`X'tSimp-, \\`F'itRules") "store" ?s)) (defun calc-r-prefix-help () (interactive) (calc-do-prefix-help - '("digits 0-9: recall, same as `s r 0-9'" - "Save to register, Insert from register") + '("digits \\`0'-\\`9': recall, same as \\`s r' \\`0'-\\`9'" + "\\`s'ave to register, \\`i'nsert from register") "recall/register" ?r)) (defun calc-j-prefix-help () (interactive) (calc-do-prefix-help - '("Select, Additional, Once; eVal, Formula; Rewrite" - "More, Less, 1-9, Next, Previous" - "Unselect, Clear; Display; Enable; Breakable" - "\\=' (replace), \\=` (edit), +, -, *, /, RET (grab), DEL" - "SHIFT + swap: Left, Right; maybe: Select, Once" - "SHIFT + Commute, Merge, Distrib, jump-Eqn, Isolate" - "SHIFT + Negate, & (invert); Unpack") + '("\\`s'elect, \\`a'dditional, \\`o'nce; e\\`v'al, \\`f'ormula; \\`r'ewrite" + "\\`m'ore, \\`l'ess, \\`1'-\\`9', \\`n'ext, \\`p'revious" + "\\`u'nselect, \\`c'lear; \\`d'isplay; \\`e'nable; \\`b'reakable" + "\\=' (replace), \\=` (edit), \\`+', \\`-', \\`*', \\`/', \\`RET' (grab), \\`DEL'" + "swap: \\`L'eft, \\`R'ight; maybe: \\`S'elect, \\`O'nce" + "\\`C'ommute, \\`M'erge, \\`D'istrib, jump-\\`E'qn, \\`I'solate" + "\\`N'egate, \\`&' (invert); \\`U'npack") "select" ?j)) (defun calc-a-prefix-help () (interactive) (calc-do-prefix-help - '("Simplify, Extended-simplify, eVal; \" (exp-formula)" - "eXpand, Collect, Factor, Apart, Norm-rat" - "GCD, /, \\, % (polys); Polint" - "Derivative, Integral, Taylor; _ (subscr)" - "suBstitute; Rewrite, Match" - "SHIFT + Solve; Root, miN, maX; Poly-roots; Fit" - "SHIFT + Map; Tabulate, + (sum), * (prod); num-Integ" - "relations: =, # (not =), <, >, [ (< or =), ] (> or =)" - "logical: & (and), | (or), ! (not); : (if)" - "misc: { (in-set); . (rmeq)") + '("\\`s'implify, \\`e'xtended-simplify, e\\`v'al; \\`\"' (exp-formula)" + "e\\`x'pand, \\`c'ollect, \\`f'actor, \\`a'part, \\`n'orm-rat" + "\\`g' (GCD), \\`/', \\`\\', \\`%' (polys); \\`p'olint" + "\\`d'erivative, \\`i'ntegral, \\`t'aylor; \\`_' (subscr)" + "su\\`b'stitute; \\`r'ewrite, \\`m'atch" + "\\`S'olve; \\`R'oot, mi\\`N', ma\\`X'; \\`P'oly-roots; \\`F'it" + "\\`M'ap; \\`T'abulate, \\`+' (sum), \\`*' (prod); num-\\`I'nteg" + "relations: \\`=', \\`#' (not =), \\`<', \\`>', \\`[' (< or =), \\`]' (> or =)" + "logical: \\`&' (and), \\`|' (or), \\`!' (not); \\`:' (if)" + "misc: \\`{' (in-set); \\`.' (rmeq)") "algebra" ?a)) (defun calc-b-prefix-help () (interactive) (calc-do-prefix-help - '("And, Or, Xor, Diff, Not; Wordsize, Clip" - "Lshift, Rshift, roTate; SHIFT + signed Lshift, Rshift" - "SHIFT + business: Pv, Npv, Fv, pMt, #pmts, raTe, Irr" - "SHIFT + business: Sln, sYd, Ddb; %ch") + '("\\`a'nd, \\`o'r, \\`x'or, \\`d'iff, \\`n'ot; \\`w'ordsize, \\`c'lip" + "\\`l'shift, \\`r'shift, ro\\`t'ate; signed \\`L'shift, \\`R'shift" + "business: \\`P'v, \\`N'pv, \\`F'v, p\\`M't, \\`#'pmts, ra\\`T'e, \\`I'rr" + "business: \\`S'ln, s\\`Y'd, \\`D'db; \\`%'ch") "binary/bus" ?b)) (defun calc-c-prefix-help () (interactive) (calc-do-prefix-help - '("Deg, Rad, HMS; Float; Polar/rect; Clean, 0-9; %" - "SHIFT + Fraction") + '("\\`d'eg, \\`r'ad, \\`h'ms; \\`f'loat; \\`p'olar/rect; \\`c'lean, \\`0'-\\`9'; \\`%'" + "\\`F'raction") "convert" ?c)) (defun calc-d-prefix-help () (interactive) (calc-do-prefix-help - '("Group, \",\"; Normal, Fix, Sci, Eng, \".\"; Over" - "Radix, Zeros, 2, 8, 0, 6; Hms; Date; Complex, I, J" - "Why; Line-nums, line-Breaks; <, =, > (justify); Plain" - "\" (strings); Truncate, [, ]; SPC (refresh), RET, @" - "SHIFT + language: Normal, One-line, Big, Unformatted" - "SHIFT + language: C, Pascal, Fortran; TeX, LaTeX, Eqn" - "SHIFT + language: Yacas, X=Maxima, A=Giac" - "SHIFT + language: Mathematica, W=Maple") + '("\\`g'roup, \\`,'; \\`n'ormal, \\`f'ix, \\`s'ci, \\`e'ng, \\`.'; \\`o'ver" + "\\`r'adix, \\`z'eros, \\`2', \\`8', \\`0', \\`6'; \\`h'ms; \\`d'ate; \\`c'omplex, \\`i', \\`j'" + "\\`w'hy; \\`l'ine-nums, line-\\`b'reaks; \\`<', \\`=', \\`>' (justify); \\`p'lain" + "\\`\"' (strings); \\`t'runcate, \\`[', \\`]'; \\`SPC' (refresh), \\`RET', \\`@'" + "language: \\`N'ormal, \\`O'ne-line, \\`B'ig, \\`U'nformatted" + "language: \\`C', \\`P'ascal, \\`F'ortran; \\`T'eX, \\`L'aTeX, \\`E'qn" + "language: \\`Y'acas, \\`X'=Maxima, \\`A'=Giac" + "language: \\`M'athematica, \\`W'=Maple") "display" ?d)) (defun calc-g-prefix-help () (interactive) (calc-do-prefix-help - '("Fast; Add, Delete, Juggle; Plot, Clear; Quit" - "Header, Name, Grid, Border, Key; View-commands, X-display" - "x-axis: Range, Title, Log, Zero; lineStyle" - "SHIFT + y-axis: Range, Title, Log, Zero; pointStyle" - "SHIFT + Print; Device, Output-file; X-geometry" - "SHIFT + Num-pts; Command, Kill, View-trail" - "SHIFT + 3d: Fast, Add; CTRL + z-axis: Range, Title, Log") + '("\\`f'ast; \\`a'dd, \\`d'elete, \\`j'uggle; \\`p'lot, \\`c'lear; \\`q'uit" + "\\`h'eader, \\`n'ame, \\`g'rid, \\`b'order, \\`k'ey; \\`v'iew-commands, \\`x'-display" + "x-axis: \\`r'ange, \\`t'itle, \\`l'og, \\`z'ero; line\\`s'tyle" + "y-axis: \\`R'ange, \\`T'itle, \\`L'og, \\`Z'ero; point\\`S'tyle" + "\\`P'rint; \\`D'evice, \\`O'utput-file; \\`X'-geometry" + "\\`N'um-pts; \\`C'ommand, \\`K'ill, \\`V'iew-trail" + "3d: \\`F'ast, \\`A'dd; z-axis: \\`C-r' (range), \\`C-t' (title), \\`C-l' (log)") "graph" ?g)) (defun calc-k-prefix-help () (interactive) (calc-do-prefix-help - '("GCD, LCM; Choose (binomial), Double-factorial" - "Random, random-Again, sHuffle" - "Factors, Prime-test, Next-prime, Totient, Moebius" - "Bernoulli, Euler, Stirling" - "SHIFT + Extended-gcd" - "SHIFT + dists: Binomial, Chi-square, F, Normal" - "SHIFT + dists: Poisson, student's-T") + '("\\`g' (GCD), \\`l' (LCM); \\`c'hoose (binomial), \\`d'ouble-factorial" + "\\`r'andom, random-\\`a'gain, s\\`h'uffle" + "\\`f'actors, \\`p'rime-test, \\`n'ext-prime, \\`t'otient, \\`m'oebius" + "\\`b'ernoulli, \\`e'uler, \\`s'tirling" + "\\`E'xtended-gcd" + "dists: \\`B'inomial, \\`C'hi-square, \\`F', \\`N'ormal" + "dists: \\`P'oisson, student\\='s-\\`T'") "combinatorics" ?k)) (defun calc-m-prefix-help () (interactive) (calc-do-prefix-help - '("Deg, Rad, HMS; Frac; Polar; Inf; Alg, Total; Symb; Vec/mat" - "Working; Xtensions; Mode-save; preserve Embedded modes" - "SHIFT + Shifted-prefixes, mode-Filename; Record; reCompute" - "SHIFT + simplify: Off, Num, basIc, Algebraic, Bin, Ext, Units") + '("\\`d'eg, \\`r'ad, \\`h' (HMS); \\`f'rac; \\`p'olar; \\`i'nf; \\`a'lg, \\`t'otal; \\`s'ymb; \\`v'ec/mat" + "\\`w'orking; \\`x'tensions; \\`m'ode-save; preserve \\`e'mbedded modes" + "\\`S'hifted-prefixes, mode-\\`F'ilename; \\`R'ecord; re\\`C'ompute" + "simplify: \\`O'ff, \\`N'um, bas\\`I'c, \\`A'lgebraic, \\`B'in, \\`E'xt, \\`U'nits") "mode" ?m)) (defun calc-t-prefix-help () (interactive) (calc-do-prefix-help - '("Display; Fwd, Back; Next, Prev, Here, [, ]; Yank" - "Search, Rev; In, Out; <, >; Kill; Marker; . (abbrev)" - "SHIFT + time: Now; Part; Date, Julian, Unix, Czone" - "SHIFT + time: newWeek, newMonth, newYear; Incmonth" - "SHIFT + time: +, - (business days)" - "digits 0-9: store-to, same as `s t 0-9'") + '("\\`d'isplay; \\`f'wd, \\`b'ack; \\`n'ext, \\`p'rev, \\`h'ere, \\`[', \\`]'; \\`y'ank" + "\\`s'earch, \\`r'ev; \\`i'n, \\`o'ut; \\`<', \\`>'; \\`k'ill; \\`m'arker; \\`.' (abbrev)" + "time: \\`N'ow; \\`P'art; \\`D'ate, \\`J'ulian, \\`U'nix, \\`C'zone" + "time: new\\`W'eek, new\\`M'onth, new\\`Y'ear; \\`I'ncmonth" + "time: \\`+', \\`-' (business days)" + "digits \\`0'-\\`9': store-to, same as \\`s t' \\`0'-\\`9'") "trail/time" ?t)) (defun calc-u-prefix-help () (interactive) (calc-do-prefix-help - '("Simplify, Convert, coNvert exact, Temperature-convert, Base-units" - "Autorange; Remove, eXtract; Explain; View-table; 0-9" - "Define, Undefine, Get-defn, Permanent" - "SHIFT + View-table-other-window" - "SHIFT + stat: Mean, G-mean, Std-dev, Covar, maX, miN" - "SHIFT + stat: + (sum), - (asum), * (prod), # (count)") + '("\\`s'implify, \\`c'onvert, co\\`n'vert exact, \\`t'emperature-convert, \\`b'ase-units" + "\\`a'utorange; \\`r'emove, e\\`x'tract; \\`e'xplain; \\`v'iew-table; \\`0'-\\`9'" + "\\`d'efine, \\`u'ndefine, \\`g'et-defn, \\`p'ermanent" + "\\`V'iew-table-other-window" + "stat: \\`M'ean, \\`G'-mean, \\`S'td-dev, \\`C'ovar, ma\\`X', mi\\`N'" + "stat: \\`+' (sum), \\`-' (asum), \\`*' (prod), \\`#' (count)") "units/stat" ?u)) (defun calc-l-prefix-help () (interactive) (calc-do-prefix-help - '("Quantity, DB level, Np level" - "+, -, *, /" - "Scientific pitch notation, Midi number, Frequency" + '("\\`q'uantity, \\`d' (DB level), \\`n' (NP level)" + "\\`+', \\`-', \\`*', \\`/'" + "\\`s'cientific pitch notation, \\`m'idi number, \\`f'requency" ) "log units" ?l)) (defun calc-v-prefix-help () (interactive) (calc-do-prefix-help - '("Pack, Unpack, Identity, Diagonal, indeX, Build" - "Row, Column, Subvector; Length; Find; Mask, Expand" - "Transpose, Arrange, reVerse; Head, Kons; rNorm" - "SHIFT + Det, & (inverse), LUD, Trace, conJtrn, Cross" - "SHIFT + Sort, Grade, Histogram; cNorm" - "SHIFT + Apply, Map, Reduce, accUm, Inner-, Outer-prod" - "SHIFT + sets: V (union), ^ (intersection), - (diff)" - "SHIFT + sets: Xor, ~ (complement), Floor, Enum" - "SHIFT + sets: : (span), # (card), + (rdup)" - "<, =, > (justification); , (commas); [, {, ( (brackets)" - "} (matrix brackets); . (abbreviate); / (multi-lines)") + '("\\`p'ack, \\`u'npack, \\`i'dentity, \\`d'iagonal, inde\\`x', \\`b'uild" + "\\`r'ow, \\`c'olumn, \\`s'ubvector; \\`l'ength; \\`f'ind; \\`m'ask, \\`e'xpand" + "\\`t'ranspose, \\`a'rrange, re\\`v'erse; \\`h'ead, \\`k'ons; r\\`n'orm" + "\\`D'et, \\`&' (inverse), \\`L'UD, \\`T'race, con\\`J'trn, \\`C'ross" + "\\`S'ort, \\`G'rade, \\`H'istogram; c\\`N'orm" + "\\`A'pply, \\`M'ap, \\`R'educe, acc\\`U'm, \\`I'nner-, \\`O'uter-prod" + "sets: \\`V' (union), \\`^' (intersection), \\`-' (diff)" + "sets: \\`X'or, \\`~' (complement), \\`F'loor, \\`E'num" + "sets: \\`:' (span), \\`#' (card), \\`+' (rdup)" + "\\`<', \\`=', \\`>' (justification); \\`,' (commas); \\`[', \\`{', \\`(' (brackets)" + "\\`}' (matrix brackets); \\`.' (abbreviate); \\`/' (multi-lines)") "vec/mat" ?v)) (provide 'calc-help) diff --git a/lisp/calc/calc-misc.el b/lisp/calc/calc-misc.el index 613fb0a0154..93de04a586d 100644 --- a/lisp/calc/calc-misc.el +++ b/lisp/calc/calc-misc.el @@ -114,8 +114,11 @@ calc-dispatch-help (let (key) (select-window win) (while (progn - (message "Calc options: Calc, Keypad, ... %s" - "press SPC, DEL to scroll, C-g to cancel") + (message + (substitute-command-keys + (concat + "Calc options: \\`c'alc, \\`k'eypad, ... " + "press \\`SPC', \\`DEL' to scroll, \\`C-g' to cancel"))) (memq (setq key (read-event)) '(? ?\C-h ?\C-? ?\C-v ?\M-v))) (condition-case nil @@ -216,27 +219,26 @@ calc-info-summary (defun calc-help () (interactive) (let ((msgs - ;; FIXME: Change these to `substitute-command-keys' syntax. (mapcar #'substitute-command-keys '("Press \\`h' for complete help; press \\`?' repeatedly for a summary" - "Letter keys: Negate; Precision; Yank; Why; Xtended cmd; Quit" - "Letter keys: SHIFT + Undo, reDo; Inverse, Hyperbolic, Option" - "Letter keys: SHIFT + sQrt; Sin, Cos, Tan; Exp, Ln, logB" - "Letter keys: SHIFT + Floor, Round; Abs, conJ, arG; Pi" - "Letter keys: SHIFT + Num-eval; More-recn; eXec-kbd-macro; Keep-args" - "Other keys: +, -, *, /, ^, \\ (int div), : (frac div)" - "Other keys: & (1/x), | (concat), % (modulo), ! (factorial)" - "Other keys: \\=' (alg-entry), = (eval), \\=` (edit); M-RET (last-args)" - "Other keys: \\`SPC'/\\`RET' (enter/dup), LFD (over); < > (scroll horiz)" - "Other keys: \\`DEL' (drop), \\`M-DEL' (drop-above); { } (scroll vert)" + "Letter keys: \\`n'egate; \\`p'recision; \\`y'ank; \\`w'hy; \\`x'tended cmd; \\`q'uit" + "Letter keys: \\`U'ndo, re\\`D'o; \\`I'nverse, \\`H'yperbolic, \\`O'ption" + "Letter keys: s\\`Q'rt; \\`S'in, \\`C'os, \\`T'an; \\`E'xp, \\`L'n, log\\`B'" + "Letter keys: \\`F'loor, \\`R'ound; \\`A'bs, con\\`J', ar\\`G'; \\`P'i" + "Letter keys: \\`N'um-eval; \\`M'ore-recn; e\\`X'ec-kbd-macro; \\`K'eep-args" + "Other keys: \\`+', \\`-', \\`*', \\`/', \\`^', \\`\\' (int div), \\`:' (frac div)" + "Other keys: \\`&' (1/x), \\`|' (concat), \\`%' (modulo), \\`!' (factorial)" + "Other keys: \\=' (alg-entry), \\`=' (eval), \\=` (edit); \\`M-RET' (last-args)" + "Other keys: \\`SPC'/\\`RET' (enter/dup), \\`LFD' (over); \\`<' \\`>' (scroll horiz)" + "Other keys: \\`DEL' (drop), \\`M-DEL' (drop-above); \\`{' \\`}' (scroll vert)" "Other keys: \\`TAB' (swap/roll-dn), \\`M-TAB' (roll-up)" - "Other keys: [ , ; ] (vector), ( , ) (complex), ( ; ) (polar)" - "Prefix keys: Algebra, Binary/business, Convert, Display" - "Prefix keys: Functions, Graphics, Help, J (select)" - "Prefix keys: Kombinatorics/statistics, Modes, Store/recall" - "Prefix keys: Trail/time, Units/statistics, Vector/matrix" - "Prefix keys: Z (user), SHIFT + Z (define)" - "Prefix keys: prefix + ? gives further help for that prefix" + "Other keys: \\`[' \\`,' \\`;' \\`]' (vector), \\`(' \\`,' \\`)' (complex), \\`(' \\`;' \\`)' (polar)" + "Prefix keys: \\`a'lgebra, \\`b'inary/business, \\`c'onvert, \\`d'isplay" + "Prefix keys: \\`f'unctions, \\`g'raphics, \\`h'elp, \\`j' (select)" + "Prefix keys: \\`k'ombinatorics/statistics, \\`m'odes, \\`s'tore/recall" + "Prefix keys: \\`t'rail/time, \\`u'nits/statistics, \\`v'ector/matrix" + "Prefix keys: \\`z' (user), \\`Z' (define)" + "Prefix keys: prefix + \\`?' gives further help for that prefix" " Calc by Dave Gillespie, daveg@synaptics.com")))) (if calc-full-help-flag msgs @@ -260,7 +262,7 @@ calc-help msgs)) (length msg)) ?\ ) - " [?=MORE]") + (substitute-command-keys " [\\`?'=MORE]")) "")))))))) diff --git a/lisp/calc/calc.el b/lisp/calc/calc.el index 39e54c89e06..26556bf056a 100644 --- a/lisp/calc/calc.el +++ b/lisp/calc/calc.el @@ -1188,8 +1188,12 @@ calc-do-dispatch "Start the Calculator." (let ((key (calc-read-key-sequence (if calc-dispatch-help - "Calc options: Calc, Keypad, Quick, Embed; eXit; Info, Tutorial; Grab; ?=more" - (format "%s (Type ? for a list of Calc options)" + (substitute-command-keys + (concat + "Calc options: \\`c'alc, \\`k'eypad, \\`q'uick, \\`e'mbed; " + "e\\`x'it; \\`i'nfo, \\`t'utorial; \\`g'rab; \\`?'=more")) + (format (substitute-command-keys + "%s (Type \\`?' for a list of Calc options)") (key-description (this-command-keys)))) calc-dispatch-map))) (setq key (lookup-key calc-dispatch-map key)) commit dabd7feb950ef2dba0ce23ec74c5b141cff96a55 Author: Robert Pluim Date: Fri Feb 17 16:19:43 2023 +0100 ; Fix previous change diff --git a/lisp/env.el b/lisp/env.el index a9d1d27e1ee..faafcb6250f 100644 --- a/lisp/env.el +++ b/lisp/env.el @@ -204,8 +204,8 @@ getenv Otherwise, this function searches `process-environment' for VARIABLE. If it is not found there, then it continues the search in the environment list of the selected frame." - (interactive (list (read-envvar-name "Get environment variable: " t))) (declare (side-effect-free t)) + (interactive (list (read-envvar-name "Get environment variable: " t))) (let ((value (getenv-internal (if (multibyte-string-p variable) (encode-coding-string variable locale-coding-system) commit d5bf26f488b7968feed9f43e612a90da2aab15a8 Author: Mattias Engdegård Date: Fri Feb 17 14:38:50 2023 +0100 Move side-effect-free and pure declarations to function definitions Some Lisp functions still had their `side-effect-free` and `pure` properties declared in byte-opt.el; do it at their definition instead. The lists in byte-opt.el now only contain functions implemented in C and function aliases. * lisp/emacs-lisp/byte-opt.el (side-effect-free-fns) (side-effect-and-error-free-fns, pure-fns): Remove functions whose properties are now declared elsewhere and some obsolete entries. * lisp/custom.el (custom-variable-p): * lisp/emacs-lisp/lisp.el (buffer-end): * lisp/emacs-lisp/regexp-opt.el (regexp-opt): * lisp/env.el (getenv): * lisp/simple.el (count-lines, mark, string-empty-p, lax-plist-get): * lisp/subr.el (ignore, always, zerop, fixnump, bignump, lsh, last) (eventp, mouse-movement-p, log10, memory-limit, string-greaterp) (interactive-p): * lisp/window.el (get-lru-window, get-largest-window, (window-edges) (window-body-edges, window-pixel-edges, window-body-pixel-edges) (window-absolute-pixel-edges, window-absolute-body-pixel-edges) (one-window-p): Declare functions `side-effect-free` and/or `pure` as appropriate. diff --git a/lisp/custom.el b/lisp/custom.el index 0522bdd447b..fa77e5c2c56 100644 --- a/lisp/custom.el +++ b/lisp/custom.el @@ -665,6 +665,7 @@ custom-variable-p A customizable variable is either (i) a variable whose property list contains a non-nil `standard-value' or `custom-autoload' property, or (ii) an alias for another customizable variable." + (declare (side-effect-free t)) (when (symbolp variable) (setq variable (indirect-variable variable)) (or (get variable 'standard-value) diff --git a/lisp/emacs-lisp/byte-opt.el b/lisp/emacs-lisp/byte-opt.el index b578b99954c..a9630b6f7c2 100644 --- a/lisp/emacs-lisp/byte-opt.el +++ b/lisp/emacs-lisp/byte-opt.el @@ -1647,7 +1647,7 @@ byte-optimize-set capitalize car-less-than-car car cdr ceiling char-after char-before char-equal char-to-string char-width compare-strings window-configuration-equal-p concat coordinates-in-window-p - copy-alist copy-sequence copy-marker copysign cos count-lines + copy-alist copy-sequence copy-marker copysign cos current-time-string current-time-zone decode-char decode-time default-boundp default-value documentation downcase @@ -1659,26 +1659,24 @@ byte-optimize-set float float-time floor format format-time-string frame-first-window frame-root-window frame-selected-window frame-visible-p fround ftruncate - get gethash get-buffer get-buffer-window getenv get-file-buffer + get gethash get-buffer get-buffer-window get-file-buffer hash-table-count int-to-string intern-soft isnan keymap-parent - lax-plist-get ldexp + ldexp length length< length> length= line-beginning-position line-end-position pos-bol pos-eol local-variable-if-set-p local-variable-p locale-info - log log10 logand logb logcount logior lognot logxor lsh - make-byte-code make-list make-string make-symbol mark marker-buffer max + log logand logb logcount logior lognot logxor + make-byte-code make-list make-string make-symbol marker-buffer max match-beginning match-end member memq memql min minibuffer-selected-window minibuffer-window mod multibyte-char-to-unibyte next-window nth nthcdr number-to-string - parse-colon-path prefix-numeric-value previous-window prin1-to-string propertize - degrees-to-radians - radians-to-degrees rassq rassoc read-from-string regexp-opt + rassq rassoc read-from-string regexp-quote region-beginning region-end reverse round sin sqrt string string< string= string-equal string-lessp - string> string-greaterp string-empty-p string-blank-p + string> string-search string-to-char string-to-number string-to-syntax substring sxhash sxhash-equal sxhash-eq sxhash-eql @@ -1687,45 +1685,40 @@ byte-optimize-set string-to-multibyte take tan time-convert truncate unibyte-char-to-multibyte upcase user-full-name - user-login-name user-original-login-name custom-variable-p + user-login-name user-original-login-name vconcat - window-absolute-pixel-edges window-at window-body-height + window-at window-body-height window-body-width window-buffer window-dedicated-p window-display-table - window-combination-limit window-edges window-frame window-fringes + window-combination-limit window-frame window-fringes window-height window-hscroll window-inside-edges window-inside-absolute-pixel-edges window-inside-pixel-edges window-left-child window-left-column window-margins window-minibuffer-p window-next-buffers window-next-sibling window-new-normal window-new-total window-normal-size window-parameter window-parameters - window-parent window-pixel-edges window-point window-prev-buffers + window-parent window-point window-prev-buffers window-prev-sibling window-scroll-bars window-start window-text-height window-top-child window-top-line window-total-height window-total-width window-use-time window-vscroll - window-width zerop)) + window-width)) (side-effect-and-error-free-fns - '(always arrayp atom - bignump bobp bolp bool-vector-p - buffer-end buffer-list buffer-size buffer-string bufferp + '(arrayp atom + bobp bolp bool-vector-p + buffer-list buffer-size buffer-string bufferp car-safe case-table-p cdr-safe char-or-string-p characterp charsetp commandp cons consp current-buffer current-global-map current-indentation current-local-map current-minor-mode-maps current-time - eobp eolp eq equal eventp - fixnump floatp following-char framep - get-largest-window get-lru-window + eobp eolp eq equal + floatp following-char framep hash-table-p - ;; `ignore' isn't here because we don't want calls to it elided; - ;; see `byte-compile-ignore'. - identity integerp integer-or-marker-p interactive-p + identity integerp integer-or-marker-p invocation-directory invocation-name keymapp keywordp list listp make-marker mark-marker markerp max-char - memory-limit - mouse-movement-p natnump nlistp not null number-or-marker-p numberp - one-window-p overlayp - point point-marker point-min point-max preceding-char primary-charset + overlayp + point point-marker point-min point-max preceding-char processp proper-list-p recent-keys recursion-depth safe-length selected-frame selected-window sequencep @@ -1761,7 +1754,7 @@ byte-optimize-set ;; values if a marker is moved. (let ((pure-fns - '(concat regexp-opt regexp-quote + '(concat regexp-quote string-to-char string-to-syntax symbol-name eq eql = /= < <= >= > min max @@ -1770,8 +1763,7 @@ byte-optimize-set copysign isnan ldexp float logb floor ceiling round truncate ffloor fceiling fround ftruncate - string= string-equal string< string-lessp string> string-greaterp - string-empty-p string-blank-p + string= string-equal string< string-lessp string> string-search consp atom listp nlistp proper-list-p sequencep arrayp vectorp stringp bool-vector-p hash-table-p @@ -1780,20 +1772,19 @@ byte-optimize-set integer-or-marker-p number-or-marker-p char-or-string-p symbolp keywordp type-of - identity ignore + identity ;; The following functions are pure up to mutation of their ;; arguments. This is pure enough for the purposes of ;; constant folding, but not necessarily for all kinds of ;; code motion. - car cdr car-safe cdr-safe nth nthcdr last take + car cdr car-safe cdr-safe nth nthcdr take equal length safe-length memq memql member ;; `assoc' and `assoc-default' are excluded since they are ;; impure if the test function is (consider `string-match'). assq rassq rassoc - lax-plist-get aref elt base64-decode-string base64-encode-string base64url-encode-string bool-vector-subsetp diff --git a/lisp/emacs-lisp/lisp.el b/lisp/emacs-lisp/lisp.el index e3ed28f097a..417c218c6d7 100644 --- a/lisp/emacs-lisp/lisp.el +++ b/lisp/emacs-lisp/lisp.el @@ -519,6 +519,7 @@ buffer-end "Return the \"far end\" position of the buffer, in direction ARG. If ARG is positive, that's the end of the buffer. Otherwise, that's the beginning of the buffer." + (declare (side-effect-free error-free)) (if (> arg 0) (point-max) (point-min))) (defun end-of-defun (&optional arg interactive) diff --git a/lisp/emacs-lisp/regexp-opt.el b/lisp/emacs-lisp/regexp-opt.el index e64a3dcea1e..fd9fbbe25a4 100644 --- a/lisp/emacs-lisp/regexp-opt.el +++ b/lisp/emacs-lisp/regexp-opt.el @@ -130,6 +130,7 @@ regexp-opt (concat (car parens) (mapconcat \\='regexp-quote strings \"\\\\|\") (cdr parens))))" + (declare (pure t) (side-effect-free t)) (save-match-data ;; Recurse on the sorted list. (let* ((max-lisp-eval-depth 10000) diff --git a/lisp/env.el b/lisp/env.el index 33c02f6f920..a9d1d27e1ee 100644 --- a/lisp/env.el +++ b/lisp/env.el @@ -205,6 +205,7 @@ getenv VARIABLE. If it is not found there, then it continues the search in the environment list of the selected frame." (interactive (list (read-envvar-name "Get environment variable: " t))) + (declare (side-effect-free t)) (let ((value (getenv-internal (if (multibyte-string-p variable) (encode-coding-string variable locale-coding-system) diff --git a/lisp/simple.el b/lisp/simple.el index bed6dfb8292..f141b8f1734 100644 --- a/lisp/simple.el +++ b/lisp/simple.el @@ -1755,6 +1755,7 @@ count-lines When IGNORE-INVISIBLE-LINES is non-nil, invisible lines are not included in the count." + (declare (side-effect-free t)) (save-excursion (save-restriction (narrow-to-region start end) @@ -6830,6 +6831,7 @@ mark If you are using this in an editing command, you are most likely making a mistake; see the documentation of `set-mark'." + (declare (side-effect-free t)) (if (or force (not transient-mark-mode) mark-active mark-even-if-inactive) (marker-position (mark-marker)) (signal 'mark-inactive nil))) @@ -10840,6 +10842,7 @@ kill-buffer--possibly-save (defsubst string-empty-p (string) "Check whether STRING is empty." + (declare (pure t) (side-effect-free t)) (string= string "")) (defun read-signal-name () @@ -10857,7 +10860,7 @@ read-signal-name (defun lax-plist-get (plist prop) "Extract a value from a property list, comparing with `equal'." - (declare (obsolete plist-get "29.1")) + (declare (pure t) (side-effect-free t) (obsolete plist-get "29.1")) (plist-get plist prop #'equal)) (defun lax-plist-put (plist prop val) diff --git a/lisp/subr.el b/lisp/subr.el index a1397fa6781..819d2a51101 100644 --- a/lisp/subr.el +++ b/lisp/subr.el @@ -422,7 +422,9 @@ ignore "Do nothing and return nil. This function accepts any number of ARGUMENTS, but ignores them. Also see `always'." - (declare (completion ignore)) + ;; Not declared `side-effect-free' because we don't want calls to it + ;; elided; see `byte-compile-ignore'. + (declare (pure t) (completion ignore)) (interactive) nil) @@ -430,6 +432,7 @@ always "Do nothing and return t. This function accepts any number of ARGUMENTS, but ignores them. Also see `ignore'." + (declare (pure t) (side-effect-free error-free)) t) ;; Signal a compile-error if the first arg is missing. @@ -509,16 +512,19 @@ zerop "Return t if NUMBER is zero." ;; Used to be in C, but it's pointless since (= 0 n) is faster anyway because ;; = has a byte-code. - (declare (compiler-macro (lambda (_) `(= 0 ,number)))) + (declare (pure t) (side-effect-free t) + (compiler-macro (lambda (_) `(= 0 ,number)))) (= 0 number)) (defun fixnump (object) "Return t if OBJECT is a fixnum." + (declare (side-effect-free error-free)) (and (integerp object) (<= most-negative-fixnum object most-positive-fixnum))) (defun bignump (object) "Return t if OBJECT is a bignum." + (declare (side-effect-free error-free)) (and (integerp object) (not (fixnump object)))) (defun lsh (value count) @@ -533,7 +539,8 @@ lsh (lambda (form) (macroexp-warn-and-return (format-message "avoid `lsh'; use `ash' instead") - form '(suspicious lsh) t form)))) + form '(suspicious lsh) t form))) + (side-effect-free t)) (when (and (< value 0) (< count 0)) (when (< value most-negative-fixnum) (signal 'args-out-of-range (list value count))) @@ -706,7 +713,7 @@ last If LIST is nil, return nil. If N is non-nil, return the Nth-to-last link of LIST. If N is bigger than the length of LIST, return LIST." - (declare (side-effect-free t)) + (declare (pure t) (side-effect-free t)) ; pure up to mutation (if n (and (>= n 0) (let ((m (safe-length list))) @@ -1525,6 +1532,7 @@ listify-key-sequence (defun eventp (object) "Return non-nil if OBJECT is an input event or event object." + (declare (pure t) (side-effect-free error-free)) (or (integerp object) (and (if (consp object) (setq object (car object)) @@ -1587,6 +1595,7 @@ event-basic-type (defsubst mouse-movement-p (object) "Return non-nil if OBJECT is a mouse movement event." + (declare (side-effect-free error-free)) (eq (car-safe object) 'mouse-movement)) (defun mouse-event-p (object) @@ -1859,7 +1868,7 @@ values--store-value (defun log10 (x) "Return (log X 10), the log base 10 of X." - (declare (obsolete log "24.4")) + (declare (side-effect-free t) (obsolete log "24.4")) (log x 10)) (set-advertised-calling-convention @@ -2983,6 +2992,7 @@ process-put (defun memory-limit () "Return an estimate of Emacs virtual memory usage, divided by 1024." + (declare (side-effect-free error-free)) (let ((default-directory temporary-file-directory)) (or (cdr (assq 'vsize (process-attributes (emacs-pid)))) 0))) @@ -5544,6 +5554,7 @@ string-greaterp "Return non-nil if STRING1 is greater than STRING2 in lexicographic order. Case is significant. Symbols are also allowed; their print names are used instead." + (declare (pure t) (side-effect-free t)) (string-lessp string2 string1)) @@ -6187,7 +6198,8 @@ interactive-p `commandp'." ;; Kept around for now. See discussion at: ;; https://lists.gnu.org/r/emacs-devel/2020-08/msg00564.html - (declare (obsolete called-interactively-p "23.2")) + (declare (obsolete called-interactively-p "23.2") + (side-effect-free error-free)) (called-interactively-p 'interactive)) (defun internal-push-keymap (keymap symbol) diff --git a/lisp/window.el b/lisp/window.el index 2d9f746d8fb..6f9cd9fc3bf 100644 --- a/lisp/window.el +++ b/lisp/window.el @@ -2522,6 +2522,7 @@ get-lru-window `display-buffer-avoid-small-windows', if non-nil, is also taken into consideration. Windows whose height is smaller that the value of that variable will be avoided if larger windows are available." + (declare (side-effect-free error-free)) (let ((windows (window-list-1 nil 'nomini all-frames)) best-window best-time second-best-window second-best-time time) (dolist (window windows) @@ -2603,6 +2604,7 @@ get-largest-window Any other value of ALL-FRAMES means consider all windows on the selected frame and no others." + (declare (side-effect-free error-free)) (let ((best-size 0) best-window size) (dolist (window (window-list-1 nil 'nomini all-frames)) @@ -3801,6 +3803,7 @@ window-edges the coordinates in pixels where the values for RIGHT and BOTTOM are one more than the actual value of these edges. Note that if ABSOLUTE is non-nil, PIXELWISE is implicitly non-nil too." + (declare (side-effect-free t)) (let* ((window (window-normalize-window window body)) (frame (window-frame window)) (border-width (frame-internal-border-width frame)) @@ -3856,6 +3859,7 @@ window-body-edges "Return a list of the edge coordinates of WINDOW's body. The return value is that of `window-edges' called with argument BODY non-nil." + (declare (side-effect-free t)) (window-edges window t)) (defalias 'window-inside-edges 'window-body-edges) @@ -3863,12 +3867,14 @@ window-pixel-edges "Return a list of the edge pixel coordinates of WINDOW. The return value is that of `window-edges' called with argument PIXELWISE non-nil." + (declare (side-effect-free t)) (window-edges window nil nil t)) (defun window-body-pixel-edges (&optional window) "Return a list of the edge pixel coordinates of WINDOW's body. The return value is that of `window-edges' called with arguments BODY and PIXELWISE non-nil." + (declare (side-effect-free t)) (window-edges window t nil t)) (defalias 'window-inside-pixel-edges 'window-body-pixel-edges) @@ -3876,12 +3882,14 @@ window-absolute-pixel-edges "Return a list of the edge pixel coordinates of WINDOW. The return value is that of `window-edges' called with argument ABSOLUTE non-nil." + (declare (side-effect-free t)) (window-edges window nil t t)) (defun window-absolute-body-pixel-edges (&optional window) "Return a list of the edge pixel coordinates of WINDOW's text area. The return value is that of `window-edges' called with arguments BODY and ABSOLUTE non-nil." + (declare (side-effect-free t)) (window-edges window t t t)) (defalias 'window-inside-absolute-pixel-edges 'window-absolute-body-pixel-edges) @@ -4091,6 +4099,7 @@ one-window-p Anything else means consider all windows on the selected frame and no others." + (declare (side-effect-free error-free)) (let ((base-window (selected-window))) (if (and nomini (eq base-window (minibuffer-window))) (setq base-window (next-window base-window))) commit 7ab6c6ac8334f80a2effcb9d66d2c57810c9a73e Author: Protesilaos Stavrou Date: Thu Feb 16 11:05:53 2023 +0200 Define 'display-time-time-and-date-indicator' face * etc/NEWS: Announce the new face for the 'display-time-format'. * lisp/time.el (display-time-time-and-date-indicator): Define new face. (display-time-string-forms): Use the new face. (Bug#61567) diff --git a/etc/NEWS b/etc/NEWS index 4fbe09e0541..db42041ec6d 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -56,6 +56,11 @@ This allows the user to customize the prompt that is appended by 'yes-or-no-p' when asking questions. The default value is "(yes or no) ". +--- +** New face 'display-time-time-and-date-indicator'. +This is used for displaying the time and date components of +'display-time-mode'. + * Editing Changes in Emacs 30.1 diff --git a/lisp/time.el b/lisp/time.el index f04a22dfd28..030aef9d49b 100644 --- a/lisp/time.el +++ b/lisp/time.el @@ -139,6 +139,11 @@ display-time-mail-face :version "22.1" :type '(choice (const :tag "None" nil) face)) +(defface display-time-time-and-date-indicator nil + "Face for `display-time-format'." + :group 'mode-line-faces + :version "30.1") + (defvar display-time-mail-icon (find-image '((:type xpm :file "letter.xpm" :ascent center) (:type pbm :file "letter.pbm" :ascent center))) @@ -179,6 +184,7 @@ display-time-string-forms (format-time-string (or display-time-format (if display-time-24hr-format "%H:%M" "%-I:%M%p")) now) + 'face 'display-time-time-and-date-indicator 'help-echo (format-time-string "%a %b %e, %Y" now)) load (if mail commit d4346a7cc784349799552ec31ae66546408ae407 Author: Alan Mackenzie Date: Fri Feb 17 09:14:10 2023 +0000 Add handling of the C11 _Generic construct to C Mode This fixes bug #61481. * lisp/progmodes/cc-engine.el (c-guess-basic-syntax): Add a new CASE 6 for _Generic. * lisp/progmodes/cc-fonts.el (c-fontify-types-and-refs): Use `let*' rather than `let'. (c-get-fontification-context): Add the new result `generic', and add handling to determine it. (c-font-lock-declarations): Call c-font-lock-c11-generic-clause when needed. (c-font-lock-c11-generic-clause): New function. * lisp/progmodes/cc-langs.el (c-generic-kwds, c-generic-key): New lang constants/variable. diff --git a/lisp/progmodes/cc-engine.el b/lisp/progmodes/cc-engine.el index 1899b522ab0..f8ae49c42dd 100644 --- a/lisp/progmodes/cc-engine.el +++ b/lisp/progmodes/cc-engine.el @@ -14911,7 +14911,49 @@ c-guess-basic-syntax (c-add-syntax 'topmost-intro-cont (c-point 'boi))) )) - ;; (CASE 6 has been removed.) + ;; ((Old) CASE 6 has been removed.) + ;; CASE 6: line is within a C11 _Generic expression. + ((and c-generic-key + (eq (char-after containing-sexp) ?\() + (progn (setq tmp-pos (c-safe-scan-lists + containing-sexp 1 0 + (min (+ (point) 2000) (point-max)))) + t) + (save-excursion + (and + (progn (goto-char containing-sexp) + (zerop (c-backward-token-2))) + (looking-at c-generic-key) + (progn (goto-char (1+ containing-sexp)) + (c-syntactic-re-search-forward + "," indent-point 'bound t t)) + (setq placeholder (point))))) + (let ((res (c-syntactic-re-search-forward + "[,:)]" + (or tmp-pos (min (+ (point) 2000) (point-max))) + 'bound t t))) + (cond + ((and res + (eq (char-before) ?\)) + (save-excursion + (backward-char) + (c-backward-syntactic-ws indent-point) + (eq (point) indent-point))) + (c-add-stmt-syntax + 'arglist-close (list containing-sexp) t + (c-most-enclosing-brace paren-state indent-point) paren-state)) + ((or (not res) + (eq (char-before) ?\))) + (backward-char) + (c-syntactic-skip-backward "^,:" containing-sexp t) + (c-add-syntax (if (eq (char-before) ?:) + 'statement-case-intro + 'case-label) + (1+ containing-sexp))) + (t (c-add-syntax (if (eq (char-before) ?:) + 'case-label + 'statement-case-intro) + (1+ containing-sexp)))))) ;; CASE 7: line is an expression, not a statement. Most ;; likely we are either in a function prototype or a function diff --git a/lisp/progmodes/cc-fonts.el b/lisp/progmodes/cc-fonts.el index c220d8d8789..4ec21af1b25 100644 --- a/lisp/progmodes/cc-fonts.el +++ b/lisp/progmodes/cc-fonts.el @@ -259,14 +259,14 @@ c-annotation-face (defmacro c-fontify-types-and-refs (varlist &rest body) (declare (indent 1) (debug let*)) - ;; Like `let', but additionally activates `c-record-type-identifiers' + ;; Like `let*', but additionally activates `c-record-type-identifiers' ;; and `c-record-ref-identifiers', and fontifies the recorded ranges ;; accordingly on exit. ;; ;; This function does hidden buffer changes. - `(let ((c-record-type-identifiers t) - c-record-ref-identifiers - ,@varlist) + `(let* ((c-record-type-identifiers t) + c-record-ref-identifiers + ,@varlist) (prog1 (progn ,@body) (c-fontify-recorded-types-and-refs)))) @@ -1219,6 +1219,7 @@ c-get-fontification-context ;; inside a function declaration arglist). ;; '<> In an angle bracket arglist. ;; 'arglist Some other type of arglist. + ;; 'generic In a C11 _Generic construct. ;; 'top Some other context and point is at the top-level (either ;; outside any braces or directly inside a class or namespace, ;; etc.) @@ -1345,6 +1346,15 @@ c-get-fontification-context (c-back-over-member-initializers))) (c-put-char-property (1- match-pos) 'c-type 'c-not-decl) (cons 'not-decl nil)) + ;; In a C11 _Generic construct. + ((and c-generic-key + (eq (char-before match-pos) ?,) + (save-excursion + (and (c-go-up-list-backward match-pos + (max (- (point) 2000) (point-min))) + (zerop (c-backward-token-2)) + (looking-at c-generic-key)))) + (cons 'generic nil)) ;; At start of a declaration inside a declaration paren. ((save-excursion (goto-char match-pos) @@ -1616,13 +1626,16 @@ c-font-lock-declarations (c-forward-syntactic-ws)) ;; Now analyze the construct. - (if (eq context 'not-decl) - (progn - (setq decl-or-cast nil) - (if (c-syntactic-re-search-forward - "," (min limit (point-max)) 'at-limit t) - (c-put-char-property (1- (point)) 'c-type 'c-not-decl)) - nil) + (cond + ((eq context 'not-decl) + (setq decl-or-cast nil) + (if (c-syntactic-re-search-forward + "," (min limit (point-max)) 'at-limit t) + (c-put-char-property (1- (point)) 'c-type 'c-not-decl)) + nil) + ((eq context 'generic) + (c-font-lock-c11-generic-clause)) + (t (setq decl-or-cast (c-forward-decl-or-cast-1 match-pos context last-cast-end inside-macro)) @@ -1683,7 +1696,7 @@ c-font-lock-declarations context (or toplev (nth 4 decl-or-cast)))) - (t t)))) + (t t))))) ;; It was a false alarm. Check if we're in a label (or other ;; construct with `:' except bitfield) instead. @@ -1713,6 +1726,28 @@ c-font-lock-declarations nil)))) +(defun c-font-lock-c11-generic-clause () + ;; Fontify a type inside the C11 _Generic clause. Point will be at the + ;; type and will be left at the next comma of the clause (if any) or the + ;; closing parenthesis, if any, or at the end of the type, otherwise. + ;; The return value is always nil. + (c-fontify-types-and-refs + ((here (point)) + (type-type (c-forward-type t)) + (c-promote-possible-types (if (eq type-type 'maybe) 'just-one t)) + (pos (point)) pos1) + (when (and type-type (eq (char-after) ?:)) + (goto-char here) + (c-forward-type t)) ; Fontify the type. + (cond + ((c-syntactic-re-search-forward "," nil t t t) + (backward-char)) + ((and (setq pos1 (c-up-list-forward)) + (eq (char-before pos1) ?\))) + (goto-char (1- pos1))) + (t (goto-char pos)))) + nil) + (defun c-font-lock-enum-body (limit) ;; Fontify the identifiers of each enum we find by searching forward. ;; diff --git a/lisp/progmodes/cc-langs.el b/lisp/progmodes/cc-langs.el index daa23bd14fa..61f81f09b3e 100644 --- a/lisp/progmodes/cc-langs.el +++ b/lisp/progmodes/cc-langs.el @@ -3085,6 +3085,17 @@ c-block-stmt-2-key t (c-make-keywords-re t (c-lang-const c-block-stmt-2-kwds))) (c-lang-defvar c-block-stmt-2-key (c-lang-const c-block-stmt-2-key)) +(c-lang-defconst c-generic-kwds + "The keyword \"_Generic\" which introduces a C11 generic statement." + t nil + c '("_Generic")) + +(c-lang-defconst c-generic-key + ;; Regexp matching the keyword(s) in `c-generic-kwds'. + t (if (c-lang-const c-generic-kwds) + (c-make-keywords-re t (c-lang-const c-generic-kwds)))) +(c-lang-defvar c-generic-key (c-lang-const c-generic-key)) + (c-lang-defconst c-block-stmt-kwds ;; Union of `c-block-stmt-1-kwds' and `c-block-stmt-2-kwds'. t (c--delete-duplicates (append (c-lang-const c-block-stmt-1-kwds)