commit 945e4fa2a0cc8ec2e99b9fbf0d9fe14de8e9bcce (HEAD, refs/remotes/origin/master) Merge: 0c910f689b e6af4968f9 Author: Stefan Kangas Date: Tue Aug 2 06:30:28 2022 +0200 Merge from origin/emacs-28 e6af4968f9 ; Update ChangeLog and AUTHORS commit 0c910f689b0100ec658ba7a70da23376e8eeee81 Author: Po Lu Date: Tue Aug 2 09:41:02 2022 +0800 Avoid extra consing on monitor configuration change * src/xterm.c (x_find_monitors_changed_event): New function. (x_monitors_changed_cb, handle_one_xevent): Look through the entire event queue to skip delivering monitor change events. diff --git a/src/xterm.c b/src/xterm.c index c34fb3eb36..017e63d8b6 100644 --- a/src/xterm.c +++ b/src/xterm.c @@ -16499,6 +16499,33 @@ x_wait_for_cell_change (Lisp_Object cell, struct timespec timeout) } } +#if defined USE_GTK || defined HAVE_XRANDR + +/* Find whether or not an undelivered MONITORS_CHANGED_EVENT is + already on the event queue. DPYINFO is the display any such event + must apply to. */ + +static bool +x_find_monitors_changed_event (struct x_display_info *dpyinfo) +{ + union buffered_input_event *event; + + event = kbd_fetch_ptr; + + while (event != kbd_store_ptr) + { + if (event->ie.kind == MONITORS_CHANGED_EVENT + && XTERMINAL (event->ie.arg) == dpyinfo->terminal) + return true; + + event = X_NEXT_KBD_EVENT (event); + } + + return false; +} + +#endif + #ifdef USE_GTK static void x_monitors_changed_cb (GdkScreen *gscr, gpointer user_data) @@ -16516,6 +16543,9 @@ x_monitors_changed_cb (GdkScreen *gscr, gpointer user_data) if (!dpyinfo) return; + if (x_find_monitors_changed_event (dpyinfo)) + return; + XSETTERMINAL (terminal, dpyinfo->terminal); current_monitors @@ -22532,7 +22562,6 @@ handle_one_xevent (struct x_display_info *dpyinfo, || event->type == (dpyinfo->xrandr_event_base + RRNotify))) { - union buffered_input_event *ev; Time timestamp; Lisp_Object current_monitors; XRRScreenChangeNotifyEvent *notify; @@ -22560,13 +22589,7 @@ handle_one_xevent (struct x_display_info *dpyinfo, else timestamp = 0; - ev = (kbd_store_ptr == kbd_buffer - ? kbd_buffer + KBD_BUFFER_SIZE - 1 - : kbd_store_ptr - 1); - - if (kbd_store_ptr != kbd_fetch_ptr - && ev->ie.kind == MONITORS_CHANGED_EVENT - && XTERMINAL (ev->ie.arg) == dpyinfo->terminal) + if (x_find_monitors_changed_event (dpyinfo)) /* Don't store a MONITORS_CHANGED_EVENT if there is already an undelivered event on the queue. */ goto OTHER; commit bc7dc792dfe514fc66f8e330a4a95ece66560fa4 Author: Lars Ingebrigtsen Date: Mon Aug 1 21:22:57 2022 +0200 Fix compilation warning in spam.el * lisp/gnus/spam.el (spam-check-blackholes): Adjust now that query-dig is obsolete. diff --git a/lisp/gnus/spam.el b/lisp/gnus/spam.el index 5af29c0a24..2883a6186b 100644 --- a/lisp/gnus/spam.el +++ b/lisp/gnus/spam.el @@ -43,14 +43,12 @@ (require 'gnus-uu) ; because of key prefix issues ;;; for the definitions of group content classification and spam processors (require 'gnus) +(require 'dig) (eval-when-compile (require 'cl-lib) (require 'hashcash)) -;; autoload query-dig -(autoload 'query-dig "dig") - ;; autoload spam-report (autoload 'spam-report-gmane "spam-report") (autoload 'spam-report-gmane-spam "spam-report") @@ -2008,7 +2006,7 @@ See the Info node `(gnus)Fancy Mail Splitting' for more details." (unless matches (let ((query-string (concat ip "." server))) (if spam-use-dig - (let ((query-result (query-dig query-string))) + (let ((query-result (dig-query query-string))) (when query-result (gnus-message 6 "(DIG): positive blackhole check `%s'" query-result) commit 7320a812e9e0624480406309a3cad18db38ff87a Author: Juri Linkov Date: Mon Aug 1 22:19:01 2022 +0300 Wrap around the search on typing a letter (bug#56535) * doc/emacs/search.texi (Repeat Isearch): Improve values no/no-ding. * lisp/isearch.el (isearch-search-and-update): Try to repeat the search on an error when isearch-wrap-pause is no/no-ding. diff --git a/doc/emacs/search.texi b/doc/emacs/search.texi index 27d4db8541..582e764c55 100644 --- a/doc/emacs/search.texi +++ b/doc/emacs/search.texi @@ -228,8 +228,9 @@ customizing the @code{isearch-wrap-pause} user option. If it is @code{t} (the default), signal an error. (Repeating the search will wrap around.) If @code{no}, issue a @code{ding} and wrap immediately after reaching the last match. If @code{no-ding}, wrap immediately, -but don't @code{ding}. Finally, if @code{nil}, never wrap, but just -stop at the last match. +but don't @code{ding}. With the values @code{no} and @code{no-ding} +the search will try to wrap around also on typing a character. +Finally, if @code{nil}, never wrap, but just stop at the last match. @cindex search ring @findex isearch-ring-advance diff --git a/etc/NEWS b/etc/NEWS index b011413cbc..7aff7921f9 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -1457,6 +1457,11 @@ outside the echo area, Emacs will, by default, end the Isearch and yank the text at mouse cursor. But if 'mouse-yank-at-point' is non-nil, the text will now be added to the Isearch instead. ++++ +*** Changes for values 'no' and 'no-ding' of 'isearch-wrap-pause'. +Now with these values the search will wrap around not only on repeating +with 'C-s C-s', but also after typing a character. + +++ *** New user option 'char-fold-override'. Non-nil means that the default definitions of equivalent characters diff --git a/lisp/isearch.el b/lisp/isearch.el index 8f480a87d9..336c5f1bde 100644 --- a/lisp/isearch.el +++ b/lisp/isearch.el @@ -2838,7 +2838,9 @@ The command accepts Unicode names like \"smiling face\" or isearch-barrier (1+ isearch-other-end))))) (isearch-search) - )) + (when (and (memq isearch-wrap-pause '(no no-ding)) + (not isearch-success)) + (isearch-repeat (if isearch-forward 'forward 'backward))))) (isearch-push-state) (if isearch-op-fun (funcall isearch-op-fun)) (isearch-update)) commit 9d8a6c82838f2f24e76a67379b02956aa668d7cf Author: Gregory Heytings Date: Mon Aug 1 19:11:01 2022 +0000 Fix the bytecode incompatibility due to the change to 'narrow-to-region'. * src/editfns.c (narrow_to_region_internal): New function, which contains the body previously in 'Fnarrow_to_region' but accepts a third argument. (Fnarrow_to_region): Use the new function. Update the docstring. (Fwiden): Update the docstring. * src/lisp.h: Prototype of the new function. * src/xdisp.c (handle_fontified_prop): Use the new function instead of 'Fnarrow_to_region'. * src/process.c (Finternal_default_process_filter): * src/lread.c (readevalloop): Remove the third argument to 'Fnarrow_to_region'. * src/bytecode.c (exec_byte_code): * lisp/emacs-lisp/comp.el (comp-limplify-lap-inst): * lisp/emacs-lisp/bytecomp.el: Restore the statu quo ante. * etc/NEWS: Remove the entry about the new optional argument. * doc/lispref/positions.texi (Narrowing): Update the documentation. diff --git a/doc/lispref/positions.texi b/doc/lispref/positions.texi index 3a9a152f8d..e08ee76ed9 100644 --- a/doc/lispref/positions.texi +++ b/doc/lispref/positions.texi @@ -995,7 +995,7 @@ the entire buffer regardless of any narrowing. types of text, consider using an alternative facility described in @ref{Swapping Text}. -@deffn Command narrow-to-region start end &optional lock +@deffn Command narrow-to-region start end This function sets the accessible portion of the current buffer to start at @var{start} and end at @var{end}. Both arguments should be character positions. @@ -1003,10 +1003,9 @@ positions. In an interactive call, @var{start} and @var{end} are set to the bounds of the current region (point and the mark, with the smallest first). -When @var{lock} is non-@code{nil}, calls to @code{widen}, or to -@code{narrow-to-region} with an optional argument @var{lock} -@code{nil}, do not produce any effect until the end of the current -body form. +Note that, in rare circumstances, Emacs may decide to leave, for +performance reasons, the accessible portion of the buffer unchanged +after a call to @code{narrow-to-region}. @end deffn @deffn Command narrow-to-page &optional move-count @@ -1032,9 +1031,9 @@ It is equivalent to the following expression: @end example @end deffn -However, when @code{widen} is called inside a body form in which -@code{narrow-to-region} was called with an optional argument -@code{lock} non-@code{nil}, it does not produce any effect. +Note that, in rare circumstances, Emacs may decide to leave, for +performance reasons, the accessible portion of the buffer unchanged +after a call to @code{widen}. @defun buffer-narrowed-p This function returns non-@code{nil} if the buffer is narrowed, and diff --git a/etc/NEWS b/etc/NEWS index 963aa22c68..b011413cbc 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -2560,13 +2560,6 @@ things to be saved. ** New function 'string-equal-ignore-case'. This compares strings ignoring case differences. -+++ -** New argument LOCK of 'narrow-to-region'. -If 'narrow-to-region' is called from Lisp with the new optional -argument LOCK non-nil, then calls to 'widen' and calls to -'narrow-to-region' with the optional argument LOCK nil or omitted do -not produce any effect until the end of the current body form. - ** Themes --- diff --git a/lisp/emacs-lisp/bytecomp.el b/lisp/emacs-lisp/bytecomp.el index 1ecd77f751..b4954eee9f 100644 --- a/lisp/emacs-lisp/bytecomp.el +++ b/lisp/emacs-lisp/bytecomp.el @@ -767,7 +767,7 @@ Each element is (INDEX . VALUE)") (byte-defop 122 0 byte-char-syntax) (byte-defop 123 -1 byte-buffer-substring) (byte-defop 124 -1 byte-delete-region) -(byte-defop 125 -2 byte-narrow-to-region) +(byte-defop 125 -1 byte-narrow-to-region) (byte-defop 126 1 byte-widen) (byte-defop 127 0 byte-end-of-line) @@ -3833,7 +3833,7 @@ If it is nil, then the handler is \"byte-compile-SYMBOL.\"" (byte-defop-compiler setcdr 2) (byte-defop-compiler buffer-substring 2) (byte-defop-compiler delete-region 2) -(byte-defop-compiler narrow-to-region 2-3) +(byte-defop-compiler narrow-to-region 2) (byte-defop-compiler (% byte-rem) 2) (byte-defop-compiler aset 3) diff --git a/lisp/emacs-lisp/comp.el b/lisp/emacs-lisp/comp.el index 4354ea03a4..5ee10fcbca 100644 --- a/lisp/emacs-lisp/comp.el +++ b/lisp/emacs-lisp/comp.el @@ -1915,7 +1915,10 @@ and the annotation emission." (byte-char-syntax auto) (byte-buffer-substring auto) (byte-delete-region auto) - (byte-narrow-to-region auto) + (byte-narrow-to-region + (comp-emit-set-call (comp-call 'narrow-to-region + (comp-slot) + (comp-slot+1)))) (byte-widen (comp-emit-set-call (comp-call 'widen))) (byte-end-of-line auto) diff --git a/src/bytecode.c b/src/bytecode.c index 2b1eccdc51..d75767bb0c 100644 --- a/src/bytecode.c +++ b/src/bytecode.c @@ -1480,8 +1480,8 @@ exec_byte_code (Lisp_Object fun, ptrdiff_t args_template, CASE (Bnarrow_to_region): { - Lisp_Object v2 = POP, v1 = POP; - TOP = Fnarrow_to_region (TOP, v1, v2); + Lisp_Object v1 = POP; + TOP = Fnarrow_to_region (TOP, v1); NEXT; } diff --git a/src/editfns.c b/src/editfns.c index 79af27d24d..35b2415e8b 100644 --- a/src/editfns.c +++ b/src/editfns.c @@ -2660,9 +2660,10 @@ DEFUN ("widen", Fwiden, Swiden, 0, 0, "", doc: /* Remove restrictions (narrowing) from current buffer. This allows the buffer's full text to be seen and edited. -When called from Lisp inside a body form in which `narrow-to-region' -was called with an optional argument LOCK non-nil, this function does -not produce any effect. */) +Note that, when the current buffer contains one or more lines whose +length is above `long-line-threshold', Emacs may decide to leave, for +performance reasons, the accessible portion of the buffer unchanged +after this function is called. */) (void) { if (! NILP (Vrestrictions_locked)) @@ -2689,22 +2690,11 @@ unwind_locked_zv (Lisp_Object point_max) SET_BUF_ZV (current_buffer, XFIXNUM (point_max)); } -DEFUN ("narrow-to-region", Fnarrow_to_region, Snarrow_to_region, 2, 3, "r", - doc: /* Restrict editing in this buffer to the current region. -The rest of the text becomes temporarily invisible and untouchable -but is not deleted; if you save the buffer in a file, the invisible -text is included in the file. \\[widen] makes all visible again. -See also `save-restriction'. - -When calling from Lisp, pass two arguments START and END: -positions (integers or markers) bounding the text that should -remain visible. - -When called from Lisp with the optional argument LOCK non-nil, -calls to `widen', or to `narrow-to-region' with an optional -argument LOCK nil, do not produce any effect until the end of -the current body form. */) - (Lisp_Object start, Lisp_Object end, Lisp_Object lock) +/* Internal function for Fnarrow_to_region, meant to be used with a + third argument 'true', in which case it should be followed by "specbind + (Qrestrictions_locked, Qt)". */ +Lisp_Object +narrow_to_region_internal (Lisp_Object start, Lisp_Object end, bool lock) { EMACS_INT s = fix_position (start), e = fix_position (end); @@ -2713,7 +2703,7 @@ the current body form. */) EMACS_INT tem = s; s = e; e = tem; } - if (! NILP (lock)) + if (lock) { if (!(BEGV <= s && s <= e && e <= ZV)) args_out_of_range (start, end); @@ -2727,8 +2717,6 @@ the current body form. */) SET_BUF_BEGV (current_buffer, s); SET_BUF_ZV (current_buffer, e); - - specbind (Qrestrictions_locked, Qt); } else { @@ -2754,6 +2742,26 @@ the current body form. */) return Qnil; } +DEFUN ("narrow-to-region", Fnarrow_to_region, Snarrow_to_region, 2, 2, "r", + doc: /* Restrict editing in this buffer to the current region. +The rest of the text becomes temporarily invisible and untouchable +but is not deleted; if you save the buffer in a file, the invisible +text is included in the file. \\[widen] makes all visible again. +See also `save-restriction'. + +When calling from Lisp, pass two arguments START and END: +positions (integers or markers) bounding the text that should +remain visible. + +Note that, when the current buffer contains one or more lines whose +length is above `long-line-threshold', Emacs may decide to leave, for +performance reasons, the accessible portion of the buffer unchanged +after this function is called. */) + (Lisp_Object start, Lisp_Object end) +{ + return narrow_to_region_internal (start, end, false); +} + Lisp_Object save_restriction_save (void) { diff --git a/src/lisp.h b/src/lisp.h index 807fcb0e5b..c8ad0bc56f 100644 --- a/src/lisp.h +++ b/src/lisp.h @@ -4679,6 +4679,7 @@ extern void save_restriction_restore (Lisp_Object); extern Lisp_Object make_buffer_string (ptrdiff_t, ptrdiff_t, bool); extern Lisp_Object make_buffer_string_both (ptrdiff_t, ptrdiff_t, ptrdiff_t, ptrdiff_t, bool); +extern Lisp_Object narrow_to_region_internal (Lisp_Object, Lisp_Object, bool); extern void init_editfns (void); extern void syms_of_editfns (void); diff --git a/src/lread.c b/src/lread.c index 0720774db2..0b46a2e4ee 100644 --- a/src/lread.c +++ b/src/lread.c @@ -2261,7 +2261,7 @@ readevalloop (Lisp_Object readcharfun, /* Set point and ZV around stuff to be read. */ Fgoto_char (start); if (!NILP (end)) - Fnarrow_to_region (make_fixnum (BEGV), end, Qnil); + Fnarrow_to_region (make_fixnum (BEGV), end); /* Just for cleanliness, convert END to a marker if it is an integer. */ diff --git a/src/process.c b/src/process.c index a15efa39bd..1ac5a509e5 100644 --- a/src/process.c +++ b/src/process.c @@ -6339,7 +6339,7 @@ Otherwise it discards the output. */) /* If the restriction isn't what it should be, set it. */ if (old_begv != BEGV || old_zv != ZV) - Fnarrow_to_region (make_fixnum (old_begv), make_fixnum (old_zv), Qnil); + Fnarrow_to_region (make_fixnum (old_begv), make_fixnum (old_zv)); bset_read_only (current_buffer, old_read_only); SET_PT_BOTH (opoint, opoint_byte); diff --git a/src/xdisp.c b/src/xdisp.c index 88a489e290..65d9221a15 100644 --- a/src/xdisp.c +++ b/src/xdisp.c @@ -4406,7 +4406,8 @@ handle_fontified_prop (struct it *it) if (!begv) begv = BEGV; zv = get_narrowed_zv (it->w, charpos); } - Fnarrow_to_region (make_fixnum (begv), make_fixnum (zv), Qt); + narrow_to_region_internal (make_fixnum (begv), make_fixnum (zv), true); + specbind (Qrestrictions_locked, Qt); } /* Don't allow Lisp that runs from 'fontification-functions' commit c2ed2e68586098b600ff10a85e882ceb9eeb0c32 Author: Stefan Kangas Date: Mon Aug 1 19:46:23 2022 +0200 Don't bind non-existent command in picture-mode-map * lisp/textmodes/picture.el (picture-mode-map): Remove ineffectual binding of non-existent command. diff --git a/lisp/textmodes/picture.el b/lisp/textmodes/picture.el index 17d9483f68..e8c1e6b14f 100644 --- a/lisp/textmodes/picture.el +++ b/lisp/textmodes/picture.el @@ -641,7 +641,6 @@ Leaves the region surrounding the rectangle." (define-key map [remap move-end-of-line] 'picture-end-of-line) (define-key map [remap mouse-set-point] 'picture-mouse-set-point) (define-key map "\C-c\C-d" 'picture-delete-char) - (define-key map "\e\t" 'picture-toggle-tab-state) (define-key map "\t" 'picture-tab) (define-key map "\e\t" 'picture-tab-search) (define-key map "\C-c\t" 'picture-set-tab-stops) commit 914f6b3c2ce6c4147724b663bc9644c1fda01451 Author: Eli Zaretskii Date: Mon Aug 1 20:01:51 2022 +0300 * src/eval.c (Fdefvaralias): Clarify error messages. (Bug#56863) diff --git a/src/eval.c b/src/eval.c index 141d2546f0..d82d05797b 100644 --- a/src/eval.c +++ b/src/eval.c @@ -593,16 +593,19 @@ The return value is BASE-VARIABLE. */) if (SYMBOL_CONSTANT_P (new_alias)) /* Making it an alias effectively changes its value. */ - error ("Cannot make a constant an alias"); + error ("Cannot make a constant an alias: %s", + SDATA (SYMBOL_NAME (new_alias))); sym = XSYMBOL (new_alias); switch (sym->u.s.redirect) { case SYMBOL_FORWARDED: - error ("Cannot make an internal variable an alias"); + error ("Cannot make a built-in variable an alias: %s", + SDATA (SYMBOL_NAME (new_alias))); case SYMBOL_LOCALIZED: - error ("Don't know how to make a localized variable an alias"); + error ("Don't know how to make a buffer-local variable an alias: %s", + SDATA (SYMBOL_NAME (new_alias))); case SYMBOL_PLAINVAL: case SYMBOL_VARALIAS: break; @@ -633,7 +636,8 @@ The return value is BASE-VARIABLE. */) for (p = specpdl_ptr; p > specpdl; ) if ((--p)->kind >= SPECPDL_LET && (EQ (new_alias, specpdl_symbol (p)))) - error ("Don't know how to make a let-bound variable an alias"); + error ("Don't know how to make a let-bound variable an alias: %s", + SDATA (SYMBOL_NAME (new_alias))); } if (sym->u.s.trapped_write == SYMBOL_TRAPPED_WRITE) commit de1c98ef0ca62838da26e3f7f1f7d89ae923b084 Author: Stefan Kangas Date: Mon Aug 1 18:15:51 2022 +0200 Prefer command remapping to substitute-key-definition * lisp/textmodes/reftex-index.el (reftex-index-mode-map): * lisp/textmodes/reftex-sel.el (reftex-select-shared-map): * lisp/textmodes/reftex-toc.el (reftex-toc-mode-map): Prefer command remapping to 'substitute-key-definition'. diff --git a/lisp/textmodes/reftex-index.el b/lisp/textmodes/reftex-index.el index b517cc1663..075ad666b3 100644 --- a/lisp/textmodes/reftex-index.el +++ b/lisp/textmodes/reftex-index.el @@ -275,10 +275,8 @@ will prompt for other arguments." (define-key map [(mouse-2)] #'reftex-index-mouse-goto-line-and-hide) (define-key map [follow-link] 'mouse-face) - (substitute-key-definition - #'next-line #'reftex-index-next map global-map) - (substitute-key-definition - #'previous-line #'reftex-index-previous map global-map) + (define-key map [remap next-line] #'reftex-index-next) + (define-key map [remap previous-line] #'reftex-index-previous) (define-key map "n" #'reftex-index-next) (define-key map "p" #'reftex-index-previous) diff --git a/lisp/textmodes/reftex-sel.el b/lisp/textmodes/reftex-sel.el index 5942801a8a..80c01948e5 100644 --- a/lisp/textmodes/reftex-sel.el +++ b/lisp/textmodes/reftex-sel.el @@ -33,14 +33,10 @@ (defvar reftex-select-shared-map (let ((map (make-sparse-keymap))) (set-keymap-parent map special-mode-map) - (substitute-key-definition - #'next-line #'reftex-select-next map global-map) - (substitute-key-definition - #'previous-line #'reftex-select-previous map global-map) - (substitute-key-definition - #'keyboard-quit #'reftex-select-keyboard-quit map global-map) - (substitute-key-definition - #'newline #'reftex-select-accept map global-map) + (define-key map [remap next-line] #'reftex-select-next) + (define-key map [remap previous-line] #'reftex-select-previous) + (define-key map [remap keyboard-quit] #'reftex-select-keyboard-quit) + (define-key map [remap newline] #'reftex-select-accept) (define-key map " " #'reftex-select-callback) (define-key map "n" #'reftex-select-next) diff --git a/lisp/textmodes/reftex-toc.el b/lisp/textmodes/reftex-toc.el index 5599eaee02..a7f3a9452a 100644 --- a/lisp/textmodes/reftex-toc.el +++ b/lisp/textmodes/reftex-toc.el @@ -34,10 +34,8 @@ (define-key map [(mouse-2)] #'reftex-toc-mouse-goto-line-and-hide) (define-key map [follow-link] 'mouse-face) - (substitute-key-definition - 'next-line 'reftex-toc-next map global-map) - (substitute-key-definition - 'previous-line 'reftex-toc-previous map global-map) + (define-key map [remap next-line] #'reftex-toc-next) + (define-key map [remap previous-line] #'reftex-toc-previous) (define-key map "n" #'reftex-toc-next) (define-key map "p" #'reftex-toc-previous) commit e6af4968f947a3e536fbd80e74fea44ca18e22ac (tag: refs/tags/emacs-28.1.91, refs/remotes/origin/emacs-28) Author: Stefan Kangas Date: Mon Aug 1 18:13:13 2022 +0200 ; Update ChangeLog and AUTHORS * ChangeLog.3: * etc/AUTHORS: Update. diff --git a/ChangeLog.3 b/ChangeLog.3 index c64b8f3785..eeae810145 100644 --- a/ChangeLog.3 +++ b/ChangeLog.3 @@ -1,3 +1,52 @@ +2022-07-31 Eli Zaretskii + + * src/lisp.h (CHECK_INTEGER): Fix the predicate. (Bug#56856) + +2022-07-30 Eli Zaretskii + + Improve documentation of column-related functions + + * doc/lispref/text.texi (Primitive Indent, Columns): + * src/indent.c (Fcurrent_indentation, Fmove_to_column): Document + that column counting ignores invisible text. (Bug#56837) + +2022-07-30 YAMAMOTO Mitsuharu + + * src/macfont.m (macfont_open): Initialize font->space_width. (Bug#56808) + +2022-07-30 Eli Zaretskii + + Improve indexing of keymap variables + + * doc/lispref/maps.texi (Standard Keymaps): + * doc/lispref/display.texi (Button Buffer Commands) + (Button Properties): + * doc/lispref/keymaps.texi (Translation Keymaps): Improve indexing + of keymaps. (Bug#56816) + +2022-07-29 Alan Mackenzie + + CC Mode: fontify variables/functions after line comments ending in spaces + + * lisp/progmodes/cc-engine.el (c-forward-comment-minus-1): Take account of + spaces preceding a linefeed when scanning a putative line comment end. + +2022-07-28 Stefan Kangas + + Bump Emacs version to 28.1.91 + + * README: + * configure.ac: + * msdos/sed2v2.inp: + * nt/README.W32: Bump Emacs version to 28.1.91. + +2022-07-28 Stefan Kangas + + Update ChangeLog and AUTHORS for 28.1.91 pretest + + * ChangeLog.3: + * etc/AUTHORS: Update. + 2022-07-28 Lars Ingebrigtsen Revert the `...' documentation back to actual usage @@ -236558,7 +236607,7 @@ This file records repository revisions from commit 9d56a21e6a696ad19ac65c4b405aeca44785884a (exclusive) to -commit 05df70e755f72b7a4c7b7d94ca2349f1c5c67968 (inclusive). +commit 78759ddcb0fc7dd75a7a8edfb2c19dc2f1d86ee2 (inclusive). See ChangeLog.2 for earlier changes. ;; Local Variables: diff --git a/etc/AUTHORS b/etc/AUTHORS index 8946800e0b..4ad8a54130 100644 --- a/etc/AUTHORS +++ b/etc/AUTHORS @@ -1573,7 +1573,7 @@ Eli Zaretskii: wrote [bidirectional display in xdisp.c] and co-wrote help-tests.el and changed xdisp.c display.texi w32.c msdos.c w32fns.c simple.el files.el fileio.c emacs.c keyboard.c w32term.c text.texi dispnew.c - w32proc.c files.texi frames.texi configure.ac dispextern.h lisp.h + w32proc.c files.texi frames.texi configure.ac lisp.h dispextern.h process.c ms-w32.h and 1236 other files Eliza Velasquez: changed server.el commit 3bd9b6132f1122ea938ef65e62b2cd919e2dfe8a Author: Lars Ingebrigtsen Date: Mon Aug 1 14:28:05 2022 +0200 Fix loaddefs quirk w.r.t. pinyin-convert * lisp/international/titdic-cnv.el (pinyin-convert): Use `generate-lisp-file' for the file. This avoids having it scanned by loaddefs-gen, which will trigger re-compilation of Emacs since pinyin.el is generated after Emacs is built. diff --git a/lisp/international/titdic-cnv.el b/lisp/international/titdic-cnv.el index 2a91e7cb5e..080045e752 100644 --- a/lisp/international/titdic-cnv.el +++ b/lisp/international/titdic-cnv.el @@ -1191,10 +1191,7 @@ The library is named pinyin.el, and contains the constant (dst-file (cadr command-line-args-left)) (coding-system-for-write 'utf-8-unix)) (with-temp-file dst-file - (insert ";;; " (file-name-nondirectory dst-file) - " -*- lexical-binding:t -*- -;; This file is automatically generated from pinyin.map, by the -;; function pinyin-convert.\n\n") + (generate-lisp-file-heading dst-file 'pinyin-convert) (insert "(defconst pinyin-character-map\n'(") (let ((pos (point))) (insert-file-contents src-file) @@ -1214,7 +1211,7 @@ The library is named pinyin.el, and contains the constant (forward-line 1))) (insert ")\n\"An alist holding correspondences between pinyin syllables\ and\nChinese characters.\")\n\n") - (insert "(provide 'pinyin)\n")) + (generate-lisp-file-trailer dst-file :compile t)) (kill-emacs 0))) ;;; titdic-cnv.el ends here commit 7c8bd8802b4610bc9910038f73896e7f4268dc4e Author: Stefan Kangas Date: Mon Aug 1 13:13:25 2022 +0200 * lisp/net/dig.el: Improve Commentary. diff --git a/lisp/net/dig.el b/lisp/net/dig.el index 66defb5c89..d6436c579b 100644 --- a/lisp/net/dig.el +++ b/lisp/net/dig.el @@ -22,18 +22,14 @@ ;;; Commentary: -;; This provide an interface for "dig". +;; This provides an interface for "dig". ;; -;; For interactive use, try M-x dig and type a hostname. Use `q' to quit -;; dig buffer. +;; For interactive use, try `M-x dig' and type a hostname. Use `q' to +;; quit dig buffer. ;; -;; For use in elisp programs, call `dig-invoke' and use +;; For use in Emacs Lisp programs, call `dig-invoke' and use ;; `dig-extract-rr' to extract resource records. -;;; Release history: - -;; 2000-10-28 posted on gnu.emacs.sources - ;;; Code: (defgroup dig nil commit b9b5657c5676b66aed0a729f643e0884a5f5d611 Author: Stefan Kangas Date: Mon Aug 1 12:14:57 2022 +0200 Doc fix in eudc-hotlist.el * lisp/net/eudc-hotlist.el (eudc-hotlist-mode): Doc fix; use command substitution. diff --git a/lisp/net/eudc-hotlist.el b/lisp/net/eudc-hotlist.el index d70e0cf4f6..458d13fb24 100644 --- a/lisp/net/eudc-hotlist.el +++ b/lisp/net/eudc-hotlist.el @@ -32,7 +32,6 @@ (require 'eudc) -(defvar eudc-hotlist-menu nil) (defvar eudc-hotlist-list-beginning nil) (defvar-keymap eudc-hotlist-mode-map @@ -46,13 +45,13 @@ (define-derived-mode eudc-hotlist-mode fundamental-mode "EUDC-Servers" "Major mode used to edit the hotlist of servers. -These are the special commands of this mode: - a -- Add a new server to the list. - d -- Delete the server at point from the list. - s -- Select the server at point. - t -- Transpose the server at point and the previous one - q -- Commit the changes and quit. - x -- Quit without committing the changes." +These are the special commands of this mode:\\ + \\[eudc-hotlist-add-server] -- Add a new server to the list. + \\[eudc-hotlist-delete-server] -- Delete the server at point from the list. + \\[eudc-hotlist-select-server] -- Select the server at point. + \\[eudc-hotlist-transpose-servers] -- Transpose the server at point and the previous one + \\[eudc-hotlist-quit-edit] -- Commit the changes and quit. + \\[kill-current-buffer] -- Quit without committing the changes." (setq buffer-read-only t)) ;;;###autoload commit 66c23da444bee393fabe9076d6b829efaf495ff0 Author: Stefan Kangas Date: Mon Aug 1 12:10:43 2022 +0200 Fix namespacing issue in dig.el * lisp/net/dig.el (dig-query): Rename from 'query-dig'. (query-dig): Make into obsolete function alias for 'dig-query'. diff --git a/lisp/net/dig.el b/lisp/net/dig.el index d4fad0c61f..66defb5c89 100644 --- a/lisp/net/dig.el +++ b/lisp/net/dig.el @@ -168,20 +168,21 @@ prefix, also prompt for the SERVER parameter." (forward-line)) (dig-mode)) -;; named for consistency with query-dns in dns.el -(defun query-dig (domain &optional - query-type query-class query-option dig-option server) +(defun dig-query (domain &optional + query-type query-class query-option dig-option server) "Query addresses of a DOMAIN using dig. It works by calling `dig-invoke' and `dig-extract-rr'. Optional arguments are passed to `dig-invoke' and `dig-extract-rr'. Returns nil for domain/class/type queries that result in no data." -(let ((buffer (dig-invoke domain query-type query-class - query-option dig-option server))) - (when buffer - (pop-to-buffer-same-window buffer) - (let ((digger (dig-extract-rr domain query-type query-class))) - (kill-buffer buffer) - digger)))) + (let ((buffer (dig-invoke domain query-type query-class + query-option dig-option server))) + (when buffer + (pop-to-buffer-same-window buffer) + (let ((digger (dig-extract-rr domain query-type query-class))) + (kill-buffer buffer) + digger)))) + +(define-obsolete-function-alias 'query-dig #'dig-query "29.1") (provide 'dig) commit e976a935f8c1e6a300d6b537c6853d57bd236094 Author: Po Lu Date: Mon Aug 1 19:00:48 2022 +0800 Improve handling of xsettings events * src/xsettings.c (xft_settings_event): * src/xsettings.h: Return if the event was handled. * src/xterm.c (handle_one_xevent): If it was, don't handle the event any further. diff --git a/src/xsettings.c b/src/xsettings.c index c29a844e0a..9c60ff825a 100644 --- a/src/xsettings.c +++ b/src/xsettings.c @@ -964,9 +964,10 @@ read_and_apply_settings (Display_Info *dpyinfo, bool send_event_p) #endif #ifndef HAVE_PGTK -/* Check if EVENT for the display in DPYINFO is XSettings related. */ +/* Check if EVENT for the display in DPYINFO is XSettings related. + Return true if it is, after performing associated side effects. */ -void +bool xft_settings_event (Display_Info *dpyinfo, const XEvent *event) { bool check_window_p = false, apply_settings_p = false; @@ -1004,6 +1005,8 @@ xft_settings_event (Display_Info *dpyinfo, const XEvent *event) if (apply_settings_p) read_and_apply_settings (dpyinfo, true); + + return check_window_p || apply_settings_p; } #endif diff --git a/src/xsettings.h b/src/xsettings.h index 5e5df37062..833c2b367d 100644 --- a/src/xsettings.h +++ b/src/xsettings.h @@ -36,7 +36,7 @@ typedef struct pgtk_display_info Display_Info; extern void xsettings_initialize (Display_Info *); #ifndef HAVE_PGTK -extern void xft_settings_event (Display_Info *, const XEvent *); +extern bool xft_settings_event (Display_Info *, const XEvent *); #endif extern const char *xsettings_get_system_font (void); #ifdef USE_LUCID diff --git a/src/xterm.c b/src/xterm.c index bf6061d30e..c34fb3eb36 100644 --- a/src/xterm.c +++ b/src/xterm.c @@ -17170,7 +17170,8 @@ handle_one_xevent (struct x_display_info *dpyinfo, goto done; #endif - xft_settings_event (dpyinfo, event); + if (xft_settings_event (dpyinfo, event)) + goto done; f = any; /* We don't want to ever leak tooltip frames to Lisp code. */ commit 89fbcbb907edc8679ae61b030ae0bfb5323dce60 Author: Stefan Kangas Date: Mon Aug 1 11:52:32 2022 +0200 ; * lisp/net/net-utils.el: Delete code commented out since 2000. Note also that the netstat command is officially deprecated. diff --git a/lisp/net/net-utils.el b/lisp/net/net-utils.el index c7ff175e08..192c8446eb 100644 --- a/lisp/net/net-utils.el +++ b/lisp/net/net-utils.el @@ -442,15 +442,6 @@ If your system's ping continues until interrupted, you can try setting ping-program options))) -;; FIXME -- Needs to be a process filter -;; (defun netstat-with-filter (filter) -;; "Run netstat program." -;; (interactive "sFilter: ") -;; (netstat) -;; (set-buffer (get-buffer "*Netstat*")) -;; (goto-char (point-min)) -;; (delete-matching-lines filter)) - ;;;###autoload (defun nslookup-host (host &optional name-server) "Look up the DNS information for HOST (name or IP address). commit bec8474a453757aed9a38f4786325b7144c246e9 Author: Paul Eggert Date: Mon Aug 1 00:38:34 2022 -0700 Improve GCC pacification in xterm.c * src/xterm.c (x_dnd_free_toplevels, x_composite_image): Use UNINIT for initialization needed only to pacify GCC. (x_dnd_free_toplevels): Add an eassume to pacify GCC 12.1 x86-64 -Wanalyzer-null-dereference. 2022-07-31 Paul Eggert diff --git a/src/xterm.c b/src/xterm.c index 986973eb78..bf6061d30e 100644 --- a/src/xterm.c +++ b/src/xterm.c @@ -2837,8 +2837,8 @@ x_dnd_free_toplevels (bool display_alive) struct x_client_list_window *last; struct x_client_list_window *tem = x_dnd_toplevels; ptrdiff_t n_windows, i, buffer_size; - Window *destroy_windows; - unsigned long *prev_masks; + Window *destroy_windows UNINIT; + unsigned long *prev_masks UNINIT; specpdl_ref count; Display *dpy; struct x_display_info *dpyinfo; @@ -2847,10 +2847,6 @@ x_dnd_free_toplevels (bool display_alive) /* Probably called inside an IO error handler. */ return; - /* Pacify GCC. */ - prev_masks = NULL; - destroy_windows = NULL; - if (display_alive) { buffer_size = 1024; @@ -2913,6 +2909,7 @@ x_dnd_free_toplevels (bool display_alive) if (n_windows) { + eassume (dpyinfo); x_ignore_errors_for_next_request (dpyinfo); for (i = 0; i < n_windows; ++i) @@ -9311,9 +9308,7 @@ x_composite_image (struct glyph_string *s, Pixmap dest, { Picture destination; XRenderPictFormat *default_format; - XRenderPictureAttributes attr; - /* Pacify GCC. */ - memset (&attr, 0, sizeof attr); + XRenderPictureAttributes attr UNINIT; default_format = FRAME_X_PICTURE_FORMAT (s->f); destination = XRenderCreatePicture (display, dest, commit 72c3efd7d0ca72e12f76c5f057fd3ac9bb61b13f Author: Paul Eggert Date: Mon Aug 1 00:38:34 2022 -0700 Fix time comparison in primitive-undo * lisp/simple.el (primitive-undo): Fix time comparison. The old code was a circa-2013 mistranslation of what used to be in src/undo.c’s Fprimitive_undo. diff --git a/lisp/simple.el b/lisp/simple.el index 2ef8a3cf00..e7768837f6 100644 --- a/lisp/simple.el +++ b/lisp/simple.el @@ -3543,10 +3543,7 @@ Return what remains of the list." (setq visited-file-time (with-current-buffer (buffer-base-buffer) (visited-file-modtime)))) - (when (or (equal time visited-file-time) - (and (consp time) - (equal (list (car time) (cdr time)) - visited-file-time))) + (when (time-equal-p time visited-file-time) (unlock-buffer) (set-buffer-modified-p nil)))) ;; Element (nil PROP VAL BEG . END) is property change. commit 4d896c097760f34cbe040589a5966bcf3752991d Author: Paul Eggert Date: Mon Aug 1 00:38:34 2022 -0700 Use list-form timestamps in .nnmh-articles * lisp/gnus/nnmh.el (nnmh-update-gnus-unreads): Store list form timestamps into .nnmh-articles, even if current-time-list is nil. That way, older Emacs versions can read them. diff --git a/lisp/gnus/nnmh.el b/lisp/gnus/nnmh.el index 312a4a2a82..3902af7d2f 100644 --- a/lisp/gnus/nnmh.el +++ b/lisp/gnus/nnmh.el @@ -547,14 +547,17 @@ as unread by Gnus.") (push (car art) new)))) ;; Go through all the new articles and add them, and their ;; time-stamps, to the list. + ;; Use list format for timestamps, so Emacs <27 can read .nnmh-articles. (setq articles (nconc articles (mapcar (lambda (art) (cons art - (file-attribute-modification-time - (file-attributes - (concat dir (int-to-string art)))))) + (when-let ((modtime + (file-attribute-modification-time + (file-attributes + (concat dir (int-to-string art)))))) + (time-convert modtime 'list)))) new))) ;; Make Gnus mark all new articles as unread. (when new commit 2cd204d8bbc5ef9bc049b593f85b2fa46c07db1b Author: Paul Eggert Date: Mon Aug 1 00:38:34 2022 -0700 Prefer ‘time-equal-p’ to ‘equal’ on timestamps This is more robust since timestamps can have multiple forms. * lisp/auth-source.el (auth-source-netrc-parse): * lisp/bookmark.el (bookmark--watch-file-already-queried-p) (bookmark-maybe-load-default-file): * lisp/cedet/semantic/db.el (semanticdb-needs-refresh-p): * lisp/dired.el (dired-directory-changed-p): * lisp/files.el (dir-locals-find-file): * lisp/gnus/gnus-util.el (gnus-cache-file-contents): * lisp/gnus/nneething.el (nneething-create-mapping): * lisp/gnus/nnfolder.el (nnfolder-read-folder): * lisp/gnus/nnmaildir.el (nnmaildir--update-nov) (nnmaildir--scan, nnmaildir-request-scan) (nnmaildir-request-update-info): * lisp/gnus/nnmh.el (nnmh-update-gnus-unreads): * lisp/gnus/spam-stat.el (spam-stat-load): * lisp/mail/mailabbrev.el (mail-abbrevs-sync-aliases): * lisp/mail/sendmail.el (sendmail-sync-aliases): * lisp/net/netrc.el (netrc-parse): * lisp/nxml/rng-loc.el (rng-get-parsed-schema-locating-file): * lisp/play/cookie1.el (cookie-snarf): * lisp/vc/vc-cvs.el (vc-cvs-state-heuristic): * lisp/vc/vc-hg.el (vc-hg--ignore-patterns-valid-p) (vc-hg--cached-dirstate-search): * lisp/vc/vc-hooks.el (vc-after-save): Prefer ‘time-equal-p’ to ‘equal’ when comparing timestamps for equality. diff --git a/lisp/auth-source.el b/lisp/auth-source.el index a802ef856d..a36386101a 100644 --- a/lisp/auth-source.el +++ b/lisp/auth-source.el @@ -957,7 +957,8 @@ Note that the MAX parameter is used so we can exit the parse early." result) (if (and (functionp cached-secrets) - (equal cached-mtime + (time-equal-p + cached-mtime (file-attribute-modification-time (file-attributes file)))) (progn diff --git a/lisp/bookmark.el b/lisp/bookmark.el index b2130557dc..30a03e0431 100644 --- a/lisp/bookmark.el +++ b/lisp/bookmark.el @@ -1172,7 +1172,7 @@ it to the name of the bookmark currently being set, advancing (defun bookmark--watch-file-already-queried-p (new-mtime) ;; Don't ask repeatedly if user already said "no" to reloading a ;; file with this mtime: - (prog1 (equal new-mtime bookmark--watch-already-asked-mtime) + (prog1 (time-equal-p new-mtime bookmark--watch-already-asked-mtime) (setq bookmark--watch-already-asked-mtime new-mtime))) (defun bookmark-maybe-load-default-file () @@ -1185,7 +1185,7 @@ it to the name of the bookmark currently being set, advancing (let ((new-mtime (nth 5 (file-attributes (car bookmark-bookmarks-timestamp)))) (old-mtime (cdr bookmark-bookmarks-timestamp))) - (and (not (equal new-mtime old-mtime)) + (and (not (time-equal-p new-mtime old-mtime)) (not (bookmark--watch-file-already-queried-p new-mtime)) (or (eq 'silent bookmark-watch-bookmark-file) (yes-or-no-p diff --git a/lisp/cedet/semantic/db.el b/lisp/cedet/semantic/db.el index 82785ec6d2..757e46677e 100644 --- a/lisp/cedet/semantic/db.el +++ b/lisp/cedet/semantic/db.el @@ -609,7 +609,7 @@ The file associated with OBJ does not need to be in a buffer." (or (not (slot-boundp obj 'tags)) ;; (not (oref obj tags)) --> not needed anymore? (/= (or (oref obj fsize) 0) actualsize) - (not (equal (oref obj lastmodtime) actualmod)) + (not (time-equal-p (oref obj lastmodtime) actualmod)) ) )))) diff --git a/lisp/dired.el b/lisp/dired.el index 7cdcc3438d..f261f9f477 100644 --- a/lisp/dired.el +++ b/lisp/dired.el @@ -1140,7 +1140,8 @@ If DIRNAME is already in a Dired buffer, that buffer is used without refresh." (modtime (visited-file-modtime))) (or (eq modtime 0) (not (eq (file-attribute-type attributes) t)) - (equal (file-attribute-modification-time attributes) modtime))))) + (time-equal-p (file-attribute-modification-time attributes) + modtime))))) (defvar auto-revert-remote-files) diff --git a/lisp/files.el b/lisp/files.el index 65f9039b33..5df1966193 100644 --- a/lisp/files.el +++ b/lisp/files.el @@ -4446,7 +4446,8 @@ This function returns either: ;; The entry MTIME should match the most recent ;; MTIME among matching files. (and cached-files - (equal (nth 2 dir-elt) + (time-equal-p + (nth 2 dir-elt) (let ((latest 0)) (dolist (f cached-files latest) (let ((f-time diff --git a/lisp/gnus/gnus-util.el b/lisp/gnus/gnus-util.el index ea11642cf4..9bf48b1f4c 100644 --- a/lisp/gnus/gnus-util.el +++ b/lisp/gnus/gnus-util.el @@ -1254,7 +1254,7 @@ SPEC is a predicate specifier that contains stuff like `or', `and', contents value) (if (or (null (setq value (symbol-value variable))) (not (equal (car value) file)) - (not (equal (nth 1 value) time))) + (not (time-equal-p (nth 1 value) time))) (progn (setq contents (funcall function file)) (set variable (list file time contents)) diff --git a/lisp/gnus/nneething.el b/lisp/gnus/nneething.el index 829d912cb2..0c565a8230 100644 --- a/lisp/gnus/nneething.el +++ b/lisp/gnus/nneething.el @@ -245,7 +245,8 @@ included.") (while map (if (and (member (cadr (car map)) files) ;; We also remove files that have changed mod times. - (equal (file-attribute-modification-time (file-attributes + (time-equal-p + (file-attribute-modification-time (file-attributes (nneething-file-name (cadr (car map))))) (cadr (cdar map)))) (progn diff --git a/lisp/gnus/nnfolder.el b/lisp/gnus/nnfolder.el index 5dc8e5c30d..c3f7073a7b 100644 --- a/lisp/gnus/nnfolder.el +++ b/lisp/gnus/nnfolder.el @@ -860,7 +860,8 @@ deleted. Point is left where the deleted region was." (nnheader-find-file-noselect file t))))) (mm-enable-multibyte) ;; Use multibyte buffer for future copying. (buffer-disable-undo) - (if (equal (cadr (assoc group nnfolder-scantime-alist)) + (if (time-equal-p + (cadr (assoc group nnfolder-scantime-alist)) (file-attribute-modification-time (file-attributes file))) ;; This looks up-to-date, so we don't do any scanning. (if (file-exists-p file) diff --git a/lisp/gnus/nnmaildir.el b/lisp/gnus/nnmaildir.el index 30f473b129..98e074233d 100644 --- a/lisp/gnus/nnmaildir.el +++ b/lisp/gnus/nnmaildir.el @@ -463,7 +463,7 @@ This variable is set by `nnmaildir-request-article'.") ;; usable: if the message has been edited or if nnmail-extra-headers ;; has been augmented since this data was parsed from the message, ;; then we have to reparse. Otherwise it's up-to-date. - (when (and nov (equal mtime (nnmaildir--nov-get-mtime nov))) + (when (and nov (time-equal-p mtime (nnmaildir--nov-get-mtime nov))) ;; The timestamp matches. Now check nnmail-extra-headers. (setq old-extra (nnmaildir--nov-get-extra nov)) (when (equal nnmaildir--extra old-extra) ;; common case @@ -799,7 +799,7 @@ This variable is set by `nnmaildir-request-article'.") isnew (throw 'return t)) (setq nattr (file-attribute-modification-time nattr)) - (if (equal nattr (nnmaildir--grp-new group)) + (if (time-equal-p nattr (nnmaildir--grp-new group)) (setq nattr nil)) (if read-only (setq dir (and (or isnew nattr) ndir)) (when (or isnew nattr) @@ -811,7 +811,7 @@ This variable is set by `nnmaildir-request-article'.") (rename-file x (concat cdir (nnmaildir--ensure-suffix file))))) (setf (nnmaildir--grp-new group) nattr)) (setq cattr (file-attribute-modification-time (file-attributes cdir))) - (if (equal cattr (nnmaildir--grp-cur group)) + (if (time-equal-p cattr (nnmaildir--grp-cur group)) (setq cattr nil)) (setq dir (and (or isnew cattr) cdir))) (unless dir (throw 'return t)) @@ -899,7 +899,7 @@ This variable is set by `nnmaildir-request-article'.") (remhash scan-group groups)) (setq x (file-attribute-modification-time (file-attributes srv-dir)) scan-group (null scan-group)) - (if (equal x (nnmaildir--srv-mtime nnmaildir--cur-server)) + (if (time-equal-p x (nnmaildir--srv-mtime nnmaildir--cur-server)) (when scan-group (maphash (lambda (group-name _group) (nnmaildir--scan group-name t groups @@ -1049,7 +1049,7 @@ This variable is set by `nnmaildir-request-article'.") (t markdir-mtime)))) (puthash mark mtime new-mmth) - (when (equal mtime (gethash mark old-mmth)) + (when (time-equal-p mtime (gethash mark old-mmth)) (setq ranges (assq mark old-marks)) (if ranges (setq ranges (cdr ranges))) (throw 'got-ranges nil)) diff --git a/lisp/gnus/nnmh.el b/lisp/gnus/nnmh.el index 5d016267bc..312a4a2a82 100644 --- a/lisp/gnus/nnmh.el +++ b/lisp/gnus/nnmh.el @@ -539,7 +539,7 @@ as unread by Gnus.") (let ((arts articles) art) (while (setq art (pop arts)) - (when (not (equal + (when (not (time-equal-p (file-attribute-modification-time (file-attributes (concat dir (int-to-string (car art))))) (cdr art))) diff --git a/lisp/gnus/spam-stat.el b/lisp/gnus/spam-stat.el index 084eb3d774..5763ac14bb 100644 --- a/lisp/gnus/spam-stat.el +++ b/lisp/gnus/spam-stat.el @@ -422,7 +422,8 @@ spam-stat (spam-stat-to-hash-table '(" spam-stat-ngood spam-stat-nbad)) (cond (spam-stat-dirty (message "Spam stat not loaded: spam-stat-dirty t")) ((or (not (boundp 'spam-stat-last-saved-at)) (null spam-stat-last-saved-at) - (not (equal spam-stat-last-saved-at + (not (time-equal-p + spam-stat-last-saved-at (file-attribute-modification-time (file-attributes spam-stat-file))))) (progn diff --git a/lisp/mail/mailabbrev.el b/lisp/mail/mailabbrev.el index e4061bd2f1..86711a4543 100644 --- a/lisp/mail/mailabbrev.el +++ b/lisp/mail/mailabbrev.el @@ -163,7 +163,7 @@ no aliases, which is represented by this being a table with no entries.)") (if (file-exists-p mail-personal-alias-file) (let ((modtime (file-attribute-modification-time (file-attributes mail-personal-alias-file)))) - (if (not (equal mail-abbrev-modtime modtime)) + (if (not (time-equal-p mail-abbrev-modtime modtime)) (progn (setq mail-abbrev-modtime modtime) (build-mail-abbrevs))))))) diff --git a/lisp/mail/sendmail.el b/lisp/mail/sendmail.el index 76ef65b343..f985b2ceac 100644 --- a/lisp/mail/sendmail.el +++ b/lisp/mail/sendmail.el @@ -537,7 +537,7 @@ This also saves the value of `send-mail-function' via Customize." (when mail-personal-alias-file (let ((modtime (file-attribute-modification-time (file-attributes mail-personal-alias-file)))) - (or (equal mail-alias-modtime modtime) + (or (time-equal-p mail-alias-modtime modtime) (setq mail-alias-modtime modtime mail-aliases t))))) diff --git a/lisp/net/netrc.el b/lisp/net/netrc.el index c272c07e4c..2f38e22178 100644 --- a/lisp/net/netrc.el +++ b/lisp/net/netrc.el @@ -63,8 +63,9 @@ "port")) alist elem result pair) (if (and netrc-cache - (equal (car netrc-cache) (file-attribute-modification-time - (file-attributes file)))) + (time-equal-p (car netrc-cache) + (file-attribute-modification-time + (file-attributes file)))) (insert (base64-decode-string (rot13-string (cdr netrc-cache)))) (insert-file-contents file) (when (string-match "\\.gpg\\'" file) diff --git a/lisp/nxml/rng-loc.el b/lisp/nxml/rng-loc.el index 0fa455cbb5..302aa05176 100644 --- a/lisp/nxml/rng-loc.el +++ b/lisp/nxml/rng-loc.el @@ -414,7 +414,7 @@ or nil." (setq rng-schema-locating-file-alist (delq cached rng-schema-locating-file-alist))) nil) - ((and cached (equal (nth 1 cached) mtime)) + ((and cached (time-equal-p (nth 1 cached) mtime)) (nth 2 cached)) (t (setq parsed (rng-parse-schema-locating-file file)) diff --git a/lisp/play/cookie1.el b/lisp/play/cookie1.el index fcdd2a7ce9..7ede8e358a 100644 --- a/lisp/play/cookie1.el +++ b/lisp/play/cookie1.el @@ -123,7 +123,8 @@ Emit STARTMSG and ENDMSG before and after. Cache the result; second and subsequent calls on the same file won't go to disk." (setq phrase-file (cookie-check-file phrase-file)) (let ((sym (intern-soft phrase-file cookie-cache))) - (and sym (not (equal (symbol-function sym) + (and sym (not (time-equal-p + (symbol-function sym) (file-attribute-modification-time (file-attributes phrase-file)))) (yes-or-no-p (concat phrase-file diff --git a/lisp/vc/vc-cvs.el b/lisp/vc/vc-cvs.el index 1f81ff2e0f..52cc42791f 100644 --- a/lisp/vc/vc-cvs.el +++ b/lisp/vc/vc-cvs.el @@ -250,7 +250,7 @@ See also variable `vc-cvs-sticky-date-format-string'." (let ((checkout-time (vc-file-getprop file 'vc-checkout-time)) (lastmod (file-attribute-modification-time (file-attributes file)))) (cond - ((equal checkout-time lastmod) 'up-to-date) + ((time-equal-p checkout-time lastmod) 'up-to-date) ((string= (vc-working-revision file) "0") 'added) ((null checkout-time) 'unregistered) (t 'edited)))) diff --git a/lisp/vc/vc-hg.el b/lisp/vc/vc-hg.el index 026f125396..5fba2b3908 100644 --- a/lisp/vc/vc-hg.el +++ b/lisp/vc/vc-hg.el @@ -966,7 +966,7 @@ REPO must be the directory name of an hg repository." (attr (file-attributes (nth 0 fs))) (current-mtime (file-attribute-modification-time attr)) (current-size (file-attribute-size attr))) - (unless (and (equal saved-mtime current-mtime) + (unless (and (time-equal-p saved-mtime current-mtime) (equal saved-size current-size)) (setf valid nil)))) valid)) @@ -1037,7 +1037,7 @@ Avoids the need to repeatedly scan dirstate on repeated calls to ) (if (and cache (equal dirstate (pop cache)) - (equal mtime (pop cache)) + (time-equal-p mtime (pop cache)) (equal size (pop cache)) (equal ascii-fname (pop cache))) (pop cache) diff --git a/lisp/vc/vc-hooks.el b/lisp/vc/vc-hooks.el index 80508570f3..405c9bc2ca 100644 --- a/lisp/vc/vc-hooks.el +++ b/lisp/vc/vc-hooks.el @@ -631,9 +631,10 @@ Before doing that, check if there are any old backups and get rid of them." (cond ((null backend)) ((eq (vc-checkout-model backend (list file)) 'implicit) - ;; If the file was saved in the same second in which it was + ;; If the file was saved at the same time that it was ;; checked out, clear the checkout-time to avoid confusion. - (if (equal (vc-file-getprop file 'vc-checkout-time) + (if (time-equal-p + (vc-file-getprop file 'vc-checkout-time) (file-attribute-modification-time (file-attributes file))) (vc-file-setprop file 'vc-checkout-time nil)) (if (vc-state-refresh file backend) commit a51863f73d914dbabbadb396cda2c9d360866277 Author: Paul Eggert Date: Mon Aug 1 00:38:33 2022 -0700 Simplify a few timestamps * lisp/calendar/time-date.el (safe-date-to-time): * lisp/calendar/timeclock.el (timeclock-generate-report): * lisp/epg.el (epg--start): * lisp/gnus/gnus-demon.el (gnus-demon-nntp-close-connection): * lisp/gnus/gnus-util.el (gnus-date-get-time): * lisp/gnus/nnheader.el (nnheader-last-message-time): * lisp/gnus/nnrss.el (nnrss-request-expire-articles): * lisp/vc/ediff-util.el (ediff-command-begin-time) (ediff-calc-command-time, ediff-profile): Prefer an integer like 0 to a timestamp list like (0 0) where either will do. diff --git a/lisp/calendar/time-date.el b/lisp/calendar/time-date.el index d1afd8ce95..7c99d05dc3 100644 --- a/lisp/calendar/time-date.el +++ b/lisp/calendar/time-date.el @@ -256,10 +256,10 @@ Returns a floating point number." ;;;###autoload (defun safe-date-to-time (date) "Parse a string DATE that represents a date-time and return a time value. -If DATE is malformed, return a time value of zeros." +If DATE is malformed, return a time value of zero." (condition-case () (date-to-time date) - (error '(0 0)))) + (error 0))) ;;;###autoload diff --git a/lisp/calendar/timeclock.el b/lisp/calendar/timeclock.el index 7bdaf7ceff..6b6cc517a2 100644 --- a/lisp/calendar/timeclock.el +++ b/lisp/calendar/timeclock.el @@ -1247,7 +1247,7 @@ HTML-P is non-nil, HTML markup is added." (time-out (vector (list t) (list t) (list t) (list t) (list t))) (breaks (vector (list t) (list t) (list t) (list t) (list t))) (workday (vector (list t) (list t) (list t) (list t) (list t))) - (lengths (vector '(0 0) thirty-days-ago three-months-ago + (lengths (vector 0 thirty-days-ago three-months-ago six-months-ago one-year-ago))) ;; collect statistics from complete timelog (dolist (day day-list) diff --git a/lisp/epg.el b/lisp/epg.el index c5d946cb76..c3c26badbb 100644 --- a/lisp/epg.el +++ b/lisp/epg.el @@ -606,7 +606,7 @@ callback data (if any)." process terminal-name agent-file - (agent-mtime '(0 0 0 0))) + (agent-mtime 0)) ;; Set GPG_TTY and TERM for pinentry-curses. Note that we can't ;; use `terminal-name' here to get the real pty name for the child ;; process, though /dev/fd/0" is not portable. @@ -633,7 +633,7 @@ callback data (if any)." (setq agent-file (match-string 1 agent-info) agent-mtime (or (file-attribute-modification-time (file-attributes agent-file)) - '(0 0 0 0)))) + 0))) (if epg-debug (save-excursion (unless epg-debug-buffer diff --git a/lisp/gnus/gnus-demon.el b/lisp/gnus/gnus-demon.el index d9da8529eb..f6cfd727f7 100644 --- a/lisp/gnus/gnus-demon.el +++ b/lisp/gnus/gnus-demon.el @@ -222,7 +222,7 @@ minutes, the connection is closed." (defun gnus-demon-nntp-close-connection () (save-window-excursion - (when (time-less-p '(0 300) (time-since nntp-last-command-time)) + (when (time-less-p 300 (time-since nntp-last-command-time)) (nntp-close-server)))) (defun gnus-demon-add-scanmail () diff --git a/lisp/gnus/gnus-util.el b/lisp/gnus/gnus-util.el index dda2b4ff5f..ea11642cf4 100644 --- a/lisp/gnus/gnus-util.el +++ b/lisp/gnus/gnus-util.el @@ -383,7 +383,7 @@ Cache the result as a text property stored in DATE." ;; Either return the cached value... `(let ((d ,date)) (if (equal "" d) - '(0 0) + 0 (or (get-text-property 0 'gnus-time d) ;; or compute the value... (let ((time (safe-date-to-time d))) diff --git a/lisp/gnus/nnheader.el b/lisp/gnus/nnheader.el index ab57bd7eed..92df41ea82 100644 --- a/lisp/gnus/nnheader.el +++ b/lisp/gnus/nnheader.el @@ -1055,7 +1055,7 @@ See `find-file-noselect' for the arguments." (or ,end (point-max))) '(buffer-string))))) -(defvar nnheader-last-message-time '(0 0)) +(defvar nnheader-last-message-time 0) (defun nnheader-message-maybe (&rest args) (let ((now (current-time))) (when (time-less-p 1 (time-subtract now nnheader-last-message-time)) diff --git a/lisp/gnus/nnrss.el b/lisp/gnus/nnrss.el index f740af3b6d..5047be1a6a 100644 --- a/lisp/gnus/nnrss.el +++ b/lisp/gnus/nnrss.el @@ -325,7 +325,7 @@ for decoding when the cdr that the data specify is not available.") (nnmail-expired-article-p group (if (listp (setq days (nth 1 e))) days - (days-to-time (- days (time-to-days '(0 0))))) + (days-to-time (- days (time-to-days 0)))) force)) (setq nnrss-group-data (delq e nnrss-group-data) changed t) diff --git a/lisp/vc/ediff-util.el b/lisp/vc/ediff-util.el index 040a9a63c5..3641b75251 100644 --- a/lisp/vc/ediff-util.el +++ b/lisp/vc/ediff-util.el @@ -4094,11 +4094,11 @@ Mail anyway? (y or n) ") ;;; Debug -(ediff-defvar-local ediff-command-begin-time '(0 0 0)) +(ediff-defvar-local ediff-command-begin-time 0) ;; calculate time used by command (defun ediff-calc-command-time () - (or (equal ediff-command-begin-time '(0 0 0)) + (or (equal ediff-command-begin-time 0) (message "Elapsed time: %g second(s)" (float-time (time-since ediff-command-begin-time))))) @@ -4112,10 +4112,10 @@ Mail anyway? (y or n) ") (let ((pre-hook 'pre-command-hook) (post-hook 'post-command-hook)) - (if (not (equal ediff-command-begin-time '(0 0 0))) + (if (not (equal ediff-command-begin-time 0)) (progn (remove-hook pre-hook 'ediff-save-time) (remove-hook post-hook 'ediff-calc-command-time) - (setq ediff-command-begin-time '(0 0 0)) + (setq ediff-command-begin-time 0) (message "Ediff profiling disabled")) (add-hook pre-hook 'ediff-save-time t 'local) (add-hook post-hook 'ediff-calc-command-time nil 'local) commit d634cb09547eb5ffba105b6c90410fd843bf029d Author: Paul Eggert Date: Mon Aug 1 00:38:33 2022 -0700 Omit some (current-time) calls * lisp/emacs-lisp/ert.el (ert-write-junit-test-summary-report): * lisp/emacs-lisp/shortdoc.el (file): * lisp/find-lisp.el (find-lisp-find-dired-insert-file): * lisp/progmodes/hideif.el (hide-ifdefs): * lisp/tar-mode.el (tar-subfile-save-buffer): Prefer nil or omitted arg to (current-time) where this is better or more-efficient. diff --git a/lisp/emacs-lisp/ert.el b/lisp/emacs-lisp/ert.el index 49b54c2d00..c8ff6b6814 100644 --- a/lisp/emacs-lisp/ert.el +++ b/lisp/emacs-lisp/ert.el @@ -1692,7 +1692,7 @@ test packages depend on each other, it might be helpful.") (string-match-p "^Running 0 tests" logfile-contents)) (insert (format " \n" id test-report - (ert--format-time-iso8601 (current-time)))) + (ert--format-time-iso8601 nil))) (insert (format " \n" (file-name-nondirectory test-report))) (insert (format " \n" diff --git a/lisp/emacs-lisp/shortdoc.el b/lisp/emacs-lisp/shortdoc.el index 315afd4312..d187af9ac8 100644 --- a/lisp/emacs-lisp/shortdoc.el +++ b/lisp/emacs-lisp/shortdoc.el @@ -503,7 +503,7 @@ A FUNC form can have any number of `:no-eval' (or `:no-value'), (set-file-modes :no-value "(set-file-modes \"/tmp/foo\" #o644)") (set-file-times - :no-value (set-file-times "/tmp/foo" (current-time))) + :no-value (set-file-times "/tmp/foo")) "File Modes" (set-default-file-modes :no-value "(set-default-file-modes #o755)") diff --git a/lisp/find-lisp.el b/lisp/find-lisp.el index 0a712c0b81..e825d9cba0 100644 --- a/lisp/find-lisp.el +++ b/lisp/find-lisp.el @@ -281,7 +281,7 @@ It is a function which takes two arguments, the directory and its parent." (set-buffer buffer) (insert find-lisp-line-indent (find-lisp-format file (file-attributes file 'string) (list "") - (current-time)))) + nil))) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; Lifted from ls-lisp. We don't want to require it, because that diff --git a/lisp/progmodes/hideif.el b/lisp/progmodes/hideif.el index f2ada676ab..d09e1f4cdf 100644 --- a/lisp/progmodes/hideif.el +++ b/lisp/progmodes/hideif.el @@ -2521,8 +2521,7 @@ Turn off hiding by calling `show-ifdefs'." (or hide-ifdef-read-only hif-outside-read-only)) (and hide-ifdef-verbose (message "Hiding done, %.1f seconds elapsed" - (float-time (time-subtract (current-time) - hide-start-time))))))) + (float-time (time-subtract nil hide-start-time))))))) (defun show-ifdefs (&optional start end) diff --git a/lisp/tar-mode.el b/lisp/tar-mode.el index d7a0978969..20ad6e1e46 100644 --- a/lisp/tar-mode.el +++ b/lisp/tar-mode.el @@ -1377,7 +1377,7 @@ to make your changes permanent." ;; Maybe update the datestamp. (when tar-update-datestamp (tar-alter-one-field tar-time-offset - (concat (tar-octal-time (current-time)) " ")))) + (concat (tar-octal-time nil) " ")))) ;; After doing the insertion, add any necessary final padding. (tar-pad-to-blocksize)) (set-buffer-modified-p t) ; mark the tar file as modified commit 353413a76b1bb607e1ce4368edf80890d2cc141b Author: Paul Eggert Date: Mon Aug 1 00:38:33 2022 -0700 * lisp/vc/vc.el: Remove stray comment hyphen. diff --git a/lisp/vc/vc.el b/lisp/vc/vc.el index d3e53858c1..b05adfb2d5 100644 --- a/lisp/vc/vc.el +++ b/lisp/vc/vc.el @@ -419,7 +419,7 @@ ;; AND you'd like the current time considered to be anything besides ;; (vc-annotate-convert-time (current-time)) -- i.e. the current ;; time with hours, minutes, and seconds included. Probably safe to -;; ignore. Return the current-time, in units of fractional days. +;; ignore. Return the current time, in units of fractional days. ;; ;; - annotate-extract-revision-at-line () ;; commit d6c054a00776d8d04f14a24102043bfd409f948a Author: Paul Eggert Date: Mon Aug 1 00:38:33 2022 -0700 Fix "cons up a storm" issue in type-break * lisp/type-break.el (type-break-time-last-command) (type-break-mode, type-break, type-break-check) (type-break-time-sum, type-break-keystroke-reset): Use integer timestamps; that’s good enough for this module. diff --git a/lisp/type-break.el b/lisp/type-break.el index dca5a43b89..320ccaf94a 100644 --- a/lisp/type-break.el +++ b/lisp/type-break.el @@ -46,11 +46,6 @@ ;; in the mode line instead, do M-x type-break-mode-line-message-mode ;; or set the variable of the same name to t. -;; This program can truly cons up a storm because of all the calls to -;; `current-time' (which always returns fresh conses). I'm dismayed by -;; this, but I think the health of my hands is far more important than a -;; few pages of virtual memory. - ;; This package was inspired by Roland McGrath's hanoi-break.el. ;; Several people contributed feedback and ideas, including ;; Roland McGrath @@ -263,7 +258,7 @@ It will be either \"seconds\" or \"keystrokes\".") (defvar type-break-keystroke-count 0) (defvar type-break-time-last-break nil) (defvar type-break-time-next-break nil) -(defvar type-break-time-last-command (current-time)) +(defvar type-break-time-last-command (time-convert nil 'integer)) (defvar type-break-current-time-warning-interval nil) (defvar type-break-current-keystroke-warning-interval nil) (defvar type-break-time-warning-count 0) @@ -362,7 +357,7 @@ problems." (setq type-break-time-last-break (or (type-break-get-previous-time) - (current-time))) + (time-convert nil 'integer))) ;; Schedule according to break time from session file. (type-break-schedule @@ -381,7 +376,7 @@ problems." (setq type-break-interval-start type-break-time-last-break) (- type-break-interval diff)) ;; Schedule from now. - (setq type-break-interval-start (current-time)) + (setq type-break-interval-start (time-convert nil 'integer)) (type-break-file-time type-break-interval-start) type-break-interval)) type-break-interval-start @@ -525,7 +520,7 @@ as per the function `type-break-schedule'." ;; remove any query scheduled during interactive invocation (remove-hook 'type-break-post-command-hook 'type-break-do-query) (let ((continue t) - (start-time (current-time))) + (start-time (time-convert nil 'integer))) (setq type-break-time-last-break start-time) (while continue (save-window-excursion @@ -676,9 +671,9 @@ keystroke threshold has been exceeded." (progn (type-break-keystroke-reset) (type-break-mode-line-countdown-or-break nil) - (setq type-break-time-last-break (current-time)) + (setq type-break-time-last-break (time-convert nil 'integer)) (type-break-schedule))) - (setq type-break-time-last-command (current-time)))) + (setq type-break-time-last-command (time-convert nil 'integer)))) (and type-break-keystroke-threshold (let ((keys (this-command-keys))) @@ -943,14 +938,13 @@ FRAC should be the inverse of the fractional value; for example, a value of ;;; misc functions -;; Compute the difference, in seconds, between a and b, two structures -;; similar to those returned by `current-time'. +;; Compute the difference, in seconds, between a and b, two time values. (defun type-break-time-difference (a b) (round (float-time (time-subtract b a)))) ;; Return a time value that is the sum of the time-value arguments. (defun type-break-time-sum (&rest tmlist) - (let ((sum '(0 0))) + (let ((sum 0)) (dolist (tem tmlist) (setq sum (time-add sum tem))) sum)) @@ -967,7 +961,7 @@ FRAC should be the inverse of the fractional value; for example, a value of (t (format "%d seconds" secs))))) (defun type-break-keystroke-reset () - (setq type-break-interval-start (current-time)) ; not a keystroke + (setq type-break-interval-start (time-convert nil 'integer)) (setq type-break-keystroke-count 0) (setq type-break-keystroke-warning-count 0) (setq type-break-current-keystroke-warning-interval commit afa67ed6f20780ee8e99a5cac1bcc4899d83adea Author: Paul Eggert Date: Mon Aug 1 00:38:33 2022 -0700 Fix year-285428751 bug in hanoi-unix-64 * lisp/play/hanoi.el (hanoi-move-period, hanoi, hanoi-unix) (hanoi-unix-64): Use integers, not floating point, to avoid rounding errors for timestamps greater than 2**53. diff --git a/lisp/play/hanoi.el b/lisp/play/hanoi.el index 227dd790af..58fb82b6ed 100644 --- a/lisp/play/hanoi.el +++ b/lisp/play/hanoi.el @@ -73,7 +73,7 @@ "Non-nil means that hanoi poles are oriented horizontally." :type 'boolean) -(defcustom hanoi-move-period 1.0 +(defcustom hanoi-move-period 1 "Time, in seconds, for each pole-to-pole move of a ring. If nil, move rings as fast as possible while displaying all intermediate positions." @@ -112,35 +112,32 @@ intermediate positions." (prefix-numeric-value current-prefix-arg)))) (if (< nrings 0) (error "Negative number of rings")) - (hanoi-internal nrings (make-list nrings 0) (float-time))) + (hanoi-internal nrings (make-list nrings 0) (time-convert nil 'integer))) ;;;###autoload (defun hanoi-unix () - "Towers of Hanoi, UNIX doomsday version. -Displays 32-ring towers that have been progressing at one move per -second since 1970-01-01 00:00:00 GMT. + "Towers of Hanoi, 32-bit UNIX doomsday version. +Display 32-ring towers that have been progressing at one move per +second since 1970-01-01 00:00:00 UTC. Repent before ring 31 moves." (interactive) - (let* ((start (ftruncate (float-time))) - (bits (cl-loop repeat 32 - for x = (/ start (expt 2.0 31)) then (* x 2.0) - collect (truncate (mod x 2.0)))) - (hanoi-move-period 1.0)) + (let* ((start (time-convert nil 'integer)) + (bits (nreverse (cl-loop repeat 32 + for x = start then (ash x -1) + collect (logand x 1)))) + (hanoi-move-period 1)) (hanoi-internal 32 bits start))) ;;;###autoload (defun hanoi-unix-64 () - "Like `hanoi-unix', but pretend to have a 64-bit clock. -This is, necessarily (as of Emacs 20.3), a crock. When the -`current-time' interface is made s2G-compliant, hanoi.el will need -to be updated." + "Like `hanoi-unix', but with a 64-bit clock." (interactive) - (let* ((start (ftruncate (float-time))) - (bits (cl-loop repeat 64 - for x = (/ start (expt 2.0 63)) then (* x 2.0) - collect (truncate (mod x 2.0)))) - (hanoi-move-period 1.0)) + (let* ((start (time-convert nil 'integer)) + (bits (nreverse (cl-loop repeat 64 + for x = start then (ash x -1) + collect (logand x 1)))) + (hanoi-move-period 1)) (hanoi-internal 64 bits start))) (defun hanoi-internal (nrings bits start-time) @@ -378,9 +375,10 @@ BITS must be of length nrings. Start at START-TIME." (/ (- tick flyward-ticks fly-ticks) ticks-per-pole-step)))))))) (if hanoi-move-period - (cl-loop for elapsed = (- (float-time) start-time) - while (< elapsed hanoi-move-period) - with tick-period = (/ (float hanoi-move-period) total-ticks) + (cl-loop for elapsed = (float-time (time-subtract nil start-time)) + while (time-less-p elapsed hanoi-move-period) + with tick-period = (/ (float-time hanoi-move-period) + total-ticks) for tick = (ceiling elapsed tick-period) do (hanoi-ring-to-pos ring (funcall tick-to-pos tick)) (hanoi-sit-for (- (* tick tick-period) elapsed))) @@ -389,7 +387,7 @@ BITS must be of length nrings. Start at START-TIME." (hanoi-sit-for 0))) ;; Always make last move to keep pole and ring data consistent (hanoi-ring-to-pos ring (car to)) - (if hanoi-move-period (+ start-time hanoi-move-period)))) + (if hanoi-move-period (time-add start-time hanoi-move-period)))) ;; update display and pause, quitting with a pithy comment if the user ;; hits a key. commit 2fd2008e6717189627019e30591bc788f7957917 Author: Paul Eggert Date: Mon Aug 1 00:38:32 2022 -0700 * src/timefns.c (Ffloat_time): Fix doc string. diff --git a/src/timefns.c b/src/timefns.c index 990b23a508..1112f17476 100644 --- a/src/timefns.c +++ b/src/timefns.c @@ -1253,7 +1253,7 @@ instead of the current time. See `format-time-string' for the various forms of a time value. WARNING: Since the result is floating point, it may not be exact. -If precise time stamps are required, use either `encode-time', +If precise time stamps are required, use either `time-convert', or (if you need time as a string) `format-time-string'. */) (Lisp_Object specified_time) { commit 24e1123241b5692628de08e2de23448e07861111 Author: Paul Eggert Date: Mon Aug 1 00:38:32 2022 -0700 Improve time-equal-p etc. performance * src/timefns.c (time_cmp): Return EMACS_INT, not int; no need to change callers. Compare (X . Z) to (Y . Z) quickly if X and Y are fixnums. diff --git a/src/timefns.c b/src/timefns.c index 078e1f40fb..990b23a508 100644 --- a/src/timefns.c +++ b/src/timefns.c @@ -1192,7 +1192,7 @@ For example, nil stands for the current time. */) /* Return negative, 0, positive if A < B, A == B, A > B respectively. A and B should be Lisp time values. */ -static int +static EMACS_INT time_cmp (Lisp_Object a, Lisp_Object b) { /* Compare nil to nil correctly, and handle other eq values quicker @@ -1201,6 +1201,12 @@ time_cmp (Lisp_Object a, Lisp_Object b) if (BASE_EQ (a, b)) return 0; + /* Compare (X . Z) to (Y . Z) quickly if X and Y are fixnums. + Do not inspect Z, as it is OK to not signal if A and B are invalid. */ + if (FASTER_TIMEFNS && CONSP (a) && CONSP (b) && BASE_EQ (XCDR (a), XCDR (b)) + && FIXNUMP (XCAR (a)) && FIXNUMP (XCAR (b))) + return XFIXNUM (XCAR (a)) - XFIXNUM (XCAR (b)); + /* Compare (ATICKS . AZ) to (BTICKS . BHZ) by comparing ATICKS * BHZ to BTICKS * AHZ. */ struct lisp_time ta = lisp_time_struct (a, 0); commit 0a4477415c9df7d2cce8906155caadaa092b167e Author: Paul Eggert Date: Mon Aug 1 00:38:32 2022 -0700 Improve float-time etc. performance * src/timefns.c (decode_float_time): Assume T is finite. All callers changed. (decode_time_components): Assume FORM is not TIMEFORM_FLOAT. All callers changed. (decode_lisp_time): If the specified time is a float, signal an error if it is not finite. (Ffloat_time): If the specified time is a float, simply return it. diff --git a/src/timefns.c b/src/timefns.c index c8becac863..078e1f40fb 100644 --- a/src/timefns.c +++ b/src/timefns.c @@ -387,9 +387,9 @@ enum { flt_radix_power_size = DBL_MANT_DIG - DBL_MIN_EXP + 1 }; equals FLT_RADIX**P. */ static Lisp_Object flt_radix_power; -/* Convert T into an Emacs time *RESULT, truncating toward minus infinity. - Return zero if successful, an error number otherwise. */ -static int +/* Convert the finite number T into an Emacs time *RESULT, truncating + toward minus infinity. Signal an error if unsuccessful. */ +static void decode_float_time (double t, struct lisp_time *result) { Lisp_Object ticks, hz; @@ -401,6 +401,7 @@ decode_float_time (double t, struct lisp_time *result) else { int scale = double_integer_scale (t); + eassume (scale < flt_radix_power_size); if (scale < 0) { @@ -412,8 +413,6 @@ decode_float_time (double t, struct lisp_time *result) which is typically better than signaling overflow. */ scale = 0; } - else if (flt_radix_power_size <= scale) - return isnan (t) ? EDOM : EOVERFLOW; /* Compute TICKS, HZ such that TICKS / HZ exactly equals T, where HZ is T's frequency or 1, whichever is greater. Here, “frequency” means @@ -431,7 +430,6 @@ decode_float_time (double t, struct lisp_time *result) } result->ticks = ticks; result->hz = hz; - return 0; } /* Make a 4-element timestamp (HI LO US PS) from TICKS and HZ. @@ -705,7 +703,7 @@ enum timeform TIMEFORM_TICKS_HZ /* fractional time: HI is ticks, LO is ticks per second */ }; -/* From the valid form FORM and the time components HIGH, LOW, USEC +/* From the non-float form FORM and the time components HIGH, LOW, USEC and PSEC, generate the corresponding time value. If LOW is floating point, the other components should be zero and FORM should not be TIMEFORM_TICKS_HZ. @@ -734,16 +732,7 @@ decode_time_components (enum timeform form, return EINVAL; case TIMEFORM_FLOAT: - { - double t = XFLOAT_DATA (low); - if (result) - return decode_float_time (t, result); - else - { - *dresult = t; - return 0; - } - } + eassume (false); case TIMEFORM_NIL: return decode_ticks_hz (timespec_ticks (current_timespec ()), @@ -830,7 +819,16 @@ decode_lisp_time (Lisp_Object specified_time, bool decode_secs_only, if (NILP (specified_time)) form = TIMEFORM_NIL; else if (FLOATP (specified_time)) - form = TIMEFORM_FLOAT; + { + double d = XFLOAT_DATA (specified_time); + if (!isfinite (d)) + time_error (isnan (d) ? EDOM : EOVERFLOW); + if (result) + decode_float_time (d, result); + else + *dresult = d; + return TIMEFORM_FLOAT; + } else if (CONSP (specified_time)) { high = XCAR (specified_time); @@ -878,7 +876,7 @@ decode_lisp_time (Lisp_Object specified_time, bool decode_secs_only, return form; } -/* Convert a Lisp timestamp SPECIFIED_TIME to double. +/* Convert a non-float Lisp timestamp SPECIFIED_TIME to double. Signal an error if unsuccessful. */ double float_time (Lisp_Object specified_time) @@ -1253,7 +1251,8 @@ If precise time stamps are required, use either `encode-time', or (if you need time as a string) `format-time-string'. */) (Lisp_Object specified_time) { - return make_float (float_time (specified_time)); + return (FLOATP (specified_time) ? specified_time + : make_float (float_time (specified_time))); } /* Write information into buffer S of size MAXSIZE, according to the commit 914cf4b91ba8bdf63cd10a66f970c396329beeab Author: Paul Eggert Date: Mon Aug 1 00:38:32 2022 -0700 Make time arithmetic more like comparison Since time comparison says X == X, have time arithmetic behave similarly for X - X. This should also be a bit faster due to not having to test for floats and NaNs. * src/timefns.c (time_arith, time_cmp): Simplify by not worrying about NaNs, which are not time values. (time_arith): Simplify by not worrying about subtracting nil from nil; the caller now handles this. (Ftime_subtract): Handle subtracting X from X specially. diff --git a/src/timefns.c b/src/timefns.c index 25bfda513c..c8becac863 100644 --- a/src/timefns.c +++ b/src/timefns.c @@ -1074,27 +1074,9 @@ lispint_arith (Lisp_Object a, Lisp_Object b, bool subtract) static Lisp_Object time_arith (Lisp_Object a, Lisp_Object b, bool subtract) { - if (FLOATP (a) && !isfinite (XFLOAT_DATA (a))) - { - double da = XFLOAT_DATA (a); - double db = float_time (b); - return make_float (subtract ? da - db : da + db); - } enum timeform aform, bform; struct lisp_time ta = lisp_time_struct (a, &aform); - - if (FLOATP (b) && !isfinite (XFLOAT_DATA (b))) - return subtract ? make_float (-XFLOAT_DATA (b)) : b; - - /* Subtract nil from nil correctly, and handle other eq values - quicker while we're at it. Compare here rather than earlier, to - handle NaNs and check formats. */ - struct lisp_time tb; - if (BASE_EQ (a, b)) - bform = aform, tb = ta; - else - tb = lisp_time_struct (b, &bform); - + struct lisp_time tb = lisp_time_struct (b, &bform); Lisp_Object ticks, hz; if (FASTER_TIMEFNS && BASE_EQ (ta.hz, tb.hz)) @@ -1201,27 +1183,23 @@ See `format-time-string' for the various forms of a time value. For example, nil stands for the current time. */) (Lisp_Object a, Lisp_Object b) { + /* Subtract nil from nil correctly, and handle other eq values + quicker while we're at it. This means (time-subtract X X) does + not signal an error if X is not a valid time value, but that's OK. */ + if (BASE_EQ (a, b)) + return timespec_to_lisp ((struct timespec) {0}); + return time_arith (a, b, true); } -/* Return negative, 0, positive if a < b, a == b, a > b respectively. - Return positive if either a or b is a NaN; this is good enough - for the current callers. */ +/* Return negative, 0, positive if A < B, A == B, A > B respectively. + A and B should be Lisp time values. */ static int time_cmp (Lisp_Object a, Lisp_Object b) { - if ((FLOATP (a) && !isfinite (XFLOAT_DATA (a))) - || (FLOATP (b) && !isfinite (XFLOAT_DATA (b)))) - { - double da = FLOATP (a) ? XFLOAT_DATA (a) : 0; - double db = FLOATP (b) ? XFLOAT_DATA (b) : 0; - return da < db ? -1 : da != db; - } - /* Compare nil to nil correctly, and handle other eq values quicker - while we're at it. Compare here rather than earlier, to handle - NaNs. This means (time-equal-p X X) does not signal an error if - X is not a valid time value, but that's OK. */ + while we're at it. This means (time-equal-p X X) does not signal + an error if X is not a valid time value, but that's OK. */ if (BASE_EQ (a, b)) return 0; commit e3b6242938fa9bcc3aebaa0eddd6aa561136dbf1 Author: Paul Eggert Date: Mon Aug 1 00:38:32 2022 -0700 Fix get-internal-runtime precision * src/sysdep.c (make_lisp_s_us): Also define if HAVE_GETRUSAGE. (Fget_internal_run_time): Don’t generate more precision than the underlying primitives. diff --git a/src/sysdep.c b/src/sysdep.c index c1545622df..efd9638b07 100644 --- a/src/sysdep.c +++ b/src/sysdep.c @@ -3169,7 +3169,8 @@ list_system_processes (void) #endif /* !defined (WINDOWSNT) */ -#if defined __FreeBSD__ || defined DARWIN_OS || defined __OpenBSD__ +#if (HAVE_GETRUSAGE \ + || defined __FreeBSD__ || defined DARWIN_OS || defined __OpenBSD__) static Lisp_Object make_lisp_s_us (time_t s, long us) @@ -4276,7 +4277,7 @@ does the same thing as `current-time'. */) usecs -= 1000000; secs++; } - return make_lisp_time (make_timespec (secs, usecs * 1000)); + return make_lisp_s_us (secs, usecs); #else /* ! HAVE_GETRUSAGE */ #ifdef WINDOWSNT return w32_get_internal_run_time (); commit 9d4633e934da77bc1c3617a9450ee17151f35271 Author: Paul Eggert Date: Mon Aug 1 00:38:32 2022 -0700 (time-equal-p nil X) returns nil * src/timefns.c (Ftime_equal_p): nil compares unequal to non-nil. diff --git a/doc/lispref/os.texi b/doc/lispref/os.texi index 2b49818ed3..5fb34fb9b6 100644 --- a/doc/lispref/os.texi +++ b/doc/lispref/os.texi @@ -2067,7 +2067,12 @@ This returns @code{t} if the time value @var{t1} is less than the time value @defun time-equal-p t1 t2 This returns @code{t} if the two time values @var{t1} and @var{t2} are -equal. +equal. The result is @code{nil} if either argument is a NaN. +For the purpose of comparison, a @code{nil} argument represents the +current time with infinite resolution, so this function returns +@code{nil} if one argument is @code{nil} and the other is not, and +callers can therefore use @code{nil} to represent an unknown time +value that does not equal any timestamp. @end defun @defun time-subtract t1 t2 diff --git a/src/timefns.c b/src/timefns.c index 9df50eaecc..25bfda513c 100644 --- a/src/timefns.c +++ b/src/timefns.c @@ -1258,7 +1258,9 @@ DEFUN ("time-equal-p", Ftime_equal_p, Stime_equal_p, 2, 2, 0, See `format-time-string' for the various forms of a time value. */) (Lisp_Object a, Lisp_Object b) { - return time_cmp (a, b) == 0 ? Qt : Qnil; + /* A nil arg compares unequal to a non-nil arg. This also saves the + expense of current_timespec if either arg is nil. */ + return NILP (a) == NILP (b) && time_cmp (a, b) == 0 ? Qt : Qnil; } commit 932c0bc1fc80a63fb4d6015c049592f3c228cc4f Author: Paul Eggert Date: Mon Aug 1 00:38:32 2022 -0700 Tune blv_found * src/lisp.h (blv_found): Prefer BASE_EQ to EQ where either will do. diff --git a/src/lisp.h b/src/lisp.h index 8fcc9b6e75..807fcb0e5b 100644 --- a/src/lisp.h +++ b/src/lisp.h @@ -3793,10 +3793,10 @@ make_symbol_constant (Lisp_Object sym) /* Buffer-local variable access functions. */ -INLINE int +INLINE bool blv_found (struct Lisp_Buffer_Local_Value *blv) { - eassert (blv->found == !EQ (blv->defcell, blv->valcell)); + eassert (blv->found == !BASE_EQ (blv->defcell, blv->valcell)); return blv->found; } commit ee0ce186621d788d9292afe8de9459d4af2d49c9 Author: Gerd Möllmann Date: Mon Aug 1 09:48:39 2022 +0200 ; * nextstep/Makefile.in: Fix last change (bug#56853). diff --git a/nextstep/Makefile.in b/nextstep/Makefile.in index ee883f3cff..82bf13bc92 100644 --- a/nextstep/Makefile.in +++ b/nextstep/Makefile.in @@ -26,6 +26,7 @@ srcdir = @srcdir@ abs_builddir = @abs_builddir@ abs_top_builddir = @abs_top_builddir@ EXEEXT = @EXEEXT@ +DUMPING = @DUMPING@ # abs_top_srcdir may contain ".." top_srcdir_abs = $(shell cd @top_srcdir@; pwd -P) @@ -46,7 +47,7 @@ ns_check_file = @ns_appdir@/@ns_check_file@ .PHONY: all ifeq ($(DUMPING),pdumper) -ns_pdump_target = ${ns_applibexecdir}/Emacs.pdmp +ns_pdmp_target = ${ns_applibexecdir}/Emacs.pdmp endif all: ${ns_appdir} ${ns_appbindir}/Emacs ${ns_pdmp_target}