]> git.eshelyaron.com Git - emacs.git/log
emacs.git
2 years agoDon't trigger ASan use-after-poison while checking for live pointers
Vibhav Pant [Sat, 3 Dec 2022 10:10:50 +0000 (15:40 +0530)]
Don't trigger ASan use-after-poison while checking for live pointers

* src/alloc.c (live_string_holding, live_cons_holding)
(live_symbol_holding, live_float_holding) [GC_ASAN_POISON_OBJECTS]:
When compiling with address sanitization and GC poisoning support,
return NULL if the passed address is poisoned, or if the Lisp object
it resides in is poisoned. This fixes a rare use-after-poison abort
when these functions are called on a pointer that might be referring
to a now dead/sweep object.

2 years ago; src/alloc.c: Fix styling issues.
Vibhav Pant [Wed, 30 Nov 2022 17:29:52 +0000 (22:59 +0530)]
; src/alloc.c: Fix styling issues.

2 years agoetc/DEBUG: Add more information about ASan memory poisoning.
Vibhav Pant [Wed, 30 Nov 2022 17:28:09 +0000 (22:58 +0530)]
etc/DEBUG: Add more information about ASan memory poisoning.

2 years agoAdd support for additional memory checks using AddressSanitizer.
Vibhav Pant [Tue, 29 Nov 2022 20:30:09 +0000 (02:00 +0530)]
Add support for additional memory checks using AddressSanitizer.

When Emacs is compiled with AddressSanitizer support, enable
poisoning/unpoisoning freed/unused Lisp objects and other internal
memory management structures. If enabled, this will mark freed bytes
that have been put on free lists for future use, and initially
allocated memory blocks/chunks as "poisoned", triggering an ASan error
if they are accessed improperly. Structures are unpoisoned when they
have been taken off their respective free lists.

* configure.ac: Check for the existence of the ASan API header.

* src/alloc.c (ASAN_POISON_ABLOCK, ASAN_UNPOISON_ABLOCK)
(ASAN_POISON_INTERVAL_BLOCK, ASAN_UNPOISON_INTERVAL_BLOCK)
(ASAN_POISON_INTERVAL, ASAN_UNPOISON_INTERVAL)
(ASAN_PREPARE_DEAD_SDATA, ASAN_PREPARE_LIVE_SDATA)
(ASAN_POISON_SBLOCK_DATA, ASAN_POISON_STRING_BLOCK)
(ASAN_UNPOISON_STRING_BLOCK, ASAN_POISON_STRING)
(ASAN_UNPOISON_STRING, ASAN_POISON_FLOAT_BLOCK)
(ASAN_UNPOISON_FLOAT_BLOCK, ASAN_POISON_FLOAT)
(ASAN_UNPOISON_FLOAT, ASAN_POISON_CONS_BLOCK)
(ASAN_POISON_CONS, ASAN_UNPOISON_CONS)
(ASAN_POISON_VECTOR_CONTENTS, ASAN_UNPOISON_VECTOR_CONTENTS)
(ASAN_UNPOISON_VECTOR_BLOCK, ASAN_POISON_SYMBOL_BLOCK)
(ASAN_UNPOISON_SYMBOL_BLOCK, ASAN_POISON_SYMBOL)
(ASAN_UNPOISON_SYMBOL) [ADDRESS_SANITIZER]: New functions. When
address sanitization is enabled, define them to poison/unpoison
objects.

(lisp_align_malloc): Poison newly allocated blocks on `free_ablock',
unpoison ablocks taken from it respectively.
(lisp_align_free): Poison individual ablocks when they are put on the
free list, unpoison them when an entire `ablocks' chunk is being
freed.

(make_interval): Poison interval blocks on initial allocation,
unpoison individual intervals on allocation and removal from
`interval_free_list'.
(sweep_intervals): Unpoison interval blocks before sweeping, poison
dead/unmarked intervals.

(allocate_string): Poison string blocks on initial allocation,
unpoison Lisp_Strings on removal from the free list.
(allocate_string_data): Poison `sblock' data on initial allocation,
unpoison individual `sdata' contents on allocation or removal from the
free list. Call `ASAN_PREPARE_LIVE_SDATA' on the new `sdata' struct.
(sweep_strings): Unpoison string blocks before sweeping them,
poisoning dead strings and their sdata afterwards.
(compact_small_strings): Call `ASAN_PREPARE_LIVE_DATA' on the `sdata'
to where compacted strings to moved to.
(pin_string): Call `ASAN_PREPARE_DEAD_SDATA' on `old_sdata'.

(make_float): Poison float blocks on allocation, unpoisoning
individual Lisp_Floats on allocation or removal from
`float_free_list'.
(sweep_floats): Unpoison float blocks before sweeping, poison
dead/unmarked floats.

(free_cons): Poison `ptr'.
(Fcons): Poison cons blocks on allocation, unpoisoning individual
Lisp_Cons on allocation or removal from `cons_free_list'.
(sweep_conses): Poison dead/unmarked conses.

(setup_free_list): Poison vectors put on `vector_free_lists'.
(allocate_vector_from_block): Unpoison vectors taken from the free
list, poison excess vector bytes when vectors allocated from the free
list are larger than requested.
(sweep_vectors): Unpoison vector blocks before sweeping them.

(Fmake_symbol): Poison symbol blocks on initial allocation,
unpoisoning individual Lisp_Symbols on allocation or removal from
`symbol_free_list'.
(sweep_symbols): Unpoison symbol blocks before sweeping, poisoning
dead/unmarked symbols.

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)

2 years agoActivate direct asynchronous processes for Tramp container methods
Michael Albinus [Mon, 21 Nov 2022 13:49:54 +0000 (14:49 +0100)]
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'.

2 years agoMake sed invocation in Makefile POSIX-compliant
Gregory Heytings [Mon, 21 Nov 2022 12:44:13 +0000 (12:44 +0000)]
Make sed invocation in Makefile POSIX-compliant

* Makefile.in: Add a semicolon before the closing brace, which is
required by POSIX.  Fixes bug#59444.

2 years ago* lisp/forms.el (forms-mode): Prefer setq-local.
Stefan Kangas [Mon, 21 Nov 2022 10:30:58 +0000 (11:30 +0100)]
* lisp/forms.el (forms-mode): Prefer setq-local.

2 years agoMake instructions for updating ancient filesets obsolete
Stefan Kangas [Mon, 21 Nov 2022 10:20:01 +0000 (11:20 +0100)]
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.

2 years agoUse constant face for labels in c-ts-mode
Yuan Fu [Mon, 21 Nov 2022 09:27:55 +0000 (01:27 -0800)]
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.

2 years ago; * lisp/textmodes/css-mode.el (css-ts-mode): Fix typo.
Yuan Fu [Mon, 21 Nov 2022 04:52:16 +0000 (20:52 -0800)]
; * lisp/textmodes/css-mode.el (css-ts-mode): Fix typo.

2 years agoAdd separate keymaps for js/python/css-ts-mode
Yuan Fu [Mon, 21 Nov 2022 04:43:15 +0000 (20:43 -0800)]
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.

2 years agoTweak python-ts-mode fontification
Yuan Fu [Mon, 21 Nov 2022 04:31:42 +0000 (20:31 -0800)]
Tweak python-ts-mode fontification

* lisp/progmodes/python.el (python--treesit-fontify-string): Make the
matching condition for docstrings more specific.

2 years agoFix tree-sitter fontification heuristic
Yuan Fu [Mon, 21 Nov 2022 04:29:53 +0000 (20:29 -0800)]
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.

2 years ago* lisp/woman.el (woman-mode-map): Prefer defvar-keymap.
Stefan Kangas [Mon, 21 Nov 2022 08:28:05 +0000 (09:28 +0100)]
* lisp/woman.el (woman-mode-map): Prefer defvar-keymap.

2 years ago* lisp/outline.el (outline-search-function): New variable (bug#53981).
Juri Linkov [Mon, 21 Nov 2022 07:56:06 +0000 (09:56 +0200)]
* 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.

2 years ago* src/treesit.c (treesit_load_language): Fix uninitialized uses.
Po Lu [Mon, 21 Nov 2022 05:24:15 +0000 (13:24 +0800)]
* src/treesit.c (treesit_load_language): Fix uninitialized uses.

2 years agoAvoid usage of intern_c_string in treesit.c
Po Lu [Mon, 21 Nov 2022 05:17:48 +0000 (13:17 +0800)]
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.

2 years agoStylistic fixes to treesit.c
Po Lu [Mon, 21 Nov 2022 05:14:43 +0000 (13:14 +0800)]
Stylistic fixes to treesit.c

* src/treesit.c (treesit_make_ranges):
(Ftreesit_parser_set_included_ranges): Fix coding style.

2 years agoFix MS-DOS build
Po Lu [Mon, 21 Nov 2022 05:12:16 +0000 (13:12 +0800)]
Fix MS-DOS build

* msdos/sed1v2.inp: Edit out tree-sitter stuff.

2 years agoAdd another heuristic to speed up tree-sitter fontification
Yuan Fu [Mon, 21 Nov 2022 01:15:42 +0000 (17:15 -0800)]
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.

2 years agoLimit recursion level for tree-sitter imenu functions
Yuan Fu [Mon, 21 Nov 2022 00:56:33 +0000 (16:56 -0800)]
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.

2 years agoImprove tree-sitter fontification on large buffers
Yuan Fu [Mon, 21 Nov 2022 00:37:19 +0000 (16:37 -0800)]
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.

2 years agoDelete eglot spinner; not useful
Stephen Leake [Sun, 20 Nov 2022 21:45:13 +0000 (13:45 -0800)]
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.

2 years agoAvoid native compiler setting user-init-file to warnings.el (bug#59358)
Juanma Barranquero [Sun, 20 Nov 2022 20:40:08 +0000 (21:40 +0100)]
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.

2 years agoRename 'elisp-eval-buffer' to 'elisp-eval-region-or-buffer' (bug#59350)
Juri Linkov [Sun, 20 Nov 2022 18:10:45 +0000 (20:10 +0200)]
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.

2 years agoDisable display-line-numbers-mode in string-pixel-width (bug#59311)
Juri Linkov [Sun, 20 Nov 2022 18:02:20 +0000 (20:02 +0200)]
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.

2 years ago* doc/misc/Makefile.in (INFO_COMMON): Sort alphabetically.
Michael Albinus [Sun, 20 Nov 2022 16:58:49 +0000 (17:58 +0100)]
* doc/misc/Makefile.in (INFO_COMMON): Sort alphabetically.

2 years agoRework tramp-archive autoloads
Michael Albinus [Sun, 20 Nov 2022 16:58:34 +0000 (17:58 +0100)]
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.

2 years agoCoalesce duplicate scroll valuator handling code
Po Lu [Sun, 20 Nov 2022 13:01:10 +0000 (21:01 +0800)]
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.

2 years ago; Fix typos
Stefan Kangas [Sun, 20 Nov 2022 11:59:39 +0000 (12:59 +0100)]
; Fix typos

2 years ago; Add .no-advice-on-failure to .gitignore
Stefan Kangas [Sun, 20 Nov 2022 11:25:54 +0000 (12:25 +0100)]
; 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.

2 years ago; * lisp/proced.el (proced-auto-update-timer): Fix last change.
Eli Zaretskii [Sun, 20 Nov 2022 11:51:22 +0000 (13:51 +0200)]
; * lisp/proced.el (proced-auto-update-timer): Fix last change.

2 years agoCancel proced auto update timer if no proced buffers are open
Laurence Warne [Tue, 15 Nov 2022 18:48:40 +0000 (18:48 +0000)]
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.

2 years agoAdvise against using too-high GC thresholds
Eli Zaretskii [Sun, 20 Nov 2022 11:10:08 +0000 (13:10 +0200)]
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.

2 years agoHandle error in bookmark-relocate when filename is nil
Gabriel do Nascimento Ribeiro [Thu, 17 Nov 2022 00:59:17 +0000 (21:59 -0300)]
Handle error in bookmark-relocate when filename is nil

* lisp/bookmark.el (bookmark-relocate): Handle error when
filename is nil.  (Bug#59326)

2 years ago; Avoid "Local Variables" popups in Emacs tree
Eli Zaretskii [Sun, 20 Nov 2022 10:10:38 +0000 (12:10 +0200)]
; 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)

2 years ago; Fix typos
Juanma Barranquero [Sun, 20 Nov 2022 09:25:59 +0000 (10:25 +0100)]
; Fix typos

* doc/lispref/display.texi (Size of Displayed Text):
* lisp/net/trampver.el (tramp-inside-emacs): Fix typos in docstrings.

2 years ago; Improve recently-modified documentation
Eli Zaretskii [Sun, 20 Nov 2022 08:30:38 +0000 (10:30 +0200)]
; 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.

2 years agoFix uses of treesit-ready-p
Yuan Fu [Sun, 20 Nov 2022 02:58:12 +0000 (18:58 -0800)]
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.

2 years agoRemove treesit-settings
Yuan Fu [Sun, 20 Nov 2022 02:53:53 +0000 (18:53 -0800)]
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.

2 years agoRemove tree-sitter setup from js-json-mode
Yuan Fu [Sun, 20 Nov 2022 02:45:45 +0000 (18:45 -0800)]
Remove tree-sitter setup from js-json-mode

* lisp/progmodes/js.el (js-json--treesit-font-lock-settings)
(js--json-treesit-indent-rules): Remove variables.
(js-json-mode): Remove tree-sitter setup.

2 years agoFix tree-sitter comment indentation for C-like languages
Yuan Fu [Sun, 20 Nov 2022 01:59:14 +0000 (17:59 -0800)]
Fix tree-sitter comment indentation for C-like languages

The goal is to indent like this:

/* comment
   comment  --> This line aligns with the beginning of the first line
 */         --> This line aligns with the opening comment token

* lisp/treesit.el (treesit-comment-start)
(treesit-comment-end): New variables.
(treesit-simple-indent-presets): New preset comment-end,
comment-start, comment-start-skip

* lisp/progmodes/c-ts-mode.el (c-ts-mode--indent-styles)
(c-ts-mode)
* lisp/progmodes/java-ts-mode.el (java-ts-mode--indent-rules)
(java-ts-mode)
* lisp/progmodes/js.el (js--treesit-indent-rules)
(js-ts-mode)
* lisp/progmodes/ts-mode.el (ts-mode--indent-rules)
(ts-mode): Add identical indent rules to each mode, and set identical
treesit-comment-start/end's.

* doc/lispref/modes.texi (Parser-based Indentation)
* doc/lispref/parsing.texi (Tree-sitter major modes): Update manual.

2 years agoSeparate native and tree-sitter variant of js-mode
Yuan Fu [Sun, 20 Nov 2022 00:56:42 +0000 (16:56 -0800)]
Separate native and tree-sitter variant of js-mode

* lisp/progmodes/js.el (js-base-mode): New mode.
(js-mode): Return to before tree-sitter setup is added, change to
inherit from js-base-mode.
(js-ts-mode): New mode.  Now it doesn't use any cc-mode feature,
meaning it looses comment filling.