Po Lu [Sun, 7 Jul 2024 02:19:31 +0000 (10:19 +0800)]
Correct JNI string error checking and miscellaneous corrections
* src/android-emacs.c (main): Do not attempt to load the
bootstrap class path, which is redundant on all Android releases.
* src/android.c (initEmacs, android_browse_url): Do not assume
exceptions will be raised if GetStringUTFChars fails. Decode
Android JNI strings as Qandroid_jni.
* src/androidvfs.c (android_saf_check_nonnull): New function.
(android_saf_new_mkdir): Likewise.
JD Smith [Sat, 6 Jul 2024 13:22:33 +0000 (09:22 -0400)]
Fix formatting of tables with thead/tfoot but no tbody
Correctly handle formatting of tables containing thead and/or tfoot, but
without any tbody, to prevent including thead/tfoot content twice within
the table's derived body.
* lisp/net/shr.el (shr--fix-tbody): Omit 'thead' and 'tfoot' from
implicit body. (Bug#71685)
* test/lisp/net/shr-resources/table.html:
* test/lisp/net/shr-resources/table.txt: New tests for table rendering.
Vincenzo Pupillo [Thu, 27 Jun 2024 14:13:58 +0000 (16:13 +0200)]
Fix treesit range rule for jsdoc
The parser for jsdoc is local, so it is necessary for the range
rule to take this into account.
* lisp/progmodes/js.el (js-ts-mode): Add ':local' keyword.
(js-ts-language-at-point): Remove 'js-ts-language-at-point'.
(Bug#71776)
Daniel Semyonov [Mon, 1 Jul 2024 22:42:26 +0000 (01:42 +0300)]
nnfeed: (Mostly) fix group descriptions
* lisp/gnus/nnfeed.el (nnfeed--group-description): New function.
(nnfeed-request-group-description, nnfeed-request-list-newsgroups):
Use `nnfeed--group-description' and always return t if group data
is found. (Bug#71888)
Eli Zaretskii [Sat, 6 Jul 2024 07:32:39 +0000 (10:32 +0300)]
Fix returning to original TTY frame after 'rmail-reply'
* lisp/mail/rmail.el (rmail-start-mail): Record the frame from
which an Rmail command, such as 'rmail-mail' or 'rmail-reply', was
invoked.
(rmail--find-orig-rmail-frame): New function.
(rmail-mail-return): Use 'rmail--find-orig-rmail-frame' to find
the original frame, and make it the top frame on its TTY terminal.
(Bug#69738)
Eli Zaretskii [Fri, 5 Jul 2024 19:00:08 +0000 (22:00 +0300)]
Improve warnings from native compiler
* src/comp.c (syms_of_comp) <native-compiler>: Rename from 'comp'.
* src/lread.c (maybe_swap_for_eln):
* lisp/emacs-lisp/comp.el (comp--fwprop):
* lisp/emacs-lisp/comp-run.el
(comp--accept-and-process-async-output, native--compile-async):
Adjust to the new symbol.
Stefan Monnier [Fri, 5 Jul 2024 14:02:39 +0000 (10:02 -0400)]
perl-mode.el: Improve indent after hanging open-paren
Make the indentation of the code right after an open paren/brace
use the same rule as already used to indent the corresponding
matching paren/brace.
* lisp/progmodes/perl-mode.el (perl-calculate-indent):
Use `perl-indent-new-calculate`s "virtual" indentation instead of
approximating it with `current-indentation`.
Eli Zaretskii [Fri, 5 Jul 2024 10:58:11 +0000 (13:58 +0300)]
Fix file-name detection in Dired under -F
* lisp/files.el (insert-directory-clean): Support all the symbols
appended to file names by the -F/--classify option of 'ls'. See
https://lists.gnu.org/archive/html/emacs-devel/2024-07/msg00366.html
for the details.
Po Lu [Fri, 5 Jul 2024 04:09:52 +0000 (12:09 +0800)]
Enable Gnulib substitute on Android systems with defective strnlen
* configure.ac (AC_FUNC_STRNLEN): Detect a bug where strnlen is
liable to integer overflows if addition of the search limit to
the string would also overflow.
Jim Porter [Sun, 23 Jun 2024 21:53:49 +0000 (14:53 -0700)]
In SHR, load from URL cache if possible when zooming images
* lisp/net/shr.el (shr-replace-image): New function extracted from...
(shr-image-fetched): ... here.
(shr-zoom-image): Check URL cache and call 'shr-replace-image' if we
can.
Jim Porter [Sun, 23 Jun 2024 21:48:32 +0000 (14:48 -0700)]
Fix the different image zoom levels in SHR to work as expected
* lisp/net/shr.el (shr-image-zoom-levels): New option.
(shr-image-zoom-level-alist): New variable.
(shr-zoom-image): Take POSITION and ZOOM-LEVEL arguments. Consult
'shr-image-zoom-levels'.
(shr-put-image): Use 'shr-image-zoom-level-alist'.
(shr-rescale-image): Only reset width *or* height when either is too
large.
(shr--image-zoom-original-size, shr--image-zoom-image-size)
(shr--image-zoom-fill-height): New functions.
Jim Porter [Sun, 23 Jun 2024 19:25:25 +0000 (12:25 -0700)]
In SHR, keep track of image sizes as specified by the HTML
Previously, these values got lost when zooming the image.
* lisp/net/shr.el (shr-tag-img): Set 'image-dom-size'...
(shr-zoom-image): ... use it. Rename 'size' to 'zoom'.
(shr-image-fetched): Rename 'image-size' to 'image-zoom'.
(shr-put-image): Accept the zoom level as ':zoom' and document it.
Previously, FLAGS was a mix of alist and plist(!).
* test/lisp/net/shr-tests.el (shr-test/zoom-image): Rename "size" to
"zoom".
Jim Porter [Sun, 23 Jun 2024 19:18:57 +0000 (12:18 -0700)]
Slice images based on their height in SHR, not their zoom level
* lisp/net/shr.el (shr-sliced-image-height): New option...
(shr-put-image): ... use it. Compute the number of slices in relation
to the image height; this way, each slice is roughly the height of a
line of ordinary text.
* test/lisp/net/shr-tests.el (shr-test/zoom-image): Update test, since
zooming no longer necessarily triggers slicing.
Make `value<` compare fixnums and floats by value, as `<` does, instead
of coercing the fixnum to a float first which is what C would do.
This matters when the fixnum cannot be represented as a float. For
example, C would evaluate
Eli Zaretskii [Wed, 3 Jul 2024 19:13:42 +0000 (22:13 +0300)]
Fix MS-Windows build with native-compilation
* src/w32.c (globals_of_w32): Move re-initialization of
Vlibrary_cache from here...
* src/emacs.c (main): ...to here, as it must be after load_pdump.
(Bug#71916)
Stefan Kangas [Wed, 3 Jul 2024 00:02:31 +0000 (02:02 +0200)]
Focus more on MS-Windows than MS-DOS in FAQ
* doc/misc/efaq.texi (Editing Windows files): Rename section from
"Editing MS-DOS files", and update the text to focus on Windows.
* doc/misc/efaq.texi (Colors on a TTY)
(Emacs does not display 8-bit characters): Mention MS-Windows before
MS-DOS.
Stefan Kangas [Mon, 1 Jul 2024 03:14:25 +0000 (05:14 +0200)]
Autoload some string functions
These functions are documented in both `(elisp) Creating Strings' and
'M-x shortdoc RET string RET', so users will expect them to be available
without having to require 'subr-x'.
Po Lu [Wed, 3 Jul 2024 09:05:24 +0000 (17:05 +0800)]
Adapt doc-view-set-slice-using-mouse to touch-screen input
* doc/lispref/commands.texi (Touchscreen Events): Document means
of unconditionally enabling simple conversion.
* lisp/doc-view.el (doc-view-set-slice-using-mouse): Bind
touch-screen-simple-mouse-conversion to t, and read translated
mouse events with read-key rather than read-event.
* lisp/subr.el (read-key): Don't permit idle timer to interfere
with reporting of translated mouse events.
* lisp/touch-screen.el (touch-screen-simple-mouse-conversion):
New variable.
(touch-screen-handle-point-up, touch-screen-handle-touch):
Unconditionally enable `mouse-drag' translation if set. Decide
whether to send drag or mouse events by the values of the two
touchpoints' XY positions and point and double-click-fuzz, as in
make_lispy_event.
Stefan Monnier [Tue, 2 Jul 2024 20:28:08 +0000 (16:28 -0400)]
(buf_*pos_to_*pos): Fix minor off-by one
* src/marker.c (buf_charpos_to_bytepos, buf_bytepos_to_charpos):
Slightly restructure the markers loop so we check `distance`
also before "consider"ing the first marker.
Po Lu [Tue, 2 Jul 2024 04:10:43 +0000 (12:10 +0800)]
Port seccomp acceleration to Linux 3.5.0
* etc/NEWS: Update correspondingly.
* exec/Makefile.in (config-mips.m4): Don't define rule
or predicate $(LOADOBJS) on it elsewhere than on MIPS.
* exec/README: Direct developers to GDB.
* exec/trace.c (finish_exec): Resume the tracee after reporting
an error in `exec'.
(after_fork): If seccomp is enabled on Android, and the kernel
is 4.7 or earlier, detect whether revisions to the sequencing of
seccomp events have been backported from 4.8.
(exec_waitpid): Resume the process with PTRACE_CONT after
receiving an unknown signal.
(exec_init): Cease disabling seccomp on Android kernels earlier
than 4.8.
Po Lu [Mon, 1 Jul 2024 10:11:58 +0000 (18:11 +0800)]
Optimize process execution on Android
* exec/configure.ac (REENTRANT): Remove option for reentrancy.
(PROGRAM_COUNTER, HAVE_SECCOMP): Define register providing the
program counter and enable seccomp if its headers are available.
* exec/exec.c (write_load_command): Avoid defining unused
variable.
(exec_0): Remove code specific to REENTRANT configurations.
* exec/exec.h (struct exec_tracee) <exec_data, data_size>: New
fields for loader instructions and their size.
* exec/exec1.c (main): Call exec_init before forking.
* exec/mipsel-user.h (ELF_NGREG): Delete definition.
(struct mipsel_regs): Reduce number of gregs to 32, but
introduce separate fields for special registers.
* exec/trace.c (use_seccomp_p): New variable; defile to false if
!HAVE_SECCOMP.
(remove_tracee): Cease providing for non-reentrant
configurations. Release executable data if present.
(handle_clone_prepare): Likewise. Resume process with
PTRACE_CONT if seccomp-based interception is enabled.
(handle_clone, check_signal): Resume processes as above.
(handle_exec): Divide into two functions, with only rewriting
the system call and generating instructions for the loader
remaining in the first, and copying such instructions into the
loader's stack removed into a new function, `finish_exec'.
(finish_exec): New function.
(handle_readlinkat, handle_openat): Abolish non-REENTRANT
configurations.
(process_system_call): Divide exec system calls into two phases,
disambiguated by the value of tracee->waiting_for_syscall. Typo
fixes. Accommodate syscall-exit-stops where the signal was
initially intercepted by `seccomp_system_call'.
(interesting_syscalls): New array.
(ARRAYELTS): New macro.
(seccomp_system_call, establish_seccomp_filter): New function.
(tracing_execve) [HAVE_SECCOMP]: Establish a seccomp filter if
this is to be enabled.
(after_fork): Provide PTRACE_O_TRACESECCOMP. Resume process
with PTRACE_CONT if seccomp-based interception is enabled.
(exec_waitpid): Resume process with PTRACE_CONT if seccomp-based
interception is enabled. Dispatch stops identifying as
PTRACE_EVENT_SECCOMP to `seccomp_system_call'.
(exec_init): Establish whether it is possible to enable seccomp.
Stefan Kangas [Sun, 30 Jun 2024 23:44:38 +0000 (01:44 +0200)]
Backport file backup FAQ item to Emacs <28
* doc/misc/efaq.texi (Not writing files to the current directory):
Backport recommendation to Emacs 27 or older.
Problem reported by David Hedlund <davidh@gnu.org>.
Eli Zaretskii [Sun, 30 Jun 2024 19:25:31 +0000 (22:25 +0300)]
More updates of documentation for Emacs 30
* etc/NEWS: Improve wording and move/mark entries.
* doc/lispref/positions.texi (List Motion): Document
'forward-sentence-function'.
* doc/lispref/functions.texi (What Is a Function): Document
'primitive-function-p' and 'cl-functionp'.
* doc/emacs/misc.texi (Saving Emacs Sessions): Improve wording and
indexing.
* doc/lispref/tips.texi (Documentation Tips): Adapt to the new
value of 'emacs-lisp-docstring-fill-column'.
* doc/emacs/fixit.texi (Spelling): Document
'flyspell-check-changes'.
Po Lu [Sun, 30 Jun 2024 08:26:39 +0000 (16:26 +0800)]
Respect --disable-build-details in Android builds
* java/Makefile.in (BUILD_DETAILS, GEN_BUILD_DETAILS): New
variables.
(install_tmp): Tolerate failures in generation of metadata files
and prefix commands for such generation with GEN_BUILD_DETAILS.
* lisp/version.el (android-read-build-system)
(android-read-build-time): Return nil if metadata file does not
exist.
Po Lu [Sun, 30 Jun 2024 04:10:21 +0000 (12:10 +0800)]
Enable caching values generated by the Android build system
* build-aux/ndk-build-helper-1.mk:
* build-aux/ndk-build-helper-2.mk:
* build-aux/ndk-build-helper.mk: Do not generate file names with
redundant directory separators, to port to systems where the
semantics of this are undefined.
* configure.ac: Provide a cache file to the recursive invocation
of configure if one is specified for the initial.
* cross/ndk-build/Makefile.in (my-dir): Better conform to the
original ndk-build by generating directory names with no
trailing separator.
* m4/ndk-build.m4 (ndk_resolve_import_module, ndk_SEARCH_MODULE):
Cache the names of Android.mk files and the commands produced
from them.
Paul Eggert [Sat, 29 Jun 2024 23:36:34 +0000 (00:36 +0100)]
Assume setlocale exists
Like locale.h, it was standardized by C89, is universally
available now, and some code already assumes it.
* configure.ac: Do not check for setlocale.
* src/emacs.c (setlocale) [!HAVE_SETLOCALE]: Remove.
(fixup_locale, synchronize_locale, Vprevious_system_time_locale)
(synchronize_system_time_locale): Define even if !HAVE_SETLOCALE.
* src/sysdep.c (emacs_setlocale): Simplify by assuming HAVE_SETLOCALE.
Paul Eggert [Sat, 29 Jun 2024 23:20:42 +0000 (00:20 +0100)]
Do not worry about whether locale.h is includable
* src/emacs.c, src/lread.c, src/sysdep.c: Remove preconditions
from including locale.h. It was standardized in C89, is universal
now, and some code already assumes it.
Yuan Fu [Sat, 29 Jun 2024 07:16:36 +0000 (00:16 -0700)]
Fix treesit crash (bug#71681)
To reproduce the problem:
0. emacs -Q
1. eval: (add-to-list 'major-mode-remap-alist '(c-mode . c-ts-mode))
2. C-x v L
3. in the *vc-change-log* buffer move point to the commit 20af58d3a13
4. type D
5. crash caused by diff-font-lock-syntax fontification that uses treesit
Emacs: 6f2036243f2 (2024-06-23, latest master)
Tree-sitter: 3da7deed (2024-06-08, version 0.22.6)
The immediate cause of the crash is that tree-sitter accessed a node's
tree, but the tree is already deleted. Commenting out the
ts_tree_delete line in treesit_ensure_parsed can "fix" the crash.
What happended, I think, is this:
1. Buffer modified, parser->need_reparse set to true,
parser->timestamp incremented.
2. A node is created from the parser, this node has the old tree but
the new timestamp (bad!).
3. Parser re-parses (treesit_ensure_parsed), new tree created, old
tree deleted.
4. Ftreesit_query_capture accessed the old node, and the old tree,
crash.
We shouldn't bump the parser timestamp when we set
parser->need_reparse to true; instead, we should bump the timestamp
when we actually reparsed and created a new tree.
Paul Eggert [Sat, 29 Jun 2024 22:14:54 +0000 (23:14 +0100)]
Remove unused m4/printf-posix-rpl.m4
* m4/printf-posix-rpl.m4: Remove unused file.
This is leftover from an old Android branch,
and the m4 macros are no longer needed in the master branch.