Paul Eggert [Mon, 1 Aug 2022 07:38:34 +0000 (00:38 -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.
Paul Eggert [Mon, 1 Aug 2022 07:38:34 +0000 (00:38 -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.
Paul Eggert [Mon, 1 Aug 2022 07:38:34 +0000 (00:38 -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.
Paul Eggert [Mon, 1 Aug 2022 07:38:33 +0000 (00:38 -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.
Paul Eggert [Mon, 1 Aug 2022 07:38:33 +0000 (00:38 -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.
Paul Eggert [Mon, 1 Aug 2022 07:38:33 +0000 (00:38 -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.
* 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.
Paul Eggert [Mon, 1 Aug 2022 07:38:32 +0000 (00:38 -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.
Paul Eggert [Mon, 1 Aug 2022 07:38:32 +0000 (00:38 -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.
Paul Eggert [Mon, 1 Aug 2022 07:38:32 +0000 (00:38 -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.
Po Lu [Mon, 1 Aug 2022 05:51:59 +0000 (05:51 +0000)]
Implement primitive frame synchronization on Haiku
Instead of relying on a compositor to do the work, we simply
wait for VBLANK and hope that the update finishes soon enough.
* doc/lispref/frames.texi (Management Parameters): Document that
frame synchronization is now supported on Haiku.
* src/haiku_support.cc (class EmacsView): New field
`use_frame_synchronization'.
(FlipBuffers): Wait for vertical blanking period.
(be_set_use_frame_synchronization): New function.
* src/haiku_support.h: Update prototypes.
* src/haikufns.c (haiku_create_frame): Set
`use-frame-synchronization'.
(haiku_set_use_frame_synchronization)
(haiku_frame_parm_handlers): New param handler.
Declare `key-valid-p` and `readablep` as error-free
* lisp/keymap.el (key-valid-p):
* lisp/subr.el (readablep): These functions are effect-free; declare
them correspondingly. Note that readablep is not pure since its
return value depends on ambient state.
Stefan Kangas [Sun, 31 Jul 2022 16:16:45 +0000 (18:16 +0200)]
Make ps-def.el obsolete (part 1/2)
This file was created to maintain Emacs/XEmacs compat code more
easily, and no longer serves any purpose. It currently contains only
obsolete function and variable aliases.
* lisp/ps-def.el: Move from here...
* lisp/obsolete/ps-def.el: ...to here.
Stefan Kangas [Sun, 31 Jul 2022 11:15:22 +0000 (13:15 +0200)]
Remove some leftover compat code from ps-print
* lisp/ps-def.el (ps-mark-active-p): Make obsolete in favor of
'mark-active'. Update callers.
(ps-face-foreground-name): Make obsolete in favor of
'face-foreground'. Update callers.
(ps-face-background-name): Make obsolete in favor of
'face-background'. Update callers.
(ps-color-device): Make into obsolete function alias for
'display-color-p'. Update callers.
* lisp/emacs-lisp/rx.el (rx--to-expr, rx--pcase-transform):
Don't autoload.
(rx--pcase-macroexpander): Extract body into...
(rx--pcase-expand): ...a separate function, which is autoloaded.
* test/lisp/subr-tests.el (test-print-unreadable-function):
* test/src/print-tests.el (test-print-unreadable-function-buffer):
Instead of binding the value of nominally side-effect-free
expressions to an ignored variable (_), make use of them.
This is more robust and provides useful extra checks in the test.
* lisp/files.el (file-name-quoted-p): Autoload because it's
referred to from tramp-loaddefs.
* lisp/net/tramp.el (defvar): Put the entire form into the
loaddefs file instead of eval-and-compile -- this fixes a
dependency problem when byte-compiling the loaddefs file.
(tramp-methods, tramp-default-method-alist)
(tramp-default-user-alist, tramp-default-host-alist)
(tramp-local-host-regexp, tramp-terminal-type)
(tramp-foreign-file-name-handler-alist): Autoload to avoid
compilation warnings. Also put (require 'cl-lib) into the
loaddefs file for the same reason.
(tramp-ensure-dissected-file-name)
(tramp-set-completion-function)
(tramp-register-foreign-file-name-handler): Autoload.
* lisp/emacs-lisp/cl-macs.el (cl--optimize)
(cl-struct-sequence-type, cl-struct-slot-offset): Autoload since
they are referred to by code in cl-loaddefs.el.
Stefan Kangas [Sun, 31 Jul 2022 09:33:42 +0000 (11:33 +0200)]
Delete additional items obsolete since 20, 21 and 22
* lisp/font-lock.el (font-lock-reference-face): Delete variable
alias obsolete since 20.3.
* lisp/progmodes/cc-cmds.el (c-toggle-auto-state): Delete alias
obsolete since 22.1.
* lisp/replace.el (query-replace-regexp-eval): Delete function
obsolete since 22.1.
(replace-count, replace-re-search-function): Doc fixes; adjust for
above deleted function.
* lisp/net/tramp-archive.el (tramp-archive-file-name-handler):
Move to the main loaddefs file since it's referred to by functions
there.
* lisp/net/tramp.el (tramp-file-name-handler): Autoload to avoid
warning when byte-compiling loaddefs.el.
Fix further package.el loaddefs byte-compile warnings
* lisp/emacs-lisp/package.el (package-directory-list)
(package-quickstart-file): Specify group to avoid warning when
byte-compiling loaddefs.el.
(package-activated-list): Autoload since we're assigning the
variable from a function completely autoloaded.
* src/xterm.c (x_scroll_bar_create): Create an InputOnly window.
Update event masks accordingly and stop allocating back buffer.
(x_scroll_bar_remove): Stop deallocating back buffer.
(XTset_vertical_scroll_bar, x_scroll_bar_set_handle): Draw onto
the edit window so they can be synchronized with buffer flips.
(x_scroll_bar_clear): Redraw scroll bars instead of just
clearing them.
(x_scroll_bar_handle_expose, x_scroll_bar_redraw): New
functions.
(x_scroll_bar_expose, x_scroll_bar_end_update): Delete
functions.
(handle_one_xevent): Update exposure logic accordingly.
Stefan Kangas [Sat, 30 Jul 2022 23:44:22 +0000 (01:44 +0200)]
Delete redisplay-end-trigger-functions and related defuns
This variable and related functions have been obsolete since 23.1.
The last things to depend on this (fast-lock.el and lazy-lock.el) were
recently removed.
* src/dispextern.h (struct it): Delete field
'redisplay_end_trigger_charpos'.
* src/window.c (Fwindow_redisplay_end_trigger)
(Fset_window_redisplay_end_trigger): Delete defuns and corresponding
defsubrs for functions obsolete since 23.1.
* src/window.h (wset_redisplay_end_trigger): Delete function.
(GCALIGNED_STRUCT): Delete 'redisplay_end_trigger'.
* src/xdisp.c (run_redisplay_end_trigger_hook): Delete function.
(syms_of_xdisp) <redisplay_end_trigger_functions>: Delete
variable obsolete since 23.1.
(init_iterator, next_element_from_buffer): Don't run or set above
deleted hook variable.
* lisp/emacs-lisp/icons.el (icons--create): Choose another
character that's unlikely to appear in non-Emoji fonts. (Comment
left in place since this should be fixed in a less breakable way.)
* lisp/mail/mail-parse.el (mail-header-parse-address-lax):
* lisp/mail/ietf-drums.el (ietf-drums-parse-address): Clarify what
these functions do (bug#56824).
Stefan Kangas [Fri, 15 Jul 2022 16:08:34 +0000 (18:08 +0200)]
Make outline-view-change-hook obsolete
According to a comment, this hook "Seems only used by lazy-lock.
I.e. obsolete." But lazy-lock has been deleted.
* lisp/outline.el (outline-view-change-hook): Make obsolete.
Po Lu [Sat, 30 Jul 2022 03:26:46 +0000 (11:26 +0800)]
Minor improvements to precision scroll interpolation
* lisp/pixel-scroll.el (pixel-scroll-start-momentum): Bump GC
cons threshold temporarily. This leads to a very noticable
improvement to animation speed.
Po Lu [Sat, 30 Jul 2022 01:40:00 +0000 (09:40 +0800)]
Don't freeze if the compositing manager crashes
* src/xterm.c (x_if_event): New function, like XIfEvent but with
a timeout.
(x_sync_wait_for_frame_drawn_event): Disable frame
synchronization if x_if_event times out after 1 second.
Improve narrowing when iterator has moved outside of narrowing bounds.
* src/xdisp.c (get_narrowed_begv, get_narrowed_zv): Add 'pos'
parameter.
(init_iterator): Add arguments to 'get_narrowed_begv' and
'get_narrowed_zv'.
(handle_fontified_prop): Recompute the narrowing when iterator
has moved outside of narrowing bounds.
Po Lu [Fri, 29 Jul 2022 12:54:30 +0000 (20:54 +0800)]
Fix handling of extended frame resize synchronization
* src/xterm.c (x_sync_wait_for_frame_drawn_event): Don't wait if
the frame is invisible. If it is mapped again the compositing
manager is obliged to send us another event, so we can wait in
that case.
(x_sync_update_begin, x_sync_update_finish): Handle extended
resize synchronization here.
(XTframe_up_to_date, handle_one_xevent): Save stuff here.
* src/xterm.h (struct x_output): New field
`resize_counter_value'.