From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Mauro Aranda Newsgroups: gmane.emacs.bugs Subject: bug#35768: 27.0.50; CC-Mode problems with function definitions with macro names Date: Fri, 17 May 2019 09:40:09 -0300 Message-ID: References: <87k1eqdkzk.fsf@gmail.com> Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="000000000000a2208e058914af43" Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="27177"; mail-complaints-to="usenet@blaine.gmane.org" Cc: 35768@debbugs.gnu.org To: Noam Postavsky Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Fri May 17 14:41:15 2019 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([209.51.188.17]) by blaine.gmane.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hRcAk-0006wV-Hx for geb-bug-gnu-emacs@m.gmane.org; Fri, 17 May 2019 14:41:14 +0200 Original-Received: from localhost ([127.0.0.1]:48054 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hRcAj-00036Q-Hy for geb-bug-gnu-emacs@m.gmane.org; Fri, 17 May 2019 08:41:13 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:49497) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hRcAc-00036L-S0 for bug-gnu-emacs@gnu.org; Fri, 17 May 2019 08:41:07 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hRcAb-0001jf-PX for bug-gnu-emacs@gnu.org; Fri, 17 May 2019 08:41:06 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:44177) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hRcAX-0001aZ-SE; Fri, 17 May 2019 08:41:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1hRcAX-00012J-Ol; Fri, 17 May 2019 08:41:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Mauro Aranda Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org, bug-cc-mode@gnu.org Resent-Date: Fri, 17 May 2019 12:41:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 35768 X-GNU-PR-Package: emacs,cc-mode Original-Received: via spool by 35768-submit@debbugs.gnu.org id=B35768.15580968333939 (code B ref 35768); Fri, 17 May 2019 12:41:01 +0000 Original-Received: (at 35768) by debbugs.gnu.org; 17 May 2019 12:40:33 +0000 Original-Received: from localhost ([127.0.0.1]:57721 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hRcA4-00011S-PI for submit@debbugs.gnu.org; Fri, 17 May 2019 08:40:33 -0400 Original-Received: from mail-lj1-f177.google.com ([209.85.208.177]:45217) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hRcA1-00011A-MA for 35768@debbugs.gnu.org; Fri, 17 May 2019 08:40:31 -0400 Original-Received: by mail-lj1-f177.google.com with SMTP id r76so6113368lja.12 for <35768@debbugs.gnu.org>; Fri, 17 May 2019 05:40:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=uGdeod1Iv8fRHu5h6cKaLkcv3PZi19GYxpWJUnjQ9vg=; b=PK/iFoXMl345BNEFlI9IjIFLUc18ZUgMVmDBxyEUmzHAlA8ut6TtzyMr+3CsdRpJ3o slW3pwIDKBoWrweHUFfwIyge0jJVPJze2MhQNfE3b55AjdHG+Gjfitd29iv/RHuJ2u4X h05CVsNQStWeBPlq7d36Ago8sc+SITImldclylee0s3pKPbvbMMrp4pKUubYm7ZKnj3X qSOiDZeTCqFQmzUjY15qlJsV6K0Mk4Nkm6nfOOOhoO5i5GOkeh37CSdt1VHm71BFQNxE 1MicynihIV8vta3q2QlEsh0kxML2K9z59MoHilToyff9Z4k9lZcNJr7FZ+7LWGr1Gn6B KQdg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=uGdeod1Iv8fRHu5h6cKaLkcv3PZi19GYxpWJUnjQ9vg=; b=Q52Jyyz1FByFIXHypW9s1uBXQO5c1THDLLtuc28+HF9iB1K/gLYGkGMZ4hiaU7jAn6 71QbZLqZ6YjXRuXayKOL3dFoFX8oAllEfEBkEFJRrgFGCOF1G7dswk02fSDtUn9Rdtr3 KYCCmE16lOrnU1GSA0sS8YuJePc2+zijQ5CtQrY2VtFJ9mlMXbhc7HZA/DLO4EqiC3n+ s9t3U2a1DKBK8PXwC7/EmqkRPmC+0xBVJJv/VX2uPW+fU3xeys1DB3DMWGbxze37txPm VuFsRKtir876ggCJzqhV6vPQyoyFBYH4dFwAj+iu0DRhFOjfLmYO1EBWjQ8oaq1WNrYm mIBw== X-Gm-Message-State: APjAAAWIh+y8pIQVFkcCwdo662+xFYlRmGG4NjWLC2TLR4gASDKbFhda QUKVlOFI6LokgAMfhOI7TPGNYVGWx4+DaV0oC+E= X-Google-Smtp-Source: APXvYqwSRUUnRCgiRgrAnE0JhIF9WKS9mJhbbUN7GCsyceSXhWXpUvWt5NDERZiDMMYWSL0uY617qBRX/oCY+JpOuWU= X-Received: by 2002:a2e:b051:: with SMTP id d17mr16641502ljl.173.1558096822541; Fri, 17 May 2019 05:40:22 -0700 (PDT) In-Reply-To: <87k1eqdkzk.fsf@gmail.com> X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.51.188.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:159445 Archived-At: --000000000000a2208e058914af43 Content-Type: text/plain; charset="UTF-8" > Have you tried customizing c-noise-macro-names, as described in (ccmode) Noise Macros? Hello Noam, thanks for your answer. I didn't know of c-noise-macro-names, thanks. If after step 1) I eval the following: (defun my-c-mode-hook () (setq c-noise-macro-names (append c-noise-macro-names '("DUMMY"))) (c-make-noise-macro-regexps)) (add-hook 'c-mode-hook 'my-c-mode-hook) And then follow the steps of my recipe, CC Mode works correctly. However, the following recipe exposes another problem, I think: 1) emacs -Q 2) Eval the following: (defun my-c-mode-hook () (setq c-noise-macro-with-parens-names (append c-noise-macro-with-parens-names '("DUMMY_1" "DUMMY_2"))) (c-make-noise-macro-regexps)) (add-hook 'c-mode-hook 'my-c-mode-hook) 3) C-x C-f test.c 4) Type the following (no need to type the #define lines, that's just for completion) #define DUMMY_1(params) #define DUMMY_2(params) int DUMMY_1 (1) DUMMY_2 (2) foo (void) { return 0; } 5) Observe that DUMMY_1 (1) is ignored as expected, but DUMMY_2 gets font-lock-type-face. I think that's not right. 6) To be sure that I customized c-noise-macro-with-parens-names correctly, I tried a regexp search with c-noise-macro-with-parens-name-re, from the beginning of the buffer: (re-search-forward c-noise-macro-with-parens-name-re) That gets four hits, as it should (2 for DUMMY_1 and 2 for DUMMY_2), meaning that it does find DUMMY_2 as a noise macro with parens. Is that a bug? Or is there something else I can use to help CC Mode not get confused? Best regards, Mauro. --000000000000a2208e058914af43 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
> Have you tried customizing c-noise-m= acro-names, as described in (ccmode) Noise Macros?

Hello Noam, thank= s for your answer.

I didn't know of c-noise-macro-names, thanks.= =C2=A0 If after step 1) I eval
the following:
(defun my-c-mode-hook (= )
=C2=A0 (setq c-noise-macro-names (append c-noise-macro-names '(&qu= ot;DUMMY")))
=C2=A0 (c-make-noise-macro-regexps))
(add-hook '= ;c-mode-hook 'my-c-mode-hook)

And then follow the steps of my re= cipe, CC Mode works correctly.


However, the following recipe exp= oses another problem, I think:
1) emacs -Q
2) Eval the following:
= (defun my-c-mode-hook ()
=C2=A0 (setq c-noise-macro-with-parens-names (a= ppend c-noise-macro-with-parens-names
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0 '("DUMMY_1" "DUMMY_2")))=C2=A0 (c-make-noise-macro-regexps))
(add-hook 'c-mode-hook 'm= y-c-mode-hook)

3) C-x C-f test.c
4) Type the following (no need t= o type the #define lines, that's just for completion)
#define DUMMY_= 1(params)
#define DUMMY_2(params)

int DUMMY_1 (1) DUMMY_2 (2)
= foo (void)
{
=C2=A0 return 0;
}

5) Observe that DUMMY_1 (1)= is ignored as expected, but DUMMY_2 gets
font-lock-type-face.=C2=A0 I t= hink that's not right.

6) To be sure that I customized c-noise-m= acro-with-parens-names correctly, I
tried a regexp search with c-noise-m= acro-with-parens-name-re, from the
beginning of the buffer:
(re-searc= h-forward c-noise-macro-with-parens-name-re)
That gets four hits, as it = should (2 for DUMMY_1 and 2 for DUMMY_2), meaning
that it does find DUMM= Y_2 as a noise macro with parens.

Is that a bug? Or is there somethi= ng else I can use to help CC Mode not get
confused?

Best regards,=
Mauro.
--000000000000a2208e058914af43--