* bug#72223: 31.0.50; c-ts-mode-indent-style custom function should accept a `mode`(c/c++) parameter
@ 2024-07-20 14:10 Meow King via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-07-21 8:46 ` Eli Zaretskii
0 siblings, 1 reply; 3+ messages in thread
From: Meow King via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2024-07-20 14:10 UTC (permalink / raw)
To: 72223
Currently, the `c-ts-mode--get-indent-style` function:
```
(defun c-ts-mode--get-indent-style (mode)
"Helper function to set indentation style.
MODE is either `c' or `cpp'."
(let ((style
(if (functionp c-ts-mode-indent-style)
(funcall c-ts-mode-indent-style)
(alist-get c-ts-mode-indent-style (c-ts-mode--indent-styles mode)))))
`((,mode ,@style))))
```
We can use `c-ts-mode-indent-style` to customize our indentation.
However, the function doesn't accept a `mode` parameter, without which
we cannot determine the current customizing indentation style of what
language (c/c++).
---
In GNU Emacs 31.0.50 (build 1, x86_64-pc-linux-gnu, GTK+ Version
3.24.42, cairo version 1.18.0)
Repository revision: 3a790abd869ddadc343710deb0c4368227ba6611
Repository branch: master
System Description: NixOS 24.11 (Vicuna)
^ permalink raw reply [flat|nested] 3+ messages in thread
* bug#72223: 31.0.50; c-ts-mode-indent-style custom function should accept a `mode`(c/c++) parameter
2024-07-20 14:10 bug#72223: 31.0.50; c-ts-mode-indent-style custom function should accept a `mode`(c/c++) parameter Meow King via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2024-07-21 8:46 ` Eli Zaretskii
[not found] ` <87h6cjm7ic.fsf@anche.no>
0 siblings, 1 reply; 3+ messages in thread
From: Eli Zaretskii @ 2024-07-21 8:46 UTC (permalink / raw)
To: Meow King; +Cc: 72223
> Date: Sat, 20 Jul 2024 22:10:06 +0800
> From: Meow King via "Bug reports for GNU Emacs,
> the Swiss army knife of text editors" <bug-gnu-emacs@gnu.org>
>
>
> Currently, the `c-ts-mode--get-indent-style` function:
> ```
> (defun c-ts-mode--get-indent-style (mode)
> "Helper function to set indentation style.
> MODE is either `c' or `cpp'."
> (let ((style
> (if (functionp c-ts-mode-indent-style)
> (funcall c-ts-mode-indent-style)
> (alist-get c-ts-mode-indent-style (c-ts-mode--indent-styles mode)))))
> `((,mode ,@style))))
> ```
> We can use `c-ts-mode-indent-style` to customize our indentation.
> However, the function doesn't accept a `mode` parameter, without which
> we cannot determine the current customizing indentation style of what
> language (c/c++).
Isn't the mode available as the value of major-mode?
^ permalink raw reply [flat|nested] 3+ messages in thread
* bug#72223: 31.0.50; c-ts-mode-indent-style custom function should accept a `mode`(c/c++) parameter
[not found] ` <87h6cjm7ic.fsf@anche.no>
@ 2024-07-21 9:35 ` Eli Zaretskii
0 siblings, 0 replies; 3+ messages in thread
From: Eli Zaretskii @ 2024-07-21 9:35 UTC (permalink / raw)
To: Meow King; +Cc: 72223-done
> From: Meow King <mr.meowking@anche.no>
> Cc:
> Date: Sun, 21 Jul 2024 17:14:35 +0800
>
> Eli Zaretskii <eliz@gnu.org> writes:
>
> > Isn't the mode available as the value of major-mode?
>
> Yes, after testing, this approach is proved to be right.
>
> My `major-mode` related thoughts was immediately discarded since the
> function call is inside `define-derived-mode` block, and not even the
> `after-hook`. After testing, it is proved that the `major-mode` variable
> is already settled. Though, I think it's better to give it a mention in the doc.
>
> Thank you for your reply and your awesome work!
Thanks, so I'm closing this bug report.
P.S. Please in the future use Reply All to reply, so that the bug
tracker is CC'ed.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2024-07-21 9:35 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-07-20 14:10 bug#72223: 31.0.50; c-ts-mode-indent-style custom function should accept a `mode`(c/c++) parameter Meow King via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-07-21 8:46 ` Eli Zaretskii
[not found] ` <87h6cjm7ic.fsf@anche.no>
2024-07-21 9:35 ` 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).