Paul Eggert [Sat, 20 Jul 2024 07:17:14 +0000 (00:17 -0700)]
Avoid accessing uninitialized bool_vector words
Although loading uninitialized works from memory and then ignoring
the result works fine on conventional architectures, it
technically has undefined behavior in C, so redo bool_vector
allocation so that the code never does that. This can improve
performance when allocating large vectors of nil, since calloc can
clear the memory lazily.
* src/alloc.c (make_clear_bool_vector): New function,
a generalization of make_uninit_bool_vector.
(make_uninit_bool_vector): Use it.
(Fmake_bool_vector): If !INIT, rely on make_clear_bool_vector.
* src/alloc.c (Fbool_vector):
* src/fns.c (Freverse): Don’t access uninitialized bool_vector words.
* src/xdisp.c (Fremember_mouse_glyph) [CONVERT_TO_EMACS_RECT]:
Expand CONVERT_TO_EMACS_RECT to convert native rectangles into
a readable format if required. Reported by Stefan Kangas
<stefankangas@gmail.com>.
Po Lu [Sat, 20 Jul 2024 03:28:47 +0000 (11:28 +0800)]
Respect mouse-fine-graned-tracking in touch screen simple translation
* lisp/touch-screen.el (touch-screen-current-tool): Expand doc
string.
(touch-screen-handle-point-update): Record extents of glyph
beneath the mouse as computed by `remember_mouse_glyph' if
necessary, and defer generation of mouse-movement events till
the mouse exit it.
* src/xdisp.c (Fremember_mouse_glyph): New function.
(syms_of_xdisp): Define new subr.
Paul Eggert [Fri, 19 Jul 2024 20:39:21 +0000 (13:39 -0700)]
Work around GCC bug 58416 on 32-bit x86
* configure.ac (C_SWITCH_MATCHINE): On 32-bit x86 with GCC 4+,
append -mfpmath=sse (if SSE2 is known to work) or -fno-tree-sra
(otherwise) to work around GCC bug 58416.
* etc/NEWS: Mention this.
Paul Eggert [Fri, 19 Jul 2024 19:44:35 +0000 (12:44 -0700)]
In ‘INSTALL’ put configure vars in one section
* INSTALL: Move description of CFLAGS etc. into the section headed
“Here is a complete list of the variables you may want to set”
since they are also variables one might want to set.
Jim Porter [Fri, 19 Jul 2024 16:34:03 +0000 (09:34 -0700)]
Don't set exit info in Eshell if the command is being piped elsewhere
Previously, the exit info in Eshell was that of the last command that
finished, rather than the last command in a pipeline.
* lisp/eshell/esh-cmd.el (eshell-exec-lisp)
(eshell-lisp-command): Check whether the command is being piped.
* lisp/eshell/esh-proc.el (eshell-gather-process-output): Record whether
the command is being piped...
(eshell-sentinel): ... and do the right thing with that info.
* test/lisp/eshell/esh-proc-tests.el
(esh-proc-test/sigpipe-exits-process): Check the exit status to ensure
we don't report the first process's SIGPIPE exit.
Jim Porter [Tue, 24 Jan 2023 01:21:57 +0000 (17:21 -0800)]
Split out exit code parts of 'eshell-close-handles' into a new function
* lisp/eshell/esh-cmd.el (eshell-last-command-status)
(eshell-last-command-result): Move here from esh-io.el.
(eshell-set-exit-info): New function, extracted from
'eshell-close-handles'.
* lisp/eshell/esh-io.el (eshell-close-handles): Make old calling
convention obsolete. Update callers to use 'eshell-set-exit-info' as
needed.
* lisp/play/gamegrid.el (gamegrid-add-score-insecure): Move point to
the score just added, or end of buffer if the new score did not make
the list. This makes it easier to see where the last game
ranked. (Bug#72185)
Jim Porter [Thu, 18 Jul 2024 18:43:34 +0000 (11:43 -0700)]
Improve implementation of built-in Eshell "kill" command
* lisp/eshell/esh-proc.el (eshell/kill): Fix handling of commands like
"kill 123". Use REMOTE when signalling PIDs in remote directories.
Signal using process objects when possible. Report errors when failing
to signal.
* test/lisp/eshell/esh-proc-tests.el (esh-proc-test/kill/process-id)
(esh-proc-test/kill/process-object): New tests (bug#72013).
Jim Porter [Wed, 17 Jul 2024 05:07:33 +0000 (22:07 -0700)]
Improve handling of deferrable Eshell commands
Now, we use the 'eshell-deferrable' wrapper to wrap a form that returns
a process (or list thereof). This improves upon the old method, which
failed to handle 'eshell-replace-command' correctly. In that case,
Eshell would fail to unmark commands as deferrable when necessary
(e.g. for commands in pipelines).
* lisp/eshell/esh-cmd.el (eshell-deferrable-commands): Make into a
defvar.
(eshell-deferrable): New function...
(eshell-structure-basic-command): ... use it.
(eshell-trap-errors): Rename to...
(eshell-do-command): ... this, and use 'eshell-deferrable'. Update
callers.
(eshell--unmark-deferrable): Remove. Update callers.
(eshell-execute-pipeline): Remove 'eshell-process-identity'.
(eshell-process-identity, eshell-named-command*, eshell-lisp-command*):
Make obsolete.
* test/lisp/eshell/esh-cmd-tests.el (eshell-test-replace-command): New
function.
(esh-cmd-test/pipeline/replace-command): New test.
Stefan Kangas [Tue, 16 Jul 2024 02:34:53 +0000 (04:34 +0200)]
Use strnlen to avoid unnecessary work in pgtkfns.c
* src/pgtkfns.c (pgtk_get_defaults_value, pgtk_set_defaults_value):
Factor out new function...
(pgtk_check_resource_key_length): ...to here. Avoid unnecessary work by
using strnlen.
Eli Zaretskii [Thu, 18 Jul 2024 09:59:28 +0000 (12:59 +0300)]
Minor cleanup of code in insdel.c
* src/insdel.c (del_range_2): Update *_BYTE variables _after_
updating the corresponding character values. This follows what we
do everywhere else, and allows to put a watchpoint on, say, Z_BYTE
to check consistency between the character and byte counts. See
bug#72165 for one situation where it is useful.
Po Lu [Tue, 16 Jul 2024 02:14:30 +0000 (10:14 +0800)]
Port better to Android 3.0
* java/org/gnu/emacs/EmacsNoninteractive.java (main): Use the
old getPackageInfo calling convention if it exists rather than
on Android 2.3.3 and earlier.
Paul Eggert [Wed, 17 Jul 2024 15:13:31 +0000 (08:13 -0700)]
Go back to preferring -isystem to -I
* configure.ac: Go back to preferring -isystem to -I,
as headers like <gobject/gparam.h> still need it. This
reverts almost all of 2024-07-16T02:25:44!eggert@cs.ucla.edu,
except that the ‘nw="$nw -Wsystem-headers"’ line continues to
be removed as it is no longer needed due to recent Gnulib changes.
Problem reported by Eli Zaretskii in:
https://lists.gnu.org/r/emacs-devel/2024-07/msg00756.html
Notive the nested "*" blob inside the the {} group.
Eglot used to reject them in 'workspace/didChangeWatchedFiles' requests,
responding with "Internal Error". This could confuse some servers. Now
I've done some changes to the state machine generation and it supports
them.
* lisp/progmodes/eglot.el (eglot--glob-parse): Relax parser.
(eglot--glob-fsm): New helper.
(eglot--glob-compile, eglot--glob-emit-{}): Use it.
* test/lisp/progmodes/eglot-tests.el (eglot-test-glob-test):
Uncomment some test cases.
Paul Eggert [Tue, 16 Jul 2024 16:19:31 +0000 (09:19 -0700)]
Check for more ‘find’ failures and port ‘find’
* Makefile.in (install-eln), configure.ac (emacs_cv_find_delete):
* make-dist: Use ‘find ... -exec CMD {} +’ rather than ‘find
... -exec CMD {} \;’ so that if CMD fails, ‘find’ fails too.
* Makefile.in (install-eln): Port to ‘find’ implementations that
behave differently from GNU ‘find’ when given an argument
that contains ‘{}’ within a longer string. POSIX allows
this behavior.
Paul Eggert [Tue, 16 Jul 2024 02:41:35 +0000 (19:41 -0700)]
Quote BIN_DESTDIR better
* Makefile.in (BIN_DESTDIR, install-eln, uninstall):
* src/Makefile.in ($(pdmp)):
Be more consistent about quoting BIN_DESTDIR and ELN_DESTDIR,
avoiding double-quoting ''like this'' which does not work as
expected.
Paul Eggert [Tue, 16 Jul 2024 02:25:44 +0000 (19:25 -0700)]
Prefer -I to -isystem
* configure.ac: Simplify configuration by using -I instead of
-isystem, as -isystem is no longer helpful for suppressing
diagnostics (and likely has not been helpful for years).
Do not suppress -Wsystem-headers, as Gnulib no longer enables it.
Paul Eggert [Mon, 15 Jul 2024 00:00:56 +0000 (01:00 +0100)]
Simplify time form analysis
This does not change behavior; it merely refactors the code
for simplicity.
* src/timefns.c (enum timeform, struct form_time):
Remove. All uses removed.
(decode_time_components): Accept HZ instead of FORM.
This saves a switch. All uses changed.
(decode_lisp_time): Return union c_time instead of struct form_time.
All uses changed.
(lisp_time_cform): Remove. All uses changed to just use
decode_lisp_time.
(time_arith, Ftime_convert): Check (TICKS . HZ) form directly
using CONSP, instead of using the old struct form_time.
That's fast enough here.
Paul Eggert [Sun, 14 Jul 2024 16:36:01 +0000 (17:36 +0100)]
Test !FASTER_TIMEFNS with builtin resolutions
* src/timefns.c (timespec_hz, trillion, ztrillion):
If !FASTER_TIMEFNS, do not optimize the calculations of
these variables. This gives better test coverage of the
slow-path code, when compiling with -DFASTER_TIMEFNS=0.
(NEED_ZTRILLION_INIT): Move up, to simplify #ifdefery.
Now defined or not defined, instead of being 1 or not defined,
since it is used only via #ifdef.
Paul Eggert [Sun, 14 Jul 2024 22:45:31 +0000 (23:45 +0100)]
Fix buffer size problem in print_bool_vector
* src/print.c (print_bool_vector): Don’t assume SIZE fits
into ptrdiff_t, since it is an EMACS_INT. This
pacifies gcc -Wformat-overflow on i686 --with-wide-int.
* src/textconv.c (get_conversion_field): Set max value to
PTRDIFF_MAX, not MOST_POSITIVE_FIXNUM, since the variable is
ptrdiff_t, not EMACS_INT. Problem caught by gcc -Woverflow on a
32-bit platform with --with-wide-int.
Paul Eggert [Sun, 14 Jul 2024 19:53:28 +0000 (20:53 +0100)]
Pacify 32-bit GCC 14.1.1 in timer_check_2
* src/keyboard.c (timer_check_2): Refactor to make flow control
more obvious, to pacify -Wanalyzer-use-of-uninitialized-value with
gcc 14.1.1 20240607 (Red Hat 14.1.1-5) on i686.
Paul Eggert [Fri, 12 Jul 2024 16:23:30 +0000 (17:23 +0100)]
Use Gnulib workaround for Android strnlen bug
The workaround for the Android 5.0 (API 21) strnlen bug
is now done in m4/strnlen.m4, taken from Gnulib, so
there is no need for Emacs to have its own workaround.
* configure.ac (ORIGINAL_AC_FUNC_STRNLEN, AC_FUNC_STRNLEN):
Remove.
Previously, project-kill-buffers always called (project-current t). A
Lisp program could change what project project-kill-buffers operated
on by binding project-current-directory-override. However, in some
edge cases (for example, if the project was deleted between looking it
up and calling project-kill-buffers) this might fail to detect a
project, and so (project-current t) would prompt the user.
To avoid this, accept the project to kill buffers for as an argument.
* lisp/progmodes/project.el (project-kill-buffers): Take project as an
optional argument (bug#72019).
Peter Oliver [Mon, 15 Jul 2024 11:03:47 +0000 (12:03 +0100)]
Fix intermittent failure of dired-test-bug27243-02
* test/lisp/dired-tests.el (dired-test-bug27243-02): Exclude free disk
space from dired listing in this test, in case it changes while it's
running and confuses the result. (Bug#72120)
Jim Porter [Sat, 13 Jul 2024 18:43:42 +0000 (11:43 -0700)]
Don't save to history from 'eshell-command' when aborting
* lisp/eshell/eshell.el (eshell-add-input-to-history)
(eshell--save-history): Declare.
(eshell-command-mode-exit): New function...
(eshell-command-mode): ... use it.
* lisp/eshell/em-hist.el (eshell-hist-initialize): Don't handle
minibuffer logic here. Always read history file (this ensures that
'eshell-command' can see the history, too).
(eshell-add-command-to-history): Remove.
Eli Zaretskii [Sun, 14 Jul 2024 06:06:55 +0000 (09:06 +0300)]
Fix decoding 'display' properties with SVG images in Enriched mode
* lisp/textmodes/enriched.el (enriched-next-annotation): Reject
matches of 'enriched-annotation-regexp' inside strings. Reported
by Christopher Howard <christopher@librehacker.com> in
https://lists.gnu.org/archive/html/help-gnu-emacs/2024-06/msg00178.html.
Paul Eggert [Sun, 14 Jul 2024 05:16:26 +0000 (22:16 -0700)]
Minor renaming in timefns.c
* src/timefns.c (current_time_in_cform): Rename this static
function from current_time_in_form, since this is about enum cform
not enum timeform. Use changed.
Po Lu [Sun, 14 Jul 2024 04:46:23 +0000 (12:46 +0800)]
Do not set LD_LIBRARY_PATH during Android initialization
* doc/emacs/android.texi (Android Environment): Adjust
documentation to match.
* java/org/gnu/emacs/EmacsNoninteractive.java (main1): New
function. Remove initialization of EmacsNative hither.
(main): Acquire an ApplicationInfo or LoadedApk, as the case may
be on the host system, derive a ClassLoader from the result, and
load and call `main1' from within this class loader.
* src/android-emacs.c (main):
* src/android.c (setEmacsParams): Do not override
LD_LIBRARY_PATH or set EMACS_LD_LIBRARY_PATH. This enables
Emacs to execute subprocesses in certain "fortified" Android
systems, amongst other things.