emacs-31 062dcd2aead: Fix prev-adaptive-prefix anchor (bug#61314)
Eli Zaretskii <[email protected]>
| Newsgroups | gmane.emacs.diffs |
|---|---|
| Message-ID | <[email protected]> |
branch: emacs-31 commit 062dcd2aead00c3b47c14ff5b6c40313f7a775f5 Author: Yuan Fu <[email protected]> Commit: Eli Zaretskii <[email protected]> Fix prev-adaptive-prefix anchor (bug#61314) * lisp/treesit.el (treesit-simple-indent-presets): Replace (match-beginning 1) with (skip-syntax-forward "-"), both returns the position of the beginning of the prefix, but skip-syntax-forward always works regardless whether adaptive-fill-regexp has a match group for the prefix. --- lisp/treesit.el | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/lisp/treesit.el b/lisp/treesit.el index 7fa7df08194..1273e43b2fe 100644 --- a/lisp/treesit.el +++ b/lisp/treesit.el @@ -2559,9 +2559,11 @@ as the anchor.") ;; has a prefix, indent to the beginning of ;; prev line's prefix rather than the end of ;; prev line's prefix. (Bug#61314). - (or (and this-line-has-prefix - (match-beginning 1)) - (match-end 0))))))) + (if this-line-has-prefix + (progn + (skip-syntax-forward "-") + (point)) + (match-end 0))))))) (cons 'grand-parent (lambda (_n parent &rest _) (treesit-node-start (treesit-node-parent parent))))