]> git.eshelyaron.com Git - emacs.git/log
emacs.git
2 years agoexternal-completion.el: Minor changes scratch/backend-completion
Stefan Monnier [Tue, 6 Dec 2022 04:50:55 +0000 (23:50 -0500)]
external-completion.el: Minor changes

* lisp/external-completion.el (external-completion-table): Tweak docstring.
Explicitly handle `lambda`.

* lisp/progmodes/eglot.el (xref-backend-identifier-completion-table):
Rename category to `eglot-xref`.

2 years agoUpdate eglot.el to use the new external-completion-table
João Távora [Sun, 4 Dec 2022 13:24:00 +0000 (13:24 +0000)]
Update eglot.el to use the new external-completion-table

* lisp/progmodes/eglot.el
(xref-backend-identifier-completion-table): Update.

2 years agoAdd caching and yet more doc to external-completion.el
João Távora [Sun, 4 Dec 2022 11:01:49 +0000 (11:01 +0000)]
Add caching and yet more doc to external-completion.el

* lisp/external-completion.el (cl-lib): Require cl-lib.
(external-completion-table): Rework for caching.

2 years agoMore tweaks to external-completion.el after Stefan's comments
João Távora [Sat, 3 Dec 2022 23:20:51 +0000 (23:20 +0000)]
More tweaks to external-completion.el after Stefan's comments

* lisp/external-completion.el (Commentary): Update.
(completion-styles-alist): Name the style 'external'.
(external-completion-table): Change order of arguments.  Use
double-dashed symbols.
(external-completion--try-completion)
(external-completion--all-completions): Use double-dashed symbols.

2 years agoSpeed it up
João Távora [Sat, 3 Dec 2022 13:13:02 +0000 (13:13 +0000)]
Speed it up

2 years agoIntegrate Stefan suggestions but rename it to "external-completion.el"
João Távora [Sat, 3 Dec 2022 13:01:26 +0000 (13:01 +0000)]
Integrate Stefan suggestions but rename it to "external-completion.el"

"External completion" is a much better name.  There are already a
thousand in-Emacs meanings for "backend" and this new style is really
meant to be used for tools _outside_ of Emacs.

2 years agoDon't override completion-category-defaults in fido-mode
João Távora [Fri, 25 Nov 2022 13:05:40 +0000 (13:05 +0000)]
Don't override completion-category-defaults in fido-mode

Fido mode's mantra is to use the 'flex' completion style wherever
possible, but this clashes with some completion table categories that
can't use that style, such as the 'backend-completion' category, which
uses the backend-completion-backend-style style.

* lisp/icomplete.el (icomplete--fido-mode-setup): Don't override
completion-category-defaults.

2 years agoAdd lisp/backend-completion.el
João Távora [Fri, 25 Nov 2022 13:03:45 +0000 (13:03 +0000)]
Add lisp/backend-completion.el

This completion style is meant to be used with a "programmable
completion" table that interfaces with an external providing
completions, such as a shell utility, an inferior process, an http
server.  The table and external tool are tasked to do the matching of
the pattern string to the potential candidates of completion, and as
such it fully controls the style.

When this completion style is in use, the usual styles configured
by the user or other in `completion-styles' are completely
overriden.  This can be seen as a drawback, but, on the other hand,
the regular the full data set to be available in Emacs' addressing
space, which is often not feasible.

* lisp/backend-completion.el: New file.

* lisp/progmodes/eglot.el (Package-Requires): Require
backend-completion.
(completion-styles-alist): Don't set it.
(eglot--lsp-backend-style-call)
(eglot--lsp-backend-style-try-completion)
(eglot--lsp-backend-style-all-completions): Delete.

2 years agoEglot: don't confuse URLs and windows file paths
dannyfreeman [Thu, 24 Nov 2022 15:22:33 +0000 (15:22 +0000)]
Eglot: don't confuse URLs and windows file paths

bug#59338

* lisp/progmodes/eglot.el (eglot--path-to-uri): Check for windows path

2 years agoRemove fboundp check in eglot--connect
João Távora [Thu, 24 Nov 2022 14:48:35 +0000 (14:48 +0000)]
Remove fboundp check in eglot--connect

project.el is a GNU ELPA :core package, so this kind of trick isn't
needed.

* lisp/progmodes/eglot.el (eglot--connect): Don't fboundp
project-name.

2 years agoEglot: Advertise completion.resolveSupport capabilities
Marcin Pajkowski [Sun, 20 Nov 2022 19:03:57 +0000 (20:03 +0100)]
Eglot: Advertise completion.resolveSupport capabilities

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)

Copyright-paperwork-exempt: yes

2 years agoAdd new SI prefixes
Mattias Engdegård [Thu, 24 Nov 2022 12:47:55 +0000 (13:47 +0100)]
Add new SI prefixes

* lisp/calc/calc-units.el (math-unit-prefixes):
* lisp/files.el (file-size-human-readable):

Add ronna, quetta, ronto and quecto.  (We get the future IEC binary
prefixes Ri and Qi (robi and quebi) in `file-size-human-readable` for
free.)

2 years agoFix reentrancy problem/crash in xterm.c
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.

2 years agoFix trashing of symlink that points at a directory
Mike Kupfer [Mon, 21 Nov 2022 00:44:20 +0000 (16:44 -0800)]
Fix trashing of symlink that points at a directory

* lisp/files.el (move-file-to-trash): Redefine is-directory so
that it is false for symlinks.

2 years agoFix cross-filesystem directory trashing (Bug#58721)
Mike Kupfer [Sun, 30 Oct 2022 17:31:11 +0000 (10:31 -0700)]
Fix cross-filesystem directory trashing (Bug#58721)

* 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.

2 years agoCC Mode: Make it scroll fast over buffers with only #define's
Alan Mackenzie [Thu, 24 Nov 2022 10:51:03 +0000 (10:51 +0000)]
CC Mode: Make it scroll fast over buffers with only #define's

* lisp/progmodes/cc-engine.el (c-forward-over-token): New LIMIT parameter

* lisp/progmodes/cc-langs.el (c-anchored-hash-define-no-parens): Replace
ill-formed regular expression (which mixed \\sw and character alternative)
with simpler efficient regexp.

* lisp/progmodes/cc-mode.el (c-fl-decl-end): New forward limit LIM+ used in
c-forward-declarator and c-forward-over-token.

2 years agoFix face issues in show-paren context overlay (bug#59527)
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).

2 years agoAvoid assertion violations in treesit.c when editing non-ASCII
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.

2 years agoEUDC: Improve LDAP and BBDB tests
Thomas Fitzsimmons [Thu, 24 Nov 2022 07:16:26 +0000 (02:16 -0500)]
EUDC: Improve LDAP and BBDB tests

* test/lisp/net/eudc-tests.el (eudcb-ldap): Make slapd detection
reliable.
* test/lisp/net/eudc-resources/bbdb: Add another test contact.

2 years ago; Relayout comments in treesit-font-lock-fontify-region
Yuan Fu [Thu, 24 Nov 2022 03:46:38 +0000 (19:46 -0800)]
; Relayout comments in treesit-font-lock-fontify-region

; * lisp/treesit.el (treesit-font-lock-fontify-region): Relayout
comments.

2 years ago; * lisp/progmodes/csharp-mode.el: Add missing require form.
Yuan Fu [Thu, 24 Nov 2022 03:34:10 +0000 (19:34 -0800)]
; * lisp/progmodes/csharp-mode.el: Add missing require form.

2 years agoAdd an error fontification heuristic to c-ts-mode
Yuan Fu [Thu, 24 Nov 2022 01:35:15 +0000 (17:35 -0800)]
Add an error fontification heuristic to c-ts-mode

* lisp/progmodes/c-ts-mode.el (c-ts-mode--font-lock-settings): Use new
function.
(c-ts-fontify-error): New function.

2 years ago; * src/treesit.c (treesit_predicate_match): Move use below check.
Yuan Fu [Thu, 24 Nov 2022 01:24:03 +0000 (17:24 -0800)]
; * src/treesit.c (treesit_predicate_match): Move use below check.

2 years agoDon't always filter out captured tree-sitter nodes outside of region
Yuan Fu [Wed, 23 Nov 2022 23:20:19 +0000 (15:20 -0800)]
Don't always filter out captured tree-sitter nodes outside of region

* lisp/treesit.el (treesit-font-lock-fontify-region): If the capture
name is a function, don't filter.

2 years agoproject-switch-project: Use a different fix for bug#58784
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).

2 years agoAdd test scenarios for local ERC modules
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.)

2 years agoAccept functions in place of passwords in ERC
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.

2 years agoAdd non-IRCv3 SASL module to ERC
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.

2 years agoCall erc-login indirectly via new generic wrapper
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'.

2 years agoSupport local ERC modules in erc-mode buffers
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.)

2 years agoMake erc--server-reconnecting non-buffer-local
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.)

2 years agoDon't set erc-networks--id until network is known
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.

2 years agoAdd GS2 authorization to sasl-scram-rfc
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.)

2 years agoAdd csharp-mode and csharp-ts-mode
Theodor Thornhill [Tue, 22 Nov 2022 20:48:21 +0000 (21:48 +0100)]
Add csharp-mode and csharp-ts-mode

* etc/NEWS: Mention new modes.
* lisp/progmodes/csharp-mode.el (csharp-mode, csharp-ts-mode): New
major modes.

2 years agoDon't skip nested defuns in python-ts-mode defun navigation
Yuan Fu [Wed, 23 Nov 2022 20:08:47 +0000 (12:08 -0800)]
Don't skip nested defuns in python-ts-mode defun navigation

This fixes bug#59495.

Before this change, python tries to skip nested function
definition. Now we don't skip any nested defun.

* lisp/progmodes/python.el (python-treesit-beginning-of-defun)
(python-treesit-end-of-defun): Remove functions.
* lisp/progmodes/python.el (python-ts-mode): Use tree-sitter's default
navigation function.

2 years agoMore flexible tree-sitter defun navigation
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.

2 years ago; * src/treesit.c: Minor comment improvement.
Yuan Fu [Wed, 23 Nov 2022 20:06:40 +0000 (12:06 -0800)]
; * src/treesit.c: Minor comment improvement.

2 years agoicalendar.el: Add test(s) for bug#56241
Ulf Jasper [Wed, 23 Nov 2022 19:31:42 +0000 (20:31 +0100)]
icalendar.el: Add test(s) for bug#56241

* test/lisp/calendar/icalendar-tests.el
(icalendar-tests--get-error-string-for-export): new.
* icalendar-tests.el (icalendar-export-bug-56241-dotted-pair): new

2 years agoNew commands previous-line-completion and next-line-completion (bug#59486)
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.

2 years agoDon't break when loading VC packages on older Emacs versions
Philip Kaludercic [Sun, 20 Nov 2022 14:36:24 +0000 (15:36 +0100)]
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)

2 years ago* lisp/help.el (describe-bindings): Use the outline-default-rules feature.
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.

2 years agoMerge branch 'master' of git.savannah.gnu.org:/srv/git/emacs
Eli Zaretskii [Wed, 23 Nov 2022 18:33:26 +0000 (20:33 +0200)]
Merge branch 'master' of git.savannah.gnu.org:/srv/git/emacs

2 years agoSupport Racket programs in 'etags'
lu4nx [Wed, 23 Nov 2022 15:54:54 +0000 (23:54 +0800)]
Support Racket programs in 'etags'

* lib-src/ctags.c (Scheme_suffixes): Add the Racket language
extension ".rkt".

Copyright-paperwork-exempt: yes

2 years agoxref--search-property: Jump over entries hidden by outline-minor-mode
Dmitry Gutov [Wed, 23 Nov 2022 18:24:43 +0000 (20:24 +0200)]
xref--search-property: Jump over entries hidden by outline-minor-mode

* lisp/progmodes/xref.el (xref--search-property):
Jump over entries hidden by e.g. outline-minor-mode (bug#49731).

2 years ago; * src/pdumper.c (dump_buffer, dump_vectorlike): Update hashes.
Eli Zaretskii [Wed, 23 Nov 2022 18:22:19 +0000 (20:22 +0200)]
; * src/pdumper.c (dump_buffer, dump_vectorlike): Update hashes.

2 years agoAvoid signaling args-out-of-range in mouse.el
Eli Zaretskii [Wed, 23 Nov 2022 15:16:32 +0000 (17:16 +0200)]
Avoid signaling args-out-of-range in mouse.el

* lisp/mouse.el (mouse-posn-property): Avoid
signaling args-out-of-range errors when mode-line format uses
min-width 'display' property.  (Bug#59452)

2 years agoImprove documentation of locale-specific string comparison
Eli Zaretskii [Wed, 23 Nov 2022 14:54:01 +0000 (16:54 +0200)]
Improve documentation of locale-specific string comparison

* doc/lispref/strings.texi (Text Comparison):
* src/fns.c (Fstring_collate_equalp): Improve documentation of
'string-collate-equalp' and 'string-collate-lessp'.  (Bug#59275)

2 years agoFix error signaled by mouse-highlight on mode line
Eli Zaretskii [Wed, 23 Nov 2022 14:18:55 +0000 (16:18 +0200)]
Fix error signaled by mouse-highlight on mode line

* src/xdisp.c (note_mode_line_or_margin_highlight): Avoid
signaling args-out-of-range errors when mode-line format uses
min-width 'display' property.  (Bug#59452)

2 years agoImprove last change to xterm.c
Po Lu [Wed, 23 Nov 2022 12:36:39 +0000 (20:36 +0800)]
Improve last change to xterm.c

* src/xfns.c (Fx_display_last_user_time): Reject overly large
timestamps.
* src/xterm.c (x_display_set_last_user_time, handle_one_xevent):
New functions.

2 years agoRestore tramp-achive's Emacs 26 compatibility
Michael Albinus [Wed, 23 Nov 2022 11:00:35 +0000 (12:00 +0100)]
Restore tramp-achive's Emacs 26 compatibility

* lisp/net/tramp-archive.el (tramp-archive-autoload-file-name-regexp):
Special handling of Emacs 26.  Simplify the other part.

* test/lisp/net/tramp-tests.el (tramp-test48-unload): Special case
of `tramp-register-archive-file-name-handler'.

2 years ago; * doc/lispintro/emacs-lisp-intro.texi (Complete kill-region): Fix typo
Shynur [Wed, 23 Nov 2022 09:26:46 +0000 (10:26 +0100)]
; * doc/lispintro/emacs-lisp-intro.texi (Complete kill-region): Fix typo

2 years ago* lisp/outline.el: 'S-<down-mouse-1>' on buffer buttons cycles all outlines.
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'.

2 years ago* lisp/progmodes/xref.el: Support outline-minor-mode (bug#49731)
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.

2 years ago; Fix typos
Stefan Kangas [Wed, 23 Nov 2022 04:43:19 +0000 (05:43 +0100)]
; Fix typos

2 years ago; Remove obsolete use of inhibit-point-motion-hooks
Yuan Fu [Wed, 23 Nov 2022 03:57:44 +0000 (19:57 -0800)]
; Remove obsolete use of inhibit-point-motion-hooks

* lisp/treesit.el (treesit-font-lock-fontify-region): Remove it.

2 years agoTweak python-ts-mode fontification (bug#59470)
Yuan Fu [Wed, 23 Nov 2022 02:47:47 +0000 (18:47 -0800)]
Tweak python-ts-mode fontification (bug#59470)

* lisp/progmodes/python.el (python--treesit-settings): Only fontify
the @ and the identifier of a decorator, not the argument list (if
there is any).

2 years agoUtilize new font-lock faces for more tree-sitter modes (Bug#59397)
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.

2 years agoAdd a way to override project name for project-vc backend
Dmitry Gutov [Wed, 23 Nov 2022 02:16:23 +0000 (04:16 +0200)]
Add a way to override project name for project-vc backend

* lisp/progmodes/project.el (project-vc-name): New user option.
(project-name): Override for VC project backend (bug#48747).

2 years ago; * lisp/treesit.el (treesit-ready-p): Guard against empty buffers.
Yuan Fu [Wed, 23 Nov 2022 01:29:26 +0000 (17:29 -0800)]
; * lisp/treesit.el (treesit-ready-p): Guard against empty buffers.

2 years agoFix treesit-update-ranges
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.

2 years ago; Fix treesit--children-covering-range
Yuan Fu [Tue, 22 Nov 2022 20:01:19 +0000 (12:01 -0800)]
; Fix treesit--children-covering-range

* lisp/treesit.el (treesit--children-covering-range): Handle the case
when NODE doesn't have children, and when CHILD is nil.

2 years ago; * src/casefiddle.c (casify_region): Stylistic change.
Yuan Fu [Tue, 22 Nov 2022 19:18:52 +0000 (11:18 -0800)]
; * src/casefiddle.c (casify_region): Stylistic change.

2 years ago* lisp/progmodes/eglot.el (eglot--connect): Use project-name
Stephen Leake [Tue, 22 Nov 2022 19:43:22 +0000 (11:43 -0800)]
* lisp/progmodes/eglot.el (eglot--connect): Use project-name

As discussed in bug#48747.

2 years ago* lisp/progmodes/project.el (project-name): New
Stephen Leake [Tue, 22 Nov 2022 18:55:59 +0000 (10:55 -0800)]
* lisp/progmodes/project.el (project-name): New

2 years agoFix 'treesit-max-buffer-size' and its use
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.

2 years ago; Fix comparisons in treesit.c
Eli Zaretskii [Tue, 22 Nov 2022 16:56:08 +0000 (18:56 +0200)]
; Fix comparisons in treesit.c

* src/treesit.c (Ftreesit_parser_add_notifier)
(Ftreesit_parser_remove_notifier): Fix comparison with Lisp
objects.  (Bug#59483)

2 years agoAdd '\lll' for VERY MUCH LESS-THAN to TeX input method
Robert Pluim [Tue, 22 Nov 2022 15:44:56 +0000 (16:44 +0100)]
Add '\lll' for VERY MUCH LESS-THAN to TeX input method

* lisp/leim/quail/latin-ltx.el (latin-ltx--define-rules): Add '\lll'
translation for U+22D8.  (Bug#59476)

2 years agoAdjust x_display_set_last_user_time for Xlib sign-extension
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)

2 years agoImprove the doc string of 'string-collate-lessp'
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)

2 years agoFix tree-sitter build using non-bash /bin/sh (bug#59460)
Sam James [Mon, 21 Nov 2022 22:01:37 +0000 (22:01 +0000)]
Fix tree-sitter build using non-bash /bin/sh (bug#59460)

* configure.ac: Don't use '==' in comparisons.

Copyright-paperwork-exempt: yes.

2 years agoAvoid potentially expensive XFlush and fix ordering
Po Lu [Tue, 22 Nov 2022 11:43:14 +0000 (19:43 +0800)]
Avoid potentially expensive XFlush and fix ordering

* src/xterm.c (x_raise_frame): Don't call XFlush without a
request being made.
(x_lower_frame): Fix ordering wrt to xwidget view lowering.

2 years ago; Fix warnings in builds without tree-sitter
Mattias Engdegård [Tue, 22 Nov 2022 10:06:41 +0000 (11:06 +0100)]
; Fix warnings in builds without tree-sitter

2 years agoSeparate tree-sitter and non-tree-sitter variant of sh-mode
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.

2 years agoFix treesit_record_change in casify_region
Yuan Fu [Tue, 22 Nov 2022 08:35:11 +0000 (00:35 -0800)]
Fix treesit_record_change in casify_region

This fixes bug#59455.

* src/casefiddle.c: Always record changes.

2 years agoTweak faces in Java and TypeScript
Theodor Thornhill [Mon, 21 Nov 2022 12:12:03 +0000 (13:12 +0100)]
Tweak faces in Java and TypeScript

* lisp/progmodes/java-ts-mode.el (java-ts-mode--operators): Remove @
as an operator.

(java-ts-mode--font-lock-settings): Use constant-face for @ to match
rest of the annotation.  Add bracket, delimiter and use some of the
new faces.

(java-ts-mode--imenu): Clean up the implementation a little.

(java-ts-mode): Refer to the new features.

* lisp/progmodes/ts-mode.el (ts-mode--font-lock-settings, ts-mode):
Add in bracket and delimiter'.

2 years agotreesit-font-lock-recompute-features now has two modes of operation
Yuan Fu [Tue, 22 Nov 2022 07:06:43 +0000 (23:06 -0800)]
treesit-font-lock-recompute-features now has two modes of operation

1. Set activation of each feature (changes every feature)
2. Add/remove features (only change those explicitly configured by
ADD-LIST and REMOVE-LIST)

This is useful for enabling/disabling certain features for all
modes (without resetting others) by calling this function in
prog-mode-hook

* lisp/treesit.el (treesit-font-lock-recompute-features): See above
description.

2 years agoTweak c-ts-mode fontification
Yuan Fu [Tue, 22 Nov 2022 06:37:36 +0000 (22:37 -0800)]
Tweak c-ts-mode fontification

New features: function and variable, which consistently fontify all
occurrences of functions and variables, respectively.

Remove expression feature, as its purpose is fulfilled by function,
variable, and property combined.

Fix declaration feature, remove unnecessary rule from label
feature.

* lisp/progmodes/c-ts-mode.el (c-ts-mode--font-lock-settings): See
above description.
(c-ts-mode--fontify-variable): New function.
(c-ts-mode--base-mode): Add & remove features.

2 years ago; Fix docstrings in treesit.el
Yuan Fu [Tue, 22 Nov 2022 06:33:10 +0000 (22:33 -0800)]
; Fix docstrings in treesit.el

* lisp/treesit.el (treesit--explorer--nodes-to-highlight)
(treesit--explorer-draw-node): Fix docstrings.

2 years ago* lisp/treesit.el (treesit-max-buffer-size): Enlarge value.
Yuan Fu [Tue, 22 Nov 2022 06:32:51 +0000 (22:32 -0800)]
* lisp/treesit.el (treesit-max-buffer-size): Enlarge value.

2 years agoDon't refer to deleted variable 'gnus-parameter-to-list-alist'
Stefan Kangas [Tue, 22 Nov 2022 07:25:32 +0000 (08:25 +0100)]
Don't refer to deleted variable 'gnus-parameter-to-list-alist'

* doc/misc/gnus.texi (Group Parameters):
* lisp/gnus/message.el (message-recipients-without-full-name):
Don't refer to deleted variable 'gnus-parameter-to-list-alist'.

2 years ago; Fix ERC test failure following recent typo fix
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".

2 years ago; Fix typos in tree-sitter files
Juanma Barranquero [Tue, 22 Nov 2022 03:40:49 +0000 (04:40 +0100)]
; Fix typos in tree-sitter files

* admin/notes/tree-sitter/starter-guide (Font-lock)
(Debugging queries, Indent, Navigation, Which-func)
(More features?):
* lisp/treesit.el (treesit--merge-ranges)
(treesit-font-lock-feature-list, treesit-font-lock-rules)
(treesit-font-lock-fontify-region, treesit--font-lock-notifier)
(treesit-simple-indent-presets, treesit--font-lock-fast-mode)
(treesit--indent-region-batch-size)
(treesit--indent-rules-optimize, treesit-ready-p): Fix typos.

2 years agoRefresh menus in gnus.texi
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.

2 years agoImprove wording and markup in gnus-faq.texi
Stefan Kangas [Tue, 22 Nov 2022 01:10:59 +0000 (02:10 +0100)]
Improve wording and markup in gnus-faq.texi

* doc/misc/gnus-faq.texi (FAQ 2-4): Improve wording and markup.
(FAQ 2-1, FAQ 2-4, FAQ 2-5, FAQ 3 - Getting Messages, FAQ 3-1)
(FAQ 3-2, FAQ 3-2, FAQ 3-4, FAQ 4-1, FAQ 4-2, FAQ 4-3, FAQ 4-4)
(FAQ 4-8, FAQ 4-9, FAQ 4-10, FAQ 4-12, FAQ 5-1, FAQ 5-2)
(FAQ 5-7, FAQ 6-1, FAQ 6-2, FAQ 6-2, FAQ 6-3, FAQ 6-4, FAQ 6-5)
(FAQ 7-2, FAQ 7-3, FAQ 7-3, FAQ 7-4, FAQ 8-1, FAQ 8-5, FAQ 9-1):
Improve markup and reflow some paragraphs.

2 years ago; Fix typos
Stefan Kangas [Mon, 21 Nov 2022 14:39:43 +0000 (15:39 +0100)]
; Fix typos

2 years ago; * lisp/progmodes/js.el (js-ts-mode): Add autoload cookie.
Yuan Fu [Mon, 21 Nov 2022 21:46:52 +0000 (13:46 -0800)]
; * lisp/progmodes/js.el (js-ts-mode): Add autoload cookie.

2 years ago; * test/src/treesit-tests.el (treesit-misc): Remove test.
Yuan Fu [Mon, 21 Nov 2022 21:34:38 +0000 (13:34 -0800)]
; * test/src/treesit-tests.el (treesit-misc): Remove test.

This test is for treesit--setting-for-mode, which is removed when we
switched from using treesit-settings to using separate major modes.

2 years ago; Update tree-sitter starter guide
Yuan Fu [Mon, 21 Nov 2022 21:33:03 +0000 (13:33 -0800)]
; Update tree-sitter starter guide

* admin/notes/tree-sitter/starter-guide: Reflect recent changes.
* admin/notes/tree-sitter/html-manual/Using-Parser.html:
* admin/notes/tree-sitter/html-manual/Tree_002dsitter-C-API.html:
* admin/notes/tree-sitter/html-manual/Parsing-Program-Source.html:
* admin/notes/tree-sitter/html-manual/Parser_002dbased-Indentation.html:
* admin/notes/tree-sitter/html-manual/Parser_002dbased-Font-Lock.html:
* admin/notes/tree-sitter/html-manual/Multiple-Languages.html:
* admin/notes/tree-sitter/html-manual/Language-Definitions.html: Update.

2 years ago; Fix typo in c-ts-mode--font-lock-settings
Yuan Fu [Mon, 21 Nov 2022 21:17:16 +0000 (13:17 -0800)]
; Fix typo in c-ts-mode--font-lock-settings

* lisp/progmodes/c-ts-mode.el (c-ts-mode--font-lock-settings): Fix
typo.

2 years agoMerge remote-tracking branch 'savannah/master' into feature/tree-sitter
Yuan Fu [Mon, 21 Nov 2022 20:54:35 +0000 (12:54 -0800)]
Merge remote-tracking branch 'savannah/master' into feature/tree-sitter

2 years ago; Minor fix in c-ts-mode fontification
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.

2 years agoAllow major modes to tweak tree-sitter fontification
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.

2 years agoFurther tweak tree-sitter fontification heuristics
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.

2 years ago; * src/treesit.c (treesit_load_language): Move call to eassume.
Yuan Fu [Mon, 21 Nov 2022 16:57:53 +0000 (08:57 -0800)]
; * src/treesit.c (treesit_load_language): Move call to eassume.

If handle is ever going to be NULL, it will be when error != NULL, so
we should only eassume handle != NULL after the check for error.

2 years ago; Silence byte-compiler warnings
Eli Zaretskii [Mon, 21 Nov 2022 17:08:25 +0000 (19:08 +0200)]
; Silence byte-compiler warnings

* lisp/textmodes/css-mode.el:
* lisp/progmodes/python.el:
* lisp/progmodes/json-ts-mode.el:
* lisp/progmodes/js.el:
* lisp/progmodes/java-ts-mode.el:
* lisp/progmodes/c-ts-mode.el: Add declarations of tree-sitter
functions.

2 years ago; * test/src/treesit-tests.el (treesit-misc): Don't fail without ts
Mattias Engdegård [Mon, 21 Nov 2022 15:52:05 +0000 (16:52 +0100)]
; * test/src/treesit-tests.el (treesit-misc): Don't fail without ts

2 years ago; * lisp/treesit.el (treesit-parser-add-notifier): Add declaration.
Eli Zaretskii [Mon, 21 Nov 2022 15:24:42 +0000 (17:24 +0200)]
; * lisp/treesit.el (treesit-parser-add-notifier): Add declaration.

2 years ago; Repair build without tree-sitter
Mattias Engdegård [Mon, 21 Nov 2022 14:41:28 +0000 (15:41 +0100)]
; Repair build without tree-sitter

2 years ago; Doc fixes: remove references to missing symbols
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'.

2 years ago; Fix typos (misspelled symbols)
Stefan Kangas [Mon, 21 Nov 2022 14:16:08 +0000 (15:16 +0100)]
; Fix typos (misspelled symbols)