* bug#60398: 29.0.60; c++-ts-mode: Strange indentation of function body when parameter list has newline
@ 2022-12-29 7:49 Knut Anders Hatlen
2022-12-29 9:06 ` Yuan Fu
0 siblings, 1 reply; 4+ messages in thread
From: Knut Anders Hatlen @ 2022-12-29 7:49 UTC (permalink / raw)
To: 60398
Function bodies are indented strangely in c++-ts-mode if the parameter
list has a newline between two parameters. For example:
int f1(int x, int y) {
// Indented as expected.
return x + y;
}
int f2(int x,
int y) {
// Indented too much.
return x + y;
};
In GNU Emacs 29.0.60 (build 1, x86_64-pc-linux-gnu, GTK+ Version
3.24.35, cairo version 1.16.0) of 2022-12-29 built on dell
Repository revision: 909091d7578b7225601b202fb9257dedae879e9a
Repository branch: emacs-29
System Description: Debian GNU/Linux bookworm/sid
Configured using:
'configure --with-json --with-xml2 --with-modules
--prefix=/usr/local/stow/emacs --with-pgtk --without-x
--with-native-compilation --with-tree-sitter'
Configured features:
CAIRO DBUS FREETYPE GIF GLIB GMP GNUTLS GSETTINGS HARFBUZZ JPEG JSON
LCMS2 LIBOTF LIBSELINUX LIBXML2 MODULES NATIVE_COMP NOTIFY INOTIFY
PDUMPER PGTK PNG RSVG SECCOMP SOUND SQLITE3 THREADS TIFF
TOOLKIT_SCROLL_BARS TREE_SITTER WEBP XIM GTK3 ZLIB
Important settings:
value of $LANG: nn_NO.UTF-8
value of $XMODIFIERS: @im=ibus
locale-coding-system: utf-8-unix
Major mode: C++
Minor modes in effect:
shell-dirtrack-mode: t
treesit-explore-mode: t
flyspell-mode: t
hl-line-mode: t
electric-pair-mode: t
display-line-numbers-mode: t
elide-head-mode: t
flymake-mode: t
winner-mode: t
windmove-mode: t
server-mode: t
which-function-mode: t
savehist-mode: t
save-place-mode: t
repeat-mode: t
recentf-mode: t
minibuffer-depth-indicate-mode: t
marginalia-mode: t
global-so-long-mode: t
global-auto-revert-mode: t
dynamic-completion-mode: t
tooltip-mode: t
global-eldoc-mode: t
eldoc-mode: t
show-paren-mode: t
electric-indent-mode: t
mouse-wheel-mode: t
tab-bar-mode: t
file-name-shadow-mode: t
global-font-lock-mode: t
font-lock-mode: t
column-number-mode: t
line-number-mode: t
transient-mark-mode: t
auto-composition-mode: t
auto-encryption-mode: t
auto-compression-mode: t
Load-path shadows:
/home/kah/.emacs.d/elpa/29/transient-0.3.7/transient hides /usr/local/stow/emacs/share/emacs/29.0.60/lisp/transient
Features:
(ecomplete nndraft nnmh format-spec nnml utf-7 nnfolder nnnil gnus-agent
gnus-srvr gnus-score score-mode nnvirtual gnus-msg nntp gnus-cache
gnus-art mm-uu mml2015 mm-view mml-smime smime dig gnus-sum shr
pixel-fill kinsoku url-file svg dom gnus-group gnus-undo gnus-start
gnus-dbus dbus xml gnus-cloud nnimap nnmail mail-source utf7 nnoo
parse-time iso8601 gnus-spec gnus-int gnus-range gnus-win gnus nnheader
range gnutls epa-file network-stream nsm mailalias smtpmail textsec
uni-scripts idna-mapping ucs-normalize uni-confusable textsec-check
dabbrev shadow sort mail-extr emacsbug message yank-media puny dired
dired-loaddefs rfc822 mml mml-sec epa derived epg rfc6068 epg-config
gnus-util mm-decode mm-bodies mm-encode mail-parse rfc2231 mailabbrev
gmm-utils mailheader sendmail rfc2047 rfc2045 ietf-drums mm-util
mail-prsvr mail-utils shell pcomplete cus-start pulse color noutline
outline jka-compr find-func orderless cl-print cc-langs cc-mode cc-fonts
cc-guess cc-menus cc-cmds help-fns radix-tree cc-styles cc-align
cc-engine cc-vars cc-defs mule-util etags fileloop generator xref
misearch multi-isearch vc-git diff-mode easy-mmode vc-dispatcher
c-ts-mode treesit add-log comp comp-cstr flyspell ispell hl-line
elec-pair display-line-numbers elide-head time-date checkdoc lisp-mnt
flymake-proc flymake project compile text-property-search comint
ansi-osc ansi-color warnings thingatpt cus-edit pp rx winner ring
windmove disp-table server icons cl-extra help-mode which-func imenu
savehist saveplace repeat recentf tree-widget wid-edit mb-depth
marginalia magit-autorevert magit-git magit-section magit-utils crm dash
so-long autorevert filenotify completion cus-load embark-autoloads
boxquote-autoloads slime-autoloads marginalia-autoloads
orderless-autoloads info 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/pgtk-win pgtk-win term/common-win pgtk-dnd
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 dbusbind
inotify dynamic-setting system-font-setting font-render-setting cairo
gtk pgtk lcms2 multi-tty make-network-process native-compile emacs)
Memory information:
((conses 16 609784 42800)
(symbols 48 25180 7)
(strings 32 147262 8978)
(string-bytes 1 4799636)
(vectors 16 103201)
(vector-slots 8 1470136 46014)
(floats 8 715 280)
(intervals 56 4101 1275)
(buffers 984 27))
--
Knut Anders
^ permalink raw reply [flat|nested] 4+ messages in thread
* bug#60398: 29.0.60; c++-ts-mode: Strange indentation of function body when parameter list has newline
2022-12-29 7:49 bug#60398: 29.0.60; c++-ts-mode: Strange indentation of function body when parameter list has newline Knut Anders Hatlen
@ 2022-12-29 9:06 ` Yuan Fu
2022-12-29 10:45 ` Theodor Thornhill via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-12-29 11:33 ` Knut Anders Hatlen
0 siblings, 2 replies; 4+ messages in thread
From: Yuan Fu @ 2022-12-29 9:06 UTC (permalink / raw)
To: Knut Anders Hatlen; +Cc: Theodor Thornhill, 60398
> On Dec 28, 2022, at 11:49 PM, Knut Anders Hatlen <kahatlen@gmail.com> wrote:
>
>
> Function bodies are indented strangely in c++-ts-mode if the parameter
> list has a newline between two parameters. For example:
>
> int f1(int x, int y) {
> // Indented as expected.
> return x + y;
> }
>
> int f2(int x,
> int y) {
> // Indented too much.
> return x + y;
> };
I implemented a fix in 784e509bded, Theo, WDYT? Could this be used on other C-like modes, too?
Yuan
^ permalink raw reply [flat|nested] 4+ messages in thread
* bug#60398: 29.0.60; c++-ts-mode: Strange indentation of function body when parameter list has newline
2022-12-29 9:06 ` Yuan Fu
@ 2022-12-29 10:45 ` Theodor Thornhill via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-12-29 11:33 ` Knut Anders Hatlen
1 sibling, 0 replies; 4+ messages in thread
From: Theodor Thornhill via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2022-12-29 10:45 UTC (permalink / raw)
To: Yuan Fu, Knut Anders Hatlen; +Cc: 60398
Yuan Fu <casouri@gmail.com> writes:
>> On Dec 28, 2022, at 11:49 PM, Knut Anders Hatlen <kahatlen@gmail.com> wrote:
>>
>>
>> Function bodies are indented strangely in c++-ts-mode if the parameter
>> list has a newline between two parameters. For example:
>>
>> int f1(int x, int y) {
>> // Indented as expected.
>> return x + y;
>> }
>>
>> int f2(int x,
>> int y) {
>> // Indented too much.
>> return x + y;
>> };
>
> I implemented a fix in 784e509bded, Theo, WDYT? Could this be used on other C-like modes, too?
>
LGTM!
I believe that should work for most other cases of this, but IIRC there
are some cases where the compound statements are considered as siblings,
not children, but I forgot what it was exactly...
But I think this should work in most cases, at least!
Theo
^ permalink raw reply [flat|nested] 4+ messages in thread
* bug#60398: 29.0.60; c++-ts-mode: Strange indentation of function body when parameter list has newline
2022-12-29 9:06 ` Yuan Fu
2022-12-29 10:45 ` Theodor Thornhill via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2022-12-29 11:33 ` Knut Anders Hatlen
1 sibling, 0 replies; 4+ messages in thread
From: Knut Anders Hatlen @ 2022-12-29 11:33 UTC (permalink / raw)
To: Yuan Fu; +Cc: Theodor Thornhill, 60398
Yuan Fu <casouri@gmail.com> writes:
>> On Dec 28, 2022, at 11:49 PM, Knut Anders Hatlen <kahatlen@gmail.com> wrote:
>>
>>
>> Function bodies are indented strangely in c++-ts-mode if the parameter
>> list has a newline between two parameters. For example:
>>
>> int f1(int x, int y) {
>> // Indented as expected.
>> return x + y;
>> }
>>
>> int f2(int x,
>> int y) {
>> // Indented too much.
>> return x + y;
>> };
>
> I implemented a fix in 784e509bded, Theo, WDYT? Could this be used on other C-like modes, too?
>
> Yuan
It seems to behave as expected now. Thanks for the quick fix!
--
Knut Anders
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2022-12-29 11:33 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-12-29 7:49 bug#60398: 29.0.60; c++-ts-mode: Strange indentation of function body when parameter list has newline Knut Anders Hatlen
2022-12-29 9:06 ` Yuan Fu
2022-12-29 10:45 ` Theodor Thornhill via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-12-29 11:33 ` Knut Anders Hatlen
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.