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

163958 Commits

Author SHA1 Message Date
F. Jason Park
2ddc480f44 Warn of absent networks module in ERC
* doc/misc/erc.texi: Add linkable note in Modules chapter about some
modules being required.  Also tweak markup in auth-source section.
* etc/ERC-NEWS: Mention the special role of `networks'.
* lisp/erc/erc-backend.el (erc--server-post-connect-hook): Add
internal hook for core modules to perform post-network-process,
pre-protocol config validation even when they haven't been loaded.
(erc--register-connection): Run `erc--server-post-connect-hook'.
* lisp/erc/erc-networks.el (erc-networks--bouncer-targets,
erc-networks-on-MOTD-end): Fix comments and doc strings.  Also change
former from constant to internal variable in case adjustment needed
between releases.
(erc-networks--warn-on-connect): New function to warn about the
`networks' module being absent from `erc-modules'.  This could
probably run at any time up to and including when the logical IRC
connection is established, but doing so at the process/protocol
boundary seems ideal.
* lisp/erc/erc-sasl.el (erc--register-connection): Defer to base
method instead of calling `erc-login' explicitly.
* lisp/erc/erc.el (erc-generate-new-buffer-name): Don't reconcile
buffer names when networks module not in play.
(erc-format-target-and/or-network): Don't assume networks module
loaded.
* test/lisp/erc/erc-scenarios-base-unstable.el:
(erc-scenarios-networks-no-module): New test.
* test/lisp/erc/resources/networks/no-module/basic.eld: New test data
file.  (Bug#60331.)
2022-12-28 06:51:38 -08:00
F. Jason Park
19d00fab9a Avoid "already compiled" warning in erc-compat
* lisp/erc/erc-compat.el (erc-compat--29-auth-source-pass-search):
Don't `byte-compile' sub-29 secrets wrapper.  This was especially
noisy in tests.  Ditch closed-over vars via HOF instead of suppressing
because compiling emits "unused lexical" warning on Emacs 27.
2022-12-28 06:51:38 -08:00
Eli Zaretskii
2d8f7b66bc ; Fix one more treesit byte-compilation warning. 2022-12-28 16:48:22 +02:00
Eli Zaretskii
2d0a921486 ; Avoid treesit-related byte-compiler warnings
* lisp/progmodes/json-ts-mode.el (treesit-node-child-by-field-name):
* lisp/textmodes/toml-ts-mode.el (treesit-node-child-by-field-name):
* lisp/progmodes/java-ts-mode.el (treesit-node-child-by-field-name):
* lisp/progmodes/csharp-mode.el
(treesit-node-child-by-field-name): Avoid byte-compilation
warnings about treesit-node-type.
2022-12-28 16:41:58 +02:00
Dmitry Gutov
8503b370be (python--treesit-settings): Remove duplicate matcher
* lisp/progmodes/python.el (python--treesit-settings): Remove
duplicate matcher (which found itself under 'function' in addition
to 'definition').
2022-12-28 15:13:25 +02:00
Eli Zaretskii
b464e6c490 Make last change of w32 GUI dialogs conditional and reversible
* src/w32term.c (syms_of_w32term) <w32-yes-no-dialog-show-cancel>:
New boolean variable.
(w32_initialize): Fix query for visible system caret: 'bool' is a
single-byte data type, whereas SystemParametersInfo wants a BOOL,
which is a 32-bit int.
* src/w32menu.c (simple_dialog_show): Show "Cancel" button only if
'w32-yes-no-dialog-show-cancel' is non-nil.

* etc/NEWS: Announce the change.
2022-12-28 15:10:39 +02:00
Yuan Fu
eedc9d79ae
Fix tree-sitter typos
* doc/lispref/parsing.texi (Tree-sitter major modes):
* lisp/progmodes/java-ts-mode.el:
* test/src/treesit-tests.el (treesit-defun-navigation-nested-4): Fix
typo.
2022-12-28 00:32:37 -08:00
Yuan Fu
248c13dcfe
Update tree-sitter major modes to use the new Imenu facility
See previous commit for more explanation.

* lisp/progmodes/c-ts-mode.el (c-ts-mode--defun-name): Handle more
types.
(c-ts-mode--imenu-1)
(c-ts-mode--imenu): Remove functions.
(c-ts-base-mode): Setup Imenu.
* lisp/progmodes/csharp-mode.el (csharp-ts-mode--imenu-1)
(csharp-ts-mode--imenu): Remove functions.
(csharp-ts-mode): Setup Imenu.
* lisp/progmodes/java-ts-mode.el (java-ts-mode--imenu-1)
(java-ts-mode--imenu): Remove functions.
(java-ts-mode): Setup Imenu.
* lisp/progmodes/js.el (js--treesit-imenu-1)
(js--treesit-imenu): Remove functions.
(js--treesit-valid-imenu-entry): New function.
(js-ts-mode): Setup Imenu.
* lisp/progmodes/json-ts-mode.el (json-ts-mode--defun-name): Trim the
quotes.
(json-ts-mode--imenu-1)
(json-ts-mode--imenu): Remove functions.
(json-ts-mode): Setup Imenu.
* lisp/progmodes/rust-ts-mode.el (rust-ts-mode--imenu)
(rust-ts-mode--imenu-1): Remove functions.
(rust-ts-mode): Setup Imenu.
* lisp/progmodes/typescript-ts-mode.el:
(typescript-ts-base-mode): Remove treesit-defun-prefer-top-level, it's
not used anymore.  Setup Imenu.  Setup treesit-defun-name-function.
* lisp/textmodes/css-mode.el (css--treesit-imenu-1)
(css--treesit-imenu): Remove functions.
(css-ts-mode): Setup Imenu.
* lisp/textmodes/toml-ts-mode.el (toml-ts-mode--defun-name): Fix it
and add a fallback.
(toml-ts-mode--imenu-1)
(toml-ts-mode--imenu): Remove functions.
(toml-ts-mode): Setup Imenu.
2022-12-27 20:58:53 -08:00
Yuan Fu
b39dc7ab27
Add tree-sitter helper functions for Imenu
We didn't add an integration for Imenu because we aren't sure what
should it look like.  Now we have a pretty good idea.  All the major
modes copy-paste the two Imenu functions and tweaks them in a standard
way.  With the addition of treesit-defun-type-regexp and
treesit-defun-name-function, now is a good time to standardize Imenu
integration.

In the next commit we update all the major modes to use this
integration.

* doc/lispref/modes.texi (Imenu): Add manual.
* doc/lispref/parsing.texi (Tree-sitter major modes): Update manual.
* lisp/treesit.el (treesit-simple-imenu-settings): New varaible.
(treesit--simple-imenu-1)
(treesit-simple-imenu): New functions.
(treesit-major-mode-setup): Setup Imenu.
2022-12-27 20:37:29 -08:00
Yuan Fu
ba1ddea9da
Fix treesit--things-around (bug#60355)
Current implementation of treesit--things-around only searches forward
for REGEXP and go up the tree until it finds a valid thing, if nothing
matches it gives up.  This makes it sometimes miss defuns.  The new
implementation tries multiple times (of search forward + go up) until
it exhausts all possible defun nodes.

* lisp/treesit.el (treesit--things-around): New implementation.
(treesit--navigate-defun): Refactor to use treesit-node-top-level to
simplify code, and add some guards in the predicate function.
* test/src/treesit-tests.el:
(treesit--ert-defun-navigation-elixir-program): New variable.
(treesit-defun-navigation-nested-4): New test.
2022-12-27 17:41:43 -08:00
Yuan Fu
7512b9025a
; * lisp/treesit.el (treesit-traverse-parent): Remove alias.
It was added with treesit-traverse-xxx functions, since now they are
gone, this alias doesn't make sense by itself anymore.
2022-12-27 17:38:13 -08:00
Yuan Fu
5326b04198
Improve treesit-node-top-level and treesit-parent-until
* lisp/treesit.el (treesit-node-top-level): Now it can accept a
predicate function.  Add an optional argument INCLUDE-NODE.
(treesit-parent-until): Add an optional argument INCLUDE-NODE.
2022-12-27 17:17:25 -08:00
Philip Kaludercic
637f5b164f ; Add "src" to the heuristic sub-directory heuristic
* lisp/emacs-lisp/package-vc.el (package-vc--unpack): Check for "src"
directories, next to "lisp".
2022-12-27 21:23:38 +01:00
Philip Kaludercic
8ab6df0c9f ; * lisp/epa-ks.el (epa-ks-do-key-to-fetch): Fix 'when' usage 2022-12-27 21:23:38 +01:00
Eli Zaretskii
2b55a48d3e * src/w32menu.c (simple_dialog_show): Use MB_YESNOCANCEL style. 2022-12-27 20:55:12 +02:00
Eli Zaretskii
8b8b791567 ; Improve documentation of TAB/SPC indentation
* lisp/indent.el (tab-to-tab-stop):
* src/indent.c (Findent_to): Mention 'indent-tabs-mode' in doc
strings.
2022-12-27 20:23:16 +02:00
Eli Zaretskii
624e382211 ; Improve doc strings of some new faces
* lisp/font-lock.el (font-lock-punctuation-face)
(font-lock-delimiter-face): Doc fix.
2022-12-27 18:59:59 +02:00
Stefan Kangas
41f12e1019 ; * lisp/elide-head.el (elide-head): Doc fix to silence checkdoc. 2022-12-27 17:30:51 +01:00
Eli Zaretskii
e3b4cd0ac1 ; * lisp/htmlfontify.el (hfy-text-p): Fix whitespace. 2022-12-27 16:10:42 +02:00
Xi Lu
1b4dc4691c Fix htmlfontify.el command injection vulnerability.
* lisp/htmlfontify.el (hfy-text-p): Fix command injection
vulnerability.  (Bug#60295)
2022-12-27 16:09:52 +02:00
Rudolf Adamkovič
1fe4b98b4d Improve support for Scheme R6RS and R7RS libraries (bug#54704)
* etc/NEWS (Scheme mode): Document improved file-type auto-detection
and Imenu support for R6RS and R7RS Scheme libraries.
* lisp/files.el (auto-mode-alist): Associate the '.sls' (R6RS Scheme
Library Source) and '.sld' (R7RS Scheme Library Definition) file name
extensions with the Scheme mode.
* lisp/progmodes/scheme.el (scheme-imenu-generic-expression): Make
Imenu recognize the members nested (and so indented) inside of
'library' (R6RS) or 'define-library' (R7RS) forms.
2022-12-27 15:57:45 +02:00
Mattias Engdegård
2347f37f67 ; * test/src/treesit-tests.el: remove dead store (bytecomp warning) 2022-12-27 11:18:02 +01:00
Yuan Fu
a6d961ae2f
Add a new tree-sitter query predicate 'pred'
I realized that using an arbitrary function as the predicate in
queries is very helpful for some queries I'm writing for python and
javascript, and presumably most other languages[1].

Granted, we can already filter out unwanted nodes by using a function
instead of a face for the capture name, and (1) determine whether the
captured node is valid and (2) fontify that node if it's valid.

However, such approach is a bit more cumbersome and more importantly
gets in the way of another potential use of the fontification queries:
context extraction.

For example, I could use the query for the 'variable' feature to get
all the variables in a certain region.  In this use-case, we want the
filtering happen before returning the captured nodes.

Besides, the change is relatively small and straightforward: most code
are already there, I just need to add some boilerplate.

[1] For a code like aa.bb(cc), we want bb to be in function face,
because obviously its a function.  But for aa.bb, we want bb to be in
property face, because it's a property.  In the AST, bb is always a
property, the difference between the two cases is the enclosing node:
in the first case, aa.bb is in a "call_expression" node, indicating
that bb is used as a function (a method).  So we want a predicate
function that checks whether bb is used as a function or a property,
and determine whether it should be in function or property face.

* doc/lispref/parsing.texi (Pattern Matching): Update manual.
* src/treesit.c (Ftreesit_pattern_expand): Handle :pred.
(treesit_predicate_capture_name_to_node): A new function extracted
from treesit_predicate_capture_name_to_text.
(treesit_predicate_capture_name_to_text): Use the newly extracted
function.
(treesit_predicate_pred): New predicate function.
(treesit_eval_predicates): Add new predicate.  Also fix a bug: we want
to AND the results of each predicate.
* test/src/treesit-tests.el (treesit--ert-pred-last-sibling): New
helper function.
(treesit-query-api): Test #pred predicate.
2022-12-26 17:50:14 -08:00
Yuan Fu
835a80dcc4
; Fix tree-sitter defun tests
* test/src/treesit-tests.el (treesit--ert-test-defun-navigation):
Change treesit--navigate-defun to treesit--navigate-thing.
2022-12-26 17:50:14 -08:00
Stefan Kangas
a14821d615 Improve gnutls-min-prime-bits docstring
* lisp/net/gnutls.el (gnutls-min-prime-bits): Doc fix: delete
out-of-date and now misleading sentence, added back when Emacs'
default minimum prime bits for a Diffie-Hellman handshake was only 256
bits.  These days, the default is nil, which means to let GnuTLS
decide the value.  (See also `nsm-protocol-check--dhe-prime-kx`.)
2022-12-26 21:57:31 +01:00
Gregory Heytings
b14bbd108e Improve handling of tab-bar height.
* src/xdisp.c (redisplay_tab_bar): When 'auto-resize-tab-bar' is
not 'grow-only', also consider the case when the tab-bar height
needs to shrink.  Fixes bug#60210.
2022-12-26 18:39:41 +01:00
Eli Zaretskii
669160d47b ; * nt/INSTALL.W64: More fixes and updates. 2022-12-26 16:26:28 +02:00
Eli Zaretskii
26b2ec7cb8 Simplify last change (bug#60311)
* src/json.c (json_available_p): Use original code.  Always return
true for !WINDOWSNT.
(ensure_json_available): Now defined only on WINDOWSNT.
(Fjson_serialize, Fjson_insert, Fjson_parse_string)
(Fjson_parse_buffer): Call ensure_json_available only on
WINDOWSNT.

* lisp/subr.el (json-available-p): Simplify.
2022-12-26 15:26:48 +02:00
Mattias Engdegård
082fc6e308 Fix 'json-available-p' on MS-Windows
* src/json.c (json_available_p, ensure_json_available)
(Fjson__available_p): New functions.
(Fjson_serialize, Fjson_insert, Fjson_parse_string)
(Fjson_parse_buffer): Use ensure_json_available.
(syms_of_json): Defsubr json--available-p.

* lisp/subr.el (json-available-p): Rewrite.
2022-12-26 15:12:04 +02:00
Kyle Meyer
6c86faec29 loaddefs-gen: Group results by absolute file name
loaddefs-generate produced an incomplete output file if 1) it
was called with a relative file name and 2) that same file was
specified via a generated-autoload-file cookie in a subset of
the input files.  In that case, autoload entries were lost
because loaddefs-generate writes the same output file twice:
once for the relative name specified by the caller and once
for the absolute name that loaddefs-generate--parse-file
returns for the generated-autoload-file value.
This has been fixed.  (Bug#60318)

* lisp/emacs-lisp/loaddefs-gen.el (loaddefs-generate): Expand file
names when grouping loaddef files.
2022-12-26 14:55:08 +02:00
Yuan Fu
d90d7d15f2
; Fix vindexes in parsing.texi
* doc/lispref/parsing.texi (Tree-sitter major modes): Replace vindex
with cross-reference to modes.texi.  Add manual entry for
treesit-defun-type-regexp.
* lisp/treesit.el (treesit-defun-type-regexp): Use pred in docstring
since we use pred everywhere else.
2022-12-26 01:47:56 -08:00
Yuan Fu
eb26872837
Fix imenu for c-ts-mode (bug#60296)
* lisp/progmodes/c-ts-mode.el (c-ts-mode--imenu-1): Use
c-ts-mode--defun-valid-p to filter out nested matches.
(c-ts-mode--defun-valid-p): Handle more types of nodes.
2022-12-26 01:47:56 -08:00
Yuan Fu
8f68b6497e
Clean up python-ts-mode font-lock features
* lisp/progmodes/python.el (python--treesit-settings): Remove
unnecessary override flags, add function and variable feature, fix
assignment feature.
(python--treesit-variable-p)
(python--treesit-fontify-variable): New functions.
(python-ts-mode): Add function and variable feature.
2022-12-26 01:47:56 -08:00
Yuan Fu
28f26b11a1
Add comment indent and filling to other tree-sitter major modes
Extract the setup into a function, and use it in other major modes.

* lisp/progmodes/c-ts-mode.el (c-ts-mode-comment-setup): New function.
(c-ts-base-mode): Extract out.
(c-ts-mode)
(c++-ts-mode): Remove old setup.

* lisp/progmodes/csharp-mode.el (csharp-ts-mode--indent-rules): New
indent rules.
(csharp-ts-mode): Use new setup function.
* lisp/progmodes/java-ts-mode.el (java-ts-mode--indent-rules): New
indent rules.
(java-ts-mode): Use new setup function.
* lisp/progmodes/js.el (js--treesit-indent-rules): New indent rules.
(js-ts-mode): Use new setup function.
* lisp/progmodes/rust-ts-mode.el (rust-ts-mode--indent-rules): New
indent rules.
(rust-ts-mode): Use new setup function.
* lisp/progmodes/typescript-ts-mode.el:
(typescript-ts-mode--indent-rules): New indent rules.
(typescript-ts-base-mode): Use new setup function.
2022-12-26 01:47:55 -08:00
Yuan Fu
c6b0282645
; Remove unused function in c-ts-mode
* lisp/progmodes/c-ts-mode.el (c-ts-mode--end-of-defun): Remove.
(c-ts-mode)
(c++-ts-mode): Remove setup.
2022-12-26 01:47:55 -08:00
Yuan Fu
6e52a9fcad
; * doc/lispref/modes.texi (Parser-based Font Lock): Minor fixes. 2022-12-26 01:47:55 -08:00
Yuan Fu
2bcd1e9a99
; * doc/lispref/parsing.texi (Retrieving Nodes): Add notice. 2022-12-26 01:47:55 -08:00
Yuan Fu
7c7950fe00
Add maintainer stub for tree-sitter files
* lisp/treesit.el:
* src/treesit.c: Add maintainer.
2022-12-26 01:47:55 -08:00
Yuan Fu
cf32776622
; * doc/lispref/parsing.texi (Using Parser): Remove deleted function. 2022-12-26 01:47:54 -08:00
Stefan Kangas
2608e5edcc ; Fix typos
(cherry picked from commit a5d39e1144)
2022-12-26 10:42:02 +01:00
Gregory Heytings
6c00d126e7 Remove remaining mentions of 'eval-current-buffer'
* lisp/emacs-lisp/edebug.el (edebug-all-defs):
* doc/lispref/eval.texi (Eval):
* doc/lispref/edebug.texi (Instrumenting, Edebug Options):
Remove remaining mentions of 'eval-current-buffer', obsoleted in
Emacs 22 and removed in Emacs 26.
2022-12-26 02:26:47 +01:00
Eli Zaretskii
1073e96170 ; * doc/lispref/text.texi (Database): Fix a typo. (Bug#60317) 2022-12-25 19:43:49 +02:00
Kyle Meyer
b1e68a33d8 Update to Org 9.6-61-g63e073f 2022-12-25 11:36:36 -05:00
Eli Zaretskii
dad73e4de1 ; Review and fix NEWS and related documentation
* etc/NEWS: Fix wording, punctuation, and markup.

* lisp/emacs-lisp/subr-x.el (string-glyph-split): Doc fix.

* doc/lispref/display.texi (Displaying Messages): Document
'set-message-functions'.
2022-12-25 14:54:33 +02:00
Juanma Barranquero
72786ae237 ; Restore ARGS argument in c-ts-mode--fontify-declarator
* lisp/progmodes/c-ts-mode.el (c-ts-mode--fontify-declarator):
Restore argument name referenced in the docstring.
2022-12-25 12:59:06 +01:00
Philip Kaludercic
940ab2423c ; Always consider :lisp-dir when locating main file of VC packages
* lisp/emacs-lisp/package-vc.el (package-vc--main-file): Check the
:lisp-dir entry in the "extras" of a package description to find the
directory with a main file.
2022-12-25 11:21:01 +01:00
Philip Kaludercic
9ab98cd42a Add heuristic to locate lisp code in source packages
* lisp/emacs-lisp/package-vc.el (package-vc--unpack): Check if a
"lisp" directory exists and use that instead of PKG-DIR.

(Bug#60155)
2022-12-25 11:21:01 +01:00
Eli Zaretskii
dda011c78d ; * doc/lispref/parsing.texi (Tree-sitter major modes): Fix @cindex. 2022-12-25 11:34:12 +02:00
Eli Zaretskii
d62b634d8f ; * src/process.c (Fprocess_running_child_p): Doc fix. 2022-12-25 11:23:07 +02:00
Yuan Fu
f6c5b3d635
; * doc/lispref/parsing.texi: Add a reminder. 2022-12-25 01:11:47 -08:00