From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Ergus Newsgroups: gmane.emacs.devel Subject: Re: cc-mode: Make all parameters introduced in Emacs 26 optional Date: Sat, 30 Mar 2019 22:53:10 +0100 Message-ID: <20190330215310.7hynks3lhn4m4rbh@Ergus> References: <1516608561.1943450.1243462056.1A47A60F@webmail.messagingengine.com> <20180122203254.GA4888@ACM> <87k1vuwr3p.fsf@ahungry.com> <87fu6iwqfu.fsf@ahungry.com> <20180203114451.GA4806@ACM> <20190330135148.GA6312@ACM> <20190330194204.GB6312@ACM> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii; format=flowed Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="269141"; mail-complaints-to="usenet@blaine.gmane.org" User-Agent: NeoMutt/20180716 Cc: emacs-devel@gnu.org To: Stefan Monnier Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sat Mar 30 22:54:04 2019 Return-path: Envelope-to: ged-emacs-devel@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 1hALvP-0017u3-Vl for ged-emacs-devel@m.gmane.org; Sat, 30 Mar 2019 22:54:04 +0100 Original-Received: from localhost ([127.0.0.1]:38822 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hALvP-0003ow-1I for ged-emacs-devel@m.gmane.org; Sat, 30 Mar 2019 17:54:03 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:44094) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hALuk-0003oV-Ph for emacs-devel@gnu.org; Sat, 30 Mar 2019 17:53:23 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hALuj-0004Wj-IY for emacs-devel@gnu.org; Sat, 30 Mar 2019 17:53:22 -0400 Original-Received: from sonic313-21.consmr.mail.ir2.yahoo.com ([77.238.179.188]:41823) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hALui-0004Uf-TO for emacs-devel@gnu.org; Sat, 30 Mar 2019 17:53:21 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=aol.com; s=a2048; t=1553982797; bh=vXkKxM4+sUZ66C1q+pXZ4kRo6COO/Z5KP3BSmXtetvs=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From:Subject; b=sydKa/mkq5ycdFUm+JSuKviT3+0bk0jnv4pQEcA6K19NAH2ztZ6rk92BjN1ZkVGub7Z/x6xPLdsvEVLzrRpiDtQZJbdagNyPQ4UdEjeKcZ+g+gaSGE9Vr+dvMxPx5DhtIP6aMRi41oFQrMkv4QX2JBW/SEFmvDp5CR7juSbqndQopHwkc6YMLFJCOo5XjHf363GVMqiQZxc68/LQkZkTcYAAEdxX3fQhjPHdnzlGjyC6odsn+fhDqDkTSPbjP4dgh3S/r5QDQCv9mpvl9EQ04IAa0BBu9wLkAfplQHmfJBE5nqnLZeVT/UloFpcuJk1LJaJ2Q+vYBEu3naB47I+hqg== X-YMail-OSG: wZNq5swVM1lUWwTWTjcOr6qw6hq6UZR.cBaY9NdzcGDQ3kNPr9ncfJ_FKib32Zf SHsLKWuIbXEqMbKXLpD_1ORcuQmFOuCiskynZ63TFiaeGk_5IIOC4x5dR_efrvTeJ3JGpL14b0ia 8Aflz_TUvxazY3Eyn8R02EL63pUFAgZZHc23mh4AFTqzqyGSC8Vlf_nk9g9yp3sobATb1Z9NRwXl fG5Ql59r4efEB638QJ4v.eGDYwFuFLxWC4FOl8hK4z89OBA63gSRNKSFl8tNI57js7ZhLIUjGbEH YdFVMFR3oX2O4waZ__F6F_5tsIPOfKLlclUSyg.FUxGfXV8yTUE6ZlJOLSoTMD0kOCl7EG4wb7Yt t4PgVxKXYOZx7l4ZNrK1o7q0L10.5VlIcnFMo9l4hSAlY3hDBxlDBYxvxQmgZyavJ6LRsV_9Y23i 0IVwyEu.Ykg4jjKc7iBDV9iGRG1dCCEaXHeO_KQ9E6p819L5G5xvimWpRqcx3wQNSx2lKBziqj.E xOKPcwPmwe.EN4g5P0PcWMPrlHSZf0I4E2ED_nQCiKfCaEcXFFsdAeNsSeXsbMby8arRGDr2EuTq PwR0rfT.Y83LUdamhQH8ihOrBqTB4J0fx9Is5Yb9H_pMD0vqzhUDpuUpmjPf9Xc5Mtv5cjVz.pCa 4uQ_lJAFR8L7S1dmEMqywSHBmmufQZ2qQONC8mouBTWhO_rsNz0I5HFSdUI44sJN2Ap6SnCtvezL YUSgp8g8gQKirrNmscUKTdwoLSfZ5TQwI8KixqhE4GNBsLq0mh8sSSgKbuotw3YrxTMgyAKWduwJ 8Pa2LCMNmgIu4IXWURZa1c.M4tfCp7RSnDJ2Ex6uoP Original-Received: from sonic.gate.mail.ne1.yahoo.com by sonic313.consmr.mail.ir2.yahoo.com with HTTP; Sat, 30 Mar 2019 21:53:17 +0000 Original-Received: from 2.152.205.184.dyn.user.ono.com (EHLO Ergus) ([2.152.205.184]) by smtp416.mail.ir2.yahoo.com (Oath Hermes SMTP Server) with ESMTPA ID 1ebee49381581a30314f6243c2ea1808; Sat, 30 Mar 2019 21:53:15 +0000 (UTC) Content-Disposition: inline In-Reply-To: X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 77.238.179.188 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.21 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.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.org gmane.emacs.devel:234828 Archived-At: Hi Stefan: Sorry, maybe my question is a bit orthogonal to this thread, but somehow I feel it is related. In CC mode is there a way (when activating a high level for font-lock-mode) to highlight escape sequences, and numbers as in default vim? I am talking about something simple like the packages: highlight-escape-sequences and highlight-numbers. But maybe simpler and that doesn't rely on an external package for a simpler functionality like this? This is just a question, you can ignore it. Thanks in advance Ergus On Sat, Mar 30, 2019 at 04:17:25PM -0400, Stefan Monnier wrote: >>> (modify-syntax-entry ?' "\"" st) >> >> Maybe, but that doesn't give you the facilities that CC Mode offers, >> namely that the delimiters of invalid constructs (such as unterminated >> strings, or invalid character constants) get fontified with warning face. > >... or quotes-in-numbers, indeed. > >> One question which has just occurred to me is why am I doing this in CC >> Mode rather than the syntax and font-lock functionality handling it >> directly? Languages where strings don't extend over unescaped newlines >> aren't exactly a rarity. > >I think doing it in the syntax part is not necessary: the design of the >syntax is made simpler and more efficient by assuming that the behavior >on invalid code is largely irrelevant. And efficiency is important >there when we need to parse-partial-sexp a large buffer. > >But providing support for highlighting such errors in font-lock >(e.g. within font-lock-fontify-syntactically-region) would make a lot of >sense, yes. > >Or maybe the simplest would be to provide >a `font-lock-flag-multiline-strings` function that modes can add to >font-lock-keywords. > >>> But the above sounds surprisingly complex&scary, >> It only looks like that because I've spelled it out so laboriously. There >> are two hook variables, each of which needs one function and the lack of >> another. > >After re-reading the description I wonder if it couldn't be made simpler >by making those hook functions check c-single-quotes-quote-strings >instead (or have separate code in the cc-mode setup which adds/removes >those hooks as needed based on c-single-quotes-quote-strings, >essentially replacing the docstring text with executable code)? > >Also I still wonder why c-has-quoted-numbers is incompatible with >c-single-quotes-quote-strings. I guess c-has-quoted-numbers only >exists in C++, so in practice no language needs both features, but >I can't see any reason why the CC-mode code wouldn't work just as >well when both features are set. While both have to do with ' they seem >fundamentally orthogonal. > > > Stefan > >