1
0
mirror of https://git.savannah.gnu.org/git/emacs.git synced 2024-12-14 09:39:42 +00:00
Commit Graph

7017 Commits

Author SHA1 Message Date
F. Jason Park
b4b4b5f431 Improve SOCKS error handling and support version 4a
* doc/misc/url.texi: Mention version 4a in SOCKS portion of "Gateways
in general" node.
* etc/NEWS: Mention version 4a support in new `socks' section.
* lisp/net/socks.el (socks-server): Add new Custom choice `4a' for
version field.  This change does not further overload the field in
terms of expected type because `socks-send-command' and `socks-filter'
already accommodate the symbol `http'.
(socks--errors-4): Add new constant containing error messages for
version 4.  The semantics are faithful to the de facto spec, but the
exact wording is slightly adapted.
(socks-filter): Allow for a null "type" field on error with version 5.
Previously, certain errors would not propagate because a wrong-type
signal would get in the way.
(socks-send-command): Massage existing version 4 protocol parsing to
accommodate 4a, and add error handling for version 4.  Use variable
`socks-username' for v4 variable-length ID field instead of calling
`user-full-name', which has potential privacy implications.
* test/lisp/net/socks-tests.el (socks-tests-v4-basic): Don't mock
`user-full-name' because `socks-send-command' no longer calls it to
determine the ID.
(socks-tests-v4a-basic, socks-tests-v4a-error): Add a couple tests for
SOCKS version 4a.  (Bug#53941)
2023-10-18 06:23:57 -07:00
F. Jason Park
2061bf0645 Don't hard code server ports in SOCKS tests
* test/lisp/net/socks-tests.el (socks-tests-canned-server-create,
socks-tests-filter-response-parsing-v4): Fix bug in process filter to
prevent prepared outgoing responses from being implicitly encoded as
UTF-8.  Fix similar mistake in v4 filter test.
(socks-tests-v4-basic, socks-tests-v5-auth-user-pass,
socks-tests-v5-auth-user-pass-blank, socks-tests-v5-auth-none): Allow
system to choose port instead of hard-coding it.
(socks-tests-perform-hello-world-http-request): Add optional `method'
parameter to specify a gateway method.
(socks-tests-v5-auth-none): Move body to helper function of the same
name.
(socks-override-functions): New test ensuring top-level advice around
`open-networks-stream' still supported.  (Bug#53941)
2023-10-18 06:23:14 -07:00
Michael Albinus
2071904d51 Merge from origin/emacs-29
07c45f20fd Fix test in files-tests
5d3f3288d2 ; * doc/emacs/search.texi (Regexp Backslash): Improve ind...
9525315c11 Add missing :version to two defcustoms
9044d4d94b Fix a defcustom :type in eldoc.el
8141d73ea7 Document 'M-x align' in the Emacs manual
2023-10-16 09:02:39 +02:00
Michael Albinus
07c45f20fd Fix test in files-tests
* test/lisp/files-tests.el
(files-tests-file-name-non-special-expand-file-name-tilde): Fix test.
2023-10-15 12:26:43 +02:00
Harald Jörg
330dd51f8b ;cperl-mode.el: Do not mistake a left-shift operator for a here-doc.
* lisp/progmodes/cperl-mode.el (cperl-find-pods-heres): Empty
unquoted delimiters for here-documents are now forbidden
(Bug#65834).

* test/lisp/progmodes/cperl-mode-tests.el (cperl-test-bug-65834):
New test.

* test/lisp/progmodes/cperl-mode-resources/cperl-bug-65834.pl: new
resource with source code from the bug report.
2023-10-14 18:22:11 +02:00
Mauro Aranda
ad02fc212b Fix indentation and fontification in shell-script (Bug#26217)
* lisp/progmodes/sh-script.el (sh-smie--sh-keyword-p): Treat "do" as
special, like we treat "in".
(sh-smie--sh-keyword-in-p): Change signature.  Take the token to
decide correctly if it's a keyword.
(sh-font-lock-keywords-var-1): Add do.

* test/lisp/progmodes/sh-script-resources/sh-indents.erts: New test.
* test/lisp/progmodes/sh-script-tests.el
(sh-script-test-do-fontification): New test.
2023-10-14 11:00:15 -04:00
Michael Albinus
1677a65554 Merge from origin/emacs-29
dc8b336d02 * lisp/files.el (file-name-non-special): Handle quoted ti...
2023-10-14 09:38:17 +02:00
Michael Albinus
dc8b336d02 * lisp/files.el (file-name-non-special): Handle quoted tilde.
(Bug#65685)

* test/lisp/files-tests.el
(files-tests-file-name-non-special-expand-file-name-tilde):
New test.
2023-10-14 09:34:40 +02:00
Harald Jörg
3a1fc81628 cperl-mode.el: Optionally treat trailing text as comment
* lisp/progmodes/cperl-mode.el (cperl-fontify-trailer): New
customization variable.  With a value of 'comment, cperl-mode
treats trailing text after after __END__ and __DATA__ as comment,
like perl-mode does (Bug#66161).
(cperl-find-pods-heres): Treat trailing text after __END__ and
__DATA__ according to the customization variable
`cperl-fontify-trailer'.

* test/lisp/progmodes/cperl-mode-tests.el (cperl-test-bug-66161):
New test, verifying the changed behavior if the custom variable is
set to 'comment.

* test/lisp/progmodes/cperl-mode-resources/cperl-bug-66161.pl: New
resource file, source code from the corresponding bug report.
2023-10-14 00:34:41 +02:00
F. Jason Park
52af0a5fb9 Add command to refill buffer in erc-fill-wrap-mode
* lisp/erc/erc-fill.el (erc-fill-function, erc-fill-wrap-mode):
Mention new command `erc-fill-wrap-refill-buffer' in doc string.
(erc-fill--wrap-rejigger-last-message): New internal variable.
(erc-fill--wrap-rejigger-region, erc-fill-wrap-refill-buffer): New
command and helper function for fixing alignment issues that arise,
for example, from adjusting pixel-display widths of buffer text during
a session.
* test/lisp/erc/erc-fill-tests.el (erc-fill-tests--simulate-refill):
New function for approximating `erc-fill-wrap-refill-buffer'.
(erc-fill-wrap--merge): Assert refilling is idempotent.  (Bug#60936)
2023-10-13 07:47:01 -07:00
F. Jason Park
5e2be1e0ba Swap hook positions of erc-fill and erc-match-message
* etc/ERC-NEWS: Fix new order of reserved modify-hook members.
* lisp/erc/erc-fill.el: Increase depth of `erc-fill' in both modify
hooks from 40 to 60.
* lisp/erc/erc-match.el (erc-match-mode, erc-match-enable,
erc-match-disable): Use general module setup function
`erc-match--setup' for buffer-local modifications instead of calling
`erc-match--modify-invisibility-spec' directly.  Add and remove new
post-modify hook `erc-match--on-insert-post'.
(erc-hide-fools): Use `erc--msg-props' for communicating to
post-processing step for applying invisible props instead of doing so
immediately.
(erc-match--on-insert-post): New function to apply module-specific
`invisible' props.  Will likely be replaced by a general service to do
the same, perhaps provided by a future "erc-ignore"-like module.
(erc-match--modify-invisibility-spec, erc-match--setup): Rename former
to latter and only operate on current buffer.
* test/lisp/erc/erc-scenarios-match.el
(erc-scenarios-match--stamp-left-fools-invisible,
erc-scenarios-match--stamp-right-fools-invisible,
erc-scenarios-match--stamp-right-invisible-fill-wrap,
erc-scenarios-match--stamp-both-invisible-fill-static): Update
expected order of ERC-owned `invisible' prop members `match-fools' and
`timestamp'.
* test/lisp/erc/erc-tests.el (erc--essential-hook-ordering): Swap
expected order of `erc-fill' and `erc-add-timestamp' in both hooks.
(Bug#64301)
2023-10-13 07:47:01 -07:00
F. Jason Park
c68dc7786f Manage some text props for ERC insertion-hook members
* etc/ERC-NEWS: Mention that ERC only adds the text property
`cursor-sensor-functions' when `erc-echo-timestamps' is enabled.  Also
mention that date stamps are now inserted as separate messages.
* lisp/erc/erc-fill.el (erc-fill): Look for text prop `erc-cmd'
instead of `erc-command' and use helper utility to do so.
(erc-fill-static): Skip date stamps because this fill style leaves
them flush left.
(erc-fill-wrap-mode, erc-fill-wrap-enable, erc-fill-wrap-disable):
Don't hook on the soon-to-be-removed function interface
`erc-stamp--insert-date-function' because date stamps are now separate
messages.
(erc-fill--wrap-continued-message-p): Restore accidentally discarded
doc string.  Derive context about current message from text props at
`point-min', and use updated property names and utility functions.
Abort when previous message is now hidden.
(erc-fill--wrap-stamp-insert-prefixed-date): Remove unused function,
originally meant to be new in ERC 5.6, and move logic for date-stamp
measuring portion directly to `erc-fill-wrap' itself.
(erc-fill--wrap-measure): New helper function.
(erc-fill-wrap): Use helper `erc-fill--wrap-measure' and incorporate
date-stamp detection and width measuring from removed helper.  Don't
dedent first word for messages of unknown origin, such as those
inserted by `erc-display-line' alone without prior preparation from
`erc-display-message'.
* lisp/erc/erc-goodies.el (erc-readonly-mode, erc-readonly-enable):
Set hook depth explicitly to 70.
* lisp/erc/erc-stamp.el (erc-timestamp-format-left): Mention that a
trailing newline is implicit if not provided and that users who don't
want date stamps should use `erc-timestamp-format-right' instead.
(erc-stamp-mode, erc-stamp-enable): Call `erc-stamp--setup' instead
of `erc-munge-invisibility-spec', and bump hook depth for
`erc-add-timestamp' to 70.
(erc-stamp--current-time): Use `erc-ts' instead of `erc-timestamp'
text property in doc string.
(erc-stamp--skip): New internal variable.
(erc-stamp--allow-unmanaged): New variable for legacy code to force
`erc-add-timestamps' to run when `erc--msg-props' is nil.
(erc-add-timestamp): Always run when `erc-stamp--allow-unmanaged' is
non-nil unless `erc-stamp--skip' is as well because the latter takes
precedence.  Don't add `erc-ts' text prop directly unless
`erc-stamp--allow-unmanaged is non-nil.  Instead, use the new
`erc--msg-props' facility to defer until after modification hooks.
Likewise, don't add `cursor-senor-functions' directly either unless
the same compatibility flag is enabled.  Instead, expect the latter to
be handled by a post-modify hook conditioned on the option
`erc-echo-timestamps'.
(erc-timestamp-last-inserted-left): Mention that the final trailing
newline specified in the format string no longer appears in the
recorded value.
(erc-stamp-prefix-log-filter): Use updated name for timestamp
property as well as helper utility for accessing it.
(erc-stamp--inherited-props): Add doc string.
(erc-insert-timestamp-right): Fix bug involving object cycle where
the time-stamp string would appear in its own `display' property.
(erc-stamp--insert-date-function, erc-stamp--insert-date-hook): Remove
unused internal function-valued interface variable and replace with
the latter, a normal hook.
(erc-stamp--date-format-end, erc-stamp--propertize-left-date-stamp):
New function and auxiliary variable to apply date stamp properties at
the post-modify stage.  Add text property `erc-stamp-type' to inserted
date stamps to help folks distinguish between them and other
left-sided stamps.
(erc-stamp--current-datestamp-left,
erc-stamp--format-date-stamp,
erc-stamp--insert-date-stamp-as-phony-message,
erc-stamp--lr-date-on-pre-modify): New functions and state variable to
help ERC treat date stamps as separate messages while working within
the established mechanism for processing inserted messages.  Shadow
`erc-stamp--invisible-property' when calling `erc-format-timestamp' in
order to prevent date stamps from inheriting other `invisible' props.
These date stamps are special in that they have no business being
hidden along with the current message.
(erc-insert-timestamp-left-and-right): On initial run in any buffer,
remember whether the date stamp needed newline massaging on insertion.
Move all business for inserting date stamps to post-modify hooks, but
run them forcibly if this is the very first date stamp in the current
buffer.  Also mention some specifics related to relevant text props in
the doc string.
(erc-format-timestamp): Don't add `invisible' prop to stamp unless
`erc-stamp--invisible-property' is non-nil.
(erc-stamp--csf-props-updated-p): New local variable.
(erc-munge-invisibility-spec): Restore `cursor-sensor-functions' text
property for existing messages when a user enables the option
mid-session.  Add and remove hooks for use with automatic timestamp
echoing.
(erc-stamp--add-csf-on-post-modify): New function to add
`cursor-sensor-functions' property on post-modify hooks.
(erc-stamp--setup): Perform some additional teardown.
(erc-stamp--on-clear-message): Look for text property `erc-ts' instead
of `erc-timestamp'.
(erc-echo-timestamp, erc--echo-ts-csf): Use utility to find time-stamp
text prop in current message.
(erc-stamp--update-saved-position, erc-stamp--reset-on-clear): Use
hook `erc-stamp--insert-date-hook' instead of excised function-valued
variable interface `erc-stamp--insert-date-function'.
* lisp/erc/erc-truncate.el (erc-truncate-buffer-to-size): Use internal
utility to find beginning of message.
* lisp/erc/erc.el (erc--msg-props, erc--msg-props-overrides): New
internal variables for initializing and conveying metadata-oriented
text properties among insert and send hooks.
(erc-insert-modify-hook): Mention reserved depth ranges for built-in
members in doc string.
(erc-send-action):  Use convenience variable to modifying text props
instead of awkwardly overriding `erc-insert-pre-hook'.
(erc--check-msg-prop, erc--get-inserted-msg-bounds,
erc--get-inserted-msg-prop, erc--with-inserted-msg,
erc--traverse-inserted): New utility functions and macros to help
modules find metadata and message-delimiting text props.
(erc-display-line-1): Ensure the first character of every message in
an ERC buffer has the `erc-msg' property, as well as any other props
in `erc--msg-props', when populated.
(erc--hide-message): Don't bother offsetting start of first message in
a buffer.
(erc--ranked-properties, erc--order-text-properties-from-hash): New
variable and function to convert `erc--msg-props' into a plist
suitable for `add-text-properties'.
(erc-display-message): Make doc string more informative.  Bind and
initialize `erc--msg-props' for use by all hooks.  Respect
`erc--msg-prop-overrides' when non-nil.  Don't add `erc-command'
property.  Instead, ensure `erc--msg-props' contains an `erc-cmd' item
when the parameter PARSED is non-nil.
(erc--own-property-names): Add `erc-stamp-type'.
(erc--get-speaker-bounds): Use helper to find message start.
(erc-process-ctcp-query, erc-send-current-line): Use convenience
variable to leverage framework for manipulating message metadata
instead of overriding `erc-insert-pre-hook'.
(erc-display-msg): Bind `erc--msg-props' for use by all send-related
hooks.  Add text props from table after `erc-send-post-hook'.
(erc-restore-text-properties): Improve doc string.
(erc--get-eq-comparable-cmd): Use `if-let' instead of `if-let*'.
* test/lisp/erc/erc-fill-tests.el (erc-fill-tests--insert-privmsg):
Make phony message more realistic.
(erc-fill-tests--wrap-populate): Shorten overlong line.
(erc-fill-tests--wrap-check-prefixes): Make test utility more vigilant
in asserting no gaps exist in `line-prefix' property interval.
(erc-fill-tests--compare): Compare text props on text-prop values that
are themselves strings.
* test/lisp/erc/erc-scenarios-log.el (erc-scenarios-log--clear-stamp):
Ensure `erc-stamp' is loaded.
* test/lisp/erc/erc-scenarios-match.el
(erc-scenarios-match--stamp-left-current-nick,
erc-scenarios-match--invisible-stamp): Use `default-value' for
`erc-insert-modify-hook' in ordering assertion.
(erc-scenarios-match--find-bol, erc-scenarios-match--find-eol): Remove
unused assertion helper functions.
(erc-scenarios-match--stamp-right-fools-invisible): Remove misplaced
ERT tag from function and use utility to find message bounds.
(erc-scenarios-match--stamp-right-fools-invisible): Use real utility
from main library to find message end.
(erc-scenarios-match--fill-wrap-stamp-dedented-p): New assertion
utility function.
(erc-scenarios-match--hide-fools/stamp-both/fill-wrap) New test.
(erc-scenarios-match--hide-fools/stamp-both/fill-wrap/speak): New
test.
(erc-scenarios-match--stamp-both-invisible-fill-static): Expect
`erc-cmd' at beginning of inserted message's filled line, even if the
line starts with white space.  Also, add new function parameter
`assert-ds', a callback to run when visiting the second date stamp,
which is followed by a hidden message.  In the test of the same name,
expect the date stamp's invisibility interval to begin at the newline
after the previous message and to not contain any existing
invisibility props, namely, those belonging to the subsequent hidden
"fools" message.  Also use shortened "metadata" text prop names.
(erc-scenarios-match--stamp-both-invisible-fill-static--nooffset):
Expect the date stamp's invisibility interval to match its field's
instead of starting and ending sooner.
* test/lisp/erc/erc-stamp-tests.el: Put well-known metadata prop at
the start of the message.
* test/lisp/erc/erc-tests.el (erc--refresh-prompt): Prevent modules
from mutating hooks.
(erc--order-text-properties-from-hash, erc--check-msg-prop): New
tests.
* test/lisp/erc/resources/fill/snapshots/merge-01-start.eld: Update
test data.
* test/lisp/erc/resources/fill/snapshots/merge-02-right.eld: Update
test data.
* test/lisp/erc/resources/fill/snapshots/merge-wrap-01.eld: Update.
* test/lisp/erc/resources/fill/snapshots/monospace-01-start.eld:
Update.
* test/lisp/erc/resources/fill/snapshots/monospace-02-right.eld:
Update.
* test/lisp/erc/resources/fill/snapshots/monospace-03-left.eld:
Update.
* test/lisp/erc/resources/fill/snapshots/monospace-04-reset.eld:
Update.
* test/lisp/erc/resources/fill/snapshots/spacing-01-mono.eld: Update.
* test/lisp/erc/resources/fill/snapshots/stamps-left-01.eld: Update.
* test/lisp/erc/resources/match/fools/fill-wrap.eld: New file.
(Bug#60936)
2023-10-13 07:47:01 -07:00
F. Jason Park
a4bae965e0 Easily excise list-valued text prop members in ERC
* lisp/erc/erc.el (erc--remove-from-prop-value-list): New function for
removing `invisible' and `face' prop members cleanly.
* test/lisp/erc/erc-tests.el (erc--remove-from-prop-value-list,
erc--remove-from-prop-value-list/many): New tests.  (Bug#60936)
2023-10-13 07:47:01 -07:00
F. Jason Park
1950ddebac Allow spoofing process marker in erc-display-line-1
* lisp/erc/erc.el (erc--insert-marker): New internal variable for
overriding `erc-insert-marker' when displaying messages at a
non-default location in the buffer.
(erc-display-line-1): Favor `erc--insert-marker' over
`erc-insert-marker' when non-nil.
; * test/lisp/erc/resources/base/assoc/multi-net/barnet.eld: Timeouts.
; * test/lisp/erc/resources/base/assoc/multi-net/foonet.eld: Timeouts.
; * test/lisp/erc/resources/base/netid/bouncer/barnet-drop.eld: Timeouts.
; * test/lisp/erc/resources/base/netid/bouncer/foonet-drop.eld: Timeouts.
; * test/lisp/erc/resources/erc-d/resources/dynamic-foonet.eld: Timeouts.
; * test/lisp/erc/resources/sasl/scram-sha-1.eld: Timeouts.
; * test/lisp/erc/resources/sasl/scram-sha-256.eld: Timeouts.
2023-10-13 07:47:00 -07:00
F. Jason Park
d46c016fbd Sort and dedupe when loading modules in erc-open
* doc/misc/erc.texi: Add new subheading "Module Loading" under the
"Modules" chapter.
* lisp/erc/erc.el (erc--sort-modules): New utility function to sort
and dedupe modules.
(erc-modules): In `custom-set' function, factor out collation into
separate utility `erc--sort-modules'.
(erc-update-modules): Call `erc--update-modules' with an argument, the
current value of `erc-modules'.
(erc--aberrant-modules): New variable, a list of symbols whose modules
ERC suspects of being incorrectly defined.
(erc--warn-about-aberrant-modules): New function to print an error
message and emit a warning prior to connecting when
`erc--aberrant-modules' is non-nil.
(erc--find-mode): Make heuristic more robust by always checking for a
mode activation command rather than just a state variable.  This fixes
a compatibility bug, new in 5.6, affecting third-party modules that
autoload module definitions instead of their corresponding
mode-activation commands.
(erc--update-modules): Add new positional argument `modules'.
(erc--setup-buffer-hook): Add new default member,
`erc--warn-about-aberrant-modules'.
(erc-open): Pass sorted `erc-modules' to `erc--update-modules'.
* test/lisp/erc/erc-tests.el (erc--sort-modules): New test.
(erc-tests--update-modules): New fixture.
(erc--update-modules): Remove and rework as three separate tests
dedicated to specific contexts.  The existing one had poor coverage
and was difficult, if not impossible, to follow.
(erc--update-modules/unknown, erc--update-modules/local,
erc--update-modules/realistic): New tests.  (Bug#57955)
2023-10-13 07:47:00 -07:00
F. Jason Park
9120d7a32e Honor nil values in erc--restore-initialize-priors
* lisp/erc/erc.el (erc--restore-initialize-priors): Don't produce
invalid "empty" `setq' form when parameter VARS contains defaults that
initialize to nil.  This function is mainly used by local modules,
which were first made usable in ERC 5.5 (bug#57955).
* test/lisp/erc/erc-tests.el (erc--restore-initialize-priors): Fix
expected expansion, which is now slightly leaner.  (Bug#60936)
2023-10-13 07:47:00 -07:00
F. Jason Park
328a985651 Skip post-minibuffer restore in erc-scrolltobottom-all
* etc/ERC-NEWS: Remove mention of `erc-scrolltobottom-relaxed' in
entry for module `scrolltobottom'.
* lisp/erc/erc-goodies.el (erc-input-line-position): Fix mention of
abandoned option `erc-scrolltobottom-relaxed'.
(erc-scrolltobottom-all): Subsume option `erc-scrolltobottom-relaxed'
by recognizing a third value state, `relaxed'.  A separate option
would make more sense if other options also depended on
`erc-scrolltobottom-all'.
(erc-scrolltobottom-relaxed): Remove redundant option, which was to be
new in ERC 5.6.
(erc-scrolltobottom-enable, erc-scrolltobottom-mode): Warn if user
attempts to enable `erc-scrolltobottom-all' on Emacs 27, which is not
supported.
(erc--scrolltobottom-relaxed-commands,
erc--scrolltobottom-post-force-commands,
erc--scrolltobottom-relaxed-skip-commands): Remove unused variables.
(erc--scrolltobottom-on-pre-command,
erc--scrolltobottom-on-pre-command-relaxed,
erc--scrolltobottom-on-post-command-relaxed): Remove unused functions.
(erc--scrolltobottom-on-post-command): Remove conditional branch for
dealing with a non-nil `erc--scrolltobottom-window-info'.
(erc--scrolltobottom-setup): Convert from generic to normal function
and remove setup and teardown for unused hooks.  Set variable
`read-minibuffer-restore-windows' locally when option
`erc-scrolltobottom-all' is non-nil.
(erc--scrolltobottom-on-pre-insert): Replace reference to subsumed
option `erc-scrolltobottom-relaxed' with new value `relaxed' for
existing option `erc-scrolltobottom-all'.
* test/lisp/erc/erc-scenarios-scrolltobottom-relaxed.el
(erc-scenarios-scrolltobottom--relaxed): Replace option
`erc-scrolltobottom-relaxed' with new value `relaxed' for
`erc-scrolltobottom-all'.  (Bug#64855)
2023-10-13 07:47:00 -07:00
Michael Albinus
bbccef3ceb Merge from origin/emacs-29
c8ea14e782 Handle quoted tilde in Tramp
30239759ee ; Set maintainer for elint.el to emacs-devel
eedd9db619 Update to Org 9.6.10

# Conflicts:
#	lisp/net/tramp-gvfs.el
2023-10-13 16:18:06 +02:00
Michael Albinus
c8ea14e782 Handle quoted tilde in Tramp
* lisp/net/tramp.el (tramp-handle-expand-file-name):
* lisp/net/tramp-gvfs.el (tramp-gvfs-handle-expand-file-name):
* lisp/net/tramp-sh.el (tramp-sh-handle-expand-file-name):
* lisp/net/tramp-smb.el (tramp-smb-handle-expand-file-name):
* lisp/net/tramp-sudoedit.el (tramp-sudoedit-handle-expand-file-name):
Handle quoted tilde.  (Bug#65685)

* test/lisp/net/tramp-tests.el (tramp-test05-expand-file-name-tilde):
New test.
2023-10-13 16:09:51 +02:00
Michael Albinus
088dd67f89 New filenotify tests
* src/inotify.c (Finotify_watch_list, Finotify_allocated_p):
Fix argument list.

* test/lisp/filenotify-tests.el (file-notify-test04-autorevert):
Use `skip-when'.
(file-notify-test12-unmount, file-notify-test12-unmount-remote):
New tests.
2023-10-12 11:02:53 +02:00
Jim Porter
60f6952853 Fix behavior of Eshell prompt when yanking output into it
* lisp/eshell/esh-util.el (eshell--unmark-string-as-output): New
function...

* lisp/eshell/esh-mode.el (eshell-mode): ... use it.

* test/lisp/eshell/eshell-tests.el (eshell-test/yank-output): New test
(bug#66469).
2023-10-11 12:44:31 -07:00
Harald Jörg
fc1f6688a2 ; cperl-mode.el: Don't override fontificaton in comments.
* lisp/progmodes/cperl-mode.el (cperl-init-faces): Reorder the
matchers for fontification of array and hash elements and keys so
that they don't override comment and string fontification (Bug#66145).

* test/lisp/progmodes/cperl-mode-tests.el (cperl-test-bug-66145):
New test for all combinations of sigils and brackets/braces to
verify that strings and comments are left untouched.  This test
also works for perl-mode which has always done it correctly.

* test/lisp/progmodes/cperl-mode-resources/cperl-bug-66145.pl: New
resource file for the above test.
2023-10-09 17:58:21 +02:00
Mattias Engdegård
ca9f0e75b1 Omit the omake compilation-mode rule by default
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.
2023-10-05 12:25:57 +02:00
Stefan Monnier
37130fd500 regex.c: Fix recent regression with mutually_exclusive_p
The new analysis code ended up increasing the scope of an optimization
a bit too far.  Reign it in.

* src/regex-emacs.c (struct mutexcl_data): Add `unconstrained` field.
(mutually_exclusive_one): Use and set it.
(mutually_exclusive_p): Initialize it.

* test/src/regex-emacs-tests.el (regexp-tests-backtrack-optimization):
Add test.
2023-10-03 10:10:57 -04:00
Jim Porter
498d31e9f0 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.

* lisp/eshell/esh-mode.el (eshell-intercept-commands)
(eshell-watch-for-password-prompt):
* lisp/eshell/em-cmpl.el (eshell-complete-parse-arguments):
* lisp/eshell/em-smart.el (eshell-smart-display-move): Use
'eshell-foreground-command'.

* 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.
2023-10-02 20:49:41 -07:00
Jim Porter
8f2cfe15a7 Don't print subjob messages when running an Eshell script in the background
* lisp/eshell/esh-proc.el (eshell-subjob-messages): New variable...
(eshell-record-process-object)
(eshell-remove-process-entry): ... check it.

* lisp/eshell/em-script.el (eshell-source-file): Set
'eshell-subjob-messages' to nil.

* lisp/eshell/esh-cmd.el (eshell-do-subjob): Set
'eshell-subjob-messages' to t.

* test/lisp/eshell/em-script-tests.el
(em-script-test/source-script/background): New test.
2023-10-02 20:49:40 -07:00
F. Jason Park
3979f83cd6 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)
2023-10-02 17:31:29 -07:00
F. Jason Park
a3c6ed0e36 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)
2023-10-02 17:31:29 -07:00
F. Jason Park
6135fec692 ; 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'.
2023-10-02 17:26:27 -07:00
Jim Porter
862e5effbf ; Adjust Eshell regression tests to avoid SIGPIPE
In batch mode, SIGPIPEs can cause Emacs to abort (bug#66186).

* lisp/eshell/esh-io.el (eshell-output-object-to-target): Update
comment.

* 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'.
2023-10-01 13:11:09 -07:00
Michael Albinus
9966db38b2 Some tramp-tests.el fixes
* test/lisp/net/tramp-tests.el (tramp-test17-insert-directory):
Improve check.
(tramp--test-check-files): Don't err out when "printenv" doesn't
exist on remote side.
(tramp-test47-read-password): Remove :unstable tag.
(tramp-test47-read-otp-password): Rename.
2023-10-01 11:28:20 +02:00
Mauro Aranda
7caa3f5499 Fix indentation in perl-mode (Bug#35925)
* 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.
2023-10-01 04:13:17 +02:00
Eli Zaretskii
46978fa1ef Merge from origin/emacs-29
4776d90c31 Add new Tramp test
ca5b48fd76 Fix tmm-mid-prompt :type (Bug#66179)
7447d3df94 Fix tree-sitter indentation conflict with multiple languages
bee18e5273 Fix bug#66093 in Tramp
7d5fee0fea Support regeneration of ja-dic.el under '--with-small-ja-...

Conflicts:
	make-dist
2023-09-30 13:50:07 -04:00
Alan Mackenzie
c55e22c418 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.
2023-09-30 14:32:50 +00:00
Harald Jörg
f13c4f1562 ; 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.
2023-09-29 16:46:23 +02:00
Stefan Monnier
7c26501175 regex.c (mutually_exclusive_aux) <wordbound>: Remove optimization
Another case that was too optimistic.  Better use \> or \< rather
than \b if you want your regexp to be handled efficiently.

* src/regex-emacs.c (mutually_exclusive_aux) <wordbound>: Cancel optimization.
* test/src/regex-emacs-tests.el (regexp-tests-backtrack-optimization):
New test.
2023-09-28 12:37:44 -04:00
Michael Albinus
356e79e47f Fix tramp-test.el (don't merge with master)
* test/lisp/net/tramp-tests.el (tramp--test-check-files):
Don't err out when "printenv" doesn't exist on remote side.
2023-09-28 09:56:13 +02:00
Stefan Monnier
bc52fdd1d1 * src/regex-emacs.c (analyze_first): Fix incorrect optimization
The optimization was incorrect in a particular corner case.
In this fix I just disable it conservatively for more cases because
it's not obvious how to fix it while preserving the "good" cases.

We may find a better fix by using an approach like the one
in `mutually_exhaustive_aux`, but for now this is good enough,
especially since \{..\} repetitions are not used very frequently.

* test/src/regex-resources/PTESTS: New test.
2023-09-27 13:29:50 -04:00
Mattias Engdegård
9a67540e51 ; * test/src/regex-emacs-tests.el: suppress relint complaints 2023-09-27 12:45:43 +02:00
Alan Mackenzie
6956382033 Revert "Don't use ellipses while cl-printing strings."
This reverts commit 761f8901ff.
2023-09-27 09:54:33 +00:00
Wilhelm H Kirschbaum
1f850d8d7b
Fix treesit-langauge-at-point for elixir-ts-mode.
The treesit-language-at-point function is only suppose to query the
host language.

* lisp/progmodes/elixir-ts-mode.el
(elixir-ts--indent-rules): Add missing rules.
(elixir-ts--treesit-language-at-point): Update function to only query
the host language.
* test/lisp/progmodes/elixir-ts-mode-resources/indent.erts: Add test
for inline docs.
2023-09-26 23:23:54 -07:00
Jim Porter
eef32d13da Use 'unwind-protect' in more places in Eshell
This lets us simplify the logic for how we reset
'eshell-current-command' and 'eshell-last-async-procs', as well as
improving correctness of Eshell command forms in a few esoteric
scenarios.  Additionally, this helps set the stage for better support
of background commands in Eshell (bug#66164).

* lisp/eshell/esh-cmd.el (eshell-cmd-initialize): Remove addition to
'eshell-post-command-hook'; this is handled in 'eshell-resume-command'
and 'eshell-resume-eval' now.
(eshell-resume-command): Handle resetting the prompt as needed.
(eshell-resume-eval): Use 'unwind-protect' to ensure that we set
'eshell-last-async-procs' and 'eshell-current-comment' at the right
times.
(eshell-parse-command, eshell-trap-errors, eshell-manipulate): Use
'unwind-protect'.
(eshell-do-eval): Allow 'eshell-defer' to pass through
'unwind-protect' forms without actually calling the unwinding forms
(yet).

* lisp/eshell/esh-proc.el (eshell-kill-process-function)
(eshell-reset-after-proc): Make obsolete.  The behavior is now handled
in 'eshell-resume-command'.
(eshell-gather-process-output, eshell-sentinel)
(eshell-interrupt-process, eshell-kill-process, eshell-quit-process)
(eshell-stop-process, eshell-continue-process): Run 'eshell-kill-hook'
directly.

* test/lisp/eshell/esh-cmd-tests.el (esh-cmd-test/throw): New test.
2023-09-26 12:29:52 -07:00
Stefan Monnier
e88be844bf regex.c (mutually_exclusive_p): Fix initial value of loop_beg
* src/regex-emacs.c (mutually_exclusive_p): Don't pretend that pattern
position 0 has been checked already.

* test/src/regex-emacs-tests.el (regexp-tests-backtrack-optimization):
Add a corresponding regression test plus some other related tests
I had around.
2023-09-26 11:43:51 -04:00
Michael Albinus
34550ea8ce Improve Emacs 30 compatibility in tramp-tests.el (don't merge)
* test/lisp/net/tramp-tests.el (tramp--test-deftest-direct-async-process)
(tramp-test30-make-process): Improve Emacs 30 compatibility.
2023-09-25 12:59:52 +02:00
Michael Albinus
4776d90c31 Add new Tramp test
* test/lisp/net/tramp-tests.el (tramp-test46-read-password):
Use `copy-tree' but `copy-sequence'.
(tramp-test46-read-otp-password): New test.
2023-09-25 12:48:32 +02:00
João Távora
81c6569e65 Flymake: unbreak tests
Flymake's normal behaviour implies catching the errors of misbehaving
backends.  This behavior is tested by Flymake's automated tests, built
on top of ERT, which means that debug-on-error is always t in the
bodies of said tests (I don't know the rationale for this, but it's
been like this for some time)

Flymake used to shun usage of 'condition-case-unless-debug' because of
this.  But since that macro is pretty useful, I started using it
again, and as a consequence, tests started breaking.

The solution is to:

1. stop requiring the deprecated legacy backend 'flymake-proc' (which
by design, always errors, except in rare circumstances).

2. deliberately set debug-on-error to nil around the "dummy backends""
test.

* lisp/progmodes/flymake.el (flymake-proc): Don't require it by
default.

* test/lisp/progmodes/flymake-tests.el:
(dummy-backends): Make robust to ert's debug-on-error setting.
2023-09-24 09:07:27 +01:00
Eli Zaretskii
cc8726d2c8 Merge from origin/emacs-29
6bc3800000 Ensure ucs-names is consistent with Unicode names
93134bb9c2 Make key-translate actually work
85f49a9bc8 Update to Org 9.6.9
2826c26537 Add leim subdirectories to emacs package
2023-09-23 09:32:57 -04:00
Philip Kaludercic
842411f09b package-tests.el: Add test Bug#65475
* test/lisp/emacs-lisp/package-tests.el (with-package-test): Bind
package-selected-packages.
(package-test-bug65475): Add test.
2023-09-21 18:28:30 +02:00
Mattias Engdegård
b03338c70d Warn about duplicated :tag strings in defcustom choices
It is bad user experience when two menu items have identical labels.

* lisp/emacs-lisp/bytecomp.el (bytecomp--check-cus-type): Add check.
* test/lisp/emacs-lisp/bytecomp-tests.el
(bytecomp-test-defcustom-type): Add test case.
2023-09-19 15:21:03 +02:00
Alan Mackenzie
761f8901ff Don't use ellipses while cl-printing strings.
This fixes bug#65680.  The former use of print-length as a
bound on the length of the printed string was erroneous,
causing error messages preceding backtracees to get
unnecessarily truncated to 50 characters.

* lisp/emacs-lisp/cl-print.el (cl-print-object <string>):
Remove the substitution of ellipses for long strings.

* test/lisp/emacs-lisp/cl-print-tests.el
(cl-print-tests-ellipsis-string): Remove this test.
2023-09-19 10:25:34 +00:00