bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#59498: 29.0.50; c++-ts-mode get wrong-type-argument error when enabl


From: Eli Zaretskii
Subject: bug#59498: 29.0.50; c++-ts-mode get wrong-type-argument error when enabled
Date: Sun, 27 Nov 2022 08:24:21 +0200

> From: Yuan Fu <casouri@gmail.com>
> Date: Sat, 26 Nov 2022 14:11:48 -0800
> Cc: Randy Taylor <dev@rjt.dev>,
>  aqua0210@foxmail.com,
>  59498@debbugs.gnu.org,
>  mardani29@yahoo.es
> 
> >> +  (setq-local treesit-comment-start (rx "/" (or (+ "/") (+ "*"))))
> >> +  (setq-local treesit-comment-end (rx (+ (or "*")) "/"))
> >> 
> >>   (treesit-parser-create 'cpp)
> > 
> > Thanks, but this doesn't look right to me: why should c++-ts-mode set
> > variables for treesit.el?  It is more likely that treesit.el should use the
> > buffer-local values of comment-start and comment-end instead, and fall back
> > on generic values (if they make sense) only if the local values are not set.
> > 
> > Yuan, WDYT?
> 
> I added treesit-comment-start/end to help indenting comments. So this is the 
> correct way to use them. The following comment explains why I created new 
> variables:
> 
> ;; `comment-start' and `comment-end' assume there is only one type of
> ;; comment, and that the comment spans only one line.  So they are not
> ;; sufficient for our purpose.

??? This is surprisingly unclean, IMO.  For starters, the names of the
variables are confusing.  The need to define two sets of comment-start and
comment-end regexps is also a nuisance and a source of errors.

How do non-treesit modes handle this issue?  Why do the treesit-based modes
need something special here?

Stefan, any ideas?





reply via email to

[Prev in Thread] Current Thread [Next in Thread]