From unknown Sun Jun 22 11:46:18 2025 X-Loop: help-debbugs@gnu.org Subject: bug#67734: 30.0.50; Don't mention `set` in the ELisp intro Resent-From: Stefan Monnier Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 09 Dec 2023 23:19:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 67734 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: 67734@debbugs.gnu.org X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.17021639098061 (code B ref -1); Sat, 09 Dec 2023 23:19:02 +0000 Received: (at submit) by debbugs.gnu.org; 9 Dec 2023 23:18:29 +0000 Received: from localhost ([127.0.0.1]:49172 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rC6ab-00025x-5s for submit@debbugs.gnu.org; Sat, 09 Dec 2023 18:18:29 -0500 Received: from lists.gnu.org ([2001:470:142::17]:54136) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rC6aZ-00025f-3a for submit@debbugs.gnu.org; Sat, 09 Dec 2023 18:18:28 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rC6aC-0006qK-PU for bug-gnu-emacs@gnu.org; Sat, 09 Dec 2023 18:18:05 -0500 Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rC6a7-0003oj-EX for bug-gnu-emacs@gnu.org; Sat, 09 Dec 2023 18:18:02 -0500 Received: from pmg1.iro.umontreal.ca (localhost.localdomain [127.0.0.1]) by pmg1.iro.umontreal.ca (Proxmox) with ESMTP id 0827510019F for ; Sat, 9 Dec 2023 18:17:58 -0500 (EST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1702163876; bh=STV374Gx1ygxsrBv9388gSz/eiONUcw+1uesryOBElw=; h=From:To:Subject:Date:From; b=LMRE9M3nR2ygxegc2hXO+vg7JQBOw5U4FjGhe1fq5dZ1OZIY+xTFDV2k62z0RCfWX CJ/+NDuIARnfQBpO+2YP7Cn2fBuFC0wUIIa7BkHafmS/CT03o1HJBVnVj3A4IZDQl9 n0cub2l2RuAGeoK+yYMLVt6s6aNvCI+d+XXUbhKPS4zQECYYWTWWb2zXZK/DnZaczl OZUxgSrb7eqxTuIoX35AsOzcWfZAsxfPz2ZNO2pECTa6Ny4ljzFlkmj4L7jxDzKxeP x27JPfdLIEG/p2J/7xWV2EiwE2BK6JRcEPDieN4s2Ib9qSqx59aCmbzZMHH1Ii5Ic4 5WGrXg37ISgeg== Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1]) by pmg1.iro.umontreal.ca (Proxmox) with ESMTP id D7B6C100189 for ; Sat, 9 Dec 2023 18:17:56 -0500 (EST) Received: from pastel (unknown [45.72.207.126]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id B993512031E for ; Sat, 9 Dec 2023 18:17:56 -0500 (EST) From: Stefan Monnier Date: Sat, 09 Dec 2023 18:17:50 -0500 Message-ID: MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-SPAM-INFO: Spam detection results: 0 ALL_TRUSTED -1 Passed through trusted hosts only via SMTP AWL -0.111 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% DKIM_SIGNED 0.1 Message has a DKIM or DK signature, not necessarily valid DKIM_VALID -0.1 Message has at least one valid DKIM or DK signature DKIM_VALID_AU -0.1 Message has a valid DKIM or DK signature from author's domain DKIM_VALID_EF -0.1 Message has a valid DKIM or DK signature from envelope-from domain T_SCC_BODY_TEXT_LINE -0.01 - X-SPAM-LEVEL: Received-SPF: pass client-ip=132.204.25.50; envelope-from=monnier@iro.umontreal.ca; helo=mailscanner.iro.umontreal.ca X-Spam_score_int: -42 X-Spam_score: -4.3 X-Spam_bar: ---- X-Spam_report: (-4.3 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, RCVD_IN_DNSWL_MED=-2.3, 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-Spam-Score: -0.0 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) --=-=-= Content-Type: text/plain Package: Emacs Version: 30.0.50 The ELisp intro needs to be updated to the world of static scoping. I haven't really looked at doing that, but the patch below can be considered as a step in that direction. In any case, I think it's a good change on its own. It removes all mentions of the `set` function. `set` cannot be used on statically scoped variables and I can't see what it brings to the reader of the ELisp intro (except maybe for explaining the "q" in `setq`) to first tell them about `set` only to turn around and tell them they'll never use it. Suggestions for improvements welcome, Stefan --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=elisp-intro.patch diff --git a/doc/lispintro/emacs-lisp-intro.texi b/doc/lispintro/emacs-lisp-intro.texi index eb8ff413b79..4246742a17e 100644 --- a/doc/lispintro/emacs-lisp-intro.texi +++ b/doc/lispintro/emacs-lisp-intro.texi @@ -2280,34 +2280,33 @@ set & setq @cindex @samp{bind} defined There are several ways by which a variable can be given a value. One of -the ways is to use either the function @code{set} or the special form +the ways is to use the special form @code{setq}. Another way is to use @code{let} (@pxref{let}). (The jargon for this process is to @dfn{bind} a variable to a value.) -The following sections not only describe how @code{set} and @code{setq} -work but also illustrate how arguments are passed. +The following sections not only describe how @code{setq} +works but also illustrate how arguments are passed. @menu -* Using set:: Setting values. -* Using setq:: Setting a quoted value. +* Using setq:: Setting variables. * Counting:: Using @code{setq} to count. @end menu -@node Using set -@subsection Using @code{set} +@node Using setq +@subsection Using @code{setq} @findex set -To set the value of the symbol @code{flowers} to the list @code{'(rose +To set the value of the symbol @code{flowers} to the list @code{(rose violet daisy buttercup)}, evaluate the following expression by positioning the cursor after the expression and typing @kbd{C-x C-e}. @smallexample -(set 'flowers '(rose violet daisy buttercup)) +(setq flowers '(rose violet daisy buttercup)) @end smallexample @noindent The list @code{(rose violet daisy buttercup)} will appear in the echo -area. This is what is @emph{returned} by the @code{set} function. As a +area. This is what is @emph{returned} by the @code{setq} special form. As a side effect, the symbol @code{flowers} is bound to the list; that is, the symbol @code{flowers}, which can be viewed as a variable, is given the list as its value. (This process, by the way, illustrates how a @@ -2316,7 +2315,7 @@ Using set Lisp function must return a value if it does not get an error, but it will only have a side effect if it is designed to have one.) -After evaluating the @code{set} expression, you can evaluate the symbol +After evaluating the @code{setq} expression, you can evaluate the symbol @code{flowers} and it will return the value you just set. Here is the symbol. Place your cursor after it and type @kbd{C-x C-e}. @@ -2336,29 +2335,7 @@ Using set 'flowers @end smallexample -Note also, that when you use @code{set}, you need to quote both -arguments to @code{set}, unless you want them evaluated. Since we do -not want either argument evaluated, neither the variable -@code{flowers} nor the list @code{(rose violet daisy buttercup)}, both -are quoted. (When you use @code{set} without quoting its first -argument, the first argument is evaluated before anything else is -done. If you did this and @code{flowers} did not have a value -already, you would get an error message that the @samp{Symbol's value -as variable is void}; on the other hand, if @code{flowers} did return -a value after it was evaluated, the @code{set} would attempt to set -the value that was returned. There are situations where this is the -right thing for the function to do; but such situations are rare.) - -@node Using setq -@subsection Using @code{setq} -@findex setq - -As a practical matter, you almost always quote the first argument to -@code{set}. The combination of @code{set} and a quoted first argument -is so common that it has its own name: the special form @code{setq}. -This special form is just like @code{set} except that the first argument -is quoted automatically, so you don't need to type the quote mark -yourself. Also, as an added convenience, @code{setq} permits you to set +Also, as an added convenience, @code{setq} permits you to set several different variables to different values, all in one expression. To set the value of the variable @code{carnivores} to the list @@ -2369,18 +2346,6 @@ Using setq (setq carnivores '(lion tiger leopard)) @end smallexample -@noindent -This is exactly the same as using @code{set} except the first argument -is automatically quoted by @code{setq}. (The @samp{q} in @code{setq} -means @code{quote}.) - -@need 1250 -With @code{set}, the expression would look like this: - -@smallexample -(set 'carnivores '(lion tiger leopard)) -@end smallexample - Also, @code{setq} can be used to assign different values to different variables. The first argument is bound to the value of the second argument, the third argument is bound to the value of the @@ -2401,8 +2366,8 @@ Using setq formatted lists.) Although I have been using the term ``assign'', there is another way of -thinking about the workings of @code{set} and @code{setq}; and that is to -say that @code{set} and @code{setq} make the symbol @emph{point} to the +thinking about the workings of @code{setq}; and that is to +say that @code{setq} makes the symbol @emph{point} to the list. This latter way of thinking is very common and in forthcoming chapters we shall come upon at least one symbol that has ``pointer'' as part of its name. The name is chosen because the symbol has a value, @@ -3598,6 +3563,8 @@ Prevent confusion @unnumberedsubsec @code{let} Prevents Confusion @end ifnottex +@c FIXME!! lexbind!! + @cindex @samp{local variable} defined @cindex @samp{variable, local}, defined The @code{let} special form prevents confusion. @code{let} creates a @@ -4471,9 +4438,7 @@ Review The @code{setq} special form sets the value of its first argument to the value of the second argument. The first argument is automatically quoted by @code{setq}. It does the same for succeeding pairs of -arguments. Another function, @code{set}, takes only two arguments and -evaluates both of them before setting the value returned by its first -argument to the value returned by its second argument. +arguments. @item buffer-name Without an argument, return the name of the buffer, as a string. --=-=-=-- From unknown Sun Jun 22 11:46:18 2025 X-Loop: help-debbugs@gnu.org Subject: bug#67734: 30.0.50; Don't mention `set` in the ELisp intro Resent-From: Stefan Kangas Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 14 Dec 2023 22:31:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 67734 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Stefan Monnier , 67734@debbugs.gnu.org Received: via spool by 67734-submit@debbugs.gnu.org id=B67734.170259305320559 (code B ref 67734); Thu, 14 Dec 2023 22:31:01 +0000 Received: (at 67734) by debbugs.gnu.org; 14 Dec 2023 22:30:53 +0000 Received: from localhost ([127.0.0.1]:51145 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rDuEH-0005Kw-Dk for submit@debbugs.gnu.org; Thu, 14 Dec 2023 17:30:53 -0500 Received: from mail-ed1-x52a.google.com ([2a00:1450:4864:20::52a]:42375) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rDuEF-00056y-TP for 67734@debbugs.gnu.org; Thu, 14 Dec 2023 17:30:52 -0500 Received: by mail-ed1-x52a.google.com with SMTP id 4fb4d7f45d1cf-54f4b31494fso18728a12.1 for <67734@debbugs.gnu.org>; Thu, 14 Dec 2023 14:30:52 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1702593046; x=1703197846; darn=debbugs.gnu.org; h=to:subject:message-id:date:mime-version:references:in-reply-to:from :from:to:cc:subject:date:message-id:reply-to; bh=pWZQAjuYySt2jzngdSMoNbaUmx1fYqhOAF1xE3JIi2w=; b=Vouf+u41JcO0dj4R31Lgw2xMN3thiq6fig4Q6uYJhmybBXp5TIHGShX519cyv1HZAW 7S6AHMZqjOxHpJ90J7OKVccZckZeKkRS27MHAXHwEsc6GjLDD8/EEENVVQGwuSlAqlk9 kHjDdTQCU4sD0lTL/pOEL1Y+grl7CAEsfBBXvcWtM+SmuR+szDURHigmmjDuxM5YQjit s8HvbgoE2ttNHaOq+1CbomPrc9LQkZYWY5yelRVE/qqTVBtvtZ+h+WLkps/9LgZHcEml z49qqu/st0QsJeK+eeO6yTPmXqP0FXglOj0XJIBtUhCHm/vhrI63xFHptatroyn5GkcT 5AGA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1702593046; x=1703197846; h=to:subject:message-id:date:mime-version:references:in-reply-to:from :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=pWZQAjuYySt2jzngdSMoNbaUmx1fYqhOAF1xE3JIi2w=; b=H7tThyldv8d+aTX79VGaZXLnHlMlOnPhEjNXVCl6ZCvEiFzbmWSYXaa7+7vLBs6anR PCwNlPORPpR6ZEZxAWa8hjcoAx38/9F5FWyuh0G2TU1QmO5x1fgyn6fA8POZ8qfV7XgC Mo1VPOuHfJAsAAUr64acvgQcmSRGnpl0PI5QU9KNhgB+lPJ6653vPVRtrMNEl00J7ovc KHYbmgzos6cEv1UFbGx/fVxvwioXmjNgpmqZ+thu6oey54U4v6yvEtjBdX401M6uyxoX rwb0FFCYp8qii525z5hldQj2/egBSqh3ewrZfxuDnXrdg1O5NIXYlFUl7JIQUoo9GB7z 8WnQ== X-Gm-Message-State: AOJu0Yw2WLZliDTLA0YqCDUQdyoVyFKMsKEEZNW8lA8fVHMSXw8hWDkU pgAW2TgCH8ay6thiKaSj9d2IhGfjgeTfHyKKTLk= X-Google-Smtp-Source: AGHT+IG7WpBYFYDLMiDdbHzypTYpEVLeu2ypkihEB1/2MLkI5AZHTJnxzLSOJQd8Tr9gATZ0TzHPAigkHUnUxKsTCg4= X-Received: by 2002:a05:6402:1610:b0:551:e805:411c with SMTP id f16-20020a056402161000b00551e805411cmr4310484edv.15.1702593046462; Thu, 14 Dec 2023 14:30:46 -0800 (PST) Received: from 753933720722 named unknown by gmailapi.google.com with HTTPREST; Thu, 14 Dec 2023 14:30:45 -0800 From: Stefan Kangas In-Reply-To: References: MIME-Version: 1.0 Date: Thu, 14 Dec 2023 14:30:45 -0800 Message-ID: Content-Type: text/plain; charset="UTF-8" X-Spam-Score: -0.0 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) Stefan Monnier via "Bug reports for GNU Emacs, the Swiss army knife of text editors" writes: > The ELisp intro needs to be updated to the world of static scoping. > I haven't really looked at doing that, but the patch below can be > considered as a step in that direction. > In any case, I think it's a good change on its own. > > It removes all mentions of the `set` function. > `set` cannot be used on statically scoped variables and I can't see what > it brings to the reader of the ELisp intro (except maybe for explaining > the "q" in `setq`) to first tell them about `set` only to turn around > and tell them they'll never use it. > > Suggestions for improvements welcome, LGTM. If it's worth doing, it should be worth doing also on emacs-29, I think. Is it worth reflowing the paragraphs before installing though? From unknown Sun Jun 22 11:46:18 2025 X-Loop: help-debbugs@gnu.org Subject: bug#67734: 30.0.50; Don't mention `set` in the ELisp intro Resent-From: Stefan Monnier Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 16 Dec 2023 18:07:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 67734 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Stefan Kangas Cc: 67734@debbugs.gnu.org Received: via spool by 67734-submit@debbugs.gnu.org id=B67734.170275001915503 (code B ref 67734); Sat, 16 Dec 2023 18:07:01 +0000 Received: (at 67734) by debbugs.gnu.org; 16 Dec 2023 18:06:59 +0000 Received: from localhost ([127.0.0.1]:56007 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rEZ3w-00041w-5T for submit@debbugs.gnu.org; Sat, 16 Dec 2023 13:06:59 -0500 Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:5364) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rEZ3q-00041c-Rt for 67734@debbugs.gnu.org; Sat, 16 Dec 2023 13:06:54 -0500 Received: from pmg3.iro.umontreal.ca (localhost [127.0.0.1]) by pmg3.iro.umontreal.ca (Proxmox) with ESMTP id 5C830441D97; Sat, 16 Dec 2023 13:06:44 -0500 (EST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1702750003; bh=p59lujsd/DtH2g6Qsn7oMv7/1Fl8LDrWOwubM/n5/jY=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=FFgkjqUWdhslLJMDS119uIUOPgP9KQJPQp9kRtpavCFafJjq4/CZBm4+UDPDkeTCD 3D9ge3vO/jbDx7Zzqah7uiOd8rpFj/O49Bp5WoxbOwVwAAK/xSIUqFUi5GTV5PI6Hw a43hQWGMXMOcJE9AMOlQL8vRUGX53gFEc8WhXGWPKLm57CwYuCI13RrUrjaul6kaLz 4R+JqPBYzY75PtBVXdLrVJR23JyX2QSxtjmyDCWy+N28I3uy6t1/xoQhhxku51bYKo by+ZZsar2X/1H+a1E/zrcELq34YXyC8wi+NVp8tElzm1rAQ+ix1tYlcL9Y5l6mePkr 7KUbwUxF0EWOw== Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1]) by pmg3.iro.umontreal.ca (Proxmox) with ESMTP id 2CF6A441D8D; Sat, 16 Dec 2023 13:06:43 -0500 (EST) Received: from pastel (65-110-221-238.cpe.pppoe.ca [65.110.221.238]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id 08406120E6B; Sat, 16 Dec 2023 13:06:43 -0500 (EST) From: Stefan Monnier In-Reply-To: (Stefan Kangas's message of "Thu, 14 Dec 2023 14:30:45 -0800") Message-ID: References: Date: Sat, 16 Dec 2023 13:06:42 -0500 User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain X-SPAM-INFO: Spam detection results: 0 ALL_TRUSTED -1 Passed through trusted hosts only via SMTP AWL -0.047 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% DKIM_SIGNED 0.1 Message has a DKIM or DK signature, not necessarily valid DKIM_VALID -0.1 Message has at least one valid DKIM or DK signature DKIM_VALID_AU -0.1 Message has a valid DKIM or DK signature from author's domain DKIM_VALID_EF -0.1 Message has a valid DKIM or DK signature from envelope-from domain T_SCC_BODY_TEXT_LINE -0.01 - X-SPAM-LEVEL: X-Spam-Score: -2.3 (--) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) >> The ELisp intro needs to be updated to the world of static scoping. >> I haven't really looked at doing that, but the patch below can be >> considered as a step in that direction. >> In any case, I think it's a good change on its own. >> >> It removes all mentions of the `set` function. >> `set` cannot be used on statically scoped variables and I can't see what >> it brings to the reader of the ELisp intro (except maybe for explaining >> the "q" in `setq`) to first tell them about `set` only to turn around >> and tell them they'll never use it. >> >> Suggestions for improvements welcome, > > LGTM. If it's worth doing, it should be worth doing also on emacs-29, > I think. I'm fine with `emacs-29`, yes. > Is it worth reflowing the paragraphs before installing though? Will do. Stefan From unknown Sun Jun 22 11:46:18 2025 MIME-Version: 1.0 X-Mailer: MIME-tools 5.505 (Entity 5.505) X-Loop: help-debbugs@gnu.org From: help-debbugs@gnu.org (GNU bug Tracking System) To: Stefan Monnier Subject: bug#67734: closed (Re: bug#67734: 30.0.50; Don't mention `set` in the ELisp intro) Message-ID: References: X-Gnu-PR-Message: they-closed 67734 X-Gnu-PR-Package: emacs Reply-To: 67734@debbugs.gnu.org Date: Thu, 21 Dec 2023 15:26:02 +0000 Content-Type: multipart/mixed; boundary="----------=_1703172362-32029-1" This is a multi-part message in MIME format... ------------=_1703172362-32029-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Your bug report #67734: 30.0.50; Don't mention `set` in the ELisp intro which was filed against the emacs package, has been closed. The explanation is attached below, along with your original report. If you require more details, please reply to 67734@debbugs.gnu.org. --=20 67734: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D67734 GNU Bug Tracking System Contact help-debbugs@gnu.org with problems ------------=_1703172362-32029-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at 67734-done) by debbugs.gnu.org; 21 Dec 2023 15:25:15 +0000 Received: from localhost ([127.0.0.1]:45269 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rGKvC-0008JQ-Tp for submit@debbugs.gnu.org; Thu, 21 Dec 2023 10:25:15 -0500 Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:62318) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rGKvB-0008JA-CP for 67734-done@debbugs.gnu.org; Thu, 21 Dec 2023 10:25:14 -0500 Received: from pmg2.iro.umontreal.ca (localhost.localdomain [127.0.0.1]) by pmg2.iro.umontreal.ca (Proxmox) with ESMTP id A97D880B61; Thu, 21 Dec 2023 10:25:03 -0500 (EST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1703172302; bh=hFzv+sGiDze300Mq0ThXHX5thibeYMOFc02ny9Wqo8U=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=avhcpEFSJHJ5G/8ZSYKdOQcArJA4zt9MZniu9GRGwntD+n0GN9MW05Svt87H5C/um ww7byFQT9YzaWw112B0ymzPX5hDmlbgeTg75JZ+K6C0uw52gaXfzJHrtdEwUfFVyS8 1jVR5eBPyuhihQzlaejUlJnZINIi8c6BR0XQlpLnHXiy+j+xbECo+xnV82WsiAqj/v 965qkmvbHu4dxCqatk4JtAmJ2LILhqs7CzBwefyAg3E0923U7QNnXbkZlwF6quKnGU PRl4D1Zo1Ktkbw9elJBeZjoXw0Kj8FazKQKuzE4DAiiNkejYbuLEhoQmH+kfP8md4R p/5qRvh+t82yA== Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1]) by pmg2.iro.umontreal.ca (Proxmox) with ESMTP id 9E8918106B; Thu, 21 Dec 2023 10:25:02 -0500 (EST) Received: from pastel (65-110-221-238.cpe.pppoe.ca [65.110.221.238]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id 7B3A9120F8B; Thu, 21 Dec 2023 10:25:02 -0500 (EST) From: Stefan Monnier To: Stefan Kangas Subject: Re: bug#67734: 30.0.50; Don't mention `set` in the ELisp intro In-Reply-To: (Stefan Monnier's message of "Sat, 16 Dec 2023 13:06:42 -0500") Message-ID: References: Date: Thu, 21 Dec 2023 10:25:01 -0500 User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain X-SPAM-INFO: Spam detection results: 0 ALL_TRUSTED -1 Passed through trusted hosts only via SMTP AWL 0.159 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% DKIM_SIGNED 0.1 Message has a DKIM or DK signature, not necessarily valid DKIM_VALID -0.1 Message has at least one valid DKIM or DK signature DKIM_VALID_AU -0.1 Message has a valid DKIM or DK signature from author's domain DKIM_VALID_EF -0.1 Message has a valid DKIM or DK signature from envelope-from domain T_SCC_BODY_TEXT_LINE -0.01 - X-SPAM-LEVEL: X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 67734-done Cc: 67734-done@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) >> LGTM. If it's worth doing, it should be worth doing also on emacs-29, >> I think. > I'm fine with `emacs-29`, yes. Pushed, thanks, Stefan ------------=_1703172362-32029-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at submit) by debbugs.gnu.org; 9 Dec 2023 23:18:29 +0000 Received: from localhost ([127.0.0.1]:49172 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rC6ab-00025x-5s for submit@debbugs.gnu.org; Sat, 09 Dec 2023 18:18:29 -0500 Received: from lists.gnu.org ([2001:470:142::17]:54136) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rC6aZ-00025f-3a for submit@debbugs.gnu.org; Sat, 09 Dec 2023 18:18:28 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rC6aC-0006qK-PU for bug-gnu-emacs@gnu.org; Sat, 09 Dec 2023 18:18:05 -0500 Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rC6a7-0003oj-EX for bug-gnu-emacs@gnu.org; Sat, 09 Dec 2023 18:18:02 -0500 Received: from pmg1.iro.umontreal.ca (localhost.localdomain [127.0.0.1]) by pmg1.iro.umontreal.ca (Proxmox) with ESMTP id 0827510019F for ; Sat, 9 Dec 2023 18:17:58 -0500 (EST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1702163876; bh=STV374Gx1ygxsrBv9388gSz/eiONUcw+1uesryOBElw=; h=From:To:Subject:Date:From; b=LMRE9M3nR2ygxegc2hXO+vg7JQBOw5U4FjGhe1fq5dZ1OZIY+xTFDV2k62z0RCfWX CJ/+NDuIARnfQBpO+2YP7Cn2fBuFC0wUIIa7BkHafmS/CT03o1HJBVnVj3A4IZDQl9 n0cub2l2RuAGeoK+yYMLVt6s6aNvCI+d+XXUbhKPS4zQECYYWTWWb2zXZK/DnZaczl OZUxgSrb7eqxTuIoX35AsOzcWfZAsxfPz2ZNO2pECTa6Ny4ljzFlkmj4L7jxDzKxeP x27JPfdLIEG/p2J/7xWV2EiwE2BK6JRcEPDieN4s2Ib9qSqx59aCmbzZMHH1Ii5Ic4 5WGrXg37ISgeg== Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1]) by pmg1.iro.umontreal.ca (Proxmox) with ESMTP id D7B6C100189 for ; Sat, 9 Dec 2023 18:17:56 -0500 (EST) Received: from pastel (unknown [45.72.207.126]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id B993512031E for ; Sat, 9 Dec 2023 18:17:56 -0500 (EST) From: Stefan Monnier To: bug-gnu-emacs@gnu.org Subject: 30.0.50; Don't mention `set` in the ELisp intro Date: Sat, 09 Dec 2023 18:17:50 -0500 Message-ID: MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-SPAM-INFO: Spam detection results: 0 ALL_TRUSTED -1 Passed through trusted hosts only via SMTP AWL -0.111 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% DKIM_SIGNED 0.1 Message has a DKIM or DK signature, not necessarily valid DKIM_VALID -0.1 Message has at least one valid DKIM or DK signature DKIM_VALID_AU -0.1 Message has a valid DKIM or DK signature from author's domain DKIM_VALID_EF -0.1 Message has a valid DKIM or DK signature from envelope-from domain T_SCC_BODY_TEXT_LINE -0.01 - X-SPAM-LEVEL: Received-SPF: pass client-ip=132.204.25.50; envelope-from=monnier@iro.umontreal.ca; helo=mailscanner.iro.umontreal.ca X-Spam_score_int: -42 X-Spam_score: -4.3 X-Spam_bar: ---- X-Spam_report: (-4.3 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, RCVD_IN_DNSWL_MED=-2.3, 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-Spam-Score: -0.0 (/) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) --=-=-= Content-Type: text/plain Package: Emacs Version: 30.0.50 The ELisp intro needs to be updated to the world of static scoping. I haven't really looked at doing that, but the patch below can be considered as a step in that direction. In any case, I think it's a good change on its own. It removes all mentions of the `set` function. `set` cannot be used on statically scoped variables and I can't see what it brings to the reader of the ELisp intro (except maybe for explaining the "q" in `setq`) to first tell them about `set` only to turn around and tell them they'll never use it. Suggestions for improvements welcome, Stefan --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=elisp-intro.patch diff --git a/doc/lispintro/emacs-lisp-intro.texi b/doc/lispintro/emacs-lisp-intro.texi index eb8ff413b79..4246742a17e 100644 --- a/doc/lispintro/emacs-lisp-intro.texi +++ b/doc/lispintro/emacs-lisp-intro.texi @@ -2280,34 +2280,33 @@ set & setq @cindex @samp{bind} defined There are several ways by which a variable can be given a value. One of -the ways is to use either the function @code{set} or the special form +the ways is to use the special form @code{setq}. Another way is to use @code{let} (@pxref{let}). (The jargon for this process is to @dfn{bind} a variable to a value.) -The following sections not only describe how @code{set} and @code{setq} -work but also illustrate how arguments are passed. +The following sections not only describe how @code{setq} +works but also illustrate how arguments are passed. @menu -* Using set:: Setting values. -* Using setq:: Setting a quoted value. +* Using setq:: Setting variables. * Counting:: Using @code{setq} to count. @end menu -@node Using set -@subsection Using @code{set} +@node Using setq +@subsection Using @code{setq} @findex set -To set the value of the symbol @code{flowers} to the list @code{'(rose +To set the value of the symbol @code{flowers} to the list @code{(rose violet daisy buttercup)}, evaluate the following expression by positioning the cursor after the expression and typing @kbd{C-x C-e}. @smallexample -(set 'flowers '(rose violet daisy buttercup)) +(setq flowers '(rose violet daisy buttercup)) @end smallexample @noindent The list @code{(rose violet daisy buttercup)} will appear in the echo -area. This is what is @emph{returned} by the @code{set} function. As a +area. This is what is @emph{returned} by the @code{setq} special form. As a side effect, the symbol @code{flowers} is bound to the list; that is, the symbol @code{flowers}, which can be viewed as a variable, is given the list as its value. (This process, by the way, illustrates how a @@ -2316,7 +2315,7 @@ Using set Lisp function must return a value if it does not get an error, but it will only have a side effect if it is designed to have one.) -After evaluating the @code{set} expression, you can evaluate the symbol +After evaluating the @code{setq} expression, you can evaluate the symbol @code{flowers} and it will return the value you just set. Here is the symbol. Place your cursor after it and type @kbd{C-x C-e}. @@ -2336,29 +2335,7 @@ Using set 'flowers @end smallexample -Note also, that when you use @code{set}, you need to quote both -arguments to @code{set}, unless you want them evaluated. Since we do -not want either argument evaluated, neither the variable -@code{flowers} nor the list @code{(rose violet daisy buttercup)}, both -are quoted. (When you use @code{set} without quoting its first -argument, the first argument is evaluated before anything else is -done. If you did this and @code{flowers} did not have a value -already, you would get an error message that the @samp{Symbol's value -as variable is void}; on the other hand, if @code{flowers} did return -a value after it was evaluated, the @code{set} would attempt to set -the value that was returned. There are situations where this is the -right thing for the function to do; but such situations are rare.) - -@node Using setq -@subsection Using @code{setq} -@findex setq - -As a practical matter, you almost always quote the first argument to -@code{set}. The combination of @code{set} and a quoted first argument -is so common that it has its own name: the special form @code{setq}. -This special form is just like @code{set} except that the first argument -is quoted automatically, so you don't need to type the quote mark -yourself. Also, as an added convenience, @code{setq} permits you to set +Also, as an added convenience, @code{setq} permits you to set several different variables to different values, all in one expression. To set the value of the variable @code{carnivores} to the list @@ -2369,18 +2346,6 @@ Using setq (setq carnivores '(lion tiger leopard)) @end smallexample -@noindent -This is exactly the same as using @code{set} except the first argument -is automatically quoted by @code{setq}. (The @samp{q} in @code{setq} -means @code{quote}.) - -@need 1250 -With @code{set}, the expression would look like this: - -@smallexample -(set 'carnivores '(lion tiger leopard)) -@end smallexample - Also, @code{setq} can be used to assign different values to different variables. The first argument is bound to the value of the second argument, the third argument is bound to the value of the @@ -2401,8 +2366,8 @@ Using setq formatted lists.) Although I have been using the term ``assign'', there is another way of -thinking about the workings of @code{set} and @code{setq}; and that is to -say that @code{set} and @code{setq} make the symbol @emph{point} to the +thinking about the workings of @code{setq}; and that is to +say that @code{setq} makes the symbol @emph{point} to the list. This latter way of thinking is very common and in forthcoming chapters we shall come upon at least one symbol that has ``pointer'' as part of its name. The name is chosen because the symbol has a value, @@ -3598,6 +3563,8 @@ Prevent confusion @unnumberedsubsec @code{let} Prevents Confusion @end ifnottex +@c FIXME!! lexbind!! + @cindex @samp{local variable} defined @cindex @samp{variable, local}, defined The @code{let} special form prevents confusion. @code{let} creates a @@ -4471,9 +4438,7 @@ Review The @code{setq} special form sets the value of its first argument to the value of the second argument. The first argument is automatically quoted by @code{setq}. It does the same for succeeding pairs of -arguments. Another function, @code{set}, takes only two arguments and -evaluates both of them before setting the value returned by its first -argument to the value returned by its second argument. +arguments. @item buffer-name Without an argument, return the name of the buffer, as a string. --=-=-=-- ------------=_1703172362-32029-1--