Ulf Jasper [Thu, 24 Nov 2022 17:56:50 +0000 (18:56 +0100)]
icalendar: Adjust tests after fixing parsing of sexp entries (bug#56241)
* test/lisp/calendar/icalendar-tests.el
(icalendar-export-bug-56241-nested-sexps): New.
* test/lisp/calendar/icalendar-tests.el (icalendar-real-world):
Disable testcase for exporting sexp entries that has now become invalid.
Some servers avoid reporting completion items that
require "additionalTextEdits" capability. Actually,
'eglot-completion-at-point' function supports such
feature so it can be advertised to LSP server.
* lisp/progmodes/eglot.el (eglot-client-capabilities): Advertise
resolveSupport. (bug#59465)
Po Lu [Thu, 24 Nov 2022 12:10:14 +0000 (20:10 +0800)]
Fix reentrancy problem/crash in xterm.c
* src/xterm.c (x_ignore_errors_for_next_request)
(x_stop_ignoring_errors): Be paranoid and block input inside the
protected section.
(x_focus_frame): Block input around critical section.
* lisp/files.el (move-file-to-trash): When trashing a directory with
the same name as something that's already in the trash, copy it into
the trash folder and then delete it, rather than using rename-file.
Tassilo Horn [Thu, 24 Nov 2022 09:47:54 +0000 (10:47 +0100)]
Fix face issues in show-paren context overlay (bug#59527)
* lisp/paren.el (show-paren--show-context-in-overlay): Use
show-paren-priority as overlay priority (fixes problem 2 of
bug#59527).
* lisp/simple.el (blink-paren-open-paren-line-string): Ensure the
context lines are font-locked before taking the
buffer-substring (fixes problem 1 of bug#59527).
Eli Zaretskii [Thu, 24 Nov 2022 09:09:51 +0000 (11:09 +0200)]
Avoid assertion violations in treesit.c when editing non-ASCII
* src/treesit.c (make_treesit_parser): Use byte positions when
initializing 'lisp_parser'. This avoids assertion violations when
the buffer has non-ASCII characters.
Dmitry Gutov [Thu, 24 Nov 2022 02:33:01 +0000 (04:33 +0200)]
project-switch-project: Use a different fix for bug#58784
* lisp/progmodes/project.el (project-current-inhibit-prompt):
Rename to 'project-current-directory-override', and make it a
string value.
(project-current): Refer to it.
(project-switch-project): Bind it. Drop the temp buffer (bug#58784).
F. Jason Park [Mon, 21 Nov 2022 03:01:32 +0000 (19:01 -0800)]
Add test scenarios for local ERC modules
* test/lisp/erc/erc-scenarios-base-local-modules.el: New file.
* test/lisp/erc/resources/base/local-modules/first.eld: New file.
* test/lisp/erc/resources/base/local-modules/fourth.eld: New file
* test/lisp/erc/resources/base/local-modules/second.eld: New file.
* test/lisp/erc/resources/base/local-modules/third.eld: New file.
(Bug#57955.)
F. Jason Park [Sun, 13 Nov 2022 09:52:48 +0000 (01:52 -0800)]
Accept functions in place of passwords in ERC
* lisp/erc/erc-backend.el (erc-session-password): Add comment
explaining type is now string, nil, or function.
* lisp/erc/erc-compat.el (erc-compat--29-auth-source-pass-search):
Use obfuscation from auth-source function when available.
* lisp/erc/erc-sasl.el (erc-sasl--read-password,
erc-server-AUTHENTICATE): Use `erc--unfun'.
* lisp/erc/erc-services.el (erc-nickserv-get-password,
erc-nickserv-send-identify): Use `erc--unfun'.
* lisp/erc/erc.el (erc--unfun): New function for unwrapping a
password couched in a getter.
(erc--debug-irc-protocol-mask-secrets): Add variable to indicate
whether to mask passwords in debug logs.
(erc--mask-secrets): New function to swap masked secret with question
marks in debug logs.
(erc-log-irc-protocol): Conditionally mask secrets when
`erc--debug-irc-protocol-mask-secrets' is non-nil.
(erc--auth-source-search): Don't unwrap secret from function before
returning.
(erc-server-join-channel, erc-login): Use `erc--unfun'.
* test/lisp/erc/erc-services-tests.el
(erc-services-tests--wrap-search): Add helper for `erc--unfun'.
(erc-services-tests--auth-source-standard,
erc-services-tests--auth-source-announced,
erc-services-tests--auth-source-overrides, erc-nickserv-get-password):
Use `erc--unfun'.
* test/lisp/erc/erc-tests.el (erc--debug-irc-protocol-mask-secrets):
Add test for masking secrets with `erc--unfun' and friends.
F. Jason Park [Mon, 12 Jul 2021 10:44:28 +0000 (03:44 -0700)]
Add non-IRCv3 SASL module to ERC
* doc/misc/erc.texi: Add SASL section in Advanced Usage chapter to
document the new SASL module.
* etc/ERC-NEWS: Mention addition of erc-sasl module for SASL support.
* lisp/erc/erc-compat.el
(erc-compat--29-sasl-scram-construct-gs2-header,
erc-compat--29-sasl-scram-client-first-message,
erc-compat--29-sasl-scram--client-final-message): Fix encoding bug and
add minimal authorization support with copies of SASL functions
introduced in Emacs 29.
* lisp/erc/erc.el (erc-modules): Add `sasl'.
* lisp/erc/erc-sasl.el: New file (bug#29108).
* test/lisp/erc/erc-sasl-tests.el: New file.
* test/lisp/erc/erc-scenarios-sasl.el: New file.
* test/lisp/erc/resources/sasl/plain-failed.eld: New file.
* test/lisp/erc/resources/sasl/plain.eld: New file.
* test/lisp/erc/resources/sasl/scram-sha-1.eld: New file.
* test/lisp/erc/resources/sasl/scram-sha-256.eld: New file.
* test/lisp/erc/resources/sasl/external.eld: New file.
F. Jason Park [Sun, 18 Sep 2022 08:49:23 +0000 (01:49 -0700)]
Call erc-login indirectly via new generic wrapper
* lisp/erc/erc-backend (erc--register-connection): Add new internal
generic function that defers to `erc-login' by default.
(erc-process-sentinel, erc-server-connect): Call
`erc--register-connection' instead of `erc-login'.
F. Jason Park [Mon, 12 Jul 2021 10:44:28 +0000 (03:44 -0700)]
Support local ERC modules in erc-mode buffers
* doc/misc/erc.texi: Mention local modules in Modules chapter.
* etc/ERC-NEWS: Mention changes to `erc-update-modules'.
* lisp/erc/erc.el (erc-migrate-modules): Add some missing mappings.
(erc-modules): When a user removes a module, disable it and kill its
local variable in all ERC buffers.
(erc-update-modules): Move body of `erc-update-modules' to new
internal function.
(erc--update-modules): Add new function, a renamed and slightly
modified version of `erc-update-modules'. Specifically, change return
value from nil to a list of minor-mode commands for local modules.
Use `custom-variable-p' to detect flavor.
(erc--merge-local-modes): Add helper for finding local modules
already active as minor modes in an ERC buffer.
(erc-open): Replace `erc-update-modules' with `erc--update-modules'.
Defer enabling of local modules via `erc--update-modules' until after
buffer is initialized with other local vars. Also defer major-mode
hooks so they can detect things like whether the buffer is a server or
target buffer. Also ensure local module setup code can detect when
`erc-open' was called with a non-nil `erc--server-reconnecting'.
* lisp/erc/erc-common.el (erc--module-name-migrations,
erc--features-to-modules, erc--modules-to-features): Add alists of
old-to-new module names to support module-name migrations.
(erc--assemble-toggle): Add new helper for constructing mode toggles,
like `erc-sasl-enable'.
(define-erc-modules): Defer to `erc--assemble-toggle' to create toggle
commands.
(erc--normalize-module-symbol): Add helper for `erc-migrate-modules'.
* lisp/erc/erc-goodies.el: Require cl-lib.
* test/lisp/erc/erc-tests.el (erc-migrate-modules,
erc--update-modules): Add rudimentary unit tests asserting correct
module-name mappings.
(erc--merge-local-modes): Add test for helper.
(define-erc-module--global, define-erc-module--local): Add tests
asserting module-creation macro. (Bug#57955.)
F. Jason Park [Sat, 19 Nov 2022 06:42:15 +0000 (22:42 -0800)]
Make erc--server-reconnecting non-buffer-local
* lisp/erc/erc-backend.el (erc--server-reconnecting): Mention expected
non-nil value type in doc string.
(erc-server-connect): Don't set `erc--server-reconnecting'.
(erc-server--reconnect): Let-bind `erc--server-reconnecting' instead
of setting it locally in the server buffer. Set it to an alist
containing the current buffer's local variables.
(erc-process-sentinel-2): Don't set `erc--server-reconnect'.
* lisp/erc/erc.el (erc--cmd-reconnect): Clean up some assertions.
(Bug#57955.)
F. Jason Park [Sun, 13 Nov 2022 09:52:48 +0000 (01:52 -0800)]
Don't set erc-networks--id until network is known
* lisp/erc/erc-networks.el (erc-networks--id-given): Accept a null
argument.
(erc-networks--id-on-connect): Remove unused function.
(erc-networks--id-equal-p): Add method for comparing initialized and
unset IDs.
(erc-networks--update-server-identity): Ensure `erc-networks--id' is
set before continuing search.
(erc-networks--init-identity): Don't assume `erc-networks--id' is
non-nil. Add branch condition to reload ID on non-nil case.
(erc-networks-on-MOTD-end): Let init-ID function handle renaming of
server buffer.
* lisp/erc/erc.el (erc-open): For continued sessions, try copying over
the last network ID.
(erc--auth-source-determine-params-default): Don't expect a network ID
to have been initialized.
(erc-set-current-nick): When connected, reload network ID. Leave
comment warning that it may be unneeded.
* lisp/erc/erc-backend.el (erc-server-NICK, erc-server-433): Unless
already connected, schedule ID reload when server rejects or mandates
a nick change.
* test/lisp/erc/erc-scenarios-base-association-nick.el
(erc-scenarios-base-association-nick-bumped,
erc-scenarios-base-association-nick-bumped-mandated-renick): Update to
reflect more liberal association behavior when renamed by IRCd.
F. Jason Park [Tue, 20 Sep 2022 04:28:52 +0000 (21:28 -0700)]
Add GS2 authorization to sasl-scram-rfc
* lisp/net/sasl-scram-rfc.el (sasl-scram-gs2-header-function,
sasl-scram-construct-gs2-header): Add new variable and default
function for determining a SCRAM GSS-API message header. This is
mainly intended for other libraries rather than end users.
(sasl-scram-client-first-message): Use gs2-header function.
(sasl-scram--client-final-message): Use dedicated gs2-header function.
Also remove whitespace when base64-encoding, as per RFC 5802.
(Bug#57956.)
Yuan Fu [Wed, 23 Nov 2022 20:07:07 +0000 (12:07 -0800)]
More flexible tree-sitter defun navigation
Before this change, treesit-beginning-of-defun skips nested defuns.
Now user can decide whether to skip nested defuns.
* lisp/treesit.el (treesit-search-forward-goto): Improve docstring.
(treesit-defun-prefer-top-level): New variable.
(treesit--defun-maybe-top-level): New function.
(treesit-beginning-of-defun)
(treesit-end-of-defun): Use treesit--defun-maybe-top-level.
Juri Linkov [Wed, 23 Nov 2022 18:44:37 +0000 (20:44 +0200)]
New commands previous-line-completion and next-line-completion (bug#59486)
* lisp/simple.el (completion-list-mode-map): Bind [up] to
'previous-line-completion', and [down] to 'next-line-completion'.
(completion-auto-wrap): Mention `next-line-completion' and
`previous-line-completion' in the docstring.
(previous-line-completion, next-line-completion): New commands.
Don't break when loading VC packages on older Emacs versions
* lisp/emacs-lisp/package-vc.el
(package-vc--generate-description-file): Append a :kind property
instead of modifying the version number.
* lisp/emacs-lisp/package.el (package-desc): Remove special handling
for "vc annotated" versions. (bug#59404)
Juri Linkov [Wed, 23 Nov 2022 18:33:18 +0000 (20:33 +0200)]
* lisp/help.el (describe-bindings): Use the outline-default-rules feature.
Set buffer-local outline-default-state to 1, and outline-default-rules
to match "Key translations", instead of searching and hiding this section
explicitly.
Juri Linkov [Wed, 23 Nov 2022 08:50:23 +0000 (10:50 +0200)]
* lisp/outline.el: 'S-<down-mouse-1>' on buffer buttons cycles all outlines.
(outline--create-button-icons, outline--insert-button): Bind 'S-<mouse-1>' to
'outline-cycle-buffer' as it's already done for buttons on the margins.
Ignore 'S-<down-mouse-1>'. Don't hard-code 'help-echo' since it should be
customizable by the ':help-echo' keyword in 'define-icon'.
Juri Linkov [Wed, 23 Nov 2022 08:38:28 +0000 (10:38 +0200)]
* lisp/progmodes/xref.el: Support outline-minor-mode (bug#49731)
(xref--xref-buffer-mode): Set buffer-local variables outline-minor-mode-cycle,
outline-minor-mode-use-buttons, outline-search-function, outline-level
as settings for enabling outline-minor-mode in xref output buffers where
outline headings are xref groups, and their lines can be hidden by
outline commands.
Randy Taylor [Sun, 20 Nov 2022 03:30:13 +0000 (22:30 -0500)]
Utilize new font-lock faces for more tree-sitter modes (Bug#59397)
* lisp/progmodes/java-ts-mode.el (java-ts-mode--font-lock-settings):
Use font-lock-number-face.
(java-ts-mode): Alphabetize features.
* lisp/progmodes/js.el (js--treesit-operators): Define operators.
(js--treesit-font-lock-settings): Use bracket, delimiter,
escape-sequence, property, number, and operator font-lock faces.
(js-ts-mode): Add them to the feature list and alphabetize.
* lisp/progmodes/json-ts-mode.el (json-ts-mode--font-lock-settings):
Use bracket, delimiter, escape-sequence, and number faces. Remove
unused features.
(json-ts-mode): Add them to the feature list and alphabetize.
* lisp/progmodes/sh-script.el (sh-mode--treesit-settings): Use
bracket, delimiter, number, misc-punctuation, and operator font-lock
faces.
(sh-mode--treesit-operators): Remove ; and ;; from list.
(bash-ts-mode): Add them to the feature list and alphabetize.
* lisp/progmodes/ts-mode.el (ts-mode--operators): Define operators.
(ts-mode--font-lock-settings): Use escape-sequence, number, and
operator font-lock faces.
(ts-mode): Add them to the feature list and alphabetize.
Yuan Fu [Tue, 22 Nov 2022 20:01:53 +0000 (12:01 -0800)]
Fix treesit-update-ranges
* lisp/treesit.el (treesit--clip-ranges): New function.
(treesit-update-ranges): Now clips the range within (point-min)
and (point-max), so the new range we use are not out-of-range.
Eli Zaretskii [Tue, 22 Nov 2022 18:22:41 +0000 (20:22 +0200)]
Fix 'treesit-max-buffer-size' and its use
* lisp/treesit.el (treesit-max-buffer-size): Avoid overflow in
computing buffer-size limit. Account for 32-but systems built
"--with-wide-int". Extend doc string.
(treesit-ready-p): Compare the limit with the size of the buffer
in bytes, not in characters.
* src/treesit.c (treesit_check_buffer_size): Measure buffer size
in bytes.
Po Lu [Tue, 22 Nov 2022 12:57:47 +0000 (20:57 +0800)]
Adjust x_display_set_last_user_time for Xlib sign-extension
* src/xterm.c (x_display_set_last_user_time): Adjust for Xlib
sign extending fields in client messages to 64 bit long, which
then break x_display_set_last_user_time after 24 days, as Time
is unsigned long for historical reasons. (bug#59480)
Ihor Radchenko [Tue, 22 Nov 2022 01:21:17 +0000 (09:21 +0800)]
Improve the doc string of 'string-collate-lessp'
* src/fns.c (Fstring_collate_lessp): Clarify that
IGNORE-CASE argument might be ignored when the operating
system does not implement string collation for the
specified locale. (Bug#59275)
Yuan Fu [Tue, 22 Nov 2022 08:49:04 +0000 (00:49 -0800)]
Separate tree-sitter and non-tree-sitter variant of sh-mode
Now there are three modes, sh-base-mode, sh-mode, bash-ts-mode.
The change I made: change sh-mode to sh-base-mode, remove docstring.
Below the new sh-base-mode, create a new definition for sh-mode, paste
the dostring, add setup for font-lock-defaults. Below sh-mode, add
bash-ts-mode.
* lisp/progmodes/sh-script.el (sh-mode): Moves all setup into
sh-base-mode, except for the setup for font-lock-defaults and the
docstring.
(sh-base-mode): New mode.
(bash-ts-mode): New mode.
F. Jason Park [Tue, 22 Nov 2022 04:53:25 +0000 (20:53 -0800)]
; Fix ERC test failure following recent typo fix
* test/lisp/erc/erc-scenarios-base-compat-rename-bouncer.el: Replace
expected buffer content in test assertion.
* test/lisp/erc/resources/erc-scenarios-common.el: Replace expected
buffer content in test assertion. See also 40539c7587dc474b424cff732973fe8958eadf14 "; Fix typos".
Stefan Kangas [Tue, 22 Nov 2022 01:38:41 +0000 (02:38 +0100)]
Refresh menus in gnus.texi
Fixes problem reported by Po Lu <luangruo@yahoo.com>.
* doc/misc/gnus.texi (Top, Starting Up, Article Treatment)
(The Gnus Diary Library, Searching, nnmairix): Refresh menus.
Yuan Fu [Mon, 21 Nov 2022 20:07:20 +0000 (12:07 -0800)]
; Minor fix in c-ts-mode fontification
* lisp/progmodes/c-ts-mode.el (c-ts-mode--font-lock-settings): use
override. Include the outer call_expression.
(c-ts-mode--fontify-defun): Use the override given to it rather than
hard-code. Add missing space.
Yuan Fu [Mon, 21 Nov 2022 19:26:46 +0000 (11:26 -0800)]
Allow major modes to tweak tree-sitter fontification
treesit--font-lock-query-expand-range allows a major mode to fix
fontification problems temporarily before the parser can be fixed.
* lisp/treesit.el (treesit--font-lock-query-expand-range): New variable.
(treesit-font-lock-fontify-region): Use the new variable.
* lisp/textmodes/css-mode.el (css-ts-mode): Use the new variable.
Yuan Fu [Mon, 21 Nov 2022 18:52:55 +0000 (10:52 -0800)]
Further tweak tree-sitter fontification heuristics
So it turns out the slowness observed in bug#59415 is not due to the
size, but the strangely tall tree. Adjust the heuristic to DTRT:
don't enable the heuristic by default or when buffer is large, enable
when query is abnormally slow. We could do some clever thing that
calibrates a base reading for the query time instead of using a
hard-coded value, but it doesn't seem necessary.
* lisp/treesit.el (treesit--font-lock-fast-mode): New variable.
(treesit-font-lock-fontify-region): Don't activate heuristic by
default (reasons in comments). Measure the query time and activate
the fast mode if query time is long.
Stefan Kangas [Mon, 21 Nov 2022 14:18:54 +0000 (15:18 +0100)]
; Doc fixes: remove references to missing symbols
* lisp/allout.el (allout-process-exposed): Don't refer to missing
value 'flat-indented'.
* lisp/help.el (resize-temp-buffer-window): Don't refer to missing
function 'preserve-window-size'.
* lisp/pcomplete.el (pcomplete-stub): Don't refer to missing
function 'pcomplete-filename'.