1
0
mirror of https://git.savannah.gnu.org/git/emacs.git synced 2024-12-01 08:17:38 +00:00
Commit Graph

162564 Commits

Author SHA1 Message Date
Yuan Fu
3f37f6b435
; * 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.
2022-11-21 13:34:38 -08:00
Yuan Fu
eb1a35adc1
; 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.
2022-11-21 13:33:03 -08:00
Yuan Fu
abf40a41aa
; Fix typo in c-ts-mode--font-lock-settings
* lisp/progmodes/c-ts-mode.el (c-ts-mode--font-lock-settings): Fix
typo.
2022-11-21 13:17:16 -08:00
Yuan Fu
aaeaa310f0
Merge remote-tracking branch 'savannah/master' into feature/tree-sitter 2022-11-21 12:54:35 -08:00
Yuan Fu
b2ea38ab03
; 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.
2022-11-21 12:50:40 -08:00
Yuan Fu
6cf8bf5042
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.
2022-11-21 11:26:46 -08:00
Yuan Fu
0cbb7d3bd0
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.
2022-11-21 10:52:55 -08:00
Yuan Fu
aa6958c04e
; * 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.
2022-11-21 09:31:14 -08:00
Eli Zaretskii
9f7ae2be60 ; 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.
2022-11-21 19:08:25 +02:00
Mattias Engdegård
2450973165 ; * test/src/treesit-tests.el (treesit-misc): Don't fail without ts 2022-11-21 16:53:15 +01:00
Eli Zaretskii
27e89ff116 ; * lisp/treesit.el (treesit-parser-add-notifier): Add declaration. 2022-11-21 17:24:42 +02:00
Mattias Engdegård
87c696b7a8 ; Repair build without tree-sitter 2022-11-21 15:41:28 +01:00
Stefan Kangas
f176a36f46 ; 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'.
2022-11-21 15:20:11 +01:00
Stefan Kangas
beaa2e4953 ; Fix typos (misspelled symbols) 2022-11-21 15:20:11 +01:00
Michael Albinus
61e96789dd Activate direct asynchronous processes for Tramp container methods
* doc/misc/tramp.texi (Remote processes): Mention also
tramp-container.el.

* lisp/emacs-lisp/ert-x.el (ert-remote-temporary-file-directory):
Add `tramp-direct-async' to "mock" method.

* lisp/net/tramp-container.el
(tramp-methods) <docker, podman, kubernetes>: Add `tramp-direct-async'.

* lisp/net/tramp.el (tramp-methods): Adapt docstring.
(tramp-handle-make-process): Handle `tramp-direct-async'.

* test/lisp/net/tramp-tests.el (tramp-methods) <mock>:
Add `tramp-direct-async'.
2022-11-21 14:49:54 +01:00
Gregory Heytings
a3b654e069 Make sed invocation in Makefile POSIX-compliant
* Makefile.in: Add a semicolon before the closing brace, which is
required by POSIX.  Fixes bug#59444.
2022-11-21 13:47:06 +01:00
Stefan Kangas
0fa916c7dd * lisp/forms.el (forms-mode): Prefer setq-local. 2022-11-21 12:11:50 +01:00
Stefan Kangas
f7ba92287d Make instructions for updating ancient filesets obsolete
* lisp/filesets.el (filesets-update-pre010505): Make update
information for filesets older than 2001 obsolete.  Note that this
dates back to before filesets.el was even added to Emacs.
2022-11-21 12:11:50 +01:00
Yuan Fu
c96157c8f8
Use constant face for labels in c-ts-mode
* lisp/progmodes/c-ts-mode.el (c-ts-mode--font-lock-settings): Use
constant face for labels.
2022-11-21 01:41:19 -08:00
Yuan Fu
a7ed5071b7
; * lisp/textmodes/css-mode.el (css-ts-mode): Fix typo. 2022-11-21 01:29:32 -08:00
Yuan Fu
1e62445200
Add separate keymaps for js/python/css-ts-mode
* lisp/progmodes/js.el (js-ts-mode-map)
* lisp/progmodes/python.el (python-ts-mode-map)
* lisp/textmodes/css-mode.el (css-ts-mode-map): New keymap.
2022-11-21 01:29:32 -08:00
Yuan Fu
3f25b22cad
Tweak python-ts-mode fontification
* lisp/progmodes/python.el (python--treesit-fontify-string): Make the
matching condition for docstrings more specific.
2022-11-21 01:29:31 -08:00
Yuan Fu
938e68bb28
Fix tree-sitter fontification heuristic
Previously applied heuristic 2 sometimes invalidates heuristic 1, add
a guard so it doesn't.

The new function is just for clearity of the code and has nothing to
do with the change itself.

* lisp/treesit.el (treesit--node-length): New function
(treesit-font-lock-fontify-region): Use the new function.  Only do
heuristic 2 when the node is large.
2022-11-21 01:29:31 -08:00
Stefan Kangas
4536ce86d0 * lisp/woman.el (woman-mode-map): Prefer defvar-keymap. 2022-11-21 09:28:32 +01:00
Juri Linkov
d9d8a2eba9 * lisp/outline.el (outline-search-function): New variable (bug#53981).
(outline-font-lock-keywords, outline-font-lock-face)
(outline-minor-mode-highlight-buffer, outline-next-preface)
(outline-next-heading, outline-previous-heading)
(outline-back-to-heading, outline-on-heading-p, outline-demote)
(outline-map-region, outline-next-visible-heading)
(outline-hide-sublevels, outline-up-heading): Use outline-search-function
when it's non-nil as an alternative to searching outline-regexp.
(outline-search-level, outline-search-text-property): New functions.

* lisp/apropos.el (apropos-mode): Set outline-search-function
instead of unreliable outline-regexp.
(apropos-print): Add text property outline-level.

* lisp/emacs-lisp/shortdoc.el (shortdoc-display-group):
Add text property outline-level on text separate from final newlines.
(shortdoc-display-group): Add a narrow newline to not show
text properties of the final line when the outline is hidden.
(shortdoc--display-function): Add text property outline-level.
(shortdoc-mode): Set buffer-local outline-search-function and outline-level.
2022-11-21 09:56:06 +02:00
Po Lu
3069849bd4 * src/treesit.c (treesit_load_language): Fix uninitialized uses. 2022-11-21 14:10:21 +08:00
Po Lu
d452539966 Avoid usage of intern_c_string in treesit.c
* src/treesit.c (Ftreesit_pattern_expand): Use DEFSYM'd symbols
when the naming makes sense.
(syms_of_treesit): Add new defsyms QCanchor, QCequal, QCmatch.
2022-11-21 14:10:21 +08:00
Po Lu
43f25120c9 Stylistic fixes to treesit.c
* src/treesit.c (treesit_make_ranges):
(Ftreesit_parser_set_included_ranges): Fix coding style.
2022-11-21 14:10:21 +08:00
Po Lu
9d266f2a6c Fix MS-DOS build
* msdos/sed1v2.inp: Edit out tree-sitter stuff.
2022-11-21 14:10:21 +08:00
Yuan Fu
76eb88df02
Add another heuristic to speed up tree-sitter fontification
* lisp/treesit.el (treesit-font-lock-fontify-region): Use
treesit--children-covering-range to reduce the node size.
2022-11-20 17:15:42 -08:00
Yuan Fu
32870d2f20
Limit recursion level for tree-sitter imenu functions
Generating imenu index doesn't require going down to the bottom of the
tree (defun's are usually top-level).  Add limit so we don't go too
far down on very large buffers.

* lisp/progmodes/c-ts-mode.el (c-ts-mode--imenu)
* lisp/progmodes/java-ts-mode.el (java-ts-mode--imenu)
* lisp/progmodes/js.el (js--treesit-imenu)
* lisp/progmodes/json-ts-mode.el (json-ts-mode--imenu)
* lisp/progmodes/python.el (python-imenu-treesit-create-index)
* lisp/textmodes/css-mode.el (css--treesit-imenu): Add limit to
treesit-induce-sparse-tree.
2022-11-20 17:04:58 -08:00
Yuan Fu
625ea08652
Improve tree-sitter fontification on large buffers
* lisp/treesit.el (treesit--children-covering-range)
(treesit--children-covering-range-recurse): New functions.  They are
not currently used but could be useful in the future, so I left them
in place.
(treesit-font-lock-fontify-region):
* lisp/treesit.el (treesit-font-lock-fontify-region): Use the result
of treesit-node-on instead of the root node.
2022-11-20 17:04:58 -08:00
Stephen Leake
6b0179f790 Delete eglot spinner; not useful
* lisp/progmodes/eglot.el (eglot-lsp-server): Delete slot spinner.
(eglot--mode-line-format): Don't include spinner in mode-line.
(eglot--signal-textDocument/didChange): Don't set spinner.
2022-11-20 13:45:13 -08:00
Juanma Barranquero
8ec8decd9f Avoid native compiler setting user-init-file to warnings.el (bug#59358)
* src/lread.c (maybe_swap_for_eln): Use a delayed warning
instead of `display-warning' to avoid a recursive call to
Fload while loading the init file that sets `user-init-file'
to a bogus value.
2022-11-20 21:40:08 +01:00
Juri Linkov
4bc9fe33af Rename 'elisp-eval-buffer' to 'elisp-eval-region-or-buffer' (bug#59350)
* lisp/progmodes/elisp-mode.el (elisp-eval-region-or-buffer):
Rename recently added command 'elisp-eval-buffer' to support active region.
(emacs-lisp-mode-map, lisp-interaction-mode-map): Rebind 'C-c C-e'
from elisp-eval-buffer to elisp-eval-region-or-buffer.
2022-11-20 20:10:45 +02:00
Juri Linkov
5c709bd605 Disable display-line-numbers-mode in string-pixel-width (bug#59311)
* lisp/emacs-lisp/subr-x.el (string-pixel-width):
Turn off display-line-numbers-mode when it's enabled.
2022-11-20 20:02:20 +02:00
Michael Albinus
79eca4652b * doc/misc/Makefile.in (INFO_COMMON): Sort alphabetically. 2022-11-20 17:58:49 +01:00
Michael Albinus
7ad6104a17 Rework tramp-archive autoloads
* lisp/net/tramp-archive.el (tramp-archive-autoload-file-name-regexp):
Use `tramp-compat-rx'.  Protect `tramp-archive-suffixes' and
`tramp-archive-compression-suffixes'.
(tramp-archive-file-name-handler): Don't autoload.
(tramp-register-archive-autoload-file-name-handler): Rename from
`tramp-register-archive-file-name-handler'.  Adapt callees.
2022-11-20 17:58:34 +01:00
Po Lu
8874cd908c Coalesce duplicate scroll valuator handling code
Also, write more commentary.

* src/xterm.c (xi_populate_scroll_valuator): New function.
Describe the meaning of each field in xi_scroll_valuator_t.
(xi_populate_device_from_info, xi_handle_new_classes): Factor
out duplicate code to that function.
2022-11-20 21:03:18 +08:00
Stefan Kangas
16318bfb51 ; Fix typos 2022-11-20 12:59:39 +01:00
Stefan Kangas
6082ab9697 ; Add .no-advice-on-failure to .gitignore
This is for the new "disable advice on failure" feature added by
Gregory Heytings <gregory@heytings.org>.
* .gitignore: Add .no-advice-on-failure.
2022-11-20 12:59:34 +01:00
Eli Zaretskii
50e6bc72c2 ; * lisp/proced.el (proced-auto-update-timer): Fix last change. 2022-11-20 13:51:22 +02:00
Laurence Warne
07705f5ddc Cancel proced auto update timer if no proced buffers are open
* lisp/proced.el (proced-auto-update-timer): Cancel timer if no proced
buffers are open.
2022-11-20 13:44:10 +02:00
Eli Zaretskii
7b09ed28ba Advise against using too-high GC thresholds
* doc/lispref/internals.texi (Garbage Collection):
* src/alloc.c (syms_of_alloc) <gc-cons-threshold>
<gc-cons-percentage>: Advise against enlarging the GC thresholds
more than needed and for prolonged periods of time.
2022-11-20 13:10:08 +02:00
Gabriel do Nascimento Ribeiro
fbad9c05ea Handle error in bookmark-relocate when filename is nil
* lisp/bookmark.el (bookmark-relocate): Handle error when
filename is nil.  (Bug#59326)
2022-11-20 12:14:51 +02:00
Eli Zaretskii
d46d67bef1 ; Avoid "Local Variables" popups in Emacs tree
* lisp/vc/vc.el (vc-prepare-patches-separately): Add an autoloaded
form for the 'safe-local-variable' property.  (Bug#59384)
2022-11-20 12:10:38 +02:00
Juanma Barranquero
0fcf8dca6a ; Fix typos
* doc/lispref/display.texi (Size of Displayed Text):
* lisp/net/trampver.el (tramp-inside-emacs): Fix typos in docstrings.
2022-11-20 10:25:59 +01:00
Eli Zaretskii
657947dc7c ; Improve recently-modified documentation
* lisp/progmodes/python.el (python-base-mode)
(python--treesit-fontify-string):
* lisp/textmodes/css-mode.el (css-base-mode):
* lisp/treesit.el (treesit-ready-p, treesit-comment-end)
(treesit-simple-indent-presets): Fix typos and wording in doc strings.

* doc/lispref/parsing.texi (Tree-sitter major modes):
* doc/lispref/modes.texi (Parser-based Indentation): Fix wording
and add cross-references.
2022-11-20 10:30:38 +02:00
Yuan Fu
4fa13b2d83
Fix uses of treesit-ready-p
* lisp/progmodes/c-ts-mode.el (c-ts-mode)
(c++-ts-mode)
* lisp/progmodes/java-ts-mode.el (java-ts-mode)
* lisp/progmodes/js.el (js-ts-mode)
* lisp/progmodes/json-ts-mode.el (json-ts-mode)
* lisp/progmodes/python.el (python-ts-mode)
* lisp/progmodes/sh-script.el (sh-mode)
* lisp/progmodes/ts-mode.el (ts-mode): Remove the MODE argument.
2022-11-19 18:58:12 -08:00
Yuan Fu
f17ca55a0a
Remove treesit-settings
Remove it since we are using separate major modes for tree-sitter and
native variant now.

* doc/lispref/parsing.texi (Tree-sitter major modes): Update manual.
* lisp/treesit.el (treesit-settings): Remove option.
(treesit--setting-for-mode): Remove function.
(treesit-ready-p): Don't check for user preference in treesit-settings.
2022-11-19 18:54:39 -08:00