Po Lu [Wed, 3 Aug 2022 03:38:27 +0000 (11:38 +0800)]
Add preparations for animation frame timing support
* src/xterm.c (x_sync_get_monotonic_time)
(x_sync_current_monotonic_time, x_sync_note_frame_times): New
functions.
(x_sync_wait_for_frame_drawn_event, x_sync_update_begin)
(x_sync_handle_frame_drawn): Note frame times.
(x_display_set_last_user_time): Check if the X server time is
probably the same as CLOCK_MONOTONIC.
* src/xterm.h (struct x_display_info, struct x_output): New
fields and flags for clock handling and frame times.
Po Lu [Wed, 3 Aug 2022 01:28:44 +0000 (09:28 +0800)]
Fix window iconification, raising and lowering frames, etc
* src/xterm.c (XFlush): Remove define to 0.
(x_clear_frame, x_scroll_run, x_draw_window_cursor)
(x_free_frame_resources): Remove calls to XFlush where it is not
really necessary. Leave the calls that actually are intact.
* lisp/cedet/semantic/complete.el (semantic-displayer-focus-abstract):
Move before use of `cl-typep` on it.
(semantic-complete-current-match):
* lisp/cedet/ede/speedbar.el (ede-speedbar-menu): Use `cl-typep`
instead of `<class>-child-p`.
* lisp/cedet/semantic/db.el (semanticdb-get-buffer):
Use `cl-defgeneric` for the main/default definition.
(semantic-tag-parent-buffer): Add method.
* lisp/cedet/semantic/tag-file.el (semantic-tag-parent-buffer):
New generic function extracted from `semantic-go-to-tag`.
This allows us to keep the semanticdb-table part in semantic/db and
thus break a cyclic dependency.
(semantic-go-to-tag): Use it.
Demote to a plain `defun` since it's not overloaded anywhere.
* lisp/cedet/srecode/compile.el (srecode-template-inserter-newline-child-p):
Remove unused declaration.
(srecord-compile-inserter-newline-p): New generic function, so we can
move the `srecode-template-inserter-newline` case to `srecode/insert.el`,
to avoid a cyclic dependency.
* lisp/cedet/srecode/insert.el (srecord-compile-inserter-newline-p):
New method.
Eli Zaretskii [Tue, 2 Aug 2022 13:24:00 +0000 (16:24 +0300)]
; Clarify documentation of "locked narrowing"
* src/editfns.c (Fwiden, Fnarrow_to_region):
* doc/lispref/positions.texi (Narrowing): Explain when
'narrow-to-region' and 'widen' might have no effect.
Robert Pluim [Tue, 2 Aug 2022 12:20:42 +0000 (14:20 +0200)]
Remove duplicate key definitions from keymaps
* lisp/gnus/gnus-srvr.el (gnus-browse-mode-map): Remove binding for
'gnus-browse-prev-map'.
* lisp/gnus/gnus-sum.el (gnus-summary-mode-map): Remove
'gnus-summary-down-thread' binding, and by symmetry
'gnus-summary-up-thread' (it's still available on "T-u").
* lisp/ibuffer.el (ibuffer-mode-map): Remove binding for
'ibuffer-mark-for-delete'.
* lisp/wdired.el (wdired-perm-mode-map): Remove duplicate binding of
"s" to 'wdired-set-bit'.
* lisp/find-dired.el (find-dired-with-command): Set the
filter/sentinel immediately -- scheduling may make process output
(and exit) happen before these are set otherwise (bug#56865).
(find-dired-sort-by-filename): Don't bug out on error messages
from find.
* lisp/emacs-lisp/eldoc.el
(eldoc-display-message-no-interference-p): Don't disable eldoc
when edebugging (bug#56459). There should be no interference in
that case, because edebug messaging is done after stepping, and
eldoc messaging is done after other movements.
Po Lu [Tue, 2 Aug 2022 01:41:02 +0000 (09:41 +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.
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.
* 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.
Po Lu [Mon, 1 Aug 2022 11:00:48 +0000 (19:00 +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.
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.