Po Lu [Mon, 29 Jan 2024 02:54:49 +0000 (10:54 +0800)]
Prevent filling from mangling ChangeLog defun lists
* lisp/vc/log-edit.el (log-edit-fill-entry): Replace space
characters within defun lists with NBSPs for the duration of
`fill-region''s execution, so that they are never considered
break points.
* test/lisp/vc/log-edit-tests.el
(log-edit-fill-entry-space-substitution): New test.
Jim Porter [Sun, 28 Jan 2024 23:49:03 +0000 (15:49 -0800)]
In Eshell, allow an escaped newline at the end of a command
Normally, "echo<RET>" runs the command "echo". Likewise,
"echo\<RET><RET>" should too: we escape the first newline, and then
the second one is unescaped and should send the command input to
Eshell. Previously, you had to press RET a third time, but now it
works as expected.
* lisp/eshell/esh-arg.el (eshell-looking-at-backslash-return): Make
obsolete.
(eshell-parse-backslash): A backslash sequence is only incomplete if
there's nothing at all after it.
* test/lisp/eshell/esh-arg-tests.el (esh-arg-test/escape/newline)
(esh-arg-test/escape-quoted/newline): Remove inaccurate comment;
escaped newlines are always special.
(esh-arg-test/escape/trailing-newline): New test.
* lisp/xt-mouse.el (xterm-mouse--same-button-p): New function.
(xterm-mouse--read-event-sequence): Use it to obey
`mouse-wheel-*-event` variables.
* lisp/mwheel.el (mouse-wheel-obey-old-style-wheel-buttons):
Update docstring.
Paul Eggert [Sun, 28 Jan 2024 08:15:38 +0000 (00:15 -0800)]
Rename TAG_PTR to TAG_PTR_INITIALLY
* src/lisp.h (TAG_PTR_INITIALLY): Rename from TAG_PTR, since calls
can be used only as initializers, and the convention elsewhere in
lisp.c is to give these macros names ending in ‘_INITIALLY’.
This should help avoid confusion such as we recently experienced
in make_lisp_symbol_internal. All uses changed.
Paul Eggert [Sun, 28 Jan 2024 08:15:38 +0000 (00:15 -0800)]
Fix C conformance issue in LISPSYM_INITIALLY
* src/lisp.h (LISPSYM_INITIALLY): Remove unnecessary cast to char *.
The C standard allows but does not require support for casts to
pointers in constant expressions in static initializers.
Eli Zaretskii [Sun, 28 Jan 2024 08:19:48 +0000 (10:19 +0200)]
Fix "emacs -nw" on MS-Windows
* src/w32term.c (w32_flip_buffers_if_dirty): Do nothing if F is
not a GUI frame. This avoids rare crashes in "emacs -nw".
* src/w32console.c (initialize_w32_display): Set the
ENABLE_EXTENDED_FLAGS bit in 'prev_console_mode'.
Jim Porter [Thu, 25 Jan 2024 02:32:00 +0000 (18:32 -0800)]
Fix command replacement with the Eshell builtin versions of "sudo" and "doas"
This is particularly important when the inner command to execute is an
alias. Aliases throw 'eshell-replace-command' too, so we want to do
this in two phases: first, replace the "sudo"/"doas" with a
let-binding of 'default-directory', and then later, let the alias code
do its own replacement (bug#68074).
* lisp/eshell/em-tramp.el (eshell/sudo, eshell/doas): Use
'eshell-replace-command' to wrap the inner command.
* test/lisp/eshell/em-tramp-tests.el (mock-eshell-named-command):
Remove.
(em-tramp-test/sudo-basic, em-tramp-test/sudo-user)
(em-tramp-test/doas-basic, em-tramp-test/doas-user): Catch
'eshell-replace-command'.
Support a local repo as URL in 'treesit-language-source-alist'
Sometimes people may need to bisect to find specific revision
in a grammar library's repo. In this case they'd want to point
the URL to the local repo to avoid cloning it on every rebuild.
So add support for a directory instead of URL in
'treesit-language-source-alist'.
* lisp/treesit.el (treesit--install-language-grammar-1): Test
if URL is a local directory. Then if it is, avoid cloning the
repo and removing the path on success.
(treesit--git-clone-repo): Factor out the code for cloning to
a separate function.
(treesit--git-checkout-branch): A helper to checkout the
revision for cases where we didn't clone the repo but want it
to point the revision. (Bug#68579)
Manuel Giraud [Sat, 27 Jan 2024 16:23:06 +0000 (17:23 +0100)]
Enable marking tagged with ls -F
Bug#68637
* lisp/image/image-dired-dired.el (image-dired-mark-tagged-files):
Enable marking tagged for executable and symlink images when
'dired-listing-switches' includes -F.
Eli Zaretskii [Sat, 27 Jan 2024 17:11:22 +0000 (19:11 +0200)]
Allow users to opt out of following Windows Dark mode
* src/w32fns.c (globals_of_w32fns) <w32-follow-system-dark-mode>:
New variable.
(w32_applytheme): Disable application of Dark mode if
'w32-follow-system-dark-mode' is nil.
Daniel Brooks [Sun, 5 Nov 2023 08:03:37 +0000 (01:03 -0700)]
Calc parses fractions written using U+2044 FRACTION SLASH
Fractions of the form 123⁄456 are handled as if written 123:456. Note
in particular the difference in behavior from U+2215 DIVISION SLASH
and U+002F SOLIDUS, which result in division rather than a rational
fraction.
* lisp/calc/calc-aent.el (math-read-replacement-list): Substitute a
colon for any fraction slash. (Bug#66944)
* test/lisp/calc/calc-tests.el (calc-frac-input): Test various
fraction types.
Revert DOHASH to the fast (field-caching) implementation but with
an assertion to detect misuses. Add DOHASH_SAFE for use in
code that must tolerate arbitrary mutation of the table being
iterated through.
* src/lisp.h (DOHASH): Go back to fast design that only allows
restricted mutation, but with a checking assertion.
(DOHASH_SAFE): New macro that tolerates arbitrary mutation while being
much simpler (and acceptably fast).
* src/fns.c (Fmaphash):
* src/comp.c (compile_function, Fcomp__compile_ctxt_to_file):
Use DOHASH_SAFE.
Mekeor Melire [Mon, 4 Dec 2023 15:37:37 +0000 (16:37 +0100)]
Add option Info-url-alist
* lisp/info.el (Info-url-alist): New option mapping manuals
to URLs.
(Info-url-for-node): Use it.
* test/lisp/info-tests.el (test-info-urls): Add more tests.
In particular, 'Info-url-for-node' should error when
manual-name is not handled in 'Info-url-alist'.
* etc/NEWS: Announce the change. (Bug#67615)
It is now possible to avoid extending
'completion-at-point-functions' in Text mode and its descendants.
* lisp/textmodes/text-mode.el
(text-mode-meta-tab-ispell-complete-word): Rename to...
(text-mode-ispell-word-completion): ...this. Extend with another
option 'completion-at-point'.
(text-mode): Only extend 'completion-at-point-functions' when
'text-mode-ispell-word-completion' is 'completion-at-point'.
(Bug#67527)
* etc/NEWS: Update the entry about 'M-TAB' in Text mode.
Eli Zaretskii [Sat, 27 Jan 2024 09:44:54 +0000 (11:44 +0200)]
Minor fix in 'describe-language-environment'
* lisp/international/mule-cmds.el (describe-language-environment):
Use 'current-language-environment' as DEFAULT in the prompt.
Patch by Thierry Volpiatto <thievol@posteo.net>. (Bug#68602)
Eli Zaretskii [Sat, 27 Jan 2024 08:52:47 +0000 (10:52 +0200)]
Improve 'refill-mode' in Org buffers
* lisp/textmodes/refill.el (refill-fill-paragraph-at): Use
'fill-forward-paragraph' instead of 'forward/backward-paragraph',
so that modes could customize the behavior. (Bug#68418)
Eli Zaretskii [Sat, 27 Jan 2024 08:38:14 +0000 (10:38 +0200)]
; Minor improvements in 'visual-wrap-prefix-mode'
* lisp/visual-wrap.el (visual-wrap-extra-indent): Add :version.
(visual-wrap-fill-context-prefix): Doc fix.
* lisp/menu-bar.el (menu-bar-line-wrapping-menu): Move the menu to
a better place, improve the help-echo text.
* etc/NEWS:
* doc/emacs/basic.texi (Continuation Lines): Improve documentation
and indexing of 'visual-wrap-prefix-mode'.
Eli Zaretskii [Sat, 27 Jan 2024 08:11:32 +0000 (10:11 +0200)]
Fix description of when "\xNNN" is considered a unibyte character
* doc/lispref/objects.texi (Non-ASCII in Strings): More accurate
description of when a hexadecimal escape sequence yields a unibyte
character. (Bug#68751)
Randy Taylor [Thu, 25 Jan 2024 02:39:45 +0000 (21:39 -0500)]
Simplify imenu setup for {cmake,dockerfile}-ts-modes
* lisp/progmodes/cmake-ts-mode.el (treesit-induce-sparse-tree,
treesit-node-child, treesit-node-start, cmake-ts-mode--imenu,
cmake-ts-mode--imenu-1): Remove.
(treesit-search-subtree): Declare.
(cmake-ts-mode--function-name): New function.
(cmake-ts-mode): Use it.
* lisp/progmodes/dockerfile-ts-mode.el (treesit-induce-sparse-tree,
treesit-node-start, dockerfile-ts-mode--imenu,
dockerfile-ts-mode--imenu-1): Remove.
(dockerfile-ts-mode--stage-name): New function.
(dockerfile-ts-mode): Use it.
Stefan Monnier [Sat, 27 Jan 2024 04:03:00 +0000 (23:03 -0500)]
pdumder.c: Fix bug#68690
The problem was that the offset computed for the `charset_table` array
was a multiple of 4 but the `struct charset` needed an alignment on
a multiple of 8, so `dump_charset` inserted 4 bytes of padding,
whereas you can't have padding at the beginning of an array.
* src/pdumper.c (dump_charset): Don't set alignment here.
(dump_charset_table): Set it here instead.
Po Lu [Sat, 27 Jan 2024 02:36:30 +0000 (10:36 +0800)]
Intercept calls to `openat' under Android
* exec/configure.ac (OPEN_SYSCALL, OPENAT_SYSCALL): Define new
macros.
* exec/exec.h (struct exec_tracee): New field `sp'.
* exec/trace.c (handle_openat): New function.
(process_system_call): If handle_openat executes successfully,
save the unmodified stack pointer within the tracee structure to
be restored once the system call completes.
Po Lu [Sat, 27 Jan 2024 01:30:16 +0000 (09:30 +0800)]
Import ELPA package adaptive-wrap as visual-wrap
* doc/emacs/basic.texi (Continuation Lines): Document
visual-wrap and its applications.
* etc/NEWS (Editing Changes in Emacs 30.1): Ditto.
* lisp/visual-wrap.el (visual-wrap-extra-indent)
(visual-wrap--face-extend-p, visual-wrap--prefix-face)
(visual-wrap--prefix, visual-wrap-fill-context-prefix)
(visual-wrap-prefix-function, visual-wrap-prefix-mode, lookup-key)
(visual-wrap): New file. Update copyright years and rename to
`visual-wrap'.
Matthew Smith [Sat, 20 Jan 2024 09:45:31 +0000 (09:45 +0000)]
typescript-ts-mode: Skip test if tsx grammar missing
typescript-ts-mode-test-indentation depends on both the tree-sitter
typescript grammar, and the tree-sitter tsx grammar. If only the
typescript is installed, the tests will run and then fail unexpectedly
after tsx fails to load.
* test/lisp/progmodes/typescript-ts-mode-tests.el
(typescript-ts-mode-test-indentation): Skip test if tsx grammar is
missing.
* lisp/eshell/esh-cmd.el (eshell--find-subcommands): Yield the second
element of the subcommand.
(eshell--invoke-command-directly-p): Rename and account for
'eshell-with-copied-handles'.
(eshell-invoke-directly): Rename to...
(eshell-invoke-directly-p): ... this, and use 'pcase' to make the
logic clearer.
* lisp/eshell/esh-mode.el (eshell-send-input): Always queue input if
the process is running; rename some locals to be clearer.
* lisp/eshell/esh-var.el (eshell-var-initialize): Add "env" as a
complex command.
* test/lisp/eshell/esh-cmd-tests.el
(esh-cmd-test--deftest-invoke-directly): New macro.
(no-args, with-args, multiple-cmds, subcmd, complex, complex-subcmd):
New test cases.
Eli Zaretskii [Fri, 26 Jan 2024 13:01:51 +0000 (15:01 +0200)]
Fix crash backtraces on MS-Windows, broken by ASLR
* src/w32fns.c (DEFAULT_IMAGE_BASE): Define for 64-bit and 32-bit
MinGW builds.
(emacs_abort): Correct the callstack addresses for potential
relocation of the image base due to ASLR. This makes 'addr2line'
be able to interpret emacs_backtrace.txt when ASLR is in effect,
which it is on every modern version of MS-Windows. (Bug#63365)
* configure.ac (LD_SWITCH_SYSTEM_TEMACS) [mingw32]: Add comment
about keeping the image-base values in sync with w32fns.c.
Jim Porter [Fri, 26 Jan 2024 04:58:34 +0000 (20:58 -0800)]
Add support for running commands via Eshell's "env" command
* (eshell-handle-local-variables): Move most of the code to...
(eshell-parse-local-variables): ... here.
(eshell/env): Call 'eshell-parse-local-variables'.
* test/lisp/eshell/esh-var-tests.el
(esh-var-test/local-variables/env): New test.
* doc/misc/eshell.texi (Built-ins): Describe the new behavior.
Po Lu [Fri, 26 Jan 2024 03:24:51 +0000 (11:24 +0800)]
Avert race condition between window attachment and buffer swap
* java/org/gnu/emacs/EmacsView.java (swapBuffers): Synchronize
such that code cannot execute between the bitmap's being loaded
and being transferred to surfaceView.
(onDetachedFromWindow): Recycle bitmap after the surface view is
reset.
Jim Porter [Fri, 26 Jan 2024 01:54:13 +0000 (17:54 -0800)]
Improve handling of local variable settings in Eshell
This ensures that these commands work the same as normal commands,
aside from making environment variable settings local to that command.
Among other things, this means that "VAR=value cd dir/" now changes
the directory correctly.
* lisp/eshell/esh-var.el (eshell-in-local-scope-p)
(eshell-local-variable-bindings): New variables.
(eshell-var-initialize, eshell-set-variable): Use
'eshell-local-variable-bindings'.
(eshell-handle-local-variables): Don't use 'eshell-as-subcommand'.
* test/lisp/eshell/esh-var-tests.el (esh-var-test/local-variables/cd):
New test.
Dmitry Gutov [Fri, 26 Jan 2024 01:00:04 +0000 (03:00 +0200)]
python--treesit-syntax-propertize: Fix edits in the middle
* lisp/progmodes/python.el (python--treesit-syntax-propertize):
Process the beginning and the end of the triple-quoted string's
delimiters separately. Among other things, that still works when
the beginning is outside of the propertized region (bug#68445).
Juri Linkov [Thu, 25 Jan 2024 17:52:08 +0000 (19:52 +0200)]
* lisp/simple.el (next-line-completion): Better handing of group lines.
Simplify to not compare the result of 'move-to-column'
with the value 'column'. Such comparison prevented from moving
over lines without completion candidates such as group lines (bug#68688).
* test/lisp/minibuffer-tests.el (completions-group-navigation-test):
Add more group candidates to create more columns and to test
moving over group lines and over columns without candidates.