1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2025-12-07 06:50:23 -08:00
Commit graph

4372 commits

Author SHA1 Message Date
Roi Martin
b208b08371 Fix bug in semantic linefeed filling
Fix bug in semantic linefeed filling related to wide characters and
`sentence-end-without-space'.
* lisp/textmodes/fill.el (fill-region-as-paragraph-semlf): Fix the
calculation of the maximum column.  Do not depend on where
`fill-region-as-paragraph-default' leaves point after being called.
(Bug#79575)
2025-11-30 11:41:49 +02:00
Yuan Fu
2c19f6087e
Remove the cached values in tree-sitter modes (bug#79363)
The cached values are not needed anymore since Emacs now caches
the compiled queries.

* lisp/progmodes/cmake-ts-mode.el:
(cmake-ts-mode--indent-rules-cached): Remove.
(cmake-ts-mode--indent-rules): Return values directly.
(cmake-ts-mode--font-lock-settings-cached): Remove.
(cmake-ts-mode--font-lock-settings): Return values directly.
* lisp/progmodes/php-ts-mode.el:
(php-ts-mode--font-lock-settings-cached): Remove.
(php-ts-mode--font-lock-settings): Return values directly.
(php-ts-mode--custom-html-font-lock-settings-cached): Remove.
(php-ts-mode--custom-html-font-lock-settings): Return values directly.
* lisp/textmodes/mhtml-ts-mode.el:
(mhtml-ts-mode--treesit-font-lock-settings-cached): Remove.
(mhtml-ts-mode--treesit-font-lock-settings): Return values directly.
(mhtml-ts-mode--treesit-indent-rules-cached): Remove.
(mhtml-ts-mode--treesit-indent-rules): Return values directly.
* lisp/progmodes/cmake-ts-mode.el:
(cmake-ts-mode--indent-rules-cached): Remove
(cmake-ts-mode--indent-rules): Return values directly.
(cmake-ts-mode--font-lock-settings-cached): Remove.
(cmake-ts-mode--font-lock-settings): Return values directly.
* lisp/progmodes/csharp-mode.el:
(csharp-ts-mode--font-lock-settings-cached): Remove.
(csharp-ts-mode--font-lock-settings): Return values directly.
2025-11-28 00:12:28 -08:00
Reuben Thomas
e1f851e840 Fix ispell’s handling of comment-end when adding local words
* lisp/textmodes/ispell.el (ispell-add-per-file-word-list): Deal
with `comment-end' in a way that works for comments that don’t
nest.

We proceed as follows: when `comment-end' is non-empty, we only
ever insert one start and one end comment, the first time we add
a local word.  This works with both C-style (which don’t nest)
and Rust-style comments (which do).

If we’re using line comments (i.e. comments that only have a
`comment-start'), then continue to insert one on each line.

* test/lisp/textmodes/ispell-tests/ispell-tests.el
(ispell/ispell-add-per-file-word-list/nxml): Adjust test.

Bug#79871
2025-11-22 13:15:45 +02:00
Juri Linkov
9709cb8d16 Improve hideshow support for heex-ts-mode and yaml-ts-mode
* lisp/progmodes/heex-ts-mode.el (heex-ts--thing-settings): Add 'defun' thing.
(heex-ts-mode): Use it in 'hs-treesit-things'.

* lisp/textmodes/yaml-ts-mode.el (yaml-ts-mode): Set 'hs-treesit-things'
and 'hs-adjust-block-end-function'.
2025-11-10 21:46:29 +02:00
Elías Gabriel Pérez
ef2584585b hideshow: Rework previous changes
* lisp/progmodes/hideshow.el: Set default values of buffer-local variables.
(hs-inside-comment-p): Restore.
(hs--set-variable): Rename from 'hs--get-mode-value'.
(hs-grok-mode-type): Rework.
* lisp/nxml/nxml-mode.el:
* lisp/progmodes/f90.el:
* lisp/progmodes/fortran.el:
* lisp/progmodes/icon.el:
* lisp/progmodes/lua-mode.el:
* lisp/progmodes/python.el:
* lisp/progmodes/verilog-mode.el:
* lisp/progmodes/vhdl-mode.el:
* lisp/textmodes/mhtml-mode.el:
* lisp/textmodes/sgml-mode.el:
* lisp/treesit.el (treesit-major-mode-setup): Rename
'hs-forward-sexp-func' to 'hs-forward-sexp-function',
'hs-adjust-block-beginning' to 'hs-adjust-block-beginning-function',
'hs-find-block-beginning-func' to 'hs-find-block-beginning-function',
'hs-find-next-block-func' to 'hs-find-next-block-function',
'hs-looking-at-block-start-p-func' to 'hs-looking-at-block-start-predicate',
'hs-inside-comment-p-func' to 'hs-inside-comment-predicate'.
2025-11-08 20:04:30 +02:00
Elías Gabriel Pérez
cc589d7003 hideshow: Rework previous changes
* doc/emacs/programs.texi (Hideshow):
* etc/NEWS: Fix doc.
* lisp/progmodes/hideshow.el: Update Commentary Header.
(hs-modes-alist): Remove.
(hs--get-mode-value, hs-grok-mode-type): Rework.
* lisp/treesit.el (treesit-major-mode-setup):
* lisp/emacs-lisp/lisp-mode.el:
* lisp/nxml/nxml-mode.el:
* lisp/progmodes/cc-mode.el:
* lisp/progmodes/f90.el:
* lisp/progmodes/fortran.el:
* lisp/progmodes/hideshow.el:
* lisp/progmodes/icon.el:
* lisp/progmodes/js.el:
* lisp/progmodes/lua-mode.el:
* lisp/progmodes/python.el:
* lisp/progmodes/verilog-mode.el:
* lisp/progmodes/vhdl-mode.el:
* lisp/textmodes/bibtex.el:
* lisp/textmodes/mhtml-mode.el:
* lisp/textmodes/sgml-mode.el:
* lisp/treesit.el: Fix and rework previous changes.
2025-11-06 09:41:12 +02:00
Elías Gabriel Pérez
959345f602 hideshow: Rewrite 'hs-special-modes-alist'
Rewrite the format in 'hs-special-modes-alist' to make easier to
exclude some values, add support for settings inheritance
according to current major mode and parents, and support string
hiding for lisp modes.

Bug#79671

* lisp/progmodes/hideshow.el (hs-modes-alist): New variable.
(hs-special-modes-alist): Mark as obsolete.
(hs-forward-sexp-func, hs-adjust-block-beginning)
(hs-find-block-beginning-func, hs-find-next-block-func)
(hs-looking-at-block-start-p-func): Set default values to nil.
(hs-inside-comment-p): Remove function.
(hs-adjust-block-end, hs-treesit-things): New buffer-local
variables.
(hs-block-positions): Minor updates.
(hs--get-mode-value): New function.
(hs-grok-mode-type): Rewrite.
* lisp/progmodes/f90.el (hs-special-modes-alist):
* lisp/progmodes/fortran.el (hs-special-modes-alist):
* lisp/progmodes/icon.el (icon-mode):
* lisp/progmodes/lua-mode.el (lua-mode):
* lisp/progmodes/python.el (python-base-mode):
* lisp/progmodes/verilog-mode.el (verilog-mode):
* lisp/progmodes/vhdl-mode.el (vhdl-hs-minor-mode): Rewrite
settings.
* lisp/progmodes/python.el (python-ts-hs-adjust-block-end-fn):
New function.
* lisp/treesit.el (treesit-hs-block-end)
(treesit-hs-find-block-beginning, treesit-hs-find-next-block)
(treesit-hs-looking-at-block-start-p): Minor updates.
* doc/emacs/programs.texi (Hideshow):
* etc/NEWS: Document changes.
2025-11-04 19:15:10 +02:00
Yuan Fu
9e8557fe85
Skip unknown language for code block in markdown-ts-mode (bug#79670)
* lisp/textmodes/markdown-ts-mode.el:
(markdown-ts--convert-code-block-language): Return nil if the
langauge doesn't have a corresponding major mode in
markdown-ts-code-block-source-mode-map.
2025-10-29 21:25:23 -07:00
Juri Linkov
0a4503de3a Check if treesit-major-mode-remap-alist is bound in ts-modes autoload forms
* lisp/progmodes/c-ts-mode.el:
* lisp/progmodes/cmake-ts-mode.el:
* lisp/progmodes/csharp-mode.el:
* lisp/progmodes/dockerfile-ts-mode.el:
* lisp/progmodes/elixir-ts-mode.el:
* lisp/progmodes/go-ts-mode.el:
* lisp/progmodes/heex-ts-mode.el:
* lisp/progmodes/java-ts-mode.el:
* lisp/progmodes/js.el:
* lisp/progmodes/json-ts-mode.el:
* lisp/progmodes/lua-ts-mode.el:
* lisp/progmodes/php-ts-mode.el:
* lisp/progmodes/python.el:
* lisp/progmodes/ruby-ts-mode.el:
* lisp/progmodes/rust-ts-mode.el:
* lisp/progmodes/sh-script.el:
* lisp/progmodes/typescript-ts-mode.el:
* lisp/textmodes/css-mode.el:
* lisp/textmodes/markdown-ts-mode.el:
* lisp/textmodes/mhtml-ts-mode.el:
* lisp/textmodes/toml-ts-mode.el:
* lisp/textmodes/yaml-ts-mode.el: In autoload forms replace
'(treesit-available-p)' with (boundp 'treesit-major-mode-remap-alist).
Calling 'treesit-available-p' in loaddefs.el is too early
since the tree-sitter library might not be loaded yet.
Checking if 'treesit-major-mode-remap-alist' is bound is
equivalent to checking if Emacs is compiled with tree-sitter support.
(bug#79622)
2025-10-16 09:45:30 +03:00
Arash Esbati
f344f5c4bf Replace obsolete floatfig package with floatflt
* doc/misc/reftex.texi (Builtin Label Environments): Mention the
floatflt LaTeX package instead of the obsolete floatfig.

* lisp/textmodes/reftex-vars.el (reftex-label-alist-builtin):
Replace obsolete floatfig entry with floatflt.  Add entry for
"floatingtable".
Fix type indicator for "tabwindow".
(reftex-default-label-alist-entries): Use floatflt as well.
2025-10-10 11:17:54 +02:00
Arash Esbati
d8448facd9 Remove setting of reference format
* lisp/textmodes/reftex-vars.el (reftex-label-alist-builtin):
Don't set the reference format for ?f and ?t type indicators in
entries of subfig.
2025-10-09 11:55:47 +02:00
Eshel Yaron
32b9902603
; (read-string-from-buffer): Fix thinko and typo. 2025-09-27 16:00:41 +02:00
Roi Martin
2ae54a8b17 Fix font lock and cache indent rules in mhtml-ts-mode
Fix font lock in mhtml-ts-mode when the required tree-sitter grammars
are automatically installed (bug#79363).  Also, cache tree-sitter indent
rules.
* lisp/textmodes/mhtml-ts-mode.el
(mhtml-ts-mode--treesit-font-lock-settings): Evaluate the rules only
after the tree-sitter grammars are installed.
(mhtml-ts-mode--treesit-indent-rules): Cache indent rules.
(mhtml-ts-mode): Call the new
`mhtml-ts-mode--treesit-font-lock-settings' function.
2025-09-21 19:49:18 +03:00
Juri Linkov
27853a2bca * lisp/textmodes/mhtml-ts-mode.el: Fix for recent changes in js-ts-mode.
(mhtml-ts-mode--treesit-font-lock-settings): Replace variable
'js--treesit-font-lock-settings' with the function call.
(mhtml-ts-mode--treesit-indent-rules): Replace variable
'js--treesit-indent-rules' with the function call (bug#79363).
2025-09-18 18:20:15 +03:00
Lockywolf
4846ec4871 Add tests to ispell.el interactive functions
* lisp/textmodes/ispell.el (ispell-accept-output): Fix variable init.

* test/lisp/textmodes/ispell-resources/fake-aspell-new.bash:
Update mock aspell to be able to serve all tests.

* test/lisp/textmodes/ispell-tests/ispell-aspell-tests.el:
(ispell/aspell/ispell-word/english/correct): Implement.
(ispell/aspell/ispell-word/english/incorrect): Implement.
(ispell/aspell/ispell-word/english/wrong-language): Implement.

* test/lisp/textmodes/ispell-tests/ispell-hunspell-tests.el
Fix byte compilation errors.

* test/lisp/textmodes/ispell-international-ispell-tests.el
Fix byte compilation errors.

* test/lisp/textmodes/ispell-tests/ispell-tests-common.el
(with-ispell-global-dictionary): Implement a macro to
set and restore ispell.el's global dictionary.

* test/lisp/textmodes/ispell-tests/ispell-tests.el:
(ispell/ispell-buffer-local-words/ispell-words-keyword): Fix CI run.
(ispell/ispell-accept-buffer-local-defs/simple): Fix skip condition.
(ispell/ispell--run-on-word/default): Fix skip condition.
(ispell/ispell-word/default/check-only/correct): Fix global variable.
(ispell/ispell-word/default/check-only/correct/add-init): Fix
global variable.
(ispell/ispell-word/default/check-only/incorrect): Fix skip condition.
(ispell/ispell-region/incorrect): Fix postcondition.
(ispell/ispell-call-process/simple): Fix emacs path.
(ispell/ispell-call-process/simple-writable): Fix emacs path.
(ispell/ispell-call-process-region/cat-empty): Fix emacs path.
(ispell/ispell-call-process-region/cat-random): Fix emacs path.
(ispell/ispell-kill-ispell): Implement.
(ispell/ispell/buffer): Implement.
(ispell/ispell/region): Implement.
(ispell/ispell-change-dictionary): Implement.
(ispell/ispell-comments-and-strings/correct): Implement.
(ispell/ispell-comments-and-strings/incorrect): Implement.
(ispell/ispell-comment-or-string-at-point): Implement.
(ispell/ispell-pdict-save): Implement.
(ispell/ispell-pdict-save/force): Implement.
(ispell/ispell-pdict-save/modified): Implement.
(ispell/ispell-pdict-save/unmodified): Implement.
(ispell/ispell-lookup-words/simple): Implement.
(ispell/ispell-complete-word/ispell-completion-at-point): Implement.
(ispell/ispell-complete-word-interior-frag/simple): Implement.
(ispell/ispell-minor-mode/simple): Implement.
(ispell/ispell-message/correct): Implement.
(ispell/ispell-message/incorrect): Implement.
2025-09-12 16:02:48 +02:00
Juri Linkov
35f8ce7835 * lisp/textmodes/markdown-ts-mode.el: Fix embed settings.
(markdown-ts--range-settings): Move embed settings
for html/toml/yaml to 'markdown-ts-setup'.
(markdown-ts-setup): Append range rules to 'treesit-range-settings'
only when grammars for html/toml/yaml are installed.
2025-08-29 19:32:22 +03:00
Juri Linkov
bf652e6844 Silence byte-compile warnings when treesit is not available
* lisp/progmodes/c-ts-mode.el:
* lisp/progmodes/cmake-ts-mode.el:
* lisp/progmodes/csharp-mode.el:
* lisp/progmodes/dockerfile-ts-mode.el:
* lisp/progmodes/elixir-ts-mode.el:
* lisp/progmodes/go-ts-mode.el:
* lisp/progmodes/heex-ts-mode.el:
* lisp/progmodes/java-ts-mode.el:
* lisp/progmodes/js.el:
* lisp/progmodes/json-ts-mode.el:
* lisp/progmodes/lua-ts-mode.el:
* lisp/progmodes/php-ts-mode.el:
* lisp/progmodes/ruby-ts-mode.el:
* lisp/progmodes/rust-ts-mode.el:
* lisp/progmodes/sh-script.el:
* lisp/progmodes/typescript-ts-mode.el:
* lisp/textmodes/css-mode.el:
* lisp/textmodes/markdown-ts-mode.el:
* lisp/textmodes/mhtml-ts-mode.el:
* lisp/textmodes/toml-ts-mode.el:
* lisp/textmodes/yaml-ts-mode.el:
Declare 'treesit-major-mode-remap-alist' and
'treesit-language-available-p' to silence warnings
that are false alarms.  Also improve docstrings.
2025-08-18 09:49:36 +03:00
Juri Linkov
0ac3a1f26c New user option 'treesit-enabled-modes' (bug#79180)
* lisp/treesit.el (treesit-enabled-modes): New user option.
* src/treesit.c (treesit-major-mode-remap-alist): New variable.

* lisp/progmodes/c-ts-mode.el:
* lisp/progmodes/csharp-mode.el:
* lisp/progmodes/java-ts-mode.el:
* lisp/progmodes/js.el:
* lisp/progmodes/json-ts-mode.el:
* lisp/progmodes/ruby-ts-mode.el:
* lisp/progmodes/sh-script.el:
* lisp/textmodes/css-mode.el:
* lisp/textmodes/mhtml-ts-mode.el:
* lisp/textmodes/toml-ts-mode.el:
Add ts-mode mapping to 'treesit-major-mode-remap-alist'
for ts-modes that already have the corresponding non-ts mode
association in 'auto-mode-alist'.

* lisp/progmodes/cmake-ts-mode.el (cmake-ts-mode-maybe):
* lisp/progmodes/dockerfile-ts-mode.el (dockerfile-ts-mode-maybe):
* lisp/progmodes/elixir-ts-mode.el (elixir-ts-mode-maybe):
* lisp/progmodes/go-ts-mode.el (go-ts-mode-maybe)
(go-mod-ts-mode-maybe, go-work-ts-mode-maybe):
* lisp/progmodes/heex-ts-mode.el (heex-ts-mode-maybe):
* lisp/progmodes/lua-ts-mode.el (lua-ts-mode-maybe):
* lisp/progmodes/php-ts-mode.el (php-ts-mode-maybe):
* lisp/progmodes/rust-ts-mode.el (rust-ts-mode-maybe):
* lisp/progmodes/typescript-ts-mode.el (typescript-ts-mode-maybe)
(tsx-ts-mode-maybe):
* lisp/textmodes/markdown-ts-mode.el (markdown-ts-mode-maybe):
* lisp/textmodes/yaml-ts-mode.el (yaml-ts-mode-maybe):
Add a wrapper function to 'auto-mode-alist'
for ts-modes that have no corresponding non-ts mode.
Also add a mapping to 'treesit-major-mode-remap-alist'
for the case when a non-ts mode is installed from an external
source to be able to customize it with 'treesit-enabled-modes'.
2025-08-14 19:40:08 +03:00
Po Lu
498b2b6d2a Fix build without tree-sitter
* lisp/textmodes/mhtml-ts-mode.el
(mhtml-ts-mode--range-settings): Don't invoke
`treesit-language-available-p' unless bound.
2025-08-12 09:34:57 +08:00
Eli Zaretskii
4293a7678b ; Fix last change in mhtml-ts-mode.el
* lisp/textmodes/mhtml-ts-mode.el (mhtml-ts-mode--range-settings):
Avoid asking about grammar installation when loading.  (Bug#79215)
2025-08-11 21:44:26 +03:00
Vincenzo Pupillo
bd62f57efd 'php-ts-mode' depends on 'mhtml-ts-mode' instead of JS,CSS and HTML
The direct dependence on 'js-ts-mode', 'css-ts-mode' and
html-ts-mode has now been replaced by 'mhtml-ts-mode'.
Additional benefits are:
1. Imenu now exposes symbols for all of all languages,
2. navigation now works correctly for all languages,
3. outline works for all languages.

Additional new features are:
1. indentation of PHP in mixed buffers with HTML now works much
better and allows three different behaviors, an option allows you to
choose the behavior.
2. a new feature shows where PHP ini files are both locally and
remotely, if the buffer is associated with a remote PHP file.

* etc/NEWS: Mention the rationale for those changes, the new command,
and the new options.
* admin/tree-sitter/treesit-admin.el (treesit-admin--builtin-modes):
Added 'mhtml-ts-mode'.
(treesit-admin--builtin-features): Added 'mhtml-ts-mode'.
* lisp/textmodes/mhtml-ts-mode.el (mhtml-ts-mode--range-settings):
New variable that store range settings.
(mhtml-ts-mode--treesit-aggregated-outline-predicate): New variable
that stores outline predicates.
(mhtml-ts-mode): Use those two new variables.
* lisp/progmodes/php-ts-mode.el: Update doc string.  Removed old
dependecies.
(php-ts-mode--language-source-alist): Updated parsers version.
(php-ts-mode-install-parsers): Removed old dependencies, now relies
on mhtml-ts-mode-install-parsers'.  Update doc string.
(php-ts-mode-js-css-indent-offset): Update doc string.
(php-ts-mode-css-fontify-colors): Removed option, now relies on
'php-ts-mode-css-fontify-colors'.
(php-ts-mode-html-indent-offset): New user option.
(php-ts-mode-html-relative-indent): New user option.
(php-ts-mode-php-default-executable): Assume "php" instead of
"/usr/bin/php" if 'executable-find' fails.
(php-ts-mode-php-config): Fix tag.
(php-ts-mode-find-sibling-rules): New user option with the rules
for finding siblings of a file.
(php-ts-mode-phpdoc-highlight-errors): New user option, if non-nil
highlight unkown PHPDOC nodes.
(php-ts-mode--indent-style-setter): Indentation fix.
(php-ts-mode-indent-style): Indentation fix.
(php-ts-mode-flymake-php): Indentation fix.
(php-ts-mode--executable): Indentation fix.
(php-ts-mode-show-ini): New command that show the locations of PHP
ini files.
(php-ts-mode--get-indent-style): Indentation fix.
(php-ts-mode--set-indent-property): Indentation fix.
(php-ts-mode-set-style): Indentation fix.
(php-ts-mode--get-parser-ranges): Indentation fix.
(php-ts-mode--possibly-braceless-keyword-re): Removed no longer used
constant.
(php-ts-mode--open-statement-group-heuristic): Removed no longer used
function.
(php-ts-mode--else-heuristic): Indentation fix.
(php-ts-mode--first-sibling): Indentation fix.
(php-ts-mode--js-css-tag-bol): Function removed, now using
'mhtml-ts-mode--js-css-tag-bol'.
(php-ts-mode--parent-html-bol): Removed no longer used
function.
(php-ts-mode--parent-html-heuristic): Now more reliably handles the
mixed indentation of PHP and HTML. The new option
'php-ts-mode-html-relative-indent' changes the behavior of the
function. When 'php-ts-mode-html-relative-indent' is 't' the new
option 'php-ts-mode-html-indent-offset' controls the offset of PHP
code relative to HTML tags.
(php-ts-mode--array-element-heuristic): Indentation fix.
(php-ts-mode--anchor-prev-sibling): Indentation fix..
(php-ts-mode--indent-styles): The indentation rules for 'program' and
text_interpolation' are now common to all indentation styles, thanks
to the new version of 'php-ts-mode-arent-html-heuristic'.  New rules
for 'namespace_use_clause', 'use_declaration', 'use_list',
'attribute_group' and 'string_content'.
(php-ts-mode--prettify-symbols-alist): New variable to support
'prettify-symbols-alist'.
(php-ts-mode--test-visibility-modifier-operation-clause-p): Rename ...
(php-ts-mode--test-visibility-modifier-operation-p): ... to this more
correct name.
(php-ts-mode--test-property-hook-clause-p): Rename ...
(php-ts-mode--test-property-hook-p): ... to this more correct name.
(php-ts-mode--test-relative-name-p): New function to test if
'relative_name' is supported by the PHP parser.
(php-ts-mode--font-lock-settings): Use the new function for highlight
'relative_name'.  Highlight 'error_suppression_expression'.
Refactoring using the renamed functions.  Indentation fix.
(php-ts-mode--custom-html-font-lock-settings): Replace the rules with
'mhtml-ts-mode--treesit-font-lock-settings'.  Fix docs string.
(php-ts-mode--phpdoc-font-lock-settings): Added support for "array" and
"list" array_type.  New "phpdoc-error" feature to highlight unknown
nodes via new 'php-ts-mode--phpdoc-fontify-error' function.
(php-ts-mode--colorize-css-value): Removed function no longer used, now
highlighting is handled directly by 'mhtml-ts-mode'.
(php-ts-mode--phpdoc-fontify-error): New function used by
'php-ts-mode--phpdoc-font-lock-settings'.
(php-ts-mode--parent-object): Indentation fix.
(php-ts-mode--defun-name-separator): Indentation fix.
(php-ts-mode--defun-object-name): Indentation fix.
(php-ts-mode--defun-name): The function now also returns the defun name
of 'mhtml-ts-mode'.
(php-ts-mode--treesit-defun-type-regexp): New regexp for
'treesit-defun-type-regexp' support.
(php-ts-mode--indent-defun): Indentation fix.
(php-ts-mode--defun-valid-p): Fix indentation
(php-ts-mode--comment-indent-new-line): Indentation fix.
(php-ts-mode--comment-current-plist): New local variable that stores
the state of the PHP comment style.
(php-ts-mode--comment-setup): The function now handles changing, for
different languages, comment styles, using
"php-ts-mode--comment-current-plist" to store and retrieve the comment
style for the PHP language.
(php-ts-mode-comment-setup): Now store the PHP comment style in
'php-ts-mode--comment-current-plist'.
(php-ts-mode-menu): Indentation fix.
(php-ts-mode): Replace dependency from JS, CSS and HTML width
'mhtml-ts-mode'.  Navigation, Imenu and Outline now support PHP, HTML,
Javascript and CSS.  Added support for 'prettify-symbol-mode'.
Added support for 'electric-layout-rules'.
(php-ts-mode-run-php-webserver, php-ts-mode--webserver-read-args)
(php-ts-mode--webserver-read-args, inferior-php-ts-mode, run-php)
(inferior-php-ts-mode-startup, php-ts-mode-inferior--write-history)
(php-ts-mode-send-region): Indentation fixes.
* lisp/treesit.el (treesit-range-rules): Check if treesit is available
before compiling a query.
(treesit-ensure-installed): Check if treesit is available before trying
to ensure if a grammar library is installed.

(Bug#78994)
2025-08-10 18:30:03 +03:00
Eli Zaretskii
204a94c9b9 Revert "php-ts-mode' depends on mhtml-ts-mode' instead of JS,CSS and HTML"
This reverts commit e1fd7b5d89.
It fails the build without treew-sitter.
2025-08-09 16:22:08 +03:00
Vincenzo Pupillo
e1fd7b5d89 php-ts-mode' depends on mhtml-ts-mode' instead of JS,CSS and HTML
The direct dependence on js-ts-mode, css-ts-mode and html-ts-mode
has now been replaced by 'mhtml-ts-mode'.
Additional benefits are:
1. Imenu now exposes symbols for all of all languages,
2. navigation now works correctly for all languages,
3. outline works for all languages.

Additional new features are:
1. indentation of PHP in mixed buffers with HTML now works much
better and allows three different behaviors, an option allows you to
choose the behavior.
2. a new feature shows where PHP ini files are both locally and
remotely, if the buffer is associated with a remote PHP file.

* etc/NEWS: Mention the rationale for those changes, the new command,
and the new options.
* lisp/textmodes/mhtml-ts-mode.el (mhtml-ts-mode--range-settings): New
variable that store range settings.
(mhtml-ts-mode--treesit-aggregated-outline-predicate): New variable
that store outline predicates.
(mhtml-ts-mode): Use those two new variables.
* lisp/progmodes/php-ts-mode.el: Update doc string.  Removed old
dependencies.
(php-ts-mode--language-source-alist): Updated parsers version.
(php-ts-mode-install-parsers): Removed old dependencies, now relies
on (mhtml-ts-mode-install-parsers).  Update doc string.
(php-ts-mode-js-css-indent-offset): Update doc string.
(php-ts-mode-css-fontify-colors): Removed option, now relies on
'php-ts-mode-css-fontify-colors'.
(php-ts-mode-html-indent-offset): New user option.
(php-ts-mode-html-relative-indent): New user option.
(php-ts-mode-php-default-executable): Assume \"php\" instead of
\"/usr/bin/php\" if 'executable-find' fails.
(php-ts-mode-php-config): Fix tag.
(php-ts-mode-find-sibling-rules): New user option with the rules for
finding siblings of a file.
(php-ts-mode-phpdoc-highlight-errors): New user option, if non-nil
highlight unkown PHPDOC nodes.
(php-ts-mode--indent-style-setter): Indentation fix.
(php-ts-mode-indent-style): Indentation fix.
(php-ts-mode-flymake-php): Indentation fix.
(php-ts-mode--executable): Indentation fix.
(php-ts-mode-show-ini): New command that show the locations of PHP
ini files.
(php-ts-mode--get-indent-style): Indentation fix.
(php-ts-mode--set-indent-property): Indentation fix.
(php-ts-mode-set-style): Indentation fix.
(php-ts-mode--get-parser-ranges): Indentation fix.
(php-ts-mode--possibly-braceless-keyword-re): Removed no longer
used constant.
(php-ts-mode--open-statement-group-heuristic): Removed no longer
used function.
(php-ts-mode--else-heuristic): Indentation fix.
(php-ts-mode--first-sibling): Indentation fix.
(php-ts-mode--js-css-tag-bol): Function removed, now using
'mhtml-ts-mode--js-css-tag-bol'.
(php-ts-mode--parent-html-bol): Removed no longer used
function.
(php-ts-mode--parent-html-heuristic): Now more reliably handles
the mixed indentation of PHP and HTML. The new option
'php-ts-mode-html-relative-indent' changes the behavior of the
function. When 'php-ts-mode-html-relative-indent' is 't' the new
option 'php-ts-mode-html-indent-offset' controls the offset of PHP
code relative to HTML tags.
(php-ts-mode--array-element-heuristic): Indentation fix.
(php-ts-mode--anchor-prev-sibling): Indentation fix..
(php-ts-mode--indent-styles): The indentation rules for 'program'
and 'text_interpolation' are now common to all indentation styles,
thanks to the new version of 'php-ts-mode-arent-html-heuristic'.
New rules for 'namespace_use_clause', 'use_declaration',
'use_list', 'attribute_group' and 'string_content'.
(php-ts-mode--prettify-symbols-alist): New variable to support
'prettify-symbols-alist'.
(php-ts-mode--test-visibility-modifier-operation-clause-p): Rename ...
(php-ts-mode--test-visibility-modifier-operation-p): ... to this more
correct name.
(php-ts-mode--test-property-hook-clause-p): Rename ...
(php-ts-mode--test-property-hook-p): ... to this more correct name.
(php-ts-mode--test-relative-name-p): New function to test if
'relative_name' is supported by the PHP parser.
(php-ts-mode--font-lock-settings): Use the new function for highlight
'relative_name'. Highlight 'error_suppression_expression'.
Refactoring using the renamed functions.  Indentation fix.
(php-ts-mode--custom-html-font-lock-settings): Replace the rules with
'mhtml-ts-mode--treesit-font-lock-settings'.  Fix docs string.
(php-ts-mode--phpdoc-font-lock-settings): Added support for "array"
and "list" array_type.  New "phpdoc-error" feature to highlight
unknown nodes via new 'php-ts-mode--phpdoc-fontify-error' function.
(php-ts-mode--colorize-css-value): Removed function no longer used,
now highlighting is handled directly by 'mhtml-ts-mode'.
(php-ts-mode--phpdoc-fontify-error): New function used by
'php-ts-mode--phpdoc-font-lock-settings'.
(php-ts-mode--parent-object): Indentation fix.
(php-ts-mode--defun-name-separator): Indentation fix.
(php-ts-mode--defun-object-name): Indentation fix.
(php-ts-mode--defun-name): The function now also returns the defun
name of 'mhtml-ts-mode'.
(php-ts-mode--treesit-defun-type-regexp): New regexp for
'treesit-defun-type-regexp' support.
(php-ts-mode--indent-defun): Indentation fix.
(php-ts-mode--defun-valid-p): Fix indentation.
(php-ts-mode--comment-indent-new-line): Indentation fix.
(php-ts-mode--comment-current-plist): New local variable that stores
the state of the PHP comment style.
(php-ts-mode--comment-setup): The function now handles changing, for
different languages, comment styles, using
"php-ts-mode--comment-current-plist" to store and retrieve the comment
style for the PHP language.
(php-ts-mode-comment-setup): Now store the PHP comment style in
'php-ts-mode--comment-current-plist'.
(php-ts-mode-menu): Indentation fix.
(php-ts-mode): Replace dependency from JS, CSS and HTML width
'mhtml-ts-mode'.  Navigation, Imenu and Outline now support PHP, HTML,
Javascript and CSS.  Added support for 'prettify-symbol-mode'.
Added support for 'electric-layout-rules'.
(php-ts-mode-run-php-webserver, php-ts-mode--webserver-read-args)
(php-ts-mode--webserver-read-args, inferior-php-ts-mode, run-php)
(inferior-php-ts-mode-startup, php-ts-mode-inferior--write-history)
(php-ts-mode-send-region): Indentation fixes.

(Bug#78994)
2025-08-09 15:57:04 +03:00
Elías Gabriel Pérez
e4352c7a45 Add multi-character pairs to lua-ts-mode and texinfo-mode
* etc/NEWS: Add entry for lua-ts-mode changes.
* lisp/progmodes/lua-ts-mode.el
(lua-ts-auto-close-block-comments): New user option.
(lua-ts-mode): Add '--[[ ]]' pairs to 'electric-pair-pairs' only
if 'lua-ts-auto-close-block-comments' is non-nil.
* lisp/textmodes/texinfo.el (texinfo-mode): Add "`` ''" pairs to
'electric-pair-pairs'.
* test/lisp/progmodes/lua-ts-mode-tests.el
(lua-ts-test-auto-close-block-comments): Add new test.
(Bug#79047)
2025-08-09 13:41:43 +03:00
Roland Winkler
48df3da4cc bibtex.el - improve last change e6c1ec71b7
* lisp/textmodes/bibtex.el: Use defvar to silence byte compiler
        * lisp/textmodes/bibtex.el (bibtex-generate-url-list-init):
        Use setq-local.
2025-07-26 14:45:36 -05:00
Roland Winkler
e6c1ec71b7 Define setfunction for bibtex-generate-url-list (bug#78798)
* lisp/textmodes/bibtex.el
        (bibtex-generate-url-list-init): New function.

        * lisp/textmodes/bibtex.el (bibtex-generate-url-list)
        (bibtex-font-lock-url-regexp): Use it.
2025-07-20 01:01:12 -05:00
Pengji Zhang
5d9a67e4bd Move some RefTeX 'setq's to major mode definition
Move two 'setq' expressions from the RefTeX label selection loop
to the body of the major mode definition, so to make it easier
to adjust the settings of the buffer via the mode hook.

* lisp/textmodes/reftex-ref.el (reftex-offer-label-menu): Move
two 'setq' expressions from here...
* lisp/textmodes/reftex-sel.el (reftex-select-label-mode): ...to
here.  (bug#77335)
2025-07-14 21:24:45 +02:00
Paul Nelson
c8b6e90b4e Improve prettification of (La)TeX symbols
* lisp/textmodes/tex-mode.el (tex--prettify-symbols-alist): Remove
entry for "\\newline", which resulted in an invisible display.
Prettify "\\ " with OPEN BOX instead of BOTTOM SQUARE BRACKET.
(tex--prettify-symbols-compose-p): Skip composition when the
control backslash is itself escaped (bug#78752).
2025-07-14 12:25:45 -04:00
Stefan Monnier
f01fc3d614 lisp/textmodes/tex-mode.el (tex--prettify-symbols-alist): Use \
This is the "standard" way to avoid those indentation problems
without relying on funny numbers.
2025-07-14 12:25:32 -04:00
Roi Martin
0ac21120cf Update `fill-region-as-paragraph-semlf' to follow fill.el protocols
Update the `fill-region-as-paragraph-semlf' function to follow the
`fill-region-as-paragraph-function' protocol.  This allows us to
reimplement the `fill-paragraph-semlf' function using `fill-paragraph'
and `fill-region-as-paragraph-function'.
* lisp/textmodes/fill.el (fill-region-as-paragraph-semlf): Make this
function compatible with `fill-region-as-paragraph-function'.  Avoid
narrowing.
(fill-paragraph-semlf): Reimplement using `fill-paragraph' and
`fill-region-as-paragraph-function'.
* test/lisp/textmodes/fill-tests.el (fill-test-semlf-fill-region): Add
test.
(fill-test-fill-paragraph-semlf-fill-paragraph-function): Remove test.
(fill-test-fill-paragraph-semlf, fill-test-semlf)
(fill-test-fill-paragraph-semlf-justify, fill-test-semlf-justify)
(fill-test-fill-paragraph-semlf-sentence-end-double-space)
(fill-test-semlf-sentence-end-double-space)
(fill-test-fill-paragraph-semlf-fill-column, fill-test-semlf-fill-column)
(fill-test-fill-paragraph-semlf-punctuation-marks)
(fill-test-semlf-punctuation-marks, fill-test-fill-paragraph-semlf-twice)
(fill-test-semlf-twice, fill-test-fill-paragraph-semlf-fill-prefix)
(fill-test-semlf-fill-prefix)
(fill-test-fill-paragraph-semlf-indented-block)
(fill-test-semlf-indented-block, fill-test-fill-paragraph-semlf-revert)
(fill-test-semlf-revert, fill-test-fill-paragraph-semlf-emacs-lisp-mode)
(fill-test-semlf-emacs-lisp-mode, fill-test-fill-paragraph-semlf-c-mode)
(fill-test-semlf-c-mode, fill-test-fill-paragraph-semlf-org-mode)
(fill-test-semlf-org-mode, fill-test-fill-paragraph-semlf-markdown-mode)
(fill-test-semlf-markdown-mode): User shorter function names consistent
with erts file names.
* test/lisp/textmodes/fill-resources/semlf-fill-region.erts: Add test
data.
* test/lisp/textmodes/fill-resources/semlf-fill-paragraph-function.erts:
Delete file.
* test/lisp/textmodes/fill-resources/semlf-emacs-lisp-mode.erts: Remove
newlines around indented block.
* doc/lispref/text.texi (Filling): Highlight that
`fill-region-as-paragraph-function' changes the behavior of
`fill-paragraph'.
2025-06-30 17:33:43 -04:00
Roi Martin
99ec286d78 Add variable `fill-region-as-paragraph-function'
Add the variable `fill-region-as-paragraph-function' to provide
a way to override how functions like `fill-region' fill text.
* doc/lispref/text.texi (Filling): Document
`fill-region-as-paragraph-function' variable.
* doc/emacs/text.texi (Fill Commands): Reference
`fill-region-as-paragraph-function' variable.
* lisp/textmodes/fill.el (fill-region-as-paragraph-function):
Add variable.
(fill-region-as-paragraph): Convert into
`fill-region-as-paragraph-function' wrapper.
(fill-region-as-paragraph-default): Rename old
`fill-region-as-paragraph' function.
(fill-region-as-paragraph-semlf): Update calls to
`fill-region-as-paragraph-default'.
(fill-region): Add reference to `fill-region-as-paragraph-function'
in doc string.
* test/lisp/textmodes/fill-tests.el (fill-test-fill-region): Add
test case for the `fill-region' function.
* test/lisp/textmodes/fill-resources/fill-region.erts: Add test
data.  (Bug#78816)
2025-06-29 07:33:24 +03:00
Sean Whitton
0c0ac8d48a 'C-u C-x .' clears the fill prefix
* lisp/textmodes/fill.el (set-fill-prefix): When called
interactively with a prefix argument, clear the fill prefix,
just like how 'C-u C-x C-n' clears the goal column.
* doc/emacs/text.texi (Fill Prefix):
* etc/NEWS: Document the change.
2025-06-27 14:14:36 +01:00
James Cherti
faae9f572a Fix yaml-ts-mode comment-start-skip to improve commenting/uncommenting
* lisp/textmodes/yaml-ts-mode.el (yaml-ts-mode): Fix 'comment-start-skip'
value to resolve an issue when commenting/uncommenting using the
'comment-or-uncomment-region' function.  The previous 'comment-start-skip'
value left some "-" uncommented after commenting and uncommenting
multiple YAML indented blocks (bug#78892).

Copyright-paperwork-exempt: yes
2025-06-25 21:50:06 +03:00
Jeremy Bryant
b687f02a73 ; * lisp/textmodes/reftex.el: Update author email (bug#77850). 2025-06-24 23:20:39 +02:00
Juri Linkov
1a76b527ac Use keyword :commit with full hashes for treesit-language-source-alist.
* lisp/treesit.el (treesit-language-source-alist):
Document the format that uses keywords.
(treesit--install-language-grammar-1): Remove args
'revision', 'source-dir', 'cc', 'c++', 'commit'.
Use 'args' to process the keywords, and use the remaining
list as the previous list of arguments.
(treesit--install-language-grammar-1): Let-bind
'treesit--install-language-grammar-full-clone' and
'treesit--install-language-grammar-blobless' to t
when 'commit' is non-nil (bug#78542).

* lisp/progmodes/c-ts-mode.el:
* lisp/progmodes/cmake-ts-mode.el:
* lisp/progmodes/csharp-mode.el:
* lisp/progmodes/dockerfile-ts-mode.el:
* lisp/progmodes/elixir-ts-mode.el:
* lisp/progmodes/go-ts-mode.el:
* lisp/progmodes/heex-ts-mode.el:
* lisp/progmodes/java-ts-mode.el:
* lisp/progmodes/js.el:
* lisp/progmodes/json-ts-mode.el:
* lisp/progmodes/php-ts-mode.el:
* lisp/progmodes/python.el:
* lisp/progmodes/ruby-ts-mode.el:
* lisp/progmodes/rust-ts-mode.el:
* lisp/progmodes/sh-script.el:
* lisp/progmodes/typescript-ts-mode.el:
* lisp/textmodes/css-mode.el:
* lisp/textmodes/html-ts-mode.el:
* lisp/textmodes/markdown-ts-mode.el:
* lisp/textmodes/toml-ts-mode.el:
* lisp/textmodes/yaml-ts-mode.el:
Use the keyword :commit with full hashes instead of tags
in 'treesit-language-source-alist'.

* lisp/treesit-x.el (define-treesit-generic-mode):
Simplify the keyword :copy-queries.
(gitattributes-generic-ts-mode, liquid-generic-ts-mode):
Add keywords :commit and :copy-queries to :source.

* admin/tree-sitter/treesit-admin.el
(treesit-admin--unversioned-treesit-language-source-alist):
Handle :revision and :commit as well.
(treesit-admin--find-latest-compatible-revision):
Process the keywords in the recipe.
2025-06-20 19:58:28 +03:00
Roi Martin
24a699243e Add semantic linefeed support for paragraph filling
* lisp/textmodes/fill.el (fill-region-as-paragraph-semlf): Add function
to fill a region using semantic linefeeds as if it were a single
paragraph.
(fill-paragraph-semlf): Add function to fill paragraph using semantic
linefeeds.
* test/lisp/textmodes/fill-tests.el
(fill-test-fill-region-as-paragraph-semlf)
(fill-test-fill-paragraph-semlf)
(fill-test-fill-paragraph-semlf-fill-paragraph-function)
(fill-test-fill-paragraph-semlf-justify)
(fill-test-fill-paragraph-semlf-sentence-end-double-space)
(fill-test-fill-paragraph-semlf-fill-column)
(fill-test-fill-paragraph-semlf-punctuation-marks)
(fill-test-fill-paragraph-semlf-twice)
(fill-test-fill-paragraph-semlf-fill-prefix)
(fill-test-fill-paragraph-semlf-indented-block)
(fill-test-fill-paragraph-semlf-revert)
(fill-test-fill-paragraph-semlf-emacs-lisp-mode)
(fill-test-fill-paragraph-semlf-c-mode)
(fill-test-fill-paragraph-semlf-org-mode)
(fill-test-fill-paragraph-semlf-markdown-mode): Add tests.
* test/lisp/textmodes/fill-resources/semlf-c-mode.erts:
* test/lisp/textmodes/fill-resources/semlf-emacs-lisp-mode.erts:
* test/lisp/textmodes/fill-resources/semlf-fill-column.erts:
* test/lisp/textmodes/fill-resources/semlf-fill-paragraph-function.erts:
* test/lisp/textmodes/fill-resources/semlf-fill-prefix.erts:
* test/lisp/textmodes/fill-resources/semlf-fill-region-as-paragraph.erts:
* test/lisp/textmodes/fill-resources/semlf-indented-block.erts:
* test/lisp/textmodes/fill-resources/semlf-justify.erts:
* test/lisp/textmodes/fill-resources/semlf-markdown-mode.erts:
* test/lisp/textmodes/fill-resources/semlf-org-mode.erts:
* test/lisp/textmodes/fill-resources/semlf-punctuation-marks.erts:
* test/lisp/textmodes/fill-resources/semlf-revert.erts:
* test/lisp/textmodes/fill-resources/semlf-sentence-end-double-space.erts:
* test/lisp/textmodes/fill-resources/semlf-twice.erts:
* test/lisp/textmodes/fill-resources/semlf.erts: Add test data.  (Bug#78561)
2025-06-14 16:34:52 +03:00
Jeremy Bryant
9e322088b0 ; reftex.el: Checkdoc fixes, comments to docstrings
* lisp/textmodes/reftex.el (reftex-next-multifile-index):
(reftex-TeX-master-file, reftex-is-multi):
(reftex-get-cite-format, reftex-ensure-compiled-variables):
(reftex-erase-all-selection-and-index-buffers):
(reftex-compile-variables, reftex-parse-args):
(reftex-access-scan-info, reftex-check-parse-consistency):
(reftex-select-external-document, reftex-find-file-externally):
(reftex-access-search-path, reftex-find-file-on-path):
(reftex-parse-colon-path, reftex-expand-path):
(reftex-recursive-directory-list, reftex-typekey-check):
(reftex-check-recursive-edit, reftex-no-props):
(reftex-match-string, reftex-kill-buffer):
(reftex-erase-buffer, reftex-this-word, reftex-all-assq):
(reftex-all-assoc-string, reftex-last-assoc-before-elt):
(reftex-sublist-nth, reftex-make-selection-buffer-name):
(reftex-make-index-buffer-name, reftex-truncate):
(reftex-nearest-match, reftex-auto-mode-alist):
(reftex-enlarge-to-fit, reftex-select-with-char):
(reftex-make-regexp-allow-for-ctrl-m, reftex-visited-files):
(reftex-get-file-buffer-force, reftex-kill-temporary-buffers):
(reftex-splice-symbols-into-list, reftex-uniquify):
(reftex-uniquify-by-car, reftex-nicify-text, reftex-refontify):
(reftex-fontify-select-label-buffer):
(reftex-select-font-lock-fontify-region):
(reftex-verified-face, reftex-highlight-shall-die): Convert
comment to docstring in functions.
(reftex-silence-toc-markers): Convert comment to docstring and
capitalize argument.
(reftex-set-cite-format): Capitalize argument.  (AUCTeX bug#77864)
2025-05-30 18:43:29 +02:00
Jeremy Bryant
0d96565d5d ; RefTeX: Update author email
Update Carsten's email across related reftex* files:
lisp/textmodes/reftex.el
lisp/textmodes/reftex-auc.el
lisp/textmodes/reftex-cite.el
lisp/textmodes/reftex-dcr.el
lisp/textmodes/reftex-global.el
lisp/textmodes/reftex-index.el
lisp/textmodes/reftex-parse.el
lisp/textmodes/reftex-ref.el
lisp/textmodes/reftex-sel.el
lisp/textmodes/reftex-toc.el
lisp/textmodes/reftex-vars.el
lisp/textmodes/reftex.el
(AUCTeX bug#77850)
2025-05-07 22:08:46 +02:00
Juri Linkov
61cb73a2db New variable 'comment-setup-function' for multi-language modes.
* lisp/newcomment.el (comment-setup-function): New variable.
(comment-normalize-vars): Call non-nil 'comment-setup-function'.

* lisp/textmodes/mhtml-ts-mode.el
(mhtml-ts-mode--comment-current-lang): New internal variable.
(mhtml-ts-mode--comment-setup): New function.
(mhtml-ts-mode): Set 'comment-setup-function' to
'mhtml-ts-mode--comment-setup' instead of using
'c-ts-common-comment-setup' only for JavaScript.

https://lists.gnu.org/archive/html/emacs-devel/2025-05/msg00025.html
2025-05-05 19:57:29 +03:00
Juri Linkov
815dea7b59 Avoid duplication in defining tree-sitter grammar sources.
* lisp/progmodes/php-ts-mode.el: Require 'html-ts-mode'.
(php-ts-mode--language-source-alist): Remove duplicate source info
for html, css, javascript, jsdoc.
(php-ts-mode-install-parsers): Install pre-defined grammars.
(php-ts-mode): Move 'require' to the top.

* lisp/textmodes/mhtml-ts-mode.el
(mhtml-ts-mode--language-source-alist): Remove variable
since 'treesit-language-source-alist' is pre-filled by
requiring 'html-ts-mode', 'css-mode', 'js'.
(mhtml-ts-mode-install-parsers): Install pre-defined grammars.

* test/infra/Dockerfile.emba: Remove 'mhtml-ts-mode'
that doesn't define own grammars.
2025-05-04 20:50:40 +03:00
Juri Linkov
9e75d18151 * lisp/textmodes/markdown-ts-mode.el: Improve.
(markdown-ts-list-marker): Inherit from 'shadow' like in non-ts mode.
(markdown-ts-block-quote): Inherit from 'italic' like in non-ts mode.
(markdown-ts--treesit-settings): Use 'shadow' for parens in
'markdown-inline' only under 'inline_link' and 'image'.
Use @markdown-ts-block-quote for 'block_quote'.
Override with 'append' for links.
(markdown-ts--range-settings): Use global html parser for 'html_tag'
since its ranges are interconnected.
(markdown-ts-setup): Create the 'html' parser.
2025-05-04 20:03:32 +03:00
Eli Zaretskii
790c475ec5 ; * lisp/textmodes/markdown-ts-mode.el (treesit-node-child): Declare. 2025-05-03 13:24:59 +03:00
Juri Linkov
1b0fe9b387 Embed html, yaml and toml in markdown-ts-mode.
* lisp/textmodes/markdown-ts-mode.el (markdown-ts--treesit-settings):
Use @italic on the whole 'block_quote'.
(markdown-ts-outline-predicate): New function.
(markdown-ts--range-settings): Embed 'yaml' in host 'markdown',
embed 'toml' in host 'markdown', embed 'html' in host 'markdown-inline',
and use local 'html_block'.
(markdown-ts-setup): Append html/yaml/toml to treesit-font-lock-settings
and treesit-font-lock-feature-list when their grammars are ready.
(markdown-ts-mode): Set comment-start/comment-end.
Set treesit-outline-predicate to 'markdown-ts-outline-predicate'.

* lisp/textmodes/toml-ts-mode.el
(toml-ts-mode--font-lock-feature-list): New variable.
(toml-ts-mode): Use it.

* lisp/textmodes/yaml-ts-mode.el
(yaml-ts-mode--font-lock-feature-list): New variable.
(yaml-ts-mode): Use it.
(yaml-ts-mode--outline-nodes): New variable.
(yaml-ts-mode--outline-predicate): Use it.

* lisp/treesit-x.el (liquid-generic-ts-mode):
Use 'treesit-ready-p' on optional 'yaml' grammar.
Merge 'yaml-ts-mode--font-lock-feature-list'.
2025-05-01 21:23:33 +03:00
Juri Linkov
5684a38086 Avoid adding duplicate items to 'treesit-language-source-alist'.
* lisp/textmodes/mhtml-ts-mode.el:
* lisp/progmodes/php-ts-mode.el:
Use 'add-to-list' on items in language-source-alist
that should check for duplicate items.

* test/infra/Dockerfile.emba: Move multi-language mhtml-ts-mode and
php-ts-mode to the end to give their dependent grammars a lower priority.

* test/lisp/progmodes/js-tests.el (js-ts-mode-test-indentation):
Skip the test when 'jsdoc' is missing since 'js-ts-mode' depends
on the 'jsdoc' grammar.
2025-05-01 20:55:33 +03:00
Eli Zaretskii
6bb3c6f9e1 Merge from origin/emacs-30
cc5b1a01a2 ; * doc/misc/efaq-w32.texi (Location of init file): Fix a...
6c2aaedfce Fix compilation errors in emacsclient.c with MinGW GCC 15
d56e5ba97e ; * etc/DEBUG: Add link to GCC bug #78685.
80cbd1e31c ; Fix key notation in Introduction to Emacs Lisp
1224e5fd96 ; * lisp/files.el (revert-buffer-restore-functions): Doc ...
79e7eeb329 ; Improve documentation of 'format-time-string'
2838b64fc8 ; * lisp/textmodes/text-mode.el (text-mode-variant): Fix ...
9adb05422e ; Improve obsolescence of 'text-mode-variant'
4858d81848 ; * lisp/files.el (revert-buffer-restore-functions): Doc ...
2a8e223b8d ; Mention early-init file in Emacs FAQ for Windows
14c707b42d ; Isearch: Fix key bindings in docstrings
2025-04-30 07:14:23 -04:00
Eli Zaretskii
2838b64fc8 ; * lisp/textmodes/text-mode.el (text-mode-variant): Fix last change. 2025-04-29 10:47:35 +03:00
Eli Zaretskii
9adb05422e ; Improve obsolescence of 'text-mode-variant'
* lisp/textmodes/text-mode.el (text-mode-variant): Improve
obsolescence announcement text.

* doc/lispref/modes.texi (Example Major Modes): Update example.
(Bug#78125).
2025-04-29 10:09:54 +03:00
Eli Zaretskii
191b4cd9a7 ; Fix compilation warning in string-edit.el
* lisp/textmodes/string-edit.el (string-edit): Avoid shadowing the
global 'major-mode'.
2025-04-26 18:01:42 +03:00
Spencer Baugh
8f58f55551 Improve help-fns-edit-variable for Lisp editing
Before d50c82f3e9 ("Simplify
'help-enable-variable-value-editing' using 'string-edit'"),
'help-fns-edit-variable' would open a buffer in 'emacs-lisp-mode'
and would not allow exiting that buffer with an invalid Lisp
expression.  Restore that functionality by enhancing 'string-edit'
to allow choosing a major mode and allow passing a function to
validate the buffer contents before returning.
* lisp/help-fns.el (help-fns-edit-variable): Call 'string-edit',
passing 'emacs-lisp-mode' and 'read'.
* lisp/textmodes/string-edit.el (string-edit--read): Add.
(string-edit): Add :major-mode and :read arguments and avoid
passive voice.
(read-string-from-buffer): Avoid passive voice in docs.
(string-edit-mode-map, string-edit-minor-mode-map)
(string-edit-mode, string-edit-minor-mode): Move 'string-edit'
keybindings to a minor mode.
(string-edit-done): Call 'string-edit--read' before exiting.
(Bug#77834)
2025-04-26 14:53:18 +03:00
Randy Taylor
417ee3a7f7 Fix 'yaml-ts-mode' filling of comments (Bug#77095)
* lisp/textmodes/yaml-ts-mode.el (yaml-ts-mode--fill-paragraph):
Handle comment filling differently than block_scalars.
(yaml-ts-mode): Set 'comment-start-skip'.
2025-04-26 14:37:02 +03:00