From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Ergus Newsgroups: gmane.emacs.devel Subject: Re: Issue with hide-ifdef and cc-mode Date: Sun, 30 May 2021 21:27:39 +0200 Message-ID: <20210530192739.34xj5ndlca4gpicm@Ergus> References: <20210530070822.h57mmtpp2n7dvpbf.ref@Ergus> <20210530070822.h57mmtpp2n7dvpbf@Ergus> <20210530181411.jquh47dwgxtctmzc@Ergus> <83pmx82gv8.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii; format=flowed Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="32349"; mail-complaints-to="usenet@ciao.gmane.io" Cc: mardani29@yahoo.es, emacs-devel@gnu.org, acm@muc.de To: Eli Zaretskii Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Sun May 30 21:29:24 2021 Return-path: Envelope-to: ged-emacs-devel@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lnR7j-0008CN-GW for ged-emacs-devel@m.gmane-mx.org; Sun, 30 May 2021 21:29:23 +0200 Original-Received: from localhost ([::1]:57600 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lnR7i-0006zM-Jz for ged-emacs-devel@m.gmane-mx.org; Sun, 30 May 2021 15:29:22 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:45812) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lnR6W-00069N-Kh for emacs-devel@gnu.org; Sun, 30 May 2021 15:28:08 -0400 Original-Received: from sonic306-2.consmr.mail.bf2.yahoo.com ([74.6.132.41]:34306) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lnR6T-0001GU-VX for emacs-devel@gnu.org; Sun, 30 May 2021 15:28:08 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=aol.com; s=a2048; t=1622402883; bh=wVN400lOH2O2iwIMouy+a8mfvX9NFyexWfNPgdnwoA8=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From:Subject:Reply-To; b=geFcU2s4mTFFsugndP09TCBSBQomn236kMBjruIpsFYiTQUhSGWsR6KuyFV5qEuIo2+OmadimcwRFVkOG8fqsi3pmpjSbTVXe0NhCuH3iCTJBIwJqg7BZ3zFnJBugmDuLaH0QZYJk1MAIkKFEej+b9KaUuLDt31NMBo2E0DXOpd4wq7kT3aOHVq54Q1X31MWTsCcKb9EE3PcEKlIXoqpxKKdtPpAcRUW+/t4UlM5X5iKNyti7bzLESD5Za8emoibe05zJXEEWFyTPhwZ1x3S+gcs2yIAy5qMoP3neSIUC7OW4WNgFhvJKVuIZ6nLQ4fyEgTdmQsT49VVKpVJzELrBw== X-SONIC-DKIM-SIGN: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1622402883; bh=TnItSF4IeH+Wr0he5Se2kOA1msKolxvqGxxxMz0ceDQ=; h=X-Sonic-MF:Date:From:To:Subject:From:Subject; b=LiAP7faAtST5anyS4HX7cfcbJVxHko0f7dgh70sxws/2XWbvseN/VOKJQgIsR0tm0ueB2EUxiy7Jnns1m5AdemIGoZFdfD5TsUI4VzqQTlq2AlZNXH46zQXZwGd/MWpnX9JUgB35FPNOlsk1w/nurz49eNxd8vq10GB37Sw84CKLqGFxsCrqwOTsi1RMeOJYqzXQYR72CL3zigNqAA3Vq5L9fxJ5alM2N0xvPt1zXzvA/EKsmu8diI29FmjZpmK1S0kQy4aEe7FCNmp0ntmZE/AUlpEU85TNWrrvfNXyIpvQydGnTSgPqR0THrR5/y/IfutHxw/4w0l44PI9ugkMCA== X-YMail-OSG: cTKsYxUVM1kH1t6N7CMiQ6dOIQwLHSVjwhOykBuFjAh45BsA27krZuf2dv5yOhK D1OUDqN6eGJrxl0SEeAMW6KccTqRPk1TW0ZGCEzJJm8lqywP3MtKQ7ZYn_BrSqfDcU95OcQbRUta wek9ojQgsAF3sNCw2T1mtPpwq4CAdroOPxI5KMLdcw56xwSnZNZUYsnjotpHCAt7.Fuk0Vso1_VZ VLFesi8j.1QSoKsr030wbWk2GVC0bhdfQpgHEuejPhyuv8Vl.fZ9kmbYF8RxdTC6jYrPzEJ1k1v8 D86jWAj0db5pN64bYqtAS5S1JyJyda.C3T4wZMzzAAvhlKS6AcVbi8k1GnCkjglbMjTiakanjEvB Pp.v.r0p5V3Gm9Euwi74KGC6kHqQ3oGQSZ5OliDbLun19A2_o352hcondzHb_YiCKJtXA4W07FGt 8Mr0x8LOjc7J.nCPLqlWNXwbigFXhusVJLroYsrUA5yfm_bM0PhW6csHTBu7Lcxvft1opByJdC2W RdvPXrRAVw7Y8VnydujuVwD5sQ_YF3yowT0cvAod1lOYCWIV5EboAIoSdaWvvcayStYM0ST.uZ5L S7bgrzXz4p.hZKfdc0ufFazHLJtpbL2z12UpSCqCe4aK_rwzph74bP5lzUEiNNteKDF9Xr7bOiaC RYFbQgkJBI.VnsT0cdeAYbcW._SJ2S5z8zh6y53kYa1diPCK4ny08rDVG5KQVuhuF.KNwlxPECnG 1Emh1RSsdcSMrIAviBvZJAr8_mgi6UGfB7x6JYAGxKe5AkvpoP6k4YBpic6a9u4z2xmAAPBoBTr5 ym6BKwu5J0U1ortXVx8ExdLwFY8EL8R_nsbpG2RhcO X-Sonic-MF: Original-Received: from sonic.gate.mail.ne1.yahoo.com by sonic306.consmr.mail.bf2.yahoo.com with HTTP; Sun, 30 May 2021 19:28:03 +0000 Original-Received: by kubenode550.mail-prod1.omega.ir2.yahoo.com (VZM Hermes SMTP Server) with ESMTPA ID c3484f7735a2e212af8e8a9ab0a2b97c; Sun, 30 May 2021 19:27:59 +0000 (UTC) Content-Disposition: inline In-Reply-To: <83pmx82gv8.fsf@gnu.org> X-Mailer: WebService/1.1.18368 mail.backend.jedi.jws.acl:role.jedi.acl.token.atz.jws.hermes.aol Received-SPF: pass client-ip=74.6.132.41; envelope-from=spacibba@aol.com; helo=sonic306-2.consmr.mail.bf2.yahoo.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.io gmane.emacs.devel:270145 Archived-At: Hi Eli: On Sun, May 30, 2021 at 09:53:15PM +0300, Eli Zaretskii wrote: >> Date: Sun, 30 May 2021 20:14:11 +0200 >> From: Ergus >> Cc: emacs-devel@gnu.org, Alan Mackenzie >> >> I didn't know I need to manually call hide-ifdefs every time I change >> the preprocessor argument. Because none of this is documented in the >> manual. But also calling that makes the functionality pretty >> sub-optimal. > >Please be sure to read the commentary at the beginning of hideif.el, >it explains quite a lot. > >> It is bad that this functionality works fine out of the box either in >> vim and in VS Code and other editors but not in emacs without user >> explicit intervention. > >??? How can Emacs know which preprocessor symbols are defined and >which undefined? You have "C-c @ d" and "C-c @ u" to tell Emacs which >symbols are defined and which undefined. > This part is fine for me. In my use case using 0 or 1 should be defined as numeric values right? so I don't need to define anything. For more complex cases I understand these commands are very useful; but not in this simple case. >> So I am not sure how difficult may be to do it automatic without killing >> the performance... Like font-lock does with everything else... Soes it >> really kills performance to add his to font-lock? > >I'm not sure I understand: what do you need to automate? Once you >turn on hiding, the display automatically changes as you define and >undefine preprocessor symbols. I mean: #if 0 #endif M-x hide-ifdef-mode M-x hide-ifdef-toggle-shadowing does not shadows the region. I need to explicitly call M-x hide-ifdefs But also If I change after that #if 0 -> #if 1; the shadow does not disappears inmediately. So I need to call: M-x hide-ifdefs again. This is the part that I think may be automatized. Calling hide-ifdefs every time is annoying. Emacs is smart enough to recognize when the user modifies a cpp-macro. And multi-line code highlight is simple like /* */ does... What I am missing here?