From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Alan Mackenzie Newsgroups: gmane.emacs.devel Subject: Re: emacs-lisp-mode highlights =?utf-8?Q?i?= =?utf-8?Q?ncorrectly_defmacros=2Fdefuns=E2=80=99?= arglists Date: Tue, 16 Oct 2018 20:10:09 +0000 Message-ID: <20181016201008.GD5722@ACM> References: <87in21u6gu.fsf@portable.galex-713.eu> <20181016183551.GB5722@ACM> <87va61r91q.fsf@portable.galex-713.eu> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Trace: blaine.gmane.org 1539720972 20388 195.159.176.226 (16 Oct 2018 20:16:12 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Tue, 16 Oct 2018 20:16:12 +0000 (UTC) User-Agent: Mutt/1.10.1 (2018-07-13) Cc: emacs-devel@gnu.org To: "Garreau, Alexandre" Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Tue Oct 16 22:16:08 2018 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1gCVl6-0005Aq-TD for ged-emacs-devel@m.gmane.org; Tue, 16 Oct 2018 22:16:05 +0200 Original-Received: from localhost ([::1]:60093 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gCVnC-0007cd-Uk for ged-emacs-devel@m.gmane.org; Tue, 16 Oct 2018 16:18:14 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:50317) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gCVn2-0007Y4-PM for emacs-devel@gnu.org; Tue, 16 Oct 2018 16:18:05 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gCVmz-0005Ic-Ij for emacs-devel@gnu.org; Tue, 16 Oct 2018 16:18:04 -0400 Original-Received: from colin.muc.de ([193.149.48.1]:10029 helo=mail.muc.de) by eggs.gnu.org with smtp (Exim 4.71) (envelope-from ) id 1gCVmz-0005C8-7S for emacs-devel@gnu.org; Tue, 16 Oct 2018 16:18:01 -0400 Original-Received: (qmail 55296 invoked by uid 3782); 16 Oct 2018 20:17:59 -0000 Original-Received: from acm.muc.de (p5B14712A.dip0.t-ipconnect.de [91.20.113.42]) by colin.muc.de (tmda-ofmipd) with ESMTP; Tue, 16 Oct 2018 22:17:58 +0200 Original-Received: (qmail 10605 invoked by uid 1000); 16 Oct 2018 20:10:09 -0000 Content-Disposition: inline In-Reply-To: <87va61r91q.fsf@portable.galex-713.eu> X-Delivery-Agent: TMDA/1.1.12 (Macallan) X-Primary-Address: acm@muc.de X-detected-operating-system: by eggs.gnu.org: FreeBSD 9.x [fuzzy] X-Received-From: 193.149.48.1 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:230424 Archived-At: On Tue, Oct 16, 2018 at 21:22:25 +0200, Garreau, Alexandre wrote: > On 2018-10-16 at 18:35, Alan Mackenzie wrote: > > On Tue, Oct 16, 2018 at 19:49:53 +0200, Garreau, Alexandre wrote: > >> At least *someone* must have *seen* this: > >> #+BEGIN_SRC elisp > >> (defmacro unless (cond &rest body) > >> "If COND yields nil, do BODY, else return nil. > >> When COND yields nil, eval BODY forms sequentially and return > >> value of last one, or nil if there are none. > >> \(fn COND BODY...)" > >> (declare (indent 1) (debug t)) > >> (cons 'if (cons cond (cons nil body)))) > >> #+END_SRC > > You surely are conscious of the fact that `cond' is a special form? > I am, yet from the time it’s used as either a variable, or a macro arg, > normally that shouldn’t cause any issue… otherwise what’s the point of a > lisp-2, with 2 whole different namespaces? > > To use it as an argument name is asking for trouble, surely. > Still Emacs seems to use it extensively to mean “form evaluating to a > boolean” (different from “test” which is a function returning a > boolean), this nicely and understandably have the same as the most > primitive, old and handy special form taking those as arguments. Apologies. `cond' is indeed used as the name of a first argument elsewhere, but relatively seldom. I found six occurrences with a grep. > This exemple was an excerpt of subr.el. And I noticed there that there > were many others. As a probably quite old convention, this must trace > back to long ago so it must be disseminated all around emacs’ source > code. Maybe it is, maybe it's not. As I said, it's not common in Emacs's own source code, having `cond' as a first argument. Perhaps it occurs more often in let, let* binding clauses (where it's more difficult to find with grep). > Do you have any so better name to suggest for replacing the symbol > “cond” used as a variable everywhere in emacs’ source code? .... Not really. I've just looked up "condition" in a thesaurus, and perhaps `stip' (for stipulation), or ... No, there's really not much to suggest. :-( > .... because otherwise I feel like it’s the fontification who’s wrong > here. It is wrong, yes. But is it wrong enough to justify the effort it would take to fix it? If you're experienced in emacs lisp, or wanting to become so, this could be a good project for you to undertake. You care about this a fair bit, I don't, really, and I suspect most other Emacs contributors don't, either. Help would be available in this list. > > The font locking in emacs-lisp-mode appears not to be too > > sophisticated. But it is fast. > >> Wouldn’t there be a way to turn off these highlightings in such > >> places of known old and fixed macro calls? > > There might well be, but it would slow fontification down, somewhat. > > I suspect that changing "cond" to something less contentious will get > > the result you want. > That much? Emacs source code using “cond” extensively, I’ve thought this > would be a must-have feature. This always bugged me and I just re-saw > it so I thought about talking about it. The expert in this area is Stefan Monnier. Maybe he'll answer you directly. But, as I say, if you decided to tackle the problem yourself, you'd get a positive reaction from people, here. -- Alan Mackenzie (Nuremberg, Germany).