Eli Zaretskii [Sat, 7 Oct 2023 07:48:00 +0000 (03:48 -0400)]
Merge from origin/emacs-29
a74e51cfd15 Fix a defcustom :type c27b90d04bf Fix 'ido--ffap-find-file' 1594d5f17ad Fix setting the pipe capacity for subprocesses aad8b5d78f3 Handle LANG on macOS differently (bug#65908)
Eli Zaretskii [Sat, 7 Oct 2023 06:46:04 +0000 (09:46 +0300)]
Fix 'ido--ffap-find-file'
* lisp/ido.el (ido--ffap-find-file): Make the signature consistent
with that of 'find-file', and pass the optional second argument to
'find-file'. (Bug#66382)
Eli Zaretskii [Fri, 6 Oct 2023 05:31:59 +0000 (08:31 +0300)]
Fix setting the pipe capacity for subprocesses
* src/process.c (create_process) [F_SETPIPE_SZ]: Set the pipe
capacity only if the required read-process-max is larger than the
default capacity of the pipe. (Bug#66288)
Gerd Möllmann [Thu, 5 Oct 2023 18:41:54 +0000 (20:41 +0200)]
Handle LANG on macOS differently (bug#65908)
* src/nsterm.m (ns_init_locale): If LANG is set, try to use that,
otherwise try to deduce what LANG should be. Check is the result is
valid, and use LANG="en_US.UTF-8" if not.
Silence macro expansion during completion at point
* lisp/emacs-lisp/macroexp.el (macroexp-inhibit-compiler-macros): Add
variable.
(macroexp--compiler-macro): Inspect that new variable and, if it is
non-nil, return the input form unchanged.
* lisp/progmodes/elisp-mode.el (elisp--local-variables): Silence
messages. Avoid compiler macros. (Bug#58148)
It keeps interfering with other rules, slowing everything down a
little bit and makes it harder to add or change other rules. The rule
is still there and can easily be re-enabled by those who need it.
* etc/NEWS: Announce.
* lisp/progmodes/compile.el (compilation-error-regexp-alist):
Exclude `omake`.
* test/lisp/progmodes/compile-tests.el
(compile-tests--test-regexps-data):
Actually test the `cucumber` rule. Remove the `omake` test case.
(compile-test-error-regexps):
Test `omake` here. Test other rules without `omake` included.
Spencer Baugh [Wed, 28 Jun 2023 12:48:01 +0000 (08:48 -0400)]
Make newly-created smerge-diff-buffers read-only
Buffers name *vc-diff* are usually created by vc, which makes them
read-only. If we create such a buffer, let's make it read-only too.
If the buffer already exists, though, don't change that since the user
might have deliberately made it writable.
* lisp/vc/smerge-mode.el (smerge-diff): Make newly-created
smerge-diff-buffers read-only. (bug#64071)
* src/androidgui.h (enum android_ime_operation): New operation
ANDROID_IME_REPLACE_TEXT.
* src/androidterm.c (android_handle_ime_event): Decode text when
encountering an ANDROID_IME_REPLACE_TEXT operation. Return if
decoding overflowed rather than presenting Qnil to textconv
functions.
(replaceText): New JNI function.
* src/frame.h (enum text_conversion_operation): New operation
TEXTCONV_REPLACE_TEXT.
* src/textconv.c (really_commit_text): Move point to start if
the composing region is set.
(really_replace_text): New function.
(handle_pending_conversion_events_1) <TEXTCONV_REPLACE_TEXT>:
New case.
(replace_text): New function.
Po Lu [Wed, 4 Oct 2023 08:33:05 +0000 (16:33 +0800)]
Correct local reference leaks
* src/android.c (android_build_string): Accept a list of local
references to destroy upon an allocation failure, facilitating
the proper deallocation of local references in such situations.
(android_browse_url): Revise for new calling convention.
* src/androidmenu.c (android_menu_show, android_dialog_show):
Revise for new calling convention.
* src/androidselect.c (android_notifications_notify_1): Supply
each successive local reference to android_build_string as
notification text is being encoded.
Alan Mackenzie [Tue, 3 Oct 2023 10:22:26 +0000 (10:22 +0000)]
Correct the `cond' forms in cl-print-string-with-limit
In this function, calling with limit bound to t will cause an
error in any of the cond forms which set print-length, etc.
Correct them!
* lisp/emacs-lisp/cl-print.el (cl-print-string-with-limit):
Amend the doc string. In the cond forms in the bindings for
print-length, etc., test the value t first. Amend those for
print-length and print-level also to test for a zero value of
limit.
Jim Porter [Sat, 23 Sep 2023 18:36:11 +0000 (11:36 -0700)]
Support Eshell iterative evaluation in the background
This really just generalizes Eshell's previous support for iterative
evaluation of a single current command to a list of multiple commands,
of which at most one can be in the foreground (bug#66066).
* lisp/eshell/esh-cmd.el (eshell-last-async-procs)
(eshell-current-command): Make obsolete in favor of...
(eshell-foreground-command): ... this
(eshell-background-commands): New variable.
(eshell-interactive-process-p): Make obsolete.
(eshell-head-process, eshell-tail-process): Use
'eshell-foreground-command'.
(eshell-cmd-initialize): Initialize new variables.
(eshell-add-command, eshell-remove-command)
(eshell-commands-for-process): New functions.
(eshell-parse-command): Make 'eshell-do-subjob' the outermost call.
(eshell-do-subjob): Call 'eshell-resume-eval' to split this command
off from its parent forms.
(eshell-eval-command): Use 'eshell-add-command'.
(eshell-resume-command): Use 'eshell-commands-for-process'.
(eshell-resume-eval): Take a COMMAND argument. Return
':eshell-background' form for deferred background commands.
(eshell-do-eval): Remove check for 'eshell-current-subjob-p'. This is
handled differently now.
* lisp/eshell/eshell.el (eshell-command): Wait for all processes to
exit when running synchronously.
* test/lisp/eshell/esh-cmd-tests.el
(esh-cmd-test/background/simple-command)
(esh-cmd-test/background/subcommand): New tests.
(esh-cmd-test/throw): Use 'eshell-foreground-command'.
* test/lisp/eshell/eshell-tests.el (eshell-test/queue-input): Use
'eshell-foreground-command'.
* test/lisp/eshell/em-script-tests.el
(em-script-test/source-script/background): Make the test script more
complex.
* test/lisp/eshell/eshell-tests.el
(eshell-test/eshell-command/pipeline-wait): New test.
* doc/misc/eshell.texi (Bugs and ideas): Remove implemented feature.
Po Lu [Tue, 3 Oct 2023 00:55:57 +0000 (08:55 +0800)]
Update Android port
* src/androidvfs.c (android_afs_open, android_asset_fstat):
Return proper mtime within file descriptors incorporating asset
data and within android_asset_fstat.
* src/xterm.c (handle_one_xevent)
<KeyPress, XI_KeyPress>: Verify presence of a quit keysym
prior to registering it.
F. Jason Park [Sat, 10 Jun 2023 04:00:03 +0000 (21:00 -0700)]
Inhibit slash commands in erc--input-review-functions
* lisp/erc/erc.el (erc--input-review-functions): Add new review
function `erc--inhibit-slash-cmd-insertion'.
(erc--check-prompt-input-functions): Move
`erc--check-prompt-input-for-multiline-command' above
`erc--check-prompt-input-for-multiline-blanks'.
(erc--inhibit-slash-cmd-insertion): New "review" function to suppress
insertion of prompt input for slash commands. Doesn't affect "meta"
slash commands like /SAY.
(erc--send-input-lines): Don't bother checking whether message is a
command. Instead, trust verdict handed down by message-prep and
review functions. This opens the door to optional insertion for
debugging purposes or when echoing command lines in a shell-like
fashion.
* test/lisp/erc/erc-tests.el (erc-send-whitespace-lines): clean up
portion dealing with trimming slash commands. (Bug#66073)
F. Jason Park [Fri, 15 Sep 2023 13:08:55 +0000 (06:08 -0700)]
Improve erc-warn-about-blank-lines behavior
* etc/ERC-NEWS: Mention more detailed feedback when option
`erc-warn-about-blank-lines' is non-nil.
* lisp/erc/erc-common.el (erc--input-split): Add `abortp' slot to
allow a premature exit while validating prompt input.
* lisp/erc/erc.el (erc-warn-about-blank-lines): Clarify meaning of
"blank lines" in doc string, and mention interaction with
companion option `erc-send-whitespace-lines'.
(erc-inhibit-multiline-input): Fix inaccurate description in doc
string.
(erc--input-review-functions): Move
`erc--discard-trailing-multiline-nulls' to end of list, after
`erc--run-input-validation-checks' so that the latter doesn't have to
resplit the original input string in order to issue feedback.
(erc--blank-in-multiline-input-p): Remove unused internal function
originally slated to be part of ERC 5.6.
(erc--check-prompt-input-for-something): New trivial validation
function to check if the input is empty.
(erc--count-blank-lines): New function that tallies up the number of
blank and whitespace-only lines in the current input. One downside of
this design is that this function's conclusions aren't shared with
`erc--discard-trailing-multiline-nulls', which must decide on its own
how many lines to strip.
(erc--check-prompt-explanation): New variable.
(erc--check-prompt-input-for-multiline-blanks): Rework significantly
to provide more informative messages and more sensible behavior for
common cases with respect to relevant option values.
(erc--check-prompt-input-functions): Add new validation function
`erc--check-prompt-for-something'.
(erc--run-input-validation-checks): Set `abortp' slot of
`erc--input-split' when hooks return a non-string, rather than
generate an unhelpful fallback message. Also print a message when
the variable `erc--check-prompt-explanation' is non-nil.
(erc-send-current-line): When the `abortp' slot of the current
`erc--input-split' object is non-nil, forgo normal input processing.
This fixes a regression in 5.6-git, which previously emitted an error
message when it should have just exited the command.
(erc--discard-trailing-multiline-nulls): Always run, regardless of
`erc-send-whitespace-lines', and leave a blank line behind when
stripping a message consisting of only blank lines.
(erc--run-send-hooks): Always run hooks and surrounding logic rather
than only when hooks are populated.
* test/lisp/erc/erc-tests.el (erc--refresh-prompt): Add assertion and
use default value for `erc--input-review-functions'.
(erc-ring-previous-command): Use default value for
`erc--input-review-functions' and ensure `erc-current-nick' does not
error.
(erc--blank-in-multiline-input-p): Remove obsolete test.
(erc--check-prompt-input-functions): Update expected message.
(erc--discard-trailing-multiline-nulls, erc--count-blank-lines): New
tests.
(erc-tests--check-prompt-input--expect,
erc-tests--check-prompt-input-messages): New helper variables.
(erc--check-prompt-input-for-multiline-blanks,
erc--check-prompt-input-for-multiline-blanks/explanations): New tests.
(erc-send-whitespace-lines): Expect hook-processing logic to pad empty
lines instead of deferring to `erc-send-input-line-function'.
(Bug#66073)
F. Jason Park [Tue, 19 Sep 2023 05:50:28 +0000 (22:50 -0700)]
Prefer ticks/hz pairs for some ERC timestamps on 29+
* lisp/erc/erc-compat.el (erc-compat--current-lisp-time): New macro to
prefer ticks/hz pairs on newer Emacs versions because stamps of this
form are easier to compare at a glance when used as values for text
properties.
* lisp/erc/erc-stamp.el (erc-stamp--current-time): Use compat macro.
(Bug#60936)
F. Jason Park [Thu, 21 Sep 2023 04:40:36 +0000 (21:40 -0700)]
Exempt text-scale-mode from erc-scrolltobottom-all
* lisp/erc/erc-goodies.el (erc--scrolltobottom-post-ignore-commands):
New variable, a list of commands that should not trigger a re-scroll.
(erc--scrolltobottom-on-post-command): Don't `recenter' when the
current command appears in `erc--scrolltobottom-post-ignore-commands'.
This fixes a bug that prevented managed recentering when disabling
`text-scale-mode'. Thanks to Corwin Brust for reporting this. Note
that this doesn't address any fill-related alignment issues involving
`text-scale-mode'. Nor does it address likely problems involving the
erroneous restoration of point after the insertion of invisible lines.
(erc-keep-place-enable, erc-keep-place-mode): Adjust hook depth to
fall within reserved interval.
(erc-keep-place-indicator-enable, erc-keep-place-indicator-mode,
erc--keep-place-indicator-on-global-module): Lower hook depth to fall
within reserved interval. Note that this hook has a buffer-local
value, so all members run after their global counterparts.
(Bug#66073)
F. Jason Park [Tue, 19 Sep 2023 05:50:28 +0000 (22:50 -0700)]
; Increase ERC test server queue size
* test/lisp/erc/erc-scenarios-scrolltobottom.el
(erc-scenarios-scrolltobottom--normal,
erc-scenarios-scrolltobottom--all): Use updated name for test fixture.
* test/lisp/erc/resources/erc-d/erc-d.el
(erc-d--initialize-client): For lengthy batches, `erc-d--filter' may
run multiple times before `erc-d--on-request' can pull from the queue,
which results in discarded incoming messages and match failures.
(erc-d--m, erc-d--log): Convert to ordinary functions.
* test/lisp/erc/resources/erc-scenarios-common.el
(erc-scenarios-scrolltobottom--normal,
erc-scenarios-common-scrolltobottom--normal): Rename test fixture from
former to latter and attempt to fix intermittent failure re
`count-screen-lines'.
F. Jason Park [Mon, 25 Sep 2023 13:06:13 +0000 (06:06 -0700)]
Fix wrong "User" column count in erc-ibuffer
(ibuffer-make-column-erc-members): Show tally of all server users for
non-target buffers, and show correct count for targets. Thanks to
Mattias Engdegård for reporting this.
(erc-ibuffer-limit-map): Use "new" `define-ibuffer-filter'
API. (Bug#66191)
F. Jason Park [Mon, 2 Oct 2023 23:29:28 +0000 (16:29 -0700)]
Remove newline from erc-fill regexp
* lisp/erc/erc-fill.el (erc-fill): Remove newline from character
alternative in pattern for skipping past blank and whitespace-only
lines. It seems that as of e61a0398 "regex.c: Consolidate the two
analysis functions", Emacs no longer sees a newline-dollar sequence as
matching an empty line. Also lose `save-match-data', which doesn't
appear to serve any purpose here.
Po Lu [Mon, 2 Oct 2023 07:38:30 +0000 (15:38 +0800)]
Properly translate touch screen events into mouse drag ones
* doc/lispref/commands.texi (Drag Events): Correct misleading
example form and reword subsequent elaboration.
* lisp/touch-screen.el (touch-screen-handle-point-up)
<mouse-drag>: Set posns representing drag start and terminus to
mouse position lists, in lieu of pairs between windows and posns
employed previously.
* test/lisp/eshell/esh-proc-tests.el
(esh-proc-test/pipeline-connection-type/middle)
(esh-proc-test/pipeline-connection-type/last): Use '(ignore)', since
that causes no output when called with no arguments, thus avoiding a
risky 'process-send-string'.
Stefan Kangas [Sun, 1 Oct 2023 17:00:26 +0000 (19:00 +0200)]
; Add several "duplicate value in `cond`" FIXMEs
* lisp/gnus/gnus-cloud.el (gnus-cloud-decode-data):
* lisp/org/org.el (org-read-date-analyze):
* lisp/org/ox-html.el (org-html-latex-fragment):
Add several "duplicate value in `cond`" FIXMEs.
Found by Mattias Engdegård <mattias.engdegard@gmail.com>.
Ref: https://debbugs.gnu.org/51368#51
Stefan Kangas [Sun, 1 Oct 2023 13:37:06 +0000 (15:37 +0200)]
Improve documentation of `ns-use-proxy-icon`
* doc/emacs/macos.texi (Mac / GNUstep Customization):
* src/nsfns.m (syms_of_nsfns): Fix documentation of
'ns-use-proxy-icon'; explain what it does and how it's
used. (Bug#66190)
Stefan Kangas [Sun, 1 Oct 2023 11:21:39 +0000 (13:21 +0200)]
Doc fix; more consistently refer to "text terminals"
In the Emacs Lisp manual, we refer to "text terminals" and "graphical
terminals" (see Info node `(elisp) Frames'). But in some places,
including the user manual, the alternative terminology "non-window
terminals" is used instead.
In other places, we use the terminology "non-windowing display"
instead of the more canonical "non-graphical display".
This is less clear than it could be. Let's consolidate our
terminology to prefer the wording from the Emacs Lisp manual; in other
words, prefer "text" and "non-graphical" to "non-window".
* doc/emacs/frames.texi (Non-Window Terminals): Rename node from this...
(Text Terminals): ...to this. (Bug#66282)
* doc/emacs/display.texi (Standard Faces):
* doc/emacs/emacs.texi (Top):
* doc/emacs/misc.texi (emacsclient Options):
* doc/misc/viper.texi (Rudimentary Changes)
(Packages that Change Keymaps):
* doc/emacs/frames.texi (Frames, Frame Commands, Mouse Avoidance):
Replace instances of "non-window terminals" with "text terminals".
* doc/misc/ediff.texi (Quick Help Customization):
(Window and Frame Configuration):
* lisp/vc/ediff.el (ediff-windows-wordwise)
(ediff-windows-linewise): Prefer saying 'non-graphical display' to
'non-windowing display'.
* lisp/net/tramp.el (tramp-default-method):
* lisp/printing.el (pr-find-command): Capitalize 'Windows' where it
clearly refers to the non-free operating system with that name.
Michael Albinus [Sun, 1 Oct 2023 09:27:41 +0000 (11:27 +0200)]
Improve handling of "--dired" in Tramp
* lisp/net/tramp-sh.el (tramp-bsd-unames): New defconst.
(tramp-sh-handle-file-ownership-preserved-p)
(tramp-open-connection-setup-interactive-shell)
(tramp-get-ls-command): Use it.
(tramp-sh-handle-insert-directory): Improve handling of "--dired".
* lisp/progmodes/perl-mode.el (perl--format-regexp): New defconst.
(perl--end-of-format-p): New function.
(perl-continuation-line-p): Use it.
(perl-calculate-indent): Use it. Make the lines of the formlist stay
at column 0.
* test/lisp/progmodes/cperl-mode-resources/cperl-bug-35925.pl: New
test file.
* test/lisp/progmodes/cperl-mode-tests.el (cperl-test-bug-35925): New
test.
john muhl [Fri, 22 Sep 2023 23:36:18 +0000 (18:36 -0500)]
Various fixes to lua-ts-mode font-locking
* lisp/progmodes/lua-ts-mode.el (lua-ts--font-lock-settings):
Identify functions and assignments in more places. Use constant
face for goto/labels. (Bug#66162)
Eli Zaretskii [Sat, 30 Sep 2023 17:50:07 +0000 (13:50 -0400)]
Merge from origin/emacs-29
4776d90c31b Add new Tramp test ca5b48fd76d Fix tmm-mid-prompt :type (Bug#66179) 7447d3df94e Fix tree-sitter indentation conflict with multiple languages bee18e52737 Fix bug#66093 in Tramp 7d5fee0feaa Support regeneration of ja-dic.el under '--with-small-ja-...
Alan Mackenzie [Sat, 30 Sep 2023 14:32:50 +0000 (14:32 +0000)]
Complete yesterday's commit for cl-print.el
I.e. commit the needed change to the test suite.
* test/lisp/emacs-lisp/cl-print-tests.el
(cl-print-tests-ellipsis-string): Bind cl-print-string-length.
Only bind print-length and print-level where they are
specifically needed.
Stefan Monnier [Fri, 29 Sep 2023 21:46:20 +0000 (17:46 -0400)]
regex.c: Remove the old analyzes functions
After testing and checking that the changes brought by the new
consolidated analysis function (which are all cases of improved
optimizations) are indeed safe, remove the old code.
* src/regex-emacs.c (analyze_first_old): Delete function.
(analyze_first): Don't call it any more.
(skip_noops): Delete function.
(mutually_exclusive_aux): Delete function.
(mutually_exclusive_p): Don't call it any more.
Stefan Monnier [Fri, 29 Sep 2023 21:39:10 +0000 (17:39 -0400)]
regex.c: Consolidate the two analysis functions
We currently have two functions that analyze the bytecode
to try and apply optimizations: `analyze_first` and `mutually_exclusive_p`.
Extract the common code between them into a new function `forall_firstchar`,
and then rewrite the old ones on top of that one.
Along the way, we get slightly better analyses that reverts
the recent de-optimizations but without re-introducing the
corresponding bugs.
* src/regex-emacs.c (forall_firstchar_1, forall_firstchar): New functions.
(analyze_first_old): Rename from `analyze_first`.
(struct anafirst_data): New struct.
(analyze_first_fastmap, analyze_first_null): New functions.
(analyze_first): Rewrite to use `forall_firstchar` with those two functions.
Take a `bufp` rather than a `multibyte` arg.
(regex_compile, re_compile_fastmap): Adjust calls accordingly.
(struct mutexcl_data): New struct.
(mutually_exclusive_one): New function.
(mutually_exclusive_p): Rewrite to use `forall_firstchar` with that function.
Stefan Monnier [Fri, 29 Sep 2023 20:41:37 +0000 (16:41 -0400)]
regex.c: Various cosmetic changes
* src/regex-emacs.c (extract_address): New function.
(skip_noops, mutually_exclusive_aux, re_match_2_internal): Use it.
(regex_compile): Fix oversight in last commit.
(analyze_first): Return a bool rather than an int.
(re_compile_fastmap): Simplify accordingly.
(re_match_2_internal): Share the common code between the fail and
success exit paths.
Stefan Monnier [Fri, 29 Sep 2023 18:55:24 +0000 (14:55 -0400)]
search.c (re--describe-compiled): New function (bug#66261)
This provides a fairly primitive but handy way to see what
a regexp compiles to without having to enable REGEX_EMACS_DEBUG
and wade through tons of stderr output.
* src/regex-emacs.c (debug_putchar, print_fastmap)
(print_partial_compiled_pattern, print_compiled_pattern): Add `dest`
argument, and compile also when `ENABLE_CHECKING` is set.
(DEBUG_PRINT_COMPILED_PATTERN, print_double_string, regex_compile):
Adjust to additional argument.
Alan Mackenzie [Fri, 29 Sep 2023 16:14:04 +0000 (16:14 +0000)]
Stop truncating strings too much in cl-print-string-with-limit
This fixes bug#65680, by introducing a new variable limiting
the length of a printed string, rather than abusing
print-length for that purpose.
* lisp/emacs-lisp/cl-print.el (cl-print-string-length): New
variable.
(cl-print-object <string>, cl-print--string-props): Use
cl-print-string-length rather than print-length here.
(cl-print-string-with-limit): bind cl-print-string-length based
on argument `limit'. Decrement it by a quarter at each trial
iteration of printing.
Small clean-up of byte-compile-docstring-style-warn
* lisp/emacs-lisp/bytecomp.el (byte-compile-docstring-style-warn):
Make the code slightly cheaper. It's still dominated by the
huge cost of `byte-compile--wide-docstring-p`, though.
Harald Jörg [Fri, 29 Sep 2023 14:46:23 +0000 (16:46 +0200)]
; cperl-mode-tests.el: Avoid using skip-when
* test/lisp/progmodes/cperl-mode-tests.el: Add a hint to the
commentary that the tests are intended to run on older Emacsen.
(cperl-test-bug-10483): Replace skip-when by skip-unless followed
by a negation.
(cperl-test-bug-37127): Replace skip-when by skip-unless followed
by a negation.
Alan Mackenzie [Fri, 29 Sep 2023 12:07:32 +0000 (12:07 +0000)]
CC Mode: Fix bug in whitespace scanning functions
c-forward-sws and c-backward-sws were scanning over spaces and
linefeeds marked with the string-fence syntax-table text
property. Fix this by (i) removing the WS text properties
c-in-sws and c-is-sws from characters when setting the
string-fence on them; (ii) checking the syntax of "space"
characters when scanning over them.
* lisp/progmodes/cc-defs.el (c-skip-ws-chars-forward)
c-skip-ws-chars-backward, c-put-string-fence): New macros.
* lisp/progmodes/cc-awk.el
(c-awk-set-string-regexp-syntax-table-properties): Use
c-put-string-fence.
* lisp/progmodes/cc-engine.el (c-beginning-of-statement-1):
Correct the determination of macro-start.
(c-forward-sws, c-backward-sws): Replace skip-chars-forward by
c-skip-ws-chars-forward and skip-chars-backward by
c-skip-ws-chars-backward.
(c-unmark-<>-around-region, c-after-change-unmark-ml-strings)
(c-propertize-ml-string-opener): Use c-put-string-fence.
* lisp/progmodes/cc-mode.el (c-put-syn-tab): Use
c-put-string-fence when appropriate.