1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2025-12-16 10:50:49 -08:00

Merge from origin/emacs-29

9f5008b9b2 Improve error message from sqlite-mode.el
73b304bb74 ; Fix last change: remove unused @anchor.
d2efee31ed ; Update htmlfontify documentation
72d2604d1f Merge branch 'emacs-29' of git.savannah.gnu.org:/srv/git/...
cf31182684 ; * lisp/files.el (insert-directory-wildcard-in-dir-p): D...
3fa10f6e54 ; Add more c-ts-mode indent and filling tests
25a5575f16 Fix c-ts-mode block comment indentation (bug#60270)
252b2c01af Fix c-ts-mode label indent
189d976dba Fix statement indent for c-ts-mode (bug#59686) (bug#60280)
c78e19d99c Allow offset in tree-sitter indent rules to be functions
d13a329acf ; Minor change in c-ts-mode--indent-styles
d428d51066 Support filling line comments in c-ts-mode
f02998939c ; Fix c-ts-mode filling
b365a7cc32 Fix expansion of wildcards in ls-lisp.el
b5e0260f42 Fix messages displayed when diary is shown
This commit is contained in:
Stefan Kangas 2023-01-15 13:08:06 +01:00
commit 0052aa54f6
11 changed files with 526 additions and 116 deletions

View file

@ -4926,8 +4926,7 @@ the current line to @var{matcher}; if it returns non-@code{nil}, this
rule is applicable. Then Emacs passes the node to @var{anchor}, which rule is applicable. Then Emacs passes the node to @var{anchor}, which
returns a buffer position. Emacs takes the column number of that returns a buffer position. Emacs takes the column number of that
position, adds @var{offset} to it, and the result is the indentation position, adds @var{offset} to it, and the result is the indentation
column for the current line. @var{offset} can be an integer or a column for the current line.
variable whose value is an integer.
The @var{matcher} and @var{anchor} are functions, and Emacs provides The @var{matcher} and @var{anchor} are functions, and Emacs provides
convenient defaults for them. convenient defaults for them.
@ -4943,10 +4942,13 @@ inside a multi-line string, no node can start at that position, so
@var{node} is @code{nil}. In that case, @var{parent} would be the @var{node} is @code{nil}. In that case, @var{parent} would be the
smallest node that spans that position. smallest node that spans that position.
Emacs finds @var{bol}, @var{node} and @var{parent} and @var{matcher} should return non-@code{nil} if the rule is applicable,
passes them to each @var{matcher} and @var{anchor}. @var{matcher} and @var{anchor} should return a buffer position.
should return non-@code{nil} if the rule is applicable, and
@var{anchor} should return a buffer position. @var{offset} can be an integer, a variable whose value is an integer,
or a function that returns an integer. If it is a function, it is
passed @var{node}, @var{parent}, and @var{bol}, like matchers and
anchors.
@end defvar @end defvar
@defvar treesit-simple-indent-presets @defvar treesit-simple-indent-presets

View file

@ -1351,11 +1351,10 @@ Whether or not to split the index @ref{hfy-index-file} alphabetically
on the first letter of each tag. Useful when the index would otherwise on the first letter of each tag. Useful when the index would otherwise
be large and take a long time to render or be difficult to navigate. be large and take a long time to render or be difficult to navigate.
@item hfy-find-cmd @item hfy-exclude-file-rules
@vindex hfy-find-cmd @vindex hfy-exclude-file-rules
@anchor{hfy-find-cmd}
The ``find'' command used to harvest a list of files to attempt to fontify. Regular expressions to exclude files which shouldn't be fontified.
@item hfy-extn @item hfy-extn
@vindex hfy-extn @vindex hfy-extn
@ -1545,12 +1544,6 @@ but you should be able to override this.
See: @ref{Customization} See: @ref{Customization}
@item
A copy of find (e.g., GNU find) that provides the @code{-path} predicate.
You may be able to work around this with a suitable clever shell
command and the customization entry: @ref{hfy-find-cmd}
@item @item
A copy of sed (e.g., GNU sed). A copy of sed (e.g., GNU sed).

View file

@ -880,7 +880,10 @@ LIST-ONLY is non-nil, in which case it just returns the list."
(original-date original-date)) (original-date original-date))
(run-hooks 'diary-hook)))))) (run-hooks 'diary-hook))))))
(and temp-buff (buffer-name temp-buff) (kill-buffer temp-buff))) (and temp-buff (buffer-name temp-buff) (kill-buffer temp-buff)))
(or d-incp (message "Preparing diary...done")) (or d-incp
;; Don't clobber messages displayed while preparing the diary.
(not (equal (current-message) "Preparing diary..."))
(message "Preparing diary...done"))
diary-entries-list))) diary-entries-list)))
(defun diary-unhide-everything () (defun diary-unhide-everything ()

View file

@ -7675,9 +7675,12 @@ regardless of the language.")
(defvar insert-directory-ls-version 'unknown) (defvar insert-directory-ls-version 'unknown)
(defun insert-directory-wildcard-in-dir-p (dir) (defun insert-directory-wildcard-in-dir-p (dir)
"Return non-nil if DIR contents a shell wildcard in the directory part. "Return non-nil if DIR contains shell wildcards in its parent directory part.
The return value is a cons (DIR . WILDCARDS); DIR is the The return value is a cons (DIRECTORY . WILDCARD), where DIRECTORY is the
`default-directory' in the Dired buffer, and WILDCARDS are the wildcards. part of DIR up to and excluding the first component that includes
wildcard characters, and WILDCARD is the rest of DIR's components. The
DIRECTORY part of the value includes the trailing slash, to indicate that
it is a directory.
Valid wildcards are `*', `?', `[abc]' and `[a-z]'." Valid wildcards are `*', `?', `[abc]' and `[a-z]'."
(let ((wildcards "[?*")) (let ((wildcards "[?*"))

View file

@ -482,8 +482,22 @@ not contain `d', so that a full listing is expected."
(if (not dir-wildcard) (if (not dir-wildcard)
(funcall orig-fun dir-or-list switches) (funcall orig-fun dir-or-list switches)
(let* ((default-directory (car dir-wildcard)) (let* ((default-directory (car dir-wildcard))
(files (file-expand-wildcards (cdr dir-wildcard))) (wildcard (cdr dir-wildcard))
(files (file-expand-wildcards wildcard))
(dir (car dir-wildcard))) (dir (car dir-wildcard)))
;; When the wildcard ends in a slash, file-expand-wildcards
;; returns nil; fix that by treating the wildcards as
;; specifying only directories whose names match the
;; widlcard.
(if (and (null files)
(directory-name-p wildcard))
(setq files
(delq nil
(mapcar (lambda (fname)
(if (file-accessible-directory-p fname)
fname))
(file-expand-wildcards
(directory-file-name wildcard))))))
(if files (if files
(let ((inhibit-read-only t) (let ((inhibit-read-only t)
(buf (buf
@ -494,7 +508,7 @@ not contain `d', so that a full listing is expected."
(dired-goto-next-file) (dired-goto-next-file)
(forward-line 0) (forward-line 0)
(insert " wildcard " (cdr dir-wildcard) "\n")))) (insert " wildcard " (cdr dir-wildcard) "\n"))))
(user-error "No files matching regexp"))))))) (user-error "No files matching wildcard")))))))
(advice-add 'dired :around #'ls-lisp--dired) (advice-add 'dired :around #'ls-lisp--dired)

View file

@ -118,7 +118,6 @@ MODE is either `c' or `cpp'."
`(((parent-is "translation_unit") parent-bol 0) `(((parent-is "translation_unit") parent-bol 0)
((node-is ")") parent 1) ((node-is ")") parent 1)
((node-is "]") parent-bol 0) ((node-is "]") parent-bol 0)
((node-is "}") c-ts-mode--bracket-children-anchor 0)
((node-is "else") parent-bol 0) ((node-is "else") parent-bol 0)
((node-is "case") parent-bol 0) ((node-is "case") parent-bol 0)
((node-is "preproc_arg") no-indent) ((node-is "preproc_arg") no-indent)
@ -130,17 +129,28 @@ MODE is either `c' or `cpp'."
c-ts-mode--comment-2nd-line-anchor c-ts-mode--comment-2nd-line-anchor
1) 1)
((parent-is "comment") prev-adaptive-prefix 0) ((parent-is "comment") prev-adaptive-prefix 0)
(c-ts-mode--top-level-label-matcher point-min 1)
;; Labels.
((node-is "labeled_statement") parent-bol 0) ((node-is "labeled_statement") parent-bol 0)
((parent-is "labeled_statement") parent-bol c-ts-mode-indent-offset) ((parent-is "labeled_statement")
point-min c-ts-mode--statement-offset)
((match "preproc_ifdef" "compound_statement") point-min 0) ((match "preproc_ifdef" "compound_statement") point-min 0)
((match "#endif" "preproc_ifdef") point-min 0) ((match "#endif" "preproc_ifdef") point-min 0)
((match "preproc_if" "compound_statement") point-min 0) ((match "preproc_if" "compound_statement") point-min 0)
((match "#endif" "preproc_if") point-min 0) ((match "#endif" "preproc_if") point-min 0)
((match "preproc_function_def" "compound_statement") point-min 0) ((match "preproc_function_def" "compound_statement") point-min 0)
((match "preproc_call" "compound_statement") point-min 0) ((match "preproc_call" "compound_statement") point-min 0)
;; {} blocks.
((node-is "}") point-min c-ts-mode--close-bracket-offset)
((parent-is "compound_statement") ((parent-is "compound_statement")
c-ts-mode--bracket-children-anchor c-ts-mode-indent-offset) point-min c-ts-mode--statement-offset)
((parent-is "enumerator_list")
point-min c-ts-mode--statement-offset)
((parent-is "field_declaration_list")
point-min c-ts-mode--statement-offset)
((parent-is "function_definition") parent-bol 0) ((parent-is "function_definition") parent-bol 0)
((parent-is "conditional_expression") first-sibling 0) ((parent-is "conditional_expression") first-sibling 0)
((parent-is "assignment_expression") parent-bol c-ts-mode-indent-offset) ((parent-is "assignment_expression") parent-bol c-ts-mode-indent-offset)
@ -156,12 +166,11 @@ MODE is either `c' or `cpp'."
((query "(for_statement update: (_) @indent)") parent-bol 5) ((query "(for_statement update: (_) @indent)") parent-bol 5)
((query "(call_expression arguments: (_) @indent)") parent c-ts-mode-indent-offset) ((query "(call_expression arguments: (_) @indent)") parent c-ts-mode-indent-offset)
((parent-is "call_expression") parent 0) ((parent-is "call_expression") parent 0)
((parent-is "enumerator_list") parent-bol c-ts-mode-indent-offset)
,@(when (eq mode 'cpp) ,@(when (eq mode 'cpp)
'(((node-is "access_specifier") parent-bol 0) '(((node-is "access_specifier") parent-bol 0)
;; Indent the body of namespace definitions. ;; Indent the body of namespace definitions.
((parent-is "declaration_list") parent-bol c-ts-mode-indent-offset))) ((parent-is "declaration_list") parent-bol c-ts-mode-indent-offset)))
((parent-is "field_declaration_list") parent-bol c-ts-mode-indent-offset)
((parent-is "initializer_list") parent-bol c-ts-mode-indent-offset) ((parent-is "initializer_list") parent-bol c-ts-mode-indent-offset)
((parent-is "if_statement") parent-bol c-ts-mode-indent-offset) ((parent-is "if_statement") parent-bol c-ts-mode-indent-offset)
((parent-is "for_statement") parent-bol c-ts-mode-indent-offset) ((parent-is "for_statement") parent-bol c-ts-mode-indent-offset)
@ -174,6 +183,7 @@ MODE is either `c' or `cpp'."
`((gnu `((gnu
;; Prepend rules to set highest priority ;; Prepend rules to set highest priority
((match "while" "do_statement") parent 0) ((match "while" "do_statement") parent 0)
(c-ts-mode--top-level-label-matcher point-min 1)
,@common) ,@common)
(k&r ,@common) (k&r ,@common)
(linux (linux
@ -210,25 +220,55 @@ NODE should be a labeled_statement."
(let ((func (treesit-parent-until (let ((func (treesit-parent-until
node (lambda (n) node (lambda (n)
(equal (treesit-node-type n) (equal (treesit-node-type n)
"function_definition"))))) "compound_statement")))))
(and (equal (treesit-node-type node) (and (equal (treesit-node-type node)
"labeled_statement") "labeled_statement")
(not (treesit-node-top-level func "function_definition"))))) (not (treesit-node-top-level func "compound_statement")))))
(defun c-ts-mode--bracket-children-anchor (_n parent &rest _) (defvar c-ts-mode-indent-block-type-regexp
"This anchor is used for children of a compound_statement. (rx (or "compound_statement"
So anything inside a {} block. PARENT should be the "field_declaration_list"
compound_statement. This anchor looks at the {, if itson its own "enumeratior_list"))
line, anchor at it, if it has stuff before it, anchor at the "Regexp matching types of block nodes (i.e., {} blocks).")
beginning of grandparent."
(defun c-ts-mode--statement-offset (node parent &rest _)
"This anchor is used for children of a statement inside a block.
This function basically counts the number of block nodes (defined
by `c-ts-mode--indent-block-type-regexp') between NODE and the
root node (not counting NODE itself), and multiply that by
`c-ts-mode-indent-offset'.
To support GNU style, on each block level, this function also
checks whether the opening bracket { is on its own line, if so,
it adds an extra level, except for the top-level.
PARENT is NODE's parent."
(let ((level 0))
;; If point is on an empty line, NODE would be nil, but we pretend
;; there is a statement node.
(when (null node)
(setq node t))
(while (if (eq node t)
(setq node parent)
(setq node (treesit-node-parent node)))
(when (string-match-p c-ts-mode-indent-block-type-regexp
(treesit-node-type node))
(cl-incf level)
(save-excursion (save-excursion
(goto-char (treesit-node-start parent)) (goto-char (treesit-node-start node))
(let ((bol (line-beginning-position))) (cond ((bolp) nil)
(skip-chars-backward " \t") ((looking-back (rx bol (* whitespace))
(treesit-node-start (line-beginning-position))
(if (< bol (point)) (cl-incf level))))))
(treesit-node-parent parent) (* level c-ts-mode-indent-offset)))
parent)))))
(defun c-ts-mode--close-bracket-offset (node parent &rest _)
"Offset for the closing bracket, NODE.
It's basically one level less that the statements in the block.
PARENT is NODE's parent."
(- (c-ts-mode--statement-offset node parent)
c-ts-mode-indent-offset))
(defun c-ts-mode--looking-at-star (_n _p bol &rest _) (defun c-ts-mode--looking-at-star (_n _p bol &rest _)
"A tree-sitter simple indent matcher. "A tree-sitter simple indent matcher.
@ -254,14 +294,15 @@ PARENT should be a comment node."
(back-to-indentation) (back-to-indentation)
(eq (point) (treesit-node-start parent))))) (eq (point) (treesit-node-start parent)))))
(defun c-ts-mode--comment-2nd-line-anchor (&rest _) (defun c-ts-mode--comment-2nd-line-anchor (_n _p bol &rest _)
"Return appropriate anchor for the second line of a comment. "Return appropriate anchor for the second line of a comment.
If the first line is /* alone, return the position right after If the first line is /* alone, return the position right after
the star; if the first line is /* followed by some text, return the star; if the first line is /* followed by some text, return
the position right before the text minus 1. the position right before the text minus 1.
Use an offset of 1 with this anchor." Use an offset of 1 with this anchor. BOL is the beginning of
non-whitespace characters of the current line."
(save-excursion (save-excursion
(forward-line -1) (forward-line -1)
(back-to-indentation) (back-to-indentation)
@ -270,8 +311,17 @@ Use an offset of 1 with this anchor."
(if (looking-at (rx (* (or " " "\t")) eol)) (if (looking-at (rx (* (or " " "\t")) eol))
;; Only /* at the first line. ;; Only /* at the first line.
(progn (skip-chars-backward " \t") (progn (skip-chars-backward " \t")
(point)) (if (save-excursion
;; There is something after /* at the first line. (goto-char bol)
(looking-at (rx "*")))
;; The common case. Checked by "Multiline Block
;; Comments 4".
(point)
;; The "Multiline Block Comments 2" test in
;; c-ts-mode-resources/indent.erts checks this.
(1- (point))))
;; There is something after /* at the first line. The
;; "Multiline Block Comments 3" test checks this.
(1- (point)))))) (1- (point))))))
;;; Font-lock ;;; Font-lock
@ -671,24 +721,43 @@ the semicolon. This function skips the semicolon."
;;; Filling ;;; Filling
(defvar c-ts-mode--comment-regexp
;; These covers C/C++, Java, JavaScript, TypeScript, Rust, C#.
(rx (or "comment" "line_comment" "block_comment"))
"Regexp pattern that matches a comment in C-like languages.")
(defun c-ts-mode--fill-paragraph (&optional arg) (defun c-ts-mode--fill-paragraph (&optional arg)
"Fillling function for `c-ts-mode'. "Fillling function for `c-ts-mode'.
ARG is passed to `fill-paragraph'." ARG is passed to `fill-paragraph'."
(interactive "*P") (interactive "*P")
(save-restriction (save-restriction
(widen) (widen)
(let ((node (treesit-node-at (point))))
(when (string-match-p c-ts-mode--comment-regexp
(treesit-node-type node))
(if (save-excursion
(goto-char (treesit-node-start node))
(looking-at "//"))
(fill-comment-paragraph arg)
(c-ts-mode--fill-block-comment arg)))
;; Return t so `fill-paragraph' doesn't attempt to fill by
;; itself.
t)))
(defun c-ts-mode--fill-block-comment (&optional arg)
"Fillling function for block comments.
ARG is passed to `fill-paragraph'. Assume point is in a block
comment."
(let* ((node (treesit-node-at (point))) (let* ((node (treesit-node-at (point)))
(start (treesit-node-start node)) (start (treesit-node-start node))
(end (treesit-node-end node)) (end (treesit-node-end node))
;; Bind to nil to avoid infinite recursion. ;; Bind to nil to avoid infinite recursion.
(fill-paragraph-function nil) (fill-paragraph-function nil)
(orig-point (point-marker)) (orig-point (point-marker))
(start-marker nil) (start-marker (point-marker))
(end-marker nil) (end-marker nil)
(end-len 0)) (end-len 0))
;; These covers C/C++, Java, JavaScript, TypeScript, Rust, C#. (move-marker start-marker start)
(when (member (treesit-node-type node)
'("comment" "line_comment" "block_comment"))
;; We mask "/*" and the space before "*/" like ;; We mask "/*" and the space before "*/" like
;; `c-fill-paragraph' does. ;; `c-fill-paragraph' does.
(atomic-change-group (atomic-change-group
@ -697,7 +766,7 @@ ARG is passed to `fill-paragraph'."
(when (looking-at (rx (* (syntax whitespace)) (when (looking-at (rx (* (syntax whitespace))
(group "/") "*")) (group "/") "*"))
(goto-char (match-beginning 1)) (goto-char (match-beginning 1))
(setq start-marker (point-marker)) (move-marker start-marker (point))
(replace-match " " nil nil nil 1)) (replace-match " " nil nil nil 1))
;; Include whitespaces before /*. ;; Include whitespaces before /*.
(goto-char start) (goto-char start)
@ -738,11 +807,7 @@ ARG is passed to `fill-paragraph'."
(when end-marker (when end-marker
(goto-char end-marker) (goto-char end-marker)
(delete-region (point) (+ end-len (point))) (delete-region (point) (+ end-len (point)))
(insert (make-string end-len ?\s)))) (insert (make-string end-len ?\s))))))
(goto-char orig-point))
;; Return t so `fill-paragraph' doesn't attempt to fill by
;; itself.
t)))
(defun c-ts-mode-comment-setup () (defun c-ts-mode-comment-setup ()
"Set up local variables for C-like comment. "Set up local variables for C-like comment.

View file

@ -55,10 +55,14 @@
(interactive "fSQLite file name: ") (interactive "fSQLite file name: ")
(unless (sqlite-available-p) (unless (sqlite-available-p)
(error "This Emacs doesn't have SQLite support, so it can't view SQLite files")) (error "This Emacs doesn't have SQLite support, so it can't view SQLite files"))
(if (file-remote-p file)
(error "Remote SQLite files are not yet supported"))
(pop-to-buffer (get-buffer-create (pop-to-buffer (get-buffer-create
(format "*SQLite %s*" (file-name-nondirectory file)))) (format "*SQLite %s*" (file-name-nondirectory file))))
(sqlite-mode) (sqlite-mode)
(setq-local sqlite--db (sqlite-open file)) (setq-local sqlite--db (sqlite-open file))
(unless (sqlitep sqlite--db)
(error "`sqlite-open' failed to open SQLite file"))
(sqlite-mode-list-tables)) (sqlite-mode-list-tables))
(defun sqlite-mode-list-tables () (defun sqlite-mode-list-tables ()

View file

@ -1511,10 +1511,15 @@ OFFSET."
return return
(let ((anchor-pos (let ((anchor-pos
(treesit--simple-indent-eval (treesit--simple-indent-eval
(list anchor node parent bol)))) (list anchor node parent bol)))
(cons anchor-pos (if (symbolp offset) (offset-val
(symbol-value offset) (cond ((numberp offset) offset)
offset))) ((and (symbolp offset)
(boundp offset))
(symbol-value offset))
(t (treesit--simple-indent-eval
(list offset node parent bol))))))
(cons anchor-pos offset-val))
finally return finally return
(progn (when treesit--indent-verbose (progn (when treesit--indent-verbose
(message "No matched rule")) (message "No matched rule"))

View file

@ -0,0 +1,198 @@
Code:
(lambda ()
(c-ts-mode)
(setq-local indent-tabs-mode nil)
(fill-paragraph))
Point-Char: |
Name: Type 1
=-=
/* woooomy woooomy woooomy woooomy woooomy woooomy woooomy woooomy woooomy
* woooomy woooomy woooomy woooomy woooomy woooomy woooomy woooomy
* woooomy woooomy woooomy woooomy woooomy woooomy woooomy
*/
=-=
/* woooomy woooomy woooomy woooomy woooomy woooomy woooomy woooomy
* woooomy woooomy woooomy woooomy woooomy woooomy woooomy woooomy
* woooomy woooomy woooomy woooomy woooomy woooomy woooomy woooomy
*/
=-=-=
Name: Type 2
=-=
/* woooomy woooomy woooomy woooomy woooomy woooomy woooomy woooomy woooomy
* woooomy woooomy woooomy woooomy woooomy woooomy woooomy woooomy
woooomy woooomy woooomy woooomy woooomy woooomy woooomy
*/
=-=
/* woooomy woooomy woooomy woooomy woooomy woooomy woooomy woooomy
* woooomy woooomy woooomy woooomy woooomy woooomy woooomy woooomy
* woooomy woooomy woooomy woooomy woooomy woooomy woooomy woooomy
*/
=-=-=
Name: Type 3
=-=
/*================================================================
woooomy woooomy woooomy woooomy woooomy woooomy woooomy woooomy woooomy
woooomy woooomy woooomy woooomy woooomy woooomy woooomy
woooomy woooomy woooomy woooomy woooomy woooomy woooomy
================================================================*/
=-=
/*================================================================
woooomy woooomy woooomy woooomy woooomy woooomy woooomy woooomy
woooomy woooomy woooomy woooomy woooomy woooomy woooomy woooomy
woooomy woooomy woooomy woooomy woooomy woooomy woooomy
================================================================*/
=-=-=
Name: Type 4
=-=
/*================================================================
* woooomy woooomy woooomy woooomy woooomy woooomy woooomy woooomy
woooomy woooomy woooomy woooomy woooomy woooomy woooomy woooomy
woooomy woooomy woooomy woooomy woooomy
* ================================================================*/
=-=
/*================================================================
* woooomy woooomy woooomy woooomy woooomy woooomy woooomy woooomy
* woooomy woooomy woooomy woooomy woooomy woooomy woooomy woooomy
* woooomy woooomy woooomy woooomy woooomy
* ================================================================*/
=-=-=
Name: Type 5
/* woooomy woooomy woooomy woooomy woooomy woooomy woooomy woooomy woooomy
* woooomy woooomy woooomy woooomy woooomy woooomy woooomy woooomy
* woooomy woooomy woooomy woooomy woooomy woooomy woooomy
*/
=-=
/* woooomy woooomy woooomy woooomy woooomy woooomy woooomy woooomy
* woooomy woooomy woooomy woooomy woooomy woooomy woooomy woooomy
* woooomy woooomy woooomy woooomy woooomy woooomy woooomy woooomy
*/
=-=-=
Name: Type 6
=-=
/* woooomy woooomy woooomy woooomy woooomy woooomy woooomy woooomy woooomy
woooomy woooomy woooomy woooomy woooomy woooomy woooomy woooomy
woooomy woooomy woooomy woooomy woooomy woooomy woooomy
*/
=-=
/* woooomy woooomy woooomy woooomy woooomy woooomy woooomy woooomy
woooomy woooomy woooomy woooomy woooomy woooomy woooomy woooomy
woooomy woooomy woooomy woooomy woooomy woooomy woooomy woooomy
*/
=-=-=
Name: Type 6
=-=
/* woooomy woooomy woooomy woooomy woooomy woooomy woooomy woooomy woooomy
woooomy woooomy woooomy woooomy woooomy woooomy woooomy woooomy
woooomy woooomy woooomy woooomy woooomy woooomy woooomy
*/
=-=
/* woooomy woooomy woooomy woooomy woooomy woooomy woooomy woooomy
woooomy woooomy woooomy woooomy woooomy woooomy woooomy woooomy
woooomy woooomy woooomy woooomy woooomy woooomy woooomy woooomy
*/
=-=-=
Name: Type 7
=-=
// woooomy woooomy woooomy woooomy woooomy woooomy woooomy woooomy woooomy
// woooomy woooomy woooomy woooomy woooomy woooomy woooomy woooomy
// woooomy woooomy woooomy woooomy woooomy woooomy woooomy
=-=
// woooomy woooomy woooomy woooomy woooomy woooomy woooomy woooomy
// woooomy woooomy woooomy woooomy woooomy woooomy woooomy woooomy
// woooomy woooomy woooomy woooomy woooomy woooomy woooomy woooomy
=-=-=
Name: Type 8
=-=
// ================================================================
// woooomy woooomy woooomy woooomy woooomy woooomy woooomy woooomy woooomy
// woooomy woooomy woooomy woooomy woooomy woooomy woooomy woooomy
// woooomy woooomy woooomy woooomy woooomy woooomy woooomy
// ================================================================
=-=
// ================================================================
// woooomy woooomy woooomy woooomy woooomy woooomy woooomy woooomy
// woooomy woooomy woooomy woooomy woooomy woooomy woooomy woooomy
// woooomy woooomy woooomy woooomy woooomy woooomy woooomy woooomy
// ================================================================
=-=-=
Name: Type 9
=-=
/* woooomy woooomy woooomy woooomy woooomy woooomy woooomy woooomy woooomy
woooomy woooomy woooomy woooomy woooomy woooomy woooomy woooomy
woooomy woooomy woooomy woooomy woooomy woooomy woooomyyy */
=-=
/* woooomy woooomy woooomy woooomy woooomy woooomy woooomy woooomy
woooomy woooomy woooomy woooomy woooomy woooomy woooomy woooomy
woooomy woooomy woooomy woooomy woooomy woooomy woooomy
woooomyyy */
=-=-=
Name: Not Over Fill 1
=-=
// woooomy woooomy woooomy woooomy woooomy woooomy woooomy woooomy woooomy
// woooomy woooomy woooomy woooomy woooomy woooomy woooomy woooomy
// woooomy woooomy woooomy woooomy woooomy woooomy woooomy
// |woooomy woooomy woooomy woooomy woooomy woooomy woooomy woooomy
// woooomy woooomy woooomy woooomy woooomy woooomy woooomy woooomy
// woooomy woooomy woooomy woooomy woooomy woooomy woooomy woooomy
// woooomy woooomy woooomy woooomy woooomy woooomy woooomy woooomy woooomy
// woooomy woooomy woooomy woooomy woooomy woooomy woooomy woooomy
// woooomy woooomy woooomy woooomy woooomy woooomy woooomy
=-=-=
Name: Not Over Fill 2
=-=
// woooomy woooomy woooomy woooomy woooomy woooomy woooomy woooomy woooomy
return; // woooomy woooomy woooomy woooomy woooomy woooomy woooomy
//| woooomy woooomy woooomy woooomy woooomy woooomy woooomy woooomy woooomy
// woooomy woooomy woooomy woooomy woooomy woooomy woooomy
return; // woooomy woooomy woooomy woooomy woooomy woooomy woooomy woooomy
=-=
// woooomy woooomy woooomy woooomy woooomy woooomy woooomy woooomy woooomy
return; // woooomy woooomy woooomy woooomy woooomy woooomy woooomy
// woooomy woooomy woooomy woooomy woooomy woooomy woooomy woooomy
// woooomy woooomy woooomy woooomy woooomy woooomy woooomy woooomy
return; // woooomy woooomy woooomy woooomy woooomy woooomy woooomy woooomy
=-=-=
Name: Not Over Fill 3
=-=
// woooomy woooomy woooomy woooomy woooomy woooomy woooomy woooomy woooomy
return; //| woooomy woooomy woooomy woooomy woooomy woooomy woooomy
// woooomy woooomy woooomy woooomy woooomy woooomy woooomy woooomy woooomy
// woooomy woooomy woooomy woooomy woooomy woooomy woooomy
return; // woooomy woooomy woooomy woooomy woooomy woooomy woooomy woooomy
=-=
// woooomy woooomy woooomy woooomy woooomy woooomy woooomy woooomy woooomy
return; // woooomy woooomy woooomy woooomy woooomy woooomy woooomy
// woooomy woooomy woooomy woooomy woooomy woooomy woooomy
// woooomy woooomy woooomy woooomy woooomy woooomy woooomy
// woooomy woooomy
return; // woooomy woooomy woooomy woooomy woooomy woooomy woooomy woooomy
=-=-=

View file

@ -1,8 +1,13 @@
Code: Code:
(lambda () (lambda ()
(setq indent-tabs-mode nil)
(setq c-ts-mode-indent-offset 2)
(setq c-ts-mode-indent-style 'gnu)
(c-ts-mode) (c-ts-mode)
(indent-region (point-min) (point-max))) (indent-region (point-min) (point-max)))
Point-Char: |
Name: Basic Name: Basic
=-= =-=
@ -25,6 +30,68 @@ main (void)
} }
=-=-= =-=-=
Name: Labels (GNU Style)
=-=
int
main (void)
{
label:
return 0;
if (true)
{
label:
return 0;
}
else
{
if (true)
{
label:
return 0;
}
}
}
=-=-=
Name: For Loop with Multi-line Condition (GNU Style)
=-=
int main()
{
for (int i = 0;
i < b;
i++)
{
return 0;
}
}
=-=-=
Name: If-Else (GNU Style)
=-=
int main()
{
if (true)
{
return 0;
}
else
{
return 1;
}
}
=-=-=
Name: Empty Line
=-=
int main()
{
|
}
=-=-=
Name: Multiline Parameter List (bug#60398) Name: Multiline Parameter List (bug#60398)
=-= =-=
@ -34,7 +101,7 @@ int f2(int x,
}; };
=-=-= =-=-=
Name: Multiline Block Comments (bug#60270) Name: Multiline Block Comments 1 (bug#60270)
=-= =-=
/** /**
@ -42,3 +109,55 @@ Name: Multiline Block Comments (bug#60270)
* @arg1: * @arg1:
*/ */
=-=-= =-=-=
Name: Multiline Block Comments 2 (bug#60270)
=-=
/*
some comment
*/
=-=-=
Name: Multiline Block Comments 3 (bug#60270)
=-=
/* some comment
*/
=-=-=
Name: Multiline Block Comments 4 (bug#60270)
=-=
/*
* Some comment
*/
=-=-=
Code:
(lambda ()
(setq indent-tabs-mode nil)
(setq c-ts-mode-indent-offset 8)
(setq c-ts-mode-indent-style 'linux)
(c-ts-mode)
(indent-region (point-min) (point-max)))
Name: Labels (Linux Style)
=-=-=
int main (void)
{
label:
return 0;
if (true) {
label:
return 0;
}
else {
if (true) {
label:
return 0;
}
}
}
=-=-=

View file

@ -27,5 +27,9 @@
(skip-unless (treesit-ready-p 'c)) (skip-unless (treesit-ready-p 'c))
(ert-test-erts-file (ert-resource-file "indent.erts"))) (ert-test-erts-file (ert-resource-file "indent.erts")))
(ert-deftest c-ts-mode-test-filling ()
(skip-unless (treesit-ready-p 'c))
(ert-test-erts-file (ert-resource-file "filling.erts")))
(provide 'c-ts-mode-tests) (provide 'c-ts-mode-tests)
;;; c-ts-mode-tests.el ends here ;;; c-ts-mode-tests.el ends here