summaryrefslogtreecommitdiff
path: root/lisp/textmodes
diff options
context:
space:
mode:
authorSean Whitton <spwhitton@spwhitton.name>2026-05-29 11:01:25 +0100
committerSean Whitton <spwhitton@spwhitton.name>2026-05-29 11:01:25 +0100
commitc7167f2a1e9dd45603e349bb2b6ea88dca07282e (patch)
treea3812972b0387011db991044cfa35b1234286cca /lisp/textmodes
parent4870bc06fa36125ff7cb323a17dc67689f6d4109 (diff)
parentc3babe4b8966c3ada6305b2af85e24398190a14f (diff)
Merge from origin/emacs-31
c3babe4b896 Fix lax whitespace highlight during query-replace 2e70b88623e Fix fill-paragraph combining text with preceding comment ea54c33950f ; * etc/PROBLEMS: Link to bug#81124. 02897e208d0 emacsclient quote_argument is void c6181780663 ; Mark process-test-stderr-buffer as :unstable when runni... 2c1b45f5c56 ; Improve documentation of 'vc-dir-auto-hide-up-to-date' 768c8bf0045 Revert "* admin/notes/documentation: Recommend not using ... a7414f18598 native--compile-skip-on-battery-p: Try to fix ?b, ?B cond... 7cee526a8cc Save and restore original local keymap in grep-edit-mode 4d87d203cfb Fix display of inline SVG images in Rmail 4c55d04ebe3 Add treesit-ready-p check back to tree-sitter major modes... 7892ae5eaf4 Fix pathological slowness in flex completion 12eec781ed6 No longer raise error on HTTP 402 (Payment Required) (bug... 1800350b186 Avoid compilation-mode matching rust as gnu
Diffstat (limited to 'lisp/textmodes')
-rw-r--r--lisp/textmodes/css-mode.el4
-rw-r--r--lisp/textmodes/fill.el13
-rw-r--r--lisp/textmodes/mhtml-ts-mode.el4
-rw-r--r--lisp/textmodes/toml-ts-mode.el4
-rw-r--r--lisp/textmodes/yaml-ts-mode.el4
5 files changed, 25 insertions, 4 deletions
diff --git a/lisp/textmodes/css-mode.el b/lisp/textmodes/css-mode.el
index 355555df090..12632e24e0e 100644
--- a/lisp/textmodes/css-mode.el
+++ b/lisp/textmodes/css-mode.el
@@ -1888,7 +1888,9 @@ can also be used to fill comments.
\\{css-mode-map}"
:syntax-table css-mode-syntax-table
- (when (treesit-ensure-installed 'css)
+ ;; `treesit-ready-p' also checks for buffer size.
+ (when (and (treesit-ensure-installed 'css)
+ (treesit-ready-p 'css))
;; Borrowed from `css-mode'.
(setq-local syntax-propertize-function
css-syntax-propertize-function)
diff --git a/lisp/textmodes/fill.el b/lisp/textmodes/fill.el
index c1ccdf2ec5f..270cb388971 100644
--- a/lisp/textmodes/fill.el
+++ b/lisp/textmodes/fill.el
@@ -911,6 +911,7 @@ region, instead of just filling the current paragraph."
(fill-comment-paragraph justify)))
;; 4. If it all fails, default to the good ol' text paragraph filling.
(let ((before (point))
+ (paragraph-start-orig paragraph-start)
(paragraph-start paragraph-start)
;; Fill prefix used for filling the paragraph.
fill-pfx)
@@ -933,6 +934,18 @@ region, instead of just filling the current paragraph."
(setq fill-pfx "")
(let ((end (point))
(beg (progn (fill-forward-paragraph -1) (point))))
+ ;; If the paragraph starts with a comment line preceding point
+ ;; on a non-comment line, skip such comment lines, so they
+ ;; are not filled together (bug#80449).
+ (when (and fill-paragraph-handle-comment comment-start-skip
+ (< beg before))
+ (save-excursion
+ (goto-char beg)
+ (when (looking-at paragraph-start-orig)
+ (goto-char (1+ (match-end 0))))
+ (when (looking-at comment-start-skip)
+ (forward-line 1)
+ (setq beg (point)))))
(goto-char before)
(setq fill-pfx
(if use-hard-newlines
diff --git a/lisp/textmodes/mhtml-ts-mode.el b/lisp/textmodes/mhtml-ts-mode.el
index 2a1c62b87e4..d53d74e220a 100644
--- a/lisp/textmodes/mhtml-ts-mode.el
+++ b/lisp/textmodes/mhtml-ts-mode.el
@@ -511,7 +511,9 @@ Powered by tree-sitter."
;; jsdoc is not mandatory for js-ts-mode, so we respect this by
;; adding jsdoc range rules only when jsdoc is available.
- (when (treesit-ensure-installed 'jsdoc)
+ ;; `treesit-ready-p' also checks for buffer size.
+ (when (and (treesit-ensure-installed 'jsdoc)
+ (treesit-ready-p 'jsdoc))
(setq-local c-ts-common--comment-regexp
js--treesit-jsdoc-comment-regexp))
diff --git a/lisp/textmodes/toml-ts-mode.el b/lisp/textmodes/toml-ts-mode.el
index d3f09526b90..63e3f60edd9 100644
--- a/lisp/textmodes/toml-ts-mode.el
+++ b/lisp/textmodes/toml-ts-mode.el
@@ -138,7 +138,9 @@ Return nil if there is no name or if NODE is not a defun node."
:group 'toml-mode
:syntax-table toml-ts-mode--syntax-table
- (when (treesit-ensure-installed 'toml)
+ ;; `treesit-ready-p' also checks for buffer size.
+ (when (and (treesit-ensure-installed 'toml)
+ (treesit-ready-p 'toml))
(setq treesit-primary-parser (treesit-parser-create 'toml))
;; Comments
diff --git a/lisp/textmodes/yaml-ts-mode.el b/lisp/textmodes/yaml-ts-mode.el
index c1521c82c22..5afd4d2d111 100644
--- a/lisp/textmodes/yaml-ts-mode.el
+++ b/lisp/textmodes/yaml-ts-mode.el
@@ -262,7 +262,9 @@ Calls REPORT-FN directly."
:group 'yaml
:syntax-table yaml-ts-mode--syntax-table
- (when (treesit-ensure-installed 'yaml)
+ ;; `treesit-ready-p' also checks for buffer size.
+ (when (and (treesit-ensure-installed 'yaml)
+ (treesit-ready-p 'yaml))
(setq treesit-primary-parser (treesit-parser-create 'yaml))
;; Comments.