1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2026-01-06 03:40:56 -08:00
Commit graph

174104 commits

Author SHA1 Message Date
Andrea Corallo
ffaf1cb235 Some clean-up in comp-tests.el
* test/src/comp-tests.el (comp-tests-cond-rw-checked-function)
(comp-tests-cond-rw-checker-val)
(comp-tests-cond-rw-expected-type)
(comp-tests-cond-rw-checker-type): Remove.
2024-07-11 16:26:49 +02:00
Andrea Corallo
baf74968f9 Fix 'comp--type-check-optim-block' it using 'comp-cstr-type-p'
* lisp/emacs-lisp/comp.el (comp--type-check-optim-block): Better
condition.
2024-07-11 16:26:49 +02:00
Andrea Corallo
0d6f3f134e Generalize 'comp-cstr-symbol-p'
* lisp/emacs-lisp/comp-cstr.el (comp-cstr-symbol-p): Make use of
'comp-cstr-type-p'.
2024-07-11 16:26:49 +02:00
Andrea Corallo
a1775552ce Add 'comp-type-check-optim' pass
* lisp/emacs-lisp/comp.el (comp-passes): Add 'comp--type-check-optim'.
(comp--type-check-optim-block, comp--type-check-optim): New functions.
2024-07-11 16:26:49 +02:00
Andrea Corallo
8538a281f5 Split 'comp--ssa' code
* lisp/emacs-lisp/comp.el (comp--ssa-function): New function.
(comp--ssa): Update.
2024-07-11 16:26:49 +02:00
Paul Eggert
c3e6923b00 Rename timefns static function lisp_time_struct
* src/timefns.c (lisp_time_cform): Rename from lisp_time_struct,
since it no longer returns a struct, and now accepts CFORM.
All uses changed.
2024-07-11 16:01:41 +02:00
Paul Eggert
e30706fd12 Avoid mpz for some common timestamp cases
Performance problem reported by Gerd Möllmann and Mattias Engdegård in:
https://lists.gnu.org/r/emacs-devel/2024-06/msg00530.html
https://lists.gnu.org/r/emacs-devel/2024-06/msg00539.html
* src/timefns.c (CFORM_SECS_ONLY): The exact tv_nsec value is now
ignored if nonnegative (i.e., the only thing that matters is that
it’s nonnegative).
(decode_time_components): Use intmax_t instead of mpz arithmetic
if the tick count fits.  Add another ‘default: eassume (false);’
so that the revised code pacifies --enable-gcc-warnings with GCC
11.4.0 on x86-64.
2024-07-11 16:01:41 +02:00
Paul Eggert
e8b3c4cb58 Decode current time directly to timespec
* src/timefns.c (decode_time_components): If FASTER_TIMEFNS, when
returning the current time and the desired form is struct timespec
or time_t, return it directly rather than converting it to struct
ticks_hz and then to struct timespec.  This can avoid some mpz
calculations and/or bignums.
2024-07-11 16:01:41 +02:00
Paul Eggert
75f53d7c2c In timefns.c avoid by-hand overflow checking
Prefer functions like ckd_add to do overflow checking, instead of
doing it by hand, to simplify and I hope to make things a bit less
error prone.
* src/timefns.c (TIME_T_MIN, TIME_T_MAX): Remove.  All by-hand
overflow checking replaced with calls to ckd_add or ckd_mul.
(s_ns_to_timespec): New static function, that uses ckd_add
instead of by-hand overflow checking.
(ticks_hz_to_timespec): Use it.
(check_tm_member): Use mpz_fits_sint_p and mpz_get_si rather
than mpz_to_intmax and by-hand overflow checking.
2024-07-11 16:01:41 +02:00
Paul Eggert
0c850df888 Optimize smallish mpz to native int conversion
* src/bignum.c (make_integer_mpz, mpz_to_intmax):
If FASTER_BIGNUM, optimize the common case where the value fits in
long int.  In this case we can use mpz_fits_slong_p and mpz_get_si
instead of looping with mpz_getlimbn.
(mpz_to_uintmax): Likewise for unsigned long int and mpz_get_ui.
2024-07-11 16:01:41 +02:00
Paul Eggert
1c8e64a953 New FASTER_BIGNUM macro to test slow-path code
* src/bignum.h (FASTER_BIGNUM): New macro.
(mpz_set_intmax, mpz_set_uintmax): Optimize only if FASTER_BIGNUM.
Also, use ckd_add to test for overflow instead of doing it by hand.
2024-07-11 16:01:41 +02:00
Paul Eggert
2fb7bb41be In timefns, call natnump only for non-fixnums
* src/timefns.c (decode_time_components): Call Fnatnump only
for non-fixnums, as we need to special-case 0 anyway.
2024-07-11 16:01:41 +02:00
Paul Eggert
b6cbf0cbb6 In timefns, do gcd reduction more often
* src/timefns.c (ticks_hz_hz_ticks): Reduce by gcd
even if t.ticks is not a fixnum, since that’s easy.
2024-07-11 16:01:41 +02:00
Paul Eggert
abafc6ca01 In timefns, prefer ui mul and div
* src/timefns.c (ticks_hz_hz_ticks): If the multiplier
is a fixnum that fits in unsigned long, use mpz_mul_ui
instead of the more-expensive mpz_mul.  Similarly, if the
divisor is a fixnum that fits in unsigned long, use
mpz_fdiv_q_ui instead of mpz_fdiv_q.
2024-07-11 16:01:41 +02:00
Paul Eggert
6ef052d9b2 Reduce size of integer product in timefns
* src/timefns.c (emacs_gcd): New static function.
(ticks_hz_hz_ticks): Use it to reduce the size of the integer
product in the common case when converting from ns to ps.  For
that, we need to multiply t.ticks only by 10³, not multiply by
10¹² and then divide by 10⁹.  This avoids the need to use bignums
in a significant number of cases.
2024-07-11 16:01:41 +02:00
Paul Eggert
5e8a38ecb2 Rename timefns internals
The old names didn’t fit in the conventions used for newer names.
* src/timefns.c (struct ticks_hz): Rename from struct lisp_time.
(union c_time): Rename lt to th.
(ticks_hz_hz_ticks): Rename from lisp_time_hz_ticks.
(ticks_hz_seconds): Rename from lisp_time_seconds.
All uses changed.
2024-07-11 16:01:41 +02:00
Paul Eggert
a6a3f32245 Speed up decode-time when not doing subseconds
* src/timefns.c (Fdecode_time): Avoid some unnecessary conversions
in the common case where subsecond resolution is not required.
2024-07-11 16:01:41 +02:00
Paul Eggert
34bde2f790 Push some time conversions down
* src/timefns.c: Push some time conversions down to lower level fns.
This is a win in its own right and should allow for further speedups.
(lisp_to_timespec): Remove; this convenience function is no longer
needed now that there would be only one caller.  Remaining caller
changed to use definiens.
(enum cform): New constant CFORM_TIMESPEC.  Also, CFORM_SECS_ONLY
now generates a struct timespec instead of a struct lisp_time.
(union c_time.ts): New member.
(decode_ticks_hz): Handle new struct timespec cases.
(decode_float_time, lisp_time_struct): New arg cform, and return
union c_time rather than struct lisp_time.  All callers changed.
(list4_to_timespec, lisp_time_argument, lisp_seconds_argument):
Let lower-level function do the conversion, to allow for better
optimization.
2024-07-11 16:01:41 +02:00
Paul Eggert
22a3a90f76 Split lisp_to_timespec in two
* src/timefns.c (ticks_hz_to_timespec): New function,
which is almost all the old lisp_to_timespec but with
a 2-arg API.  This should help further changes.
(lisp_to_timespec): Use it.
2024-07-11 16:01:41 +02:00
Paul Eggert
c45ae286b5 Refactor decode_ticks_hz via switch
* src/timefns.c (decode_ticks_hz): Change ?: to ‘switch’,
for benefit of future changes.
2024-07-11 16:01:41 +02:00
Paul Eggert
0e221d3789 Refactor timefns order
Move definitions around in timefns.c.  This does not affect the
implementation; it merely makes future changes easier to follow.
* src/timefns.c (frac_to_double, mpz_time, lisp_to_timespec)
(enum cform, union c_time, decode_ticks_hz): Move earlier.
2024-07-11 16:01:41 +02:00
Paul Eggert
35365620e4 Refactor timefns more functionally
Use a more-functional style in timefns.c, rather than passing
pointers to objects that are filled in.  Although this does not
change behavior, it should help future improvements to the code.
* src/keyboard.c (decode_timer): Return a possibly-invalid struct
timespec instead of storing a timespec into a location specified
by an arg, and returning bool.  All callers changed.
* src/systime.h (struct lisp_time): Move from here to src/timefns.c,
since the type is private to timefns.c.
* src/timefns.c (decode_float_time, decode_ticks_hz):
Return timestamp instead of storing it into a location specified
by an arg.  All callers changed.
(enum cform, union c_time, struct err_time, struct form_time):
New types, to aid functional style.
(decode_time_components): Return struct err_time
instead of returning err and storing timestamp into a location
specified by an arg.  New arg cform.  All callers changed.
(decode_lisp_time): Return struct form_time instead of returning
form and storing timestamp into a location specified by an arg.
New arg cform, replacing decode_secs_only.  All callers changed.
(list4_to_timespec): Return possibly-invalid timestamp instead
of returning a bool and storing timestamp into a location specified
by an arg.  All callers changed.
(lisp_time_struct): Omit no-longer-needed arg PFORM.
All callers changed.
2024-07-11 16:01:41 +02:00
Po Lu
166685a7d9 Merge from savannah/emacs-30
e0b271e279 Take precautions against ill-formed content URIs
9331ab056a etags-regen-mode: Handle TAGS buffer being killed
ef3f26ec02 ; Tag ERC multiline blanks test as :expensive
945335fec1 Improve 'put-image' documentation
c38d5cc3b2 Improve 'set-fontset-font' documentation
7de4dbea08 Adapt Tramp's "run0" method
871585db4c * test/src/sqlite-tests.el (sqlite-execute-batch): Declar...
5cf8d60e0d Capitalize "Dired" and "Lisp" in docstrings
37475c9af7 Document Eshell entry points

# Conflicts:
#	etc/NEWS
2024-07-11 11:40:34 +08:00
Po Lu
e0b271e279 Take precautions against ill-formed content URIs
* java/org/gnu/emacs/EmacsService.java (openContentUri)
(checkContentUri): Verify that URIs derived from user-provided
file names can be parsed before attempting to open them.
2024-07-11 11:38:41 +08:00
Dmitry Gutov
9331ab056a etags-regen-mode: Handle TAGS buffer being killed
* lisp/progmodes/etags-regen.el (etags-regen--visit-table):
Use kill-buffer-hook to ensure a refresh if the TAGS buffer is
killed manually (bug#71727).
(etags-regen--tags-cleanup):
Bind the hook var to nil to avoid an infloop.
2024-07-11 03:49:28 +03:00
F. Jason Park
ef3f26ec02 ; Tag ERC multiline blanks test as :expensive
* test/lisp/erc/erc-tests.el
(erc--check-prompt-input-for-multiline-blanks): Move message-capturing
business outside of primary fixture.  Extend subprocess sleep duration
to 5m.  Delete some unreachable code.  (Bug#72004)
2024-07-10 15:50:26 -07:00
Michael Albinus
29aeed7218 ; * test/lisp/net/dbus-tests.el: Fix thinko. 2024-07-10 18:28:43 +02:00
Paul Eggert
831539542f * lib/timespec-sub.c: Copy manually from Gnulib. 2024-07-10 18:18:07 +02:00
Robert Pluim
945335fec1 Improve 'put-image' documentation
* doc/lispref/display.texi (Showing Images): Mention that it returns the
created overlay.
* lisp/image.el (put-image): And here.
2024-07-10 16:08:29 +02:00
Robert Pluim
c38d5cc3b2 Improve 'set-fontset-font' documentation
* doc/emacs/mule.texi (Modifying Fontsets): Add an 'emoji' example.
2024-07-10 16:08:29 +02:00
Michael Albinus
7de4dbea08 Adapt Tramp's "run0" method
* doc/misc/tramp.texi (Inline methods):
* etc/NEWS: Adapt "run0" entry.

* lisp/net/tramp-sh.el (tramp-enable-run0-method): Adapt "run0"
arguments.
2024-07-10 11:58:22 +02:00
Andrea Corallo
871585db4c * test/src/sqlite-tests.el (sqlite-execute-batch): Declare to wave warning. 2024-07-10 10:24:46 +02:00
Michael Albinus
a29a385ee5 Extend dbus-test04-call-method-authorizable
* test/lisp/net/dbus-tests.el
(dbus--test-method-authorizable-handler): New defun.
(dbus-test04-call-method-authorizable): Extend test.
2024-07-10 09:50:09 +02:00
Po Lu
338337ec32 * configure.ac: Fix typo in commentary of strlen substitute. 2024-07-10 10:39:33 +08:00
Jim Porter
8e46f44ea0 Improve Eshell's behavior when waiting for processes
This has a few benefits.  First, it fixes a race condition when killing
old processes in 'eshell-command'.  Second, the "wait" built-in command
is now more useful.  Finally, killing processes when exiting Eshell (via
'eshell-round-robin-kill') should be much faster.

* lisp/eshell/esh-proc.el (esh-opt): Require.
(eshell-wait-for-process): Make obsolete in favor of...
(eshell-wait-for-processes): ... this.  Accept a timeout and support
PIDs.  Update callers.
(eshell/wait): New implementation accepting -t/--timeout.
(eshell-round-robin-kill): Use 'eshell-wait-for-processes'.

* lisp/eshell/eshell.el (eshell-command): Use 'eshell-round-robin-kill'.

* doc/misc/eshell.texi (List of Built-ins): Document the new "wait"
behavior.

* etc/NEWS: Announce this change.
2024-07-09 17:28:32 -07:00
Jim Porter
342998511a Don't use the Lisp implementation of "kill" in remote Eshell directories
* lisp/eshell/esh-proc.el (eshell/kill): When in a remote directory,
fall back to the external "kill" program (bug#72013).
2024-07-09 17:19:26 -07:00
Stefan Kangas
5cf8d60e0d Capitalize "Dired" and "Lisp" in docstrings
* lisp/desktop.el (desktop-no-desktop-file-hook):
* lisp/dired-x.el (dired-mark-sexp):
* lisp/dired.el (dired-make-directory-clickable)
(dired-map-over-marks, dired-file-name-at-point)
(dired-save-positions, dired-buffers-for-dir)
(dired-buffers-for-dir-or-subdir, dired-fun-in-all-buffers)
(dired-remove-entry, dired-delete-entry, dired-jump):
* lisp/files.el (save-buffer):
* lisp/find-dired.el (find-ls-option):
* lisp/hilit-chg.el:
* lisp/locate.el (locate-mode):
* lisp/msb.el (msb-dired-item-handler, msb-sort-by-directory):
* lisp/printing.el (pr-ps-printer-alist, pr-ps-utility-alist):
* lisp/uniquify.el (uniquify-trailing-separator-p):
* lisp/wdired.el (wdired, wdired-change-to-dired-mode, wdired-exit):
* lisp/woman.el (woman-dired-define-keys, woman-dired-find-file):
Capitalize "Dired" and "Lisp" in docstrings.  Found with checkdoc.
2024-07-10 00:36:19 +02:00
Andrea Corallo
57defada88 * test/src/comp-tests.el (compile-forms): Simplify test. 2024-07-09 22:44:28 +02:00
Andrea Corallo
b9b9322a8e Support interpreted functions as input for 'native-compile' (bug#71934)
* lisp/emacs-lisp/comp.el (comp--spill-lap-single-function): New function.
(comp--spill-lap-function): Make use of and do not accept
'(closure ...' as input.
(comp--spill-lap-function): Specialize on interpreted functions as
well.
(native-compile): Update doc.
* test/src/comp-tests.el (compile-interpreted-functions): New test.
2024-07-09 22:44:23 +02:00
Jim Porter
37475c9af7 Document Eshell entry points
* doc/misc/eshell.texi (Entry Points): New chapter.
(Scripts): Move under Entry Points.  Expand documentation.
2024-07-09 10:03:35 -07:00
Mattias Engdegård
ac797f6016 ; * lisp/net/shr.el (shr-image-zoom-levels): Fix wrong type. 2024-07-09 18:31:46 +02:00
Mattias Engdegård
7e358aa706 Use cheaper string constructors
* src/coding.c (make_string_from_utf8):
* src/fileio.c (file_name_directory):
* src/lread.c (Fintern):
* src/gnutls.c (Fgnutls_format_certificate):
Use `make_multibyte_string` and `make_unibyte_string` instead of
more expensive `make_specified_string` and `make_string_from_bytes`.
2024-07-09 18:31:46 +02:00
Michael Albinus
acfc3884bf Warn if D-Bus error "InteractiveAuthorizationRequired" occurs
* lisp/net/dbus.el
(dbus-error-interactive-authorization-required): New defconst.
(dbus-warn-interactive-authorization-required): New defun.
(dbus-event-error-functions): Add it.
2024-07-09 17:37:50 +02:00
Po Lu
df26519500 Merge from savannah/emacs-30
8350ebd22e Fix bug#71929
8f96e0064f ; Change `imap-shell-host` docstring to mention SSH
2024-07-09 22:04:03 +08:00
Po Lu
8350ebd22e Fix bug#71929
* src/image.c (free_image_cache): Unconditionally release image
cache, as this function is only called with its existence
already established.

* src/xfaces.c (free_frame_faces): Clear FRAME_IMAGE_CACHE (f).
(bug#71929)
2024-07-09 22:02:22 +08:00
Po Lu
4ca35cbb6e ; * src/dbusbind.c (Fdbus_message_internal): Fix coding style. 2024-07-09 21:16:54 +08:00
Stefan Kangas
8f96e0064f ; Change imap-shell-host docstring to mention SSH
* lisp/net/imap.el (imap-shell-host): Doc fix; mention SSH instead of
rlogin.
2024-07-09 14:09:45 +02:00
Michael Albinus
813ca8c214 Adapt dbus-tests.el
* test/lisp/net/dbus-tests.el
(dbus-test04-call-method-authorizable): New test.
(dbus--test-signal-handler): Remove debug message.
2024-07-09 14:01:07 +02:00
Steven Allen
551a71c313 Support interactive D-Bus authorization
When invoking D-Bus methods, let the user enable interactive
authorization by passing an :authorizable t parameter.  This makes
it possible to D-Bus methods that require polkit authorization.

* configure.ac (HAVE_DBUS_MESSAGE_SET_ALLOW_INTERACTIVE_AUTHORIZATION):
Set a new variable if `dbus_message_set_allow_interactive_authorization'
is available.

* src/dbusbind.c (dbus-message-internal): Allow interactive
authorization by passing :authorizable t.

* doc/misc/dbus.texi (Synchronous Methods, Asynchronous Methods):
* etc/NEWS:
* lisp/net/dbus.el (dbus-call-method-asynchronously): Document the
new parameter.
2024-07-09 13:16:43 +02:00
Michael Albinus
24cad0e2e7 Make D-Bus tests stable
* test/lisp/net/dbus-tests.el (dbus-debug): Declare, not define.
(dbus--test-event-expected): New defvar.
(dbus--test-signal-handler): Check for `dbus--test-event-expected'.
(dbus-test05-register-signal-with-nils)
(dbus-test08-register-monitor): Adapt tests.
2024-07-09 12:11:13 +02:00