From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Davin Pearson Newsgroups: gmane.emacs.devel Subject: Re: Special Event: Davin reveals his own personal additions to Emacs. Date: Thu, 14 Jul 2022 14:30:04 +1200 Message-ID: References: Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="00000000000093283505e3baaee9" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="20373"; mail-complaints-to="usenet@ciao.gmane.io" Cc: emacs-devel To: Stefan Monnier Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Thu Jul 14 04:31:22 2022 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 1oBodN-00054g-Nk for ged-emacs-devel@m.gmane-mx.org; Thu, 14 Jul 2022 04:31:21 +0200 Original-Received: from localhost ([::1]:37950 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oBodM-00027Y-BR for ged-emacs-devel@m.gmane-mx.org; Wed, 13 Jul 2022 22:31:20 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:40104) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oBocM-0001Lb-PI for emacs-devel@gnu.org; Wed, 13 Jul 2022 22:30:18 -0400 Original-Received: from mail-yb1-xb33.google.com ([2607:f8b0:4864:20::b33]:46614) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oBocK-0005fC-TA for emacs-devel@gnu.org; Wed, 13 Jul 2022 22:30:18 -0400 Original-Received: by mail-yb1-xb33.google.com with SMTP id l11so910907ybu.13 for ; Wed, 13 Jul 2022 19:30:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=0F3IMg1YEcjiD5rNSgGJQugBbxMuumrkwF3jOyhB2Ew=; b=oqNEYiTXJ+1CjV1z/CkvWA5j/MbHZDc3+OtEiOQzS1ZEybqpstzq0J5nfw2v1hY9DC 4Tf6/pi65ml15xSf8uhKmNdHo2rkZIIP6jexw+jxxlfLG+vHmXPfUqQFAmiBuFfMOV9q Os4jx6L4yKzg2FZTOQQGJkmrYPYMRQCGG+WuMsRGsLK8dgEOgNBxV/xrrXEUBoMxSOxm IBFN8kldA76ctYQsSL0SPIgBkNJoddvtJ5aHX2HemrE1Sr6thi1NjbsRKKBxGpjnXRKY 5gyohLW/HxebUGqZLx5EarEOvYnIoM+JkzW2YUGOpGyEIN2Ke9bsuWa2aaJUp0rIwl0w zf3g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=0F3IMg1YEcjiD5rNSgGJQugBbxMuumrkwF3jOyhB2Ew=; b=Y2l5K2ztOBGk1l/sE3uZgZoRfMJzvHn8NDMPzrk9RyzHwFvgrOGY4iuuyr0mEATDgL OqHUCRRqkGrb/oa4RqUBv/VfPQbm1K8AnWBOkp127z+szQft6O+tX3ehBFMY0FvU8Csa ZIzU39Y1ljtsJVzd05TN4fp+HEnY3vWAKMdtAirIyjRfmuMDlif9c363oSzP8bIc3sES CBH4dX6aMm2EJIM8K40P5sX2PfpF+dOg3PkOKKeBLfVna3HGCzpSU9MOgN2KZUoz2hJ1 2sgNuibGtbHUlDYcQYb2/o4z9LYC6YDr1uMcw9OKYV+ZQWUTTsk02xAJuioLPwdu4M+t UMLg== X-Gm-Message-State: AJIora9BUq+Qt3SJEObS1gbJlIHau7nvyc5NWvH9fdFp4tCRK3WV1wIS JGf5VvacFyVdqvfOHSLYBTlnhYCs9tAGAfxI2Dj9Sdp9 X-Google-Smtp-Source: AGRyM1sDFPKYdItmvUZ3zVihRzX4NnbqJMc4sEvHkwcFihF6HBXJVCSSEtPQaA3SwS1yddLeVGaVsmxSw94sqzOiweo= X-Received: by 2002:a05:6902:70b:b0:66e:8dde:7a58 with SMTP id k11-20020a056902070b00b0066e8dde7a58mr6767042ybt.186.1657765815853; Wed, 13 Jul 2022 19:30:15 -0700 (PDT) In-Reply-To: Received-SPF: pass client-ip=2607:f8b0:4864:20::b33; envelope-from=davin.pearson@gmail.com; helo=mail-yb1-xb33.google.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, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.29 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:292122 Archived-At: --00000000000093283505e3baaee9 Content-Type: text/plain; charset="UTF-8" Is dmp a reasonable prefix for global variables? I once used my-* for my global variables but abandoned it when other people started to use my code. It is rather unlikely that there is a dmp out there in the world today. Lisp namespaces should be allocated on a first in first served basis, which is how internet domain names are allocated. On Thu, 14 Jul 2022 at 13:48, Stefan Monnier wrote: > > I use debugging checkpoints every second line > > so the following code cannot be written: > > > > (defun foo () > > (progn > > (progn > > (zip) > > (message "&apple:1") > > (zap) > > (message "&apple:2") > > (boo) > > (message "&apple:3") > > (bum) > > (message "&apple:4")))) > > I do use separate lines for closing parens every once in a while, don't > get me wrong. It's just an exception rather than a rule. > [ Note also that inserting/removing such `message` needs to be different > for the last element in any case because it determines the return > value. ] > > >> importantly: > >> - should use `with-current-buffer`. > > > > is that instead of (set-buffer buf)? > > If you compile the code, the byte-compiler will give you a warning > suggesting to replace with-current-buffer for save-excursion + set-buffer. > > >> - should not `setq` on a global variable that doesn't have an > appropriate > >> namespace prefix. > >> > > Do you mean the following is not allowed: > > > > (setq apple 'banana) > > > > but the following code is allowed: > > > > (setq dmp-apple 'banana) > > Neither are recommended without first declaring that global variable > (since that's what it is: a global variable). > And global declarations need to use a proper namespace prefix. > Otherwise you're at risk of stepping on someone else's toes/variables. > > > Stefan > > --00000000000093283505e3baaee9 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Is dmp a reasonable prefix for global variables?

I once used my-* for my global variables but abandoned= it
when other people started to use my code.

=
It is rather unlikely that there is a dmp out there in the world= today.

Lisp namespaces should be allocated on a f= irst in first served basis,
which is how internet domain names ar= e allocated.



On Thu, 14 Jul 2022 at 13:4= 8, Stefan Monnier <monnier@i= ro.umontreal.ca> wrote:
> I use debugging checkpoints every second line
> so the following code cannot be written:
>
> (defun foo ()
>=C2=A0 =C2=A0 (progn
>=C2=A0 =C2=A0 =C2=A0 =C2=A0(progn
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (zip)
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (message "&apple:1") >=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (zap)
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (message "&apple:2") >=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (boo)
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (message "&apple:3") >=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (bum)
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (message "&apple:4")))= )

I do use separate lines for closing parens every once in a while, don't=
get me wrong.=C2=A0 It's just an exception rather than a rule.
[ Note also that inserting/removing such `message` needs to be different =C2=A0 for the last element in any case because it determines the return =C2=A0 value.=C2=A0 ]

>> importantly:
>> - should use `with-current-buffer`.
>
> is that instead of (set-buffer buf)?

If you compile the code, the byte-compiler will give you a warning
suggesting to replace with-current-buffer for save-excursion + set-buffer.<= br>
>> - should not `setq` on a global variable that doesn't have an = appropriate
>>=C2=A0 =C2=A0namespace prefix.
>>
> Do you mean the following is not allowed:
>
> (setq apple 'banana)
>
> but the following code is allowed:
>
> (setq dmp-apple 'banana)

Neither are recommended without first declaring that global variable
(since that's what it is: a global variable).
And global declarations need to use a proper namespace prefix.
Otherwise you're at risk of stepping on someone else's toes/variabl= es.


=C2=A0 =C2=A0 =C2=A0 =C2=A0 Stefan

--00000000000093283505e3baaee9--