unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#70641: 29.1.90; default-indent-new-line cannot put comment delimiter on  c-ts-mode
@ 2024-04-29  2:12 김희석
  2024-04-29  7:42 ` Eli Zaretskii
  0 siblings, 1 reply; 4+ messages in thread
From: 김희석 @ 2024-04-29  2:12 UTC (permalink / raw)
  To: 70641



On c-mode, deurn default-indent-new-line auto-indent and
put delimitors on multiple lines of comment.

For example, if there is comments like this:
    /**
     * Comment like
     * this []
     */
When I press M-j (default-indent-new-line) on the point [], on
c-mode, emacs indent and put comment delimiter automatically
like this:
    /**
     * Comment like
     * this
     * []
     */
However on c-ts-mode, it does not works. It indents well, but
could not find or put the comment delimiter on new line when
I press M-j.
    /**
     * Comment like
     * this
     []
     */
On c-ts-mode, I found that the default value of variable comment-multi-line
is nil, which was t on c-mode, and above behavior is happend when I set
this value to t. When it was nil, comment become like this:
    /**
     * Comment like
     * this *//*
     []
     */
Which is intended behavior.

Also, on c-mode, when I write multiple lines of comment with first line
of comment is "/**", (like above examples) that block is set to have
the same font-lock face as string to make it easier to read, but
in c-ts-mode that behavior doesn't happen and they all have
the same face.

Thank you for reading. Please let me know if you need any further
information.


In GNU Emacs 29.1.90 (build 1, x86_64-apple-darwin21.6.0, NS
appkit-2113.60 Version 12.7.2 (Build 21G1974)) of 2023-12-16 built on
Mac-1702653425255.local
Repository revision: 06ec20fabf8f01ba706b4f19f3622f4edca79417
Repository branch: HEAD
Windowing system distributor 'Apple', version 10.3.2113
System Description:  macOS 12.7.4

Configured using:
'configure --with-ns --with-modules
'--enable-locallisppath=/Library/Application
Support/Emacs/${version}/site-lisp:/Library/Application
Support/Emacs/site-lisp:/usr/local/share/emacs/site-lisp'
--with-xwidgets --with-tree-sitter --with-native-compilation=aot
'CFLAGS=-I/usr/local/opt/gcc/include -I/usr/local/opt/libgccjit/include
-O2' 'LDFLAGS=-L/usr/local/opt/gcc/lib/gcc/13
-L/usr/local/opt/gcc/lib/gcc/13/gcc/x86_64-apple-darwin21/13
-L/usr/local/opt/libgccjit/lib/gcc/13 -I/usr/local/opt/gcc/include
-I/usr/local/opt/libgccjit/include -Wl,-headerpad_max_install_names''

Configured features:
ACL DBUS GIF GLIB GMP GNUTLS JPEG JSON LCMS2 LIBXML2 MODULES NATIVE_COMP
NOTIFY KQUEUE NS PDUMPER PNG RSVG SQLITE3 THREADS TIFF
TOOLKIT_SCROLL_BARS TREE_SITTER WEBP XIM XWIDGETS ZLIB

Important settings:
  value of $LANG: en_US.UTF-8
  locale-coding-system: utf-8-unix

Major mode: C/*

Minor modes in effect:
  eglot--managed-mode: t
  display-line-numbers-mode: t
  yas-global-mode: t
  yas-minor-mode: t
  company-mode: t
  flymake-mode: t
  counsel-mode: t
  ivy-mode: t
  global-git-commit-mode: t
  magit-auto-revert-mode: t
  auto-revert-mode: t
  shell-dirtrack-mode: t
  tooltip-mode: t
  global-eldoc-mode: t
  eldoc-mode: t
  show-paren-mode: t
  electric-indent-mode: t
  mouse-wheel-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  blink-cursor-mode: t
  column-number-mode: 1
  line-number-mode: t
  transient-mark-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t

Load-path shadows:
/Users/hskimse/.emacs.d/elpa/transient-20240405.1443/transient hides /Applications/Emacs.app/Contents/Resources/lisp/transient

Features:
(shadow sort mail-extr emacsbug align pulse jka-compr shortdoc facemenu
two-column misearch multi-isearch cl-print cus-edit cus-start cus-load
wid-edit help-fns radix-tree cc-mode cc-fonts cc-guess cc-menus cc-cmds
cc-styles cc-align cc-engine cc-vars cc-defs markdown-mode noutline
outline vc-git vc-dispatcher eglot external-completion array jsonrpc ert
ewoc debug backtrace find-func c++-ts-mode c-ts-mode c-ts-common treesit
magit-bookmark bookmark pp display-line-numbers yasnippet
company-oddmuse company-keywords company-etags etags fileloop generator
company-gtags company-dabbrev-code company-dabbrev company-files
company-clang company-capf company-cmake company-semantic
company-template company-bbdb company flymake-proc flymake thingatpt
counsel xdg xref project compile swiper ivy delsel ivy-faces ivy-overlay
colir color zenburn-theme magit-submodule magit-blame magit-stash
magit-reflog magit-bisect magit-push magit-pull magit-fetch magit-clone
magit-remote magit-commit magit-sequence magit-notes magit-worktree
magit-tag magit-merge magit-branch magit-reset magit-files magit-refs
magit-status magit magit-repos magit-apply magit-wip magit-log
which-func imenu magit-diff smerge-mode diff diff-mode easy-mmode
git-commit log-edit message sendmail yank-media puny rfc822 mml mml-sec
epa derived epg rfc6068 epg-config gnus-util text-property-search
time-date mm-decode mm-bodies mm-encode mail-parse rfc2231 rfc2047
rfc2045 mm-util ietf-drums mail-prsvr mailabbrev mail-utils gmm-utils
mailheader pcvs-util add-log magit-core magit-autorevert autorevert
filenotify magit-margin magit-transient magit-process with-editor comp
comp-cstr warnings icons rx shell pcomplete comint ansi-osc ring server
ansi-color magit-mode transient edmacro kmacro magit-git magit-base
magit-section format-spec cursor-sensor crm dash compat cl-extra
help-mode use-package-ensure use-package-core dired dired-loaddefs
finder-inf bm-autoloads company-autoloads counsel-autoloads
flycheck-eglot-autoloads flycheck-autoloads
gruber-darker-theme-autoloads highlight-numbers-autoloads
kuronami-theme-autoloads lsp-ui-autoloads lsp-mode-autoloads
ht-autoloads f-autoloads lv-autoloads magit-autoloads pcase
git-commit-autoloads magit-section-autoloads dash-autoloads
markdown-mode-autoloads parent-mode-autoloads s-autoloads
spinner-autoloads swiper-autoloads ivy-autoloads transient-autoloads
vterm-autoloads with-editor-autoloads info compat-autoloads
yasnippet-autoloads zenburn-theme-autoloads package browse-url url
url-proxy url-privacy url-expand url-methods url-history url-cookie
generate-lisp-file url-domsuf url-util mailcap url-handlers url-parse
auth-source cl-seq eieio eieio-core cl-macs password-cache json subr-x
map byte-opt gv bytecomp byte-compile url-vars cl-loaddefs cl-lib rmc
iso-transl tooltip cconv eldoc paren electric uniquify ediff-hook
vc-hooks lisp-float-type elisp-mode mwheel term/ns-win ns-win
ucs-normalize mule-util term/common-win tool-bar dnd fontset image
regexp-opt fringe tabulated-list replace newcomment text-mode lisp-mode
prog-mode register page tab-bar menu-bar rfn-eshadow isearch easymenu
timer select scroll-bar mouse jit-lock font-lock syntax font-core
term/tty-colors frame minibuffer nadvice seq simple cl-generic
indonesian philippine cham georgian utf-8-lang misc-lang vietnamese
tibetan thai tai-viet lao korean japanese eucjp-ms cp51932 hebrew greek
romanian slovak czech european ethiopic indian cyrillic chinese
composite emoji-zwj charscript charprop case-table epa-hook
jka-cmpr-hook help abbrev obarray oclosure cl-preloaded button loaddefs
theme-loaddefs faces cus-face macroexp files window text-properties
overlay sha1 md5 base64 format env code-pages mule custom widget keymap
hashtable-print-readable backquote threads xwidget-internal dbusbind
kqueue cocoa ns lcms2 multi-tty make-network-process native-compile
emacs)

Memory information:
((conses 16 666992 60017)
(symbols 48 33157 0)
(strings 32 162775 9027)
(string-bytes 1 4905120)
(vectors 16 61754)
(vector-slots 8 1096185 66730)
(floats 8 335 320)
(intervals 56 8515 422)
(buffers 984 27))





^ permalink raw reply	[flat|nested] 4+ messages in thread

* bug#70641: 29.1.90; default-indent-new-line cannot put comment delimiter on  c-ts-mode
  2024-04-29  2:12 bug#70641: 29.1.90; default-indent-new-line cannot put comment delimiter on c-ts-mode 김희석
@ 2024-04-29  7:42 ` Eli Zaretskii
  2024-04-30  4:57   ` Yuan Fu
  0 siblings, 1 reply; 4+ messages in thread
From: Eli Zaretskii @ 2024-04-29  7:42 UTC (permalink / raw)
  To: 김희석, Yuan Fu; +Cc: 70641

> From: 김희석 <hskimse1@gmail.com>
> Date: Mon, 29 Apr 2024 11:12:35 +0900
> 
> 
> 
> On c-mode, deurn default-indent-new-line auto-indent and
> put delimitors on multiple lines of comment.
> 
> For example, if there is comments like this:
>     /**
>      * Comment like
>      * this []
>      */
> When I press M-j (default-indent-new-line) on the point [], on
> c-mode, emacs indent and put comment delimiter automatically
> like this:
>     /**
>      * Comment like
>      * this
>      * []
>      */
> However on c-ts-mode, it does not works. It indents well, but
> could not find or put the comment delimiter on new line when
> I press M-j.
>     /**
>      * Comment like
>      * this
>      []
>      */
> On c-ts-mode, I found that the default value of variable comment-multi-line
> is nil, which was t on c-mode, and above behavior is happend when I set
> this value to t. When it was nil, comment become like this:
>     /**
>      * Comment like
>      * this *//*
>      []
>      */
> Which is intended behavior.

c-mode defines a special value for comment-line-break-function,
whereas c-ts-mode does not.  Yuan, can you look into adding this?

> Also, on c-mode, when I write multiple lines of comment with first line
> of comment is "/**", (like above examples) that block is set to have
> the same font-lock face as string to make it easier to read, but
> in c-ts-mode that behavior doesn't happen and they all have
> the same face.

That's a completely separate issue, which should have been reported
separately.  It looks like c-mode uses font-lock-doc-face in those
comments, not font-lock-comment-face.  See the various uses of
c-font-lock-doc-comments in cc-fonts.el.  AFAIR, these features are
beginning to be supported by the tree-sitter grammar itself, we just
need to use that in our font-lock definitions?  Yuan, any comments?





^ permalink raw reply	[flat|nested] 4+ messages in thread

* bug#70641: 29.1.90; default-indent-new-line cannot put comment delimiter on  c-ts-mode
  2024-04-29  7:42 ` Eli Zaretskii
@ 2024-04-30  4:57   ` Yuan Fu
  2024-04-30 11:21     ` Eli Zaretskii
  0 siblings, 1 reply; 4+ messages in thread
From: Yuan Fu @ 2024-04-30  4:57 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 70641, 김희석



> On Apr 29, 2024, at 12:42 AM, Eli Zaretskii <eliz@gnu.org> wrote:
> 
>> From: 김희석 <hskimse1@gmail.com>
>> Date: Mon, 29 Apr 2024 11:12:35 +0900
>> 
>> 
>> 
>> On c-mode, deurn default-indent-new-line auto-indent and
>> put delimitors on multiple lines of comment.
>> 
>> For example, if there is comments like this:
>>    /**
>>     * Comment like
>>     * this []
>>     */
>> When I press M-j (default-indent-new-line) on the point [], on
>> c-mode, emacs indent and put comment delimiter automatically
>> like this:
>>    /**
>>     * Comment like
>>     * this
>>     * []
>>     */
>> However on c-ts-mode, it does not works. It indents well, but
>> could not find or put the comment delimiter on new line when
>> I press M-j.
>>    /**
>>     * Comment like
>>     * this
>>     []
>>     */
>> On c-ts-mode, I found that the default value of variable comment-multi-line
>> is nil, which was t on c-mode, and above behavior is happend when I set
>> this value to t. When it was nil, comment become like this:
>>    /**
>>     * Comment like
>>     * this *//*
>>     []
>>     */
>> Which is intended behavior.
> 
> c-mode defines a special value for comment-line-break-function,
> whereas c-ts-mode does not.  Yuan, can you look into adding this?

This sounds like #70074. I’ve recently added a c-ts-mode version of comment-line-break-function on master. (That function works for any C-like language.)

> 
>> Also, on c-mode, when I write multiple lines of comment with first line
>> of comment is "/**", (like above examples) that block is set to have
>> the same font-lock face as string to make it easier to read, but
>> in c-ts-mode that behavior doesn't happen and they all have
>> the same face.
> 
> That's a completely separate issue, which should have been reported
> separately.  It looks like c-mode uses font-lock-doc-face in those
> comments, not font-lock-comment-face.  See the various uses of
> c-font-lock-doc-comments in cc-fonts.el.  AFAIR, these features are
> beginning to be supported by the tree-sitter grammar itself, we just
> need to use that in our font-lock definitions?  Yuan, any comments?

Some languages formally defines different kinds of comments and the grammar tend to make the distinction between them. C grammar doesn’t make that distinction, everything is just comment.

That doesn’t stop us from adding a font-lock rule that fontifies /** comments in doc-face though. We can totally do that.

Yuan






^ permalink raw reply	[flat|nested] 4+ messages in thread

* bug#70641: 29.1.90; default-indent-new-line cannot put comment delimiter on  c-ts-mode
  2024-04-30  4:57   ` Yuan Fu
@ 2024-04-30 11:21     ` Eli Zaretskii
  0 siblings, 0 replies; 4+ messages in thread
From: Eli Zaretskii @ 2024-04-30 11:21 UTC (permalink / raw)
  To: Yuan Fu; +Cc: 70641, hskimse1

> From: Yuan Fu <casouri@gmail.com>
> Date: Mon, 29 Apr 2024 21:57:18 -0700
> Cc: 김희석 <hskimse1@gmail.com>,
>  70641@debbugs.gnu.org
> 
> > c-mode defines a special value for comment-line-break-function,
> > whereas c-ts-mode does not.  Yuan, can you look into adding this?
> 
> This sounds like #70074. I’ve recently added a c-ts-mode version of comment-line-break-function on master. (That function works for any C-like language.)

Yes, I see that the master branch already has this issue fixed.
Thanks.

> >> Also, on c-mode, when I write multiple lines of comment with first line
> >> of comment is "/**", (like above examples) that block is set to have
> >> the same font-lock face as string to make it easier to read, but
> >> in c-ts-mode that behavior doesn't happen and they all have
> >> the same face.
> > 
> > That's a completely separate issue, which should have been reported
> > separately.  It looks like c-mode uses font-lock-doc-face in those
> > comments, not font-lock-comment-face.  See the various uses of
> > c-font-lock-doc-comments in cc-fonts.el.  AFAIR, these features are
> > beginning to be supported by the tree-sitter grammar itself, we just
> > need to use that in our font-lock definitions?  Yuan, any comments?
> 
> Some languages formally defines different kinds of comments and the grammar tend to make the distinction between them. C grammar doesn’t make that distinction, everything is just comment.
> 
> That doesn’t stop us from adding a font-lock rule that fontifies /** comments in doc-face though. We can totally do that.

I think we should indeed do it.





^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2024-04-30 11:21 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-04-29  2:12 bug#70641: 29.1.90; default-indent-new-line cannot put comment delimiter on c-ts-mode 김희석
2024-04-29  7:42 ` Eli Zaretskii
2024-04-30  4:57   ` Yuan Fu
2024-04-30 11:21     ` Eli Zaretskii

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).