GNU bug report logs - #72223
31.0.50; c-ts-mode-indent-style custom function should accept a `mode`(c/c++) parameter

Previous Next

Package: emacs;

Reported by: Meow King <mr.meowking <at> anche.no>

Date: Sun, 21 Jul 2024 08:41:02 UTC

Severity: normal

Found in version 31.0.50

Done: Eli Zaretskii <eliz <at> gnu.org>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 72223 in the body.
You can then email your comments to 72223 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#72223; Package emacs. (Sun, 21 Jul 2024 08:41:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Meow King <mr.meowking <at> anche.no>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Sun, 21 Jul 2024 08:41:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Meow King <mr.meowking <at> anche.no>
To: bug-gnu-emacs <at> gnu.org
Subject: 31.0.50; c-ts-mode-indent-style custom function should accept a
 `mode`(c/c++) parameter 
Date: Sat, 20 Jul 2024 22:10:06 +0800
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)




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#72223; Package emacs. (Sun, 21 Jul 2024 08:47:01 GMT) Full text and rfc822 format available.

Message #8 received at 72223 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Meow King <mr.meowking <at> anche.no>
Cc: 72223 <at> debbugs.gnu.org
Subject: Re: bug#72223: 31.0.50;
 c-ts-mode-indent-style custom function should accept a `mode`(c/c++)
 parameter
Date: Sun, 21 Jul 2024 11:46:36 +0300
> 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 <at> 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?




Reply sent to Eli Zaretskii <eliz <at> gnu.org>:
You have taken responsibility. (Sun, 21 Jul 2024 09:36:02 GMT) Full text and rfc822 format available.

Notification sent to Meow King <mr.meowking <at> anche.no>:
bug acknowledged by developer. (Sun, 21 Jul 2024 09:36:02 GMT) Full text and rfc822 format available.

Message #13 received at 72223-done <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Meow King <mr.meowking <at> anche.no>
Cc: 72223-done <at> debbugs.gnu.org
Subject: Re: bug#72223: 31.0.50; c-ts-mode-indent-style custom function
 should accept a `mode`(c/c++) parameter
Date: Sun, 21 Jul 2024 12:35:38 +0300
> From: Meow King <mr.meowking <at> anche.no>
> Cc: 
> Date: Sun, 21 Jul 2024 17:14:35 +0800
> 
> Eli Zaretskii <eliz <at> 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.




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Sun, 18 Aug 2024 11:24:05 GMT) Full text and rfc822 format available.

This bug report was last modified 304 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.