]> git.eshelyaron.com Git - emacs.git/log
emacs.git
11 months ago; * lisp/progmodes/gud.el (gud-gud-lldb-command-name): Fix a typo.
Ulrich Müller [Sat, 21 Oct 2023 09:17:03 +0000 (11:17 +0200)]
; * lisp/progmodes/gud.el (gud-gud-lldb-command-name): Fix a typo.

11 months agoFacilitate opening multiple files through DND under Android
Po Lu [Sat, 21 Oct 2023 06:24:25 +0000 (14:24 +0800)]
Facilitate opening multiple files through DND under Android

* java/org/gnu/emacs/EmacsWindow.java (onDragEvent): Agglomerate
each provided content URI into a text/uri list.

11 months agoNew keyword :default-language in treesit-font-lock-rules function.
Huan Nguyen [Sat, 7 Oct 2023 10:03:55 +0000 (12:03 +0200)]
New keyword :default-language in treesit-font-lock-rules function.

* lisp/treesit.el (treesit-font-lock-rules): Keyword :default-language
LANGUAGE will be chosen for every :feature.  Using :language will
override the :default-language for the next :feature.

11 months ago(buffer-match-p): Replace `&optional` with `&rest` (bug#65797)
Stefan Monnier [Sat, 21 Oct 2023 00:42:04 +0000 (20:42 -0400)]
(buffer-match-p): Replace `&optional` with `&rest` (bug#65797)

* lisp/subr.el (buffer-match-p--past-warnings): New var.
(buffer-match-p): Use it.  Replace `&optional arg` with `&rest args`.
(match-buffers): Replace `&optional arg` with `&rest args`.

* lisp/window.el (display-buffer-alist): Fix out of date docstring.

* doc/lispref/buffers.texi (Buffer List): Document new calling convention.

11 months ago(sleep-for): Make the `millisec` argument obsolete
Stefan Monnier [Fri, 20 Oct 2023 22:59:51 +0000 (18:59 -0400)]
(sleep-for): Make the `millisec` argument obsolete

* lisp/subr.el (sleep-for): Set new advertized calling convention.
* src/dispnew.c (Fsleep_for): Adjust docstring.
* doc/lispref/commands.texi (Waiting): Adjust doc.

11 months agoPrefer erc-target to erc-default-target
F. Jason Park [Sun, 15 Oct 2023 20:20:07 +0000 (13:20 -0700)]
Prefer erc-target to erc-default-target

* etc/ERC-NEWS: Mention `erc-target' and new `erc-server-buffer-p'
alias.
* lisp/erc/erc-backend.el (erc-process-sentinel): Set `joined-p' slot
of `erc--target-channel' object to nil when applicable.
(erc-server-JOIN): Mark `erc--target-channel' object as being joined.
* lisp/erc/erc-common.el (erc--target-channel): Add `joined-p' slot.
Use hyphenated name so accessor function's name ends in "joined-p"
rather than "joinedp".  Note that this will always be nil when
disconnected.
(erc--target): Relocate here from erc.el.
(erc-target): New public API function to return the current buffer's
target as a string, even in channels that have been unjoined.
* lisp/erc/erc-networks.el (erc--default-target): Remove forward
declaration.
(erc-networks--id-reload): Use `erc-target' instead of
`erc--default-target' as predicate for visiting target buffers.
* lisp/erc/erc.el (erc-remove-channel-users): Set channel "joinedness"
to nil in `erc--target-channel' object, when applicable.
(erc--target): Move to erc-common.
(erc--default-target): Remove, replaced by new function `erc-target'.
(erc-query-buffer-p): Use `erc-target'.
(erc-after-connect): Revise doc string.
(erc-connection-established): Revise doc string and move
`erc-unhide-query-prompt' business before hook.
(erc--current-buffer-joined-p): Remove comment and use new `joined-p'
slot of `erc--target-channel' for determining "joinedness" of channel.
(erc-kill-buffer-function): Use `erc--target-channel-p' for detecting
whether the buffer is a channel buffer.
* test/lisp/erc/erc-networks-tests.el
(erc-networks--shrink-ids-and-buffer-names--hook-collapse-target):
Remove comment.
* test/lisp/erc/erc-scenarios-base-reuse-buffers.el
(erc-scenarios-common--base-reuse-buffers-channel-buffers):
Clarify assertion.
* test/lisp/erc/erc-tests.el (erc-with-all-buffers-of-server):
Replace `erc-default-recipients' with `erc--target'.
(erc--target-from-string): Update expected shape of
`erc--target-channel' struct with new `joined-p' slot.
(erc-message): Set `erc--target' in buffer "#chan".  (Bug#66578)

11 months agoRename erc-server-buffer-p
F. Jason Park [Sun, 15 Oct 2023 14:22:31 +0000 (07:22 -0700)]
Rename erc-server-buffer-p

* lisp/erc/erc-log.el (erc-log-all-but-server-buffers): Use
`erc--server-buffer-p' instead of `erc-server-buffer-p'.  This
replacement is presumed to be relatively "safe" because this function
is unused in the code base and only appears in the doc string for the
option `erc-enable-logging'.
* lisp/erc/erc-match.el (erc-match-message): Leave comment proposing
that `erc--server-buffer-p' should be preferred to
`erc-server-buffer-p'.  Use preferred alias for `erc-server-buffer-p'.
* lisp/erc/erc-notify.el (erc-cmd-NOTIFY): Use preferred alias for
`erc-server-buffer-p', and leave FIXME comment.
* lisp/erc/erc-speedbar.el (erc-speedbar-buttons): Use
`erc--server-buffer-p' instead of `erc-server-buffer-p'.  The logic
here seems simple enough to justify a change, however the absence of
related bug reports is perhaps an argument against this.
* lisp/erc/erc-track.el (erc-track-modified-channels): Use preferred
alias for `erc-server-buffer-p' and leave comment noting possible bug.
* lisp/erc/erc.el (erc-once-with-server-event): Use
`erc--server-buffer-p' instead of `erc-server-buffer-p'.  This change
seems justified because the function sets local hooks that would
otherwise be ignored outside of a server buffer.
(erc-server-buffer-p, erc-server-or-unjoined-channel-buffer-p): Make
the former an obsolete alias for the latter.
(erc--server-buffer-p): New function to replace `erc-server-buffer-p'
internally in new code.  Unlike its predecessor, it returns nil in
parted and kicked channels.
(erc-open-server-buffer-p): Use `erc--server-buffer-p' instead of
`erc-server-buffer-p'.  Given the name and the doc string, breaking
the odd misuse of this function in parted buffers seems justified
because this is clearly a bug fix.  Also, all uses in-tree conform to
the intended behavior as documented.  And a cursory grep of all "erc-"
prefixed packages on MELPA reveals zero instances of this function.
Nor is it used in erbot.
(erc-get-buffer): Mention behavior in doc string regarding parted and
kicked-from channels.
(erc-cmd-GQUIT): Fix wrong-number-of-arguments bug in timer function.
(erc-default-target): Mention behavior regarding unjoined channels.
(erc-kill-query-buffers): Don't use `erc-server-buffer-p'.  This
replacement may break third-party code expecting to leave parted
channels behind, but it seems sane when considering only the lone
internal use in `erc-cmd-QUIT'.
; * test/lisp/erc/resources/join/network-id/foonet.eld: Timeouts.
(Bug#66578)

11 months agoRespect user markers in erc-insert-timestamp-left
F. Jason Park [Thu, 19 Oct 2023 06:20:07 +0000 (23:20 -0700)]
Respect user markers in erc-insert-timestamp-left

* lisp/erc/erc-stamp.el (erc-insert-timestamp-left): Convert to normal
function, a mere wrapper that defers to existing generic variants, in
order to dissuade users from adding their own methods, which could
complicate troubleshooting, etc.
(erc--insert-timestamp-left): Rename both methods using internal
double-hyphen convention.  In `erc-stamp--display-margin-mode'
implementation, don't displace third-party markers.
* test/lisp/erc/erc-scenarios-stamp.el: New file.  (Bug#60936)

11 months agoFix right-sided stamps commingling with erc-prompt
F. Jason Park [Thu, 19 Oct 2023 06:20:07 +0000 (23:20 -0700)]
Fix right-sided stamps commingling with erc-prompt

* lisp/erc/erc-stamp.el (erc-insert-timestamp-left-and-right): Fix bug
that saw the prompt being inserted after messages but just inside the
narrowed operating portion of the buffer, which meant remaining
modification hooks would see it upon visiting.  Thanks to Corwin Brust
for catching this.
* test/lisp/erc/erc-fill-tests.el (erc-fill-wrap--monospace): Use
custom `erc-prompt' function to guarantee invariants asserted by
`erc--assert-input-bounds' are preserved throughout.  (Bug#60936)

11 months agoRestore missing metadata props in erc-display-line
F. Jason Park [Mon, 16 Oct 2023 00:22:22 +0000 (17:22 -0700)]
Restore missing metadata props in erc-display-line

* etc/ERC-NEWS: Designate `erc-display-message' as the favored means
of inserting messages.
* lisp/erc/erc-fill.el (erc-fill-wrap): Skip any `unknown' `erc-msg'.
* lisp/erc/erc-stamp.el (erc-stamp--current-time): Use an existing
`erc-ts' text property, when present, for the current message time.
* lisp/erc/erc.el (erc-display-line-1, erc-insert-line): Update doc
string and declare the former an obsolete alias for the latter,
`erc-insert-line'.  Have `erc-log' label say `erc-display-message'
even though this function is actually `erc-insert-line'.
(erc-display-line): Convert to a thin wrapper around
`erc-display-message', and move its existing body to a new internal
function, `erc--route-insertion'.
(erc--route-insertion): Adopt former body of `erc-display-line', now a
convenience wrapper around `erc-display-message'.  Copy
`erc--msg-props' hash table when inserting a message in multiple
buffers.  At present, only `erc-server-QUIT' uses this facility, so
such a move shouldn't impact performance in any measurable way.  Also,
improve readability with at most one recursive call for the
fall-through case.
(erc--compose-text-properties, erc--merge-text-properties-p): Rename
former to latter to avoid confusion with `composition' property.
(erc-display-message): Update doc string.  Attempt to adapt a non-nil
TYPE parameter for use as the value of the `erc-msg' text property
before resorting to a value of `unknown'.  But only do this when
PARSED is nil, and MSG is a string.  Call `erc--route-insertion'
instead of `erc-display-line'.  Use new name for
`erc--compose-text-properties'.
(erc-put-text-property): Update name of variable
`erc--compose-text-properties'.
* test/lisp/erc/erc-networks-tests.el (erc-networks--set-name): Mock
`erc--route-insertion' instead of `erc-display-line'.
* test/lisp/erc/erc-scenarios-display-message.el: New file.
* test/lisp/erc/erc-tests.el (erc--route-insertion): New test.
* test/lisp/erc/resources/base/display-message/multibuf.eld: New test
data.
; * test/lisp/erc/resources/fill/snapshots/merge-01-start.eld: Update.
; * test/lisp/erc/resources/fill/snapshots/merge-02-right.eld: Update.
; * 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.
(Bug#60936)

11 months agoWarn about top-level erc-update-modules calls
F. Jason Park [Wed, 18 Oct 2023 06:36:12 +0000 (23:36 -0700)]
Warn about top-level erc-update-modules calls

* doc/misc/erc.texi (Modules): Describe unfavorable practices enacted
by third-party modules, like running `erc-update-modules' on load.
* lisp/erc/erc.el (erc-modules): Clarify comment in `custom-set'
function.
(erc--warn-about-aberrant-modules): Tweak warning message.
(erc--requiring-module-mode-p): New internal variable.
(erc--find-mode): Guard against recursive `erc-update-module'
invocations.  (Bug#57955)

11 months ago* lisp/erc/erc-backend.el (define-erc-response-handler) Edebug spec.
F. Jason Park [Fri, 20 Oct 2023 05:59:17 +0000 (22:59 -0700)]
* lisp/erc/erc-backend.el (define-erc-response-handler) Edebug spec.

11 months ago; Mark erc-log test as :unstable
F. Jason Park [Sun, 15 Oct 2023 20:43:12 +0000 (13:43 -0700)]
; Mark erc-log test as :unstable

* test/lisp/erc/erc-scenarios-log.el (erc-scenarios-log--truncate):
Mark :unstable for now.
* test/lisp/erc/resources/base/renick/queries/solo.eld: Timeouts.
* test/lisp/erc/resources/base/reuse-buffers/channel/barnet.eld: Timeouts.
* test/lisp/erc/resources/base/reuse-buffers/channel/foonet.eld: Timeouts.
* test/lisp/erc/resources/erc-scenarios-common.el: Timeouts.

11 months agoproject--switch-project-command: Retouch
Dmitry Gutov [Fri, 20 Oct 2023 19:04:03 +0000 (22:04 +0300)]
project--switch-project-command: Retouch

* lisp/progmodes/project.el (project--switch-project-command):
Remove outdated comment and clear the echo area at the end.

11 months ago; More fixes for LLDB support
Eli Zaretskii [Fri, 20 Oct 2023 12:55:45 +0000 (15:55 +0300)]
; More fixes for LLDB support

* lisp/progmodes/gud.el (gud-gud-lldb-command-name, lldb): Doc fixes.

11 months ago; * lisp/calc/calc-units.el (math-standard-units): Drop comment for mu0.
Ulrich Müller [Fri, 20 Oct 2023 12:50:45 +0000 (14:50 +0200)]
; * lisp/calc/calc-units.el (math-standard-units): Drop comment for mu0.

11 months ago; Fix recent changes of LLDB support
Eli Zaretskii [Fri, 20 Oct 2023 12:50:33 +0000 (15:50 +0300)]
; Fix recent changes of LLDB support

* lisp/progmodes/gud.el (gud-lldb-max-completions)
(gud-lldb-fetch-completions): Fix doc string and :version tag.

11 months ago; * lisp/emacs-lisp/comp-cstr.el: Fix punctuation.
Eli Zaretskii [Fri, 20 Oct 2023 12:46:20 +0000 (15:46 +0300)]
; * lisp/emacs-lisp/comp-cstr.el: Fix punctuation.

11 months agoRepair detection of empty mailto URLs
Po Lu [Fri, 20 Oct 2023 11:09:22 +0000 (19:09 +0800)]
Repair detection of empty mailto URLs

* java/org/gnu/emacs/EmacsOpenActivity.java (onCreate):
Additonally regard mailto:// as an empty URL, since Android does
interpret them as such.

11 months agoFix Gud LLDB completion for function names
Gerd Möllmann [Thu, 19 Oct 2023 14:24:53 +0000 (16:24 +0200)]
Fix Gud LLDB completion for function names

LLDB completion candidates can contain parentheses.

* lisp/progmodes/gud.el (gud-lldb-fetch-completions): Use unique
completion list delimiters. Add timeout to accept-process-input.
(gud-lldb-def-python-completion-function): Use new completion
list delimiters.
(lldb): Add hint about completions to doc string.
(gud-lldb-marker-filter): Don't use eval.

11 months agoTreat empty mailto URIs properly under Android
Po Lu [Fri, 20 Oct 2023 07:03:56 +0000 (15:03 +0800)]
Treat empty mailto URIs properly under Android

* java/org/gnu/emacs/EmacsOpenActivity.java (onCreate): If an
empty mailto: URI is supplied, ascertain if EXTRA_EMAIL is set,
then derive a mailto URI from that if so.

11 months agoImprove behavior with project-switch-use-entire-map=t
Dmitry Gutov [Thu, 19 Oct 2023 22:24:56 +0000 (01:24 +0300)]
Improve behavior with project-switch-use-entire-map=t

* lisp/progmodes/project.el (project--keymap-prompt): New function.
(project--switch-project-command): Use it when
project-switch-use-entire-map is non-nil.  Also check that CHOICE
is not a number (bug#63648).  And print incorrect inputs too.

11 months ago* lisp/progmodes/project.el (project--other-place-prefix): New function.
Juri Linkov [Thu, 19 Oct 2023 18:50:28 +0000 (21:50 +0300)]
* lisp/progmodes/project.el (project--other-place-prefix): New function.

(project-other-window-command, project-other-frame-command)
(project-other-tab-command): Use it in Emacs versions not less than 30
where other-*-prefix commands are available.
This fixes the cases such as 'C-u C-x 5 p p f TAB' from bug#65558.

11 months agoAdapt Tramp version
Michael Albinus [Thu, 19 Oct 2023 14:39:01 +0000 (16:39 +0200)]
Adapt Tramp version

* lisp/net/trampver.el (customize-package-emacs-version-alist):
Adapt Tramp version integrated in Emacs 29.2.

11 months ago(cl--typeof-types): Complete last change
Stefan Monnier [Thu, 19 Oct 2023 14:21:22 +0000 (10:21 -0400)]
(cl--typeof-types): Complete last change

* lisp/emacs-lisp/cl-preloaded.el (cl--typeof-types):
Add `integer-or-marker` in the hierarchy as well.

11 months ago* admin/MAINTAINERS: Remove Ulf Jasper as maintainer of icalendar.el
Ulf Jasper [Thu, 19 Oct 2023 13:59:40 +0000 (15:59 +0200)]
* admin/MAINTAINERS: Remove Ulf Jasper as maintainer of icalendar.el

11 months agoFix last change in gud.el
Gerd Möllmann [Thu, 19 Oct 2023 12:56:07 +0000 (14:56 +0200)]
Fix last change in gud.el

* lisp/progmodes/gud.el (gud-lldb-initialize): Fix duplicated
output.

11 months agoAdd two missing 'number-or-marker' entries to the cl machinery (bug#66615)
Andrea Corallo [Wed, 18 Oct 2023 14:10:08 +0000 (16:10 +0200)]
Add two missing 'number-or-marker' entries to the cl machinery (bug#66615)

Assuming 'number-or-marker' is a type (as present multiple times in
cl--typeof-types) adding some missing entries for coherency.

* lisp/emacs-lisp/cl-preloaded.el (cl--typeof-types): Add
'number-or-marker' as supertype of 'number' in the 'float' branch.

* lisp/emacs-lisp/cl-macs.el (cl-deftype-satisfies): Add
'number-or-marker'.

* test/lisp/emacs-lisp/comp-cstr-tests.el (comp-cstr-typespec-tests-alist):
Update test.

* test/src/comp-tests.el (comp-tests-type-spec-tests): Update two testes.

11 months agoImprove cstr typeset normalization
Andrea Corallo [Wed, 18 Oct 2023 14:14:45 +0000 (16:14 +0200)]
Improve cstr typeset normalization

* test/lisp/emacs-lisp/comp-cstr-tests.el
(comp-cstr-typespec-tests-alist): Add four tests.

* lisp/emacs-lisp/comp-cstr.el (comp--sym-lessp)
(comp--direct-supertype, comp--normalize-typeset0): New functions.
(comp-normalize-typeset): Rework to make use of
'comp--normalize-typeset0'.
(comp--direct-subtypes): New function.

11 months agoGud support for column numbers
Gerd Möllmann [Thu, 19 Oct 2023 09:27:14 +0000 (11:27 +0200)]
Gud support for column numbers

Allow gud-last-frame to be of the form (FILE LINE COLUMN).

* lisp/progmodes/gud.el (gud-display-frame): Support column numbers.
(gud-display-line): New optional parameter for column number.  Move
point to that column, if set.
(gud-lldb-marker-filter): Set column number.

11 months agoDon't rely on LLDB output format
Gerd Möllmann [Thu, 19 Oct 2023 08:28:15 +0000 (10:28 +0200)]
Don't rely on LLDB output format

Let Gud define its own frame format that is easily parseable,
and also contains the full source file path.

* lisp/progmodes/gud.el (gud-lldb-stop): New function.
(gud-lldb-marker-filter): Support new frame-format.
(gud-lldb-frame-format): variable for frame-format.
(gud-lldb-initialize): Set frame-format.

11 months agoRelay body and attachments within Android e-mails to message-mailto
Po Lu [Thu, 19 Oct 2023 08:19:18 +0000 (16:19 +0800)]
Relay body and attachments within Android e-mails to message-mailto

* java/org/gnu/emacs/EmacsOpenActivity.java (onCreate): Infer
e-mail body and subject from its parameters and convey this
information to message-mailto.

* lisp/gnus/message.el (message-mailto): New arguments SUBJECT,
BODY and FILE-ATTACHMENTS.
(message-mailto-1): Insert these arguments as appropriate.

11 months agoGud LLDB fix for large completion count (bug#66625)
Gerd Möllmann [Thu, 19 Oct 2023 06:39:07 +0000 (08:39 +0200)]
Gud LLDB fix for large completion count (bug#66625)

* lisp/progmodes/gud.el (gud-lldb-max-completions): New defcustom.
(gud-lldb-def-python-completion-function): New argument.
(gud-lldb-fetch-completions): Pass max count to gud_complete.
(gud-lldb-initialize): Change text displayed at the end.

11 months agoGud LLDB completions (bug#66604)
Gerd Möllmann [Wed, 18 Oct 2023 07:24:45 +0000 (09:24 +0200)]
Gud LLDB completions (bug#66604)

* etc/emacs_lldb.py: Remove xcomplete.
* lisp/progmodes/gud.el: Implement lldb command completions.
* src/.lldbinit: Remove settings done in Gud.

11 months ago; cperl-mode.el: Fix indentation issues after a format declaration.
Harald Jörg [Wed, 18 Oct 2023 14:25:56 +0000 (16:25 +0200)]
; cperl-mode.el: Fix indentation issues after a format declaration.

* lisp/progmodes/cperl-mode.el (cperl-sniff-for-indent): Recognize
the end of a format declaration as a statement boundary.  This fixes
indentation if several format declarations immediately follow each
other.
(cperl-find-pods-heres): use the correct capture group for the
name of an unterminated format declaration.  Fix an out of
boundary error when a format declaration is typed at the end of a
buffer (Bug#66139).

11 months agoImprove SOCKS error handling and support version 4a
F. Jason Park [Mon, 14 Feb 2022 18:28:01 +0000 (10:28 -0800)]
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)

11 months agoDon't hard code server ports in SOCKS tests
F. Jason Park [Mon, 14 Feb 2022 18:28:01 +0000 (10:28 -0800)]
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)

11 months agoEglot: respect completion sort order dictated by the server
João Távora [Wed, 18 Oct 2023 10:48:49 +0000 (05:48 -0500)]
Eglot: respect completion sort order dictated by the server

Don't use flex style to do any completion sorting.

Previously, it was thought that the 'flex' completion style was only
kicking in to do (approximate) fontification of the completions
returned by the server, but it was found that it was also doing some
its own sorting in certain situation of non-empty matching patterns.

Replaced it with a new eglot--dumb-flex style which does only
fontification.

Github-reference: https://github.com/joaotavora/eglot/discussions/1306

* lisp/progmodes/eglot.el (eglot-completion-at-point): Rework.
(eglot--dumb-flex, eglot--dumb-allc): New helpers.
(completion-category-defaults): Rework Eglot-specific category.
(completion-styles-alist): Add Eglot-specific style.

* etc/EGLOT-NEWS: Mention change.

11 months agoCorrectly bisect format 12 and 8 cmap tables
Po Lu [Wed, 18 Oct 2023 05:52:19 +0000 (13:52 +0800)]
Correctly bisect format 12 and 8 cmap tables

* src/sfnt.c (sfnt_bsearch_above): Cease returning the last
element if it is ordered below the key itself.
(sfnt_lookup_glyph_8, sfnt_lookup_glyph_12): Verify whether the
group returned is NULL.

11 months agoMollify compiler under Android builds without mmap
Po Lu [Wed, 18 Oct 2023 01:09:47 +0000 (09:09 +0800)]
Mollify compiler under Android builds without mmap

* src/sfntfont.c (sfnt_close_tables, sfnt_open_tables)
[!HAVE_MMAP]: Do not declare rc for munmap or mmap.

11 months ago; * lisp/eshell/esh-proc.el (eshell-process-wait-time): Add :version.
Jim Porter [Tue, 17 Oct 2023 18:59:13 +0000 (11:59 -0700)]
; * lisp/eshell/esh-proc.el (eshell-process-wait-time): Add :version.

11 months agoGud lldb support (bug#66575)
Gerd Möllmann [Mon, 16 Oct 2023 11:54:02 +0000 (13:54 +0200)]
Gud lldb support (bug#66575)

* lisp/progmodes/gud.el (lldb): New command.
* etc/NEWS: Mention M-x lldb.
* src/.lldbinit: Show no souece lines on stop.
* doc/emacs/building.texi: Mention LLDB.

11 months agoModify LLDB command xcomplete to return a Lisp list
Gerd Möllmann [Tue, 17 Oct 2023 15:23:33 +0000 (17:23 +0200)]
Modify LLDB command xcomplete to return a Lisp list

* etc/emacs_lldb.py (xcomplete): Return a Lisp list. Add a comment
explaining the return value.

11 months agoFix tramp-revert-buffer-with-sudo
Michael Albinus [Tue, 17 Oct 2023 09:41:12 +0000 (11:41 +0200)]
Fix tramp-revert-buffer-with-sudo

* lisp/net/tramp-cmds.el (tramp-revert-buffer-with-sudo):
Use `buffer-file-name' instead of `buffer-name'.  (Bug#66571)

11 months agoUse project-name in the project-kill-buffers prompt
Spencer Baugh [Fri, 13 Oct 2023 12:35:58 +0000 (08:35 -0400)]
Use project-name in the project-kill-buffers prompt

This is mildly prettier (bug#66518).

* lisp/progmodes/project.el (project-kill-buffers): Use project-name.

11 months ago; 'eshell-kill-process-wait-time' can be a floating-point number
Jim Porter [Mon, 16 Oct 2023 20:34:22 +0000 (13:34 -0700)]
; 'eshell-kill-process-wait-time' can be a floating-point number

* lisp/eshell/esh-proc.el (eshell-kill-process-wait-time): Update type.

11 months ago; Use the "new" calling convention for 'sit-for' in Eshell
Jim Porter [Mon, 16 Oct 2023 20:21:07 +0000 (13:21 -0700)]
; Use the "new" calling convention for 'sit-for' in Eshell

* lisp/eshell/esh-proc.el (eshell-process-wait-seconds)
(eshell-process-wait-milliseconds): Make obsolete in favor of...
(eshell-process-wait-time): ... this, and...
(eshell-wait-for-process): ... use it.

* etc/NEWS: Announce this change (bug#66574).

11 months agoRefactor 'vc-default-mode-line-string' (bug#66464)
Juri Linkov [Mon, 16 Oct 2023 17:14:18 +0000 (20:14 +0300)]
Refactor 'vc-default-mode-line-string' (bug#66464)

* lisp/vc/vc-hooks.el (vc-mode-line-state): New function with code moved from
'vc-default-mode-line-string'.
(vc-default-mode-line-string): Use 'vc-mode-line-state'.

* lisp/vc/vc-git.el (vc-git-mode-line-string): Use
'vc-mode-line-state' instead of hacking the string returned from
'vc-default-mode-line-string'.

* lisp/vc/vc-hg.el (vc-hg-mode-line-string): Use
'vc-mode-line-state' instead of duplicating code from
'vc-default-mode-line-string'.

11 months agoFix "C-0 C-x C-s" with write-protected files
Eli Zaretskii [Mon, 16 Oct 2023 11:17:57 +0000 (14:17 +0300)]
Fix "C-0 C-x C-s" with write-protected files

* lisp/files.el (basic-save-buffer-2): Call 'set-file-modes' to
try to make the file writable, even if
'set-file-extended-attributes' succeeded.  (Bug#66546)

11 months ago; LLDB support cleanup and extension
Gerd Möllmann [Mon, 16 Oct 2023 08:12:10 +0000 (10:12 +0200)]
; LLDB support cleanup and extension

11 months agoMerge from origin/emacs-29
Michael Albinus [Mon, 16 Oct 2023 07:02:39 +0000 (09:02 +0200)]
Merge from origin/emacs-29

07c45f20fd3 Fix test in files-tests
5d3f3288d22 ; * doc/emacs/search.texi (Regexp Backslash): Improve ind...
9525315c117 Add missing :version to two defcustoms
9044d4d94bb Fix a defcustom :type in eldoc.el
8141d73ea7f Document 'M-x align' in the Emacs manual

11 months agoProperly initialize argment list supplied to android_init_emacs
Po Lu [Mon, 16 Oct 2023 01:00:45 +0000 (09:00 +0800)]
Properly initialize argment list supplied to android_init_emacs

* src/android.c (initEmacs): NULL-terminate c_argv.

11 months agoRevert "Update etc/rgb.txt from X.Org upstream"
Po Lu [Mon, 16 Oct 2023 00:56:53 +0000 (08:56 +0800)]
Revert "Update etc/rgb.txt from X.Org upstream"

This reverts commit 11f10dc0d0b4b1d6af828102421eac9f79e0fcba.

* etc/rgb.txt: Restore X11R6.6 version, where non-portable color
names are absent.

11 months agoFixup for "no file modes on windows and dos"
Sam Steingold [Sun, 15 Oct 2023 15:51:34 +0000 (11:51 -0400)]
Fixup for "no file modes on windows and dos"

* lisp/ls-lisp.el (ls-lisp-format): Keep the first group of
permissions even when `modes' is not in `ls-lisp-verbosity'.

11 months agoc-indent-new-comment-line: don't test for a macro in a comment
Alan Mackenzie [Sun, 15 Oct 2023 10:54:23 +0000 (10:54 +0000)]
c-indent-new-comment-line: don't test for a macro in a comment

This fixes bug#9860.

* lisp/progmodes/cc-cmds (c-indent-new-comment-line): Test for
a comment/string before testing for a macro, thus preventing a
"macro" being spuriously recognized in a comment.  This allows
auto-fill-mode to work on a line beginning with # in a comment.

11 months agoFix test in files-tests
Michael Albinus [Sun, 15 Oct 2023 10:26:43 +0000 (12:26 +0200)]
Fix test in files-tests

* test/lisp/files-tests.el
(files-tests-file-name-non-special-expand-file-name-tilde): Fix test.

11 months ago; * doc/emacs/search.texi (Regexp Backslash): Improve indexing.
Eli Zaretskii [Sun, 15 Oct 2023 09:37:25 +0000 (12:37 +0300)]
; * doc/emacs/search.texi (Regexp Backslash): Improve indexing.

11 months ago; New command alias xprint for LLDB
Gerd Möllmann [Sun, 15 Oct 2023 07:40:24 +0000 (09:40 +0200)]
; New command alias xprint for LLDB

11 months ago; Correct typos in android.texi
Po Lu [Sun, 15 Oct 2023 07:02:43 +0000 (15:02 +0800)]
; Correct typos in android.texi

* doc/emacs/android.texi (Android Environment): Correct typos.

11 months agoCorrectly receive files through Android DND
Po Lu [Sun, 15 Oct 2023 05:10:34 +0000 (13:10 +0800)]
Correctly receive files through Android DND

* java/org/gnu/emacs/EmacsService.java (getUsefulContentResolver)
(getContentResolverContext): New functions which return a
content resolver from an EmacsActivity, if at all possible.
(openContentUri, checkContentUri): Probe or open URIs through
such content resolvers.  Probe URIs by opening them if merely
testing permissions fails, for DND URIs do not make
checkCallingUriPermission return true.

* java/org/gnu/emacs/EmacsWindow.java (onDragEvent): Address
potential crash.

* src/androidvfs.c (android_check_content_access): Circumvent
JNI dynamic method dispatch.
(android_authority_name): Guarantee NAME is never a directory.

11 months agoFix searching for tags in compressed files
Mauro Aranda [Thu, 12 Oct 2023 12:41:58 +0000 (09:41 -0300)]
Fix searching for tags in compressed files

* lisp/progmodes/etags.el (etags--ensure-file): New function.
(etags--all-files): Make sure files in TAGS can be visited, even if
the files are compressed.  (Bug#2807)
(etags--xref-find-definitions): Report to xref a file that we are sure
it exists.  (Bug#44494)

11 months agoUpdate publicsuffix.txt from upstream
Stefan Kangas [Sat, 14 Oct 2023 22:34:02 +0000 (00:34 +0200)]
Update publicsuffix.txt from upstream

* etc/publicsuffix.txt: Update from
https://publicsuffix.org/list/public_suffix_list.dat
dated 2023-10-01 03:58:26 UTC.

11 months agoUpdate etc/rgb.txt from X.Org upstream
Stefan Kangas [Sat, 14 Oct 2023 19:07:30 +0000 (21:07 +0200)]
Update etc/rgb.txt from X.Org upstream

The upstream version contains the following changes:

  2023-07-10  rgb: Make color entries uniform
  2014-07-06  Add aliases for colors that differ between X11 and CSS
  2014-07-06  Add missing colors from CSS Color Module Level 4
  2008-06-04  Nuke CVS version tags
  2003-11-14  R6.6 is the Xorg base-line

* etc/rgb.txt: Sync with the version in X.Org upstream
https://cgit.freedesktop.org/xorg/app/rgb/tree/rgb.txt
commit 0d2caecebf0e2a10994c22960921f366dd98d19a.  (Bug#66538)

11 months agoFix an infinite loop in c-beginning-of-defun-1
Alan Mackenzie [Sat, 14 Oct 2023 19:14:57 +0000 (19:14 +0000)]
Fix an infinite loop in c-beginning-of-defun-1

This fixes bug#61436.

The loop manifested itself in c-get-fallback-scan-pos as the
position returned wasn't at a {, so the search back in
c-beginning-of-defun-1 with a defun-prompt-regexp found the
same BOL and moved forward to after the match, repeat.

* lisp/progmodes/cc-defs.el (c-beginning-of-defun-1): Accept a
position found by beginning-of-defun (which uses
defun-prompt-regexp) only when the \\s( following it is a {.
Repeat the backward search when this isn't the case.

11 months agoAdd missing :version to two defcustoms
Stefan Kangas [Sat, 14 Oct 2023 19:00:00 +0000 (21:00 +0200)]
Add missing :version to two defcustoms

* lisp/emacs-lisp/eldoc.el (eldoc-print-after-edit)
(eldoc-echo-area-prefer-doc-buffer): Add missing custom :version.

11 months agoFix a defcustom :type in eldoc.el
Mauro Aranda [Sat, 14 Oct 2023 13:34:54 +0000 (10:34 -0300)]
Fix a defcustom :type in eldoc.el

* lisp/emacs-lisp/eldoc.el (eldoc-echo-area-prefer-doc-buffer): Make
:type a choice, to allow for the value 'maybe'.  (Bug##66539)

11 months agoFix vc-hg-log-edit-toggle-amend
Dmitry Gutov [Sat, 14 Oct 2023 17:47:57 +0000 (20:47 +0300)]
Fix vc-hg-log-edit-toggle-amend

* lisp/vc/log-edit.el (log-edit--toggle-amend): Handle the case
when the VCS returns log entry that doesn't end with a newline
(bug#66423).

11 months ago(vc-default-checkin-patch): Try to be compatible with BSD 'patch'
Dmitry Gutov [Sat, 14 Oct 2023 17:10:08 +0000 (20:10 +0300)]
(vc-default-checkin-patch): Try to be compatible with BSD 'patch'

* lisp/vc/vc.el (vc-default-checkin-patch):
Try to be compatible with BSD 'patch' (bug#66211).

11 months ago(vc-root-diff): Don't compute and pass on WORKING-REVISION
Dmitry Gutov [Sat, 14 Oct 2023 17:01:24 +0000 (20:01 +0300)]
(vc-root-diff): Don't compute and pass on WORKING-REVISION

* lisp/vc/vc.el (vc-root-diff): Don't compute and pass on
WORKING-REVISION (bug#66364).  It was unused.

11 months agoOptimize vc-hg-state for directories
Spencer Baugh [Fri, 13 Oct 2023 01:06:53 +0000 (21:06 -0400)]
Optimize vc-hg-state for directories

Directories are never tracked in hg, so it's pointless to run
vc-hg-state on them.  And, in fact, our implementation previously
would list all the files contained in the directory and then parse
that in Emacs, which is very slow in large repos.

Let's just use the knowledge that directories aren't tracked in hg,
and skip running hg entirely.

* lisp/vc/vc-hg.el (vc-hg-state): Return nil for
directories.  (Bug#66364)

11 months ago;cperl-mode.el: Do not mistake a left-shift operator for a here-doc.
Harald Jörg [Sat, 14 Oct 2023 16:15:11 +0000 (18:15 +0200)]
;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.

11 months agoFix indentation and fontification in shell-script (Bug#26217)
Mauro Aranda [Sat, 14 Oct 2023 12:05:35 +0000 (09:05 -0300)]
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.

11 months agoSimplify and describe docstrings-wide check
Mattias Engdegård [Sat, 14 Oct 2023 11:24:30 +0000 (13:24 +0200)]
Simplify and describe docstrings-wide check

* lisp/emacs-lisp/bytecomp.el
(byte-compile--wide-docstring-substitution-len): Remove.
* lisp/emacs-lisp/bytecomp.el (bytecomp--docstring-line-width):
Add back explanatory comments lost in a previous change.

11 months agoDocument 'M-x align' in the Emacs manual
Eshel Yaron [Mon, 2 Oct 2023 08:02:46 +0000 (10:02 +0200)]
Document 'M-x align' in the Emacs manual

* doc/emacs/indent.texi (Alignment): New section.
* doc/emacs/emacs.texi: Update menu. (Bug#66303)

11 months agoMerge from origin/emacs-29
Eli Zaretskii [Sat, 14 Oct 2023 10:55:05 +0000 (06:55 -0400)]
Merge from origin/emacs-29

06a87738114 ; * lisp/calendar/time-date.el (days-to-time): Doc fix.
0ea2d6d9e82 Document that time-to-days and days-to-time use different...

11 months agoMake the docstrings-wide check 70x faster
Mattias Engdegård [Sat, 14 Oct 2023 09:42:44 +0000 (11:42 +0200)]
Make the docstrings-wide check 70x faster

Instead of performing a number of expensive transformations on the
original doc string and then use a dynamically-created regexp to find
wide lines, step through the lines in the unmodified string and only
perform the transformations on lines that exceed the limit.
This is sound because the transformations are contractive.

The new check will usually not cons nor perform any regexp matching.

* lisp/emacs-lisp/bytecomp.el (bytecomp--docstring-line-width): New.
(byte-compile--wide-docstring-p): Cheaper implementation.

11 months ago; * lisp/calendar/time-date.el (days-to-time): Doc fix.
Eli Zaretskii [Sat, 14 Oct 2023 09:00:51 +0000 (12:00 +0300)]
; * lisp/calendar/time-date.el (days-to-time): Doc fix.

11 months agoDocument that time-to-days and days-to-time use different epochs
Bob Rogers [Thu, 12 Oct 2023 17:23:35 +0000 (10:23 -0700)]
Document that time-to-days and days-to-time use different epochs

* doc/lispref/os.texi (Time Calculations):
* lisp/calendar/time-date.el (days-to-time, time-to-days): Doc fixes.
(Bug#66502)

11 months agoSort byte compiler warnings in alphabetic order
Mattias Engdegård [Fri, 13 Oct 2023 17:55:45 +0000 (19:55 +0200)]
Sort byte compiler warnings in alphabetic order

* lisp/emacs-lisp/bytecomp.el (byte-compile-warning-types):
Rearrange.  Add a few missing ones.

11 months agoFix beginning-of-defun not jumping to BOF
Jens Schmidt [Tue, 26 Sep 2023 19:36:19 +0000 (21:36 +0200)]
Fix beginning-of-defun not jumping to BOF

In batch mode or when font-lock and some other niceties are switched
off, function `syntax-ppss' can modify match data held by function
`beginning-of-defun-raw'.  In that case, `beginning-of-defun' can jump
to some seemingly arbitrary position, and not the actual BOF.

* lisp/emacs-lisp/lisp.el (beginning-of-defun-raw): Save match data
around a call to `syntax-ppss'. (Bug#66218)

11 months agoFix saving faces with attributes that need filtering
Mauro Aranda [Sat, 7 Oct 2023 14:57:18 +0000 (11:57 -0300)]
Fix saving faces with attributes that need filtering

* lisp/cus-edit.el (custom-face-save): The :shown-value property for
the custom-face widget is supposed to be a value suitable for the
customization widget.  (Bug#66391)

11 months agoMerge from origin/emacs-29
Michael Albinus [Sat, 14 Oct 2023 07:38:17 +0000 (09:38 +0200)]
Merge from origin/emacs-29

dc8b336d025 * lisp/files.el (file-name-non-special): Handle quoted ti...

11 months ago* lisp/files.el (file-name-non-special): Handle quoted tilde.
Michael Albinus [Sat, 14 Oct 2023 07:34:40 +0000 (09:34 +0200)]
* 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.

11 months agoImplement multi-window drag-and-drop under Android
Po Lu [Sat, 14 Oct 2023 02:15:20 +0000 (10:15 +0800)]
Implement multi-window drag-and-drop under Android

* java/org/gnu/emacs/EmacsNative.java (sendDndDrag, sendDndUri)
(sendDndText): Declare new event-sending functions.

* java/org/gnu/emacs/EmacsView.java (onDragEvent): New function.

* java/org/gnu/emacs/EmacsWindow.java (onDragEvent): New
function; respond to each drag and drop event, request
permissions if necessary and transfer dropped data to Lisp.

* lisp/dnd.el (dnd-unescape-file-uris): New variable.
(dnd-get-local-file-name): If that variable is nil, refrain from
unescaping URLs provided.

* lisp/term/android-win.el (android-handle-dnd-event): New
function.
(special-event-map): Bind drag-n-drop-event.

* src/android.c (sendDndDrag, sendDndUri, sendDndText): New
functions.

* src/androidgui.h (enum android_event_type): New event types
ANDROID_DND_DRAG_EVENT, ANDROID_DND_URI_EVENT,
ANDROID_DND_TEXT_EVENT.
(struct android_dnd_event): New structure.
(union android_event) <dnd>: New field.

* src/androidterm.c (handle_one_android_event)
<ANDROID_DND_..._EVENT>: Generate drag-n-drop events for each
of these types.
(syms_of_androidterm) <Quri, Qtext>: New defsyms.

11 months agoHave gnus-summary-limit-to-age operate on calendar days
Eric Abrahamsen [Sat, 23 Sep 2023 23:31:10 +0000 (16:31 -0700)]
Have gnus-summary-limit-to-age operate on calendar days

Reported and patched by Łukasz Stelmach <stlman@poczta.fm>.

* lisp/gnus/gnus-sum.el (gnus-summary-limit-to-age): Rather than
24-hour blocks. Also use `read-number', and drop the confusing option
to reverse younger/older both with the prefix argument and with a
negative number.

11 months ago(sit-for): Remove support for old calling convention
Stefan Monnier [Fri, 13 Oct 2023 23:28:30 +0000 (19:28 -0400)]
(sit-for): Remove support for old calling convention

* lisp/subr.el (sit-for): Remove support for old calling convention

* doc/lispref/functions.texi (Obsolete Functions): Adjust wording now
that we don't support `sit-for`s old convention any more.
* doc/lispref/commands.texi (Waiting): Remove mention of old calling
convention for `sit-for`.

11 months agocperl-mode.el: Add new user option to etc/NEWS
Harald Jörg [Fri, 13 Oct 2023 22:48:23 +0000 (00:48 +0200)]
cperl-mode.el: Add new user option to etc/NEWS

* etc/NEWS: Announce new user option `cperl-fontify-trailer'.

11 months agocperl-mode.el: Optionally treat trailing text as comment
Harald Jörg [Fri, 13 Oct 2023 22:34:41 +0000 (00:34 +0200)]
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.

11 months agoMore defcustom fixes in ERC (Bug#66520)
Mauro Aranda [Fri, 13 Oct 2023 13:36:29 +0000 (10:36 -0300)]
More defcustom fixes in ERC (Bug#66520)

* lisp/erc/erc-fill.el (erc-fill-variable-maximum-indentation): Change
:type to choice, to allow nil.
* lisp/erc/erc-goodies.el (erc-keep-place-indicator-style): Fix
copy-pasta.
* lisp/erc/erc-networks.el (erc-networks-alist): Don't advertise that
MATCHER can be a function since it doesn't look like that's ever been
the case, reaching as far back as erc-networks.el's introduction to
the old CVS repo, in 2006.  (Bug#66520)

11 months agoAdd command to refill buffer in erc-fill-wrap-mode
F. Jason Park [Thu, 21 Sep 2023 13:54:27 +0000 (06:54 -0700)]
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)

11 months agoTreat previous/next-line specially in erc-fill-wrap
F. Jason Park [Mon, 9 Oct 2023 09:29:44 +0000 (02:29 -0700)]
Treat previous/next-line specially in erc-fill-wrap

* lisp/erc/erc-fill.el (erc-fill-wrap-visual-keys): Mention option
`erc-fill-wrap-force-screen-line-movement' in doc string.
(erc-fill-wrap-force-screen-line-movement): New option to suppress
logical-line movement with `previous-line' and `next-line' when
`erc-fill-wrap-mode' is enabled.
(erc-fill--wrap-move): Accept trailing args.
(erc-fill--wrap-previous-line, erc-fill--wrap-next-line): Use
`erc-fill--wrap-move', like all the other `fill-wrap' commands.
(Bug#60936)

11 months agoSwap hook positions of erc-fill and erc-match-message
F. Jason Park [Tue, 10 Oct 2023 07:32:21 +0000 (00:32 -0700)]
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)

11 months agoManage some text props for ERC insertion-hook members
F. Jason Park [Fri, 22 Sep 2023 06:54:31 +0000 (23:54 -0700)]
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)

11 months agoEasily excise list-valued text prop members in ERC
F. Jason Park [Wed, 4 Oct 2023 06:15:40 +0000 (23:15 -0700)]
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)

11 months agoDeprecate option erc-remove-parsed-property
F. Jason Park [Tue, 3 Oct 2023 07:00:19 +0000 (00:00 -0700)]
Deprecate option erc-remove-parsed-property

* etc/ERC-NEWS: Add entry for `erc-remove-parsed-property'.
* lisp/erc/erc.el (erc-remove-parsed-property): Deprecate option
because the potential for inadvertent self harm outweighs the
potential benefits.  Additionally, replicating this functionality via
hooks is trivial.
(erc-display-line-1): Remove quasi-deprecated `tags' property because
the preferred format for `erc-response.tags' has changed, and ERC has
never supported IRCv3 tags.

11 months agoUse erc-display-message instead of erc-make-notice
F. Jason Park [Thu, 5 Oct 2023 03:39:03 +0000 (20:39 -0700)]
Use erc-display-message instead of erc-make-notice

* lisp/erc/erc-backend.el (erc-server-JOIN): Let `erc-display-message'
handle formatting instead of baking out a string.  The text ultimately
inserted remains unchanged, but forwarding the original `format-spec'
arguments now has the side effect of influencing text properties, which
conveys richer meaning for modules to act upon when doing things like
deciding whether to hide a given message.
* lisp/erc/erc.el (erc-cmd-IGNORE, erc-cmd-UNIGNORE,
erc--unignore-user, erc-cmd-IDLE, erc-cmd-BANLIST, erc-cmd-MASSUNBAN):
Use `erc-display-message' with `notice' for the TYPE parameter instead
of composing `erc-make-notice' and `erc-display-line'.

11 months agoAllow spoofing process marker in erc-display-line-1
F. Jason Park [Tue, 3 Oct 2023 05:59:22 +0000 (22:59 -0700)]
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.

11 months agoSort and dedupe when loading modules in erc-open
F. Jason Park [Sat, 7 Oct 2023 00:34:04 +0000 (17:34 -0700)]
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)

11 months agoHonor nil values in erc--restore-initialize-priors
F. Jason Park [Thu, 5 Oct 2023 07:16:46 +0000 (00:16 -0700)]
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)

11 months agoSkip post-minibuffer restore in erc-scrolltobottom-all
F. Jason Park [Wed, 11 Oct 2023 01:14:53 +0000 (18:14 -0700)]
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)