GNU bug report logs - #61691
(wrong-type-argument stringp nil) error when indenting some C code in c-ts-mode

Previous Next

Package: emacs;

Reported by: Daniel Martín <mardani29 <at> yahoo.es>

Date: Tue, 21 Feb 2023 23:24:02 UTC

Severity: normal

Tags: patch

Fixed in version 29.1

Done: Daniel Martín <mardani29 <at> yahoo.es>

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 61691 in the body.
You can then email your comments to 61691 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#61691; Package emacs. (Tue, 21 Feb 2023 23:24:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Daniel Martín <mardani29 <at> yahoo.es>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Tue, 21 Feb 2023 23:24:02 GMT) Full text and rfc822 format available.

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

From: Daniel Martín <mardani29 <at> yahoo.es>
To: bug-gnu-emacs <at> gnu.org
Subject: (wrong-type-argument stringp nil) error when indenting some C code
 in c-ts-mode
Date: Wed, 22 Feb 2023 00:23:37 +0100
[Message part 1 (text/plain, inline)]
Tags: patch


Given the following code in c-ts-mode:

int
foo ()
{
  int c;
  if (!CHAR_VALID_P (c))
    /* This is a comment.  */
    c = 'a';

  return c;
}

If point is in line "c = 'a'" and you press TAB, a (wrong-type-argument
stringp nil) error is thrown.

The attached patch fixes the problem by checking the return value of
(treesit-node-field-name node) before passing the result to
string-match-p.

[0001-Fix-wrong-argument-error-indenting-C-code-in-c-ts-mo.patch (text/patch, attachment)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#61691; Package emacs. (Sun, 26 Feb 2023 08:20:02 GMT) Full text and rfc822 format available.

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

From: Eli Zaretskii <eliz <at> gnu.org>
To: Daniel Martín <mardani29 <at> yahoo.es>
Cc: 61691 <at> debbugs.gnu.org
Subject: Re: bug#61691: (wrong-type-argument stringp nil) error when indenting
 some C code in c-ts-mode
Date: Sun, 26 Feb 2023 10:19:12 +0200
> Date: Wed, 22 Feb 2023 00:23:37 +0100
> From:  Daniel Martín via "Bug reports for GNU Emacs,
>  the Swiss army knife of text editors" <bug-gnu-emacs <at> gnu.org>
> 
> Given the following code in c-ts-mode:
> 
> int
> foo ()
> {
>   int c;
>   if (!CHAR_VALID_P (c))
>     /* This is a comment.  */
>     c = 'a';
> 
>   return c;
> }
> 
> If point is in line "c = 'a'" and you press TAB, a (wrong-type-argument
> stringp nil) error is thrown.

With today's emacs-29 branch, I cannot reproduce this.  Was the
problem solved meanwhile?




Reply sent to Daniel Martín <mardani29 <at> yahoo.es>:
You have taken responsibility. (Sun, 26 Feb 2023 11:11:01 GMT) Full text and rfc822 format available.

Notification sent to Daniel Martín <mardani29 <at> yahoo.es>:
bug acknowledged by developer. (Sun, 26 Feb 2023 11:11:01 GMT) Full text and rfc822 format available.

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

From: Daniel Martín <mardani29 <at> yahoo.es>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 61691-done <at> debbugs.gnu.org
Subject: Re: bug#61691: (wrong-type-argument stringp nil) error when
 indenting some C code in c-ts-mode
Date: Sun, 26 Feb 2023 12:10:24 +0100
Version: 29.1

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

>> Date: Wed, 22 Feb 2023 00:23:37 +0100
>> From:  Daniel Martín via "Bug reports for GNU Emacs,
>>  the Swiss army knife of text editors" <bug-gnu-emacs <at> gnu.org>
>> 
>> Given the following code in c-ts-mode:
>> 
>> int
>> foo ()
>> {
>>   int c;
>>   if (!CHAR_VALID_P (c))
>>     /* This is a comment.  */
>>     c = 'a';
>> 
>>   return c;
>> }
>> 
>> If point is in line "c = 'a'" and you press TAB, a (wrong-type-argument
>> stringp nil) error is thrown.
>
> With today's emacs-29 branch, I cannot reproduce this.  Was the
> problem solved meanwhile?

I cannot reproduce the issue anymore in Emacs 29, so I'm closing the bug
report.




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

This bug report was last modified 1 year and 2 days ago.

Previous Next


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