From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Xiyue Deng Newsgroups: gmane.emacs.bugs Subject: bug#67848: 29.1; Fix usage of `setq-default' and add explanation Date: Sat, 23 Dec 2023 23:00:59 -0800 Message-ID: <878r5kf5jo.fsf@debian-hx90.lan> References: <87msuaief7.fsf@debian-hx90.lan> <83r0jde1it.fsf@gnu.org> <87jzp5fcx2.fsf@debian-hx90.lan> <83y1dlcghi.fsf@gnu.org> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="1127"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Cc: 67848@debbugs.gnu.org To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sun Dec 24 08:02:14 2023 Return-path: Envelope-to: geb-bug-gnu-emacs@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 1rHIV4-000AeQ-1v for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 24 Dec 2023 08:02:14 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rHIUo-0005Nl-5G; Sun, 24 Dec 2023 02:01:58 -0500 Original-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 1rHIUm-0005Nc-Tl for bug-gnu-emacs@gnu.org; Sun, 24 Dec 2023 02:01:56 -0500 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rHIUm-0008M8-Lm for bug-gnu-emacs@gnu.org; Sun, 24 Dec 2023 02:01:56 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1rHIUr-000180-Va for bug-gnu-emacs@gnu.org; Sun, 24 Dec 2023 02:02:01 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Xiyue Deng Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 24 Dec 2023 07:02:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 67848 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 67848-submit@debbugs.gnu.org id=B67848.17034012763660 (code B ref 67848); Sun, 24 Dec 2023 07:02:01 +0000 Original-Received: (at 67848) by debbugs.gnu.org; 24 Dec 2023 07:01:16 +0000 Original-Received: from localhost ([127.0.0.1]:51635 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rHIU7-0000wR-RN for submit@debbugs.gnu.org; Sun, 24 Dec 2023 02:01:16 -0500 Original-Received: from mail-oo1-xc31.google.com ([2607:f8b0:4864:20::c31]:52666) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rHIU6-0000pG-0W for 67848@debbugs.gnu.org; Sun, 24 Dec 2023 02:01:14 -0500 Original-Received: by mail-oo1-xc31.google.com with SMTP id 006d021491bc7-5908a63a83fso1919558eaf.1 for <67848@debbugs.gnu.org>; Sat, 23 Dec 2023 23:01:08 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1703401262; x=1704006062; darn=debbugs.gnu.org; h=mime-version:user-agent:message-id:date:references:in-reply-to :subject:cc:to:from:from:to:cc:subject:date:message-id:reply-to; bh=SpTWc4UtGXO0sCWnCJF0m8QcxeEgtmZdbEuX94dGHMU=; b=PXvMGTVbsw+Bg+20tw3uK8g7vU5Dxd3Qqr+p56YgfLApK2OAQFeEjtf137lJQ0GnlZ 8WdxePaMsEBz0WNXKtCEuNH2bWW4ftbBqPf9Y7mtYM2Fl0WlwrklDDdSSvzfRdLgcY5N xlkFNCjfF/pRi9CjRnsI/zdJl3yGI4fGCuDlIgeAQEZlQTa4Y0LGigg+NHDGnOjO86Eo cXsedFJfXsHBueqRimNuUyqeJQayS4e1qj66c1VqdLPE4NvVg4DjZ7GwLxn2dn/Hu6Us qEnD72Q24N4+J8r36ANKG6iNjNNyAEox/wmXTyDoNxPrlGcd+Dp875hdwIrlz9DTumE+ vm/Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1703401262; x=1704006062; h=mime-version:user-agent:message-id:date:references:in-reply-to :subject:cc:to:from:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=SpTWc4UtGXO0sCWnCJF0m8QcxeEgtmZdbEuX94dGHMU=; b=EzGesyO6RRYDC+o/zrrVLqqbDgieIiF7ArC3htji8fBmow5GshC1zltxACHyXcHA0d 6ZQU9o1Ekdxe77uhJH0ykph5wkZrn4cEIDZ934WEHb3v8wXIy0cCFhnvXy8u7GbrR8cA r9qnJkB/Asr06oYrOouNFrcecZbLF0roAqXclmoapnbxvtPzwSzZre+88HDZR4yqBTZJ dnE7J4FH0br+udsEbwm+y70WuqCYc3VYtkohlTGLm2fw01pTyLW0XbZ2GU8anJTuAPjJ K1X4Dnwi+5HlysniSxrbKKpK1OibEHKiyPMBYmtHewYqGokKsiNih9IQuFnPoamLxWXh /RvA== X-Gm-Message-State: AOJu0YyAr86fgJ4aNG7nX9CtluD/+c1SUWwfUJYl5HPmUDcNU98NE/gv wkadWss/9zJ1xacNgoY52vB00+t+Yeo= X-Google-Smtp-Source: AGHT+IEmXt5nS8opuvI4XFZAtP5xoqOib0iTfibcptGyxUykkpCe17gehYMuieO/xskYXZwyY9bisg== X-Received: by 2002:a05:6870:8091:b0:203:fbf6:8c36 with SMTP id q17-20020a056870809100b00203fbf68c36mr4596766oab.68.1703401262002; Sat, 23 Dec 2023 23:01:02 -0800 (PST) Original-Received: from debian-hx90 (2603-8000-a400-0cdc-4ec0-7908-58bb-3fdc.res6.spectrum.com. [2603:8000:a400:cdc:4ec0:7908:58bb:3fdc]) by smtp.gmail.com with ESMTPSA id c6-20020a17090a020600b0028aed79c244sm5195314pjc.1.2023.12.23.23.01.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 23 Dec 2023 23:01:01 -0800 (PST) In-Reply-To: <83y1dlcghi.fsf@gnu.org> (Eli Zaretskii's message of "Sat, 23 Dec 2023 13:20:41 +0200") X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:276787 Archived-At: --=-=-= Content-Type: text/plain Eli Zaretskii writes: >> From: Xiyue Deng >> Cc: 67848@debbugs.gnu.org >> Date: Sat, 23 Dec 2023 02:09:29 -0800 >> >> Eli Zaretskii writes: >> >> >> From: Xiyue Deng >> >> Date: Sat, 16 Dec 2023 03:18:20 -0800 >> >> >> >> >> > Thanks, but I think it's wrong to use setq-default here, since that >> > makes Text mode the default major-mode (instead of Fundamental), which >> > is not what most people would want. >> >> Actually making text-mode the default mode for new files is exactly what >> the author intended based on the text from an earlier section[1]. > > I know, but I don't want that to be said without reservations, or not > at all. The author's hope was that there will be many readers of this > manual who are not programmers, and who would then prefer Text mode as > the default. We are now a few decades wiser, and we know that hope > didn't really materialize. So we should not advertise such a setting > without some explanations. While I kind of agree with what you said here, this requires a much larger rewrite of the text, because there are several paragraphs that span several sections that follows the author's original advice of making newly opened files to use text-mode instead of fundamental mode by default. Neither being a writer, nor even a native English speaker, I don't consider myself a good candidate to make such a drastic change to this classic book. So instead I added another footnote at the first sentence of this section to suggest that the suggestion was aimed for writers and the reader can feel free not to do this. The new patch is attached. PTAL. -- Xiyue Deng --=-=-= Content-Type: text/x-diff Content-Disposition: attachment; filename=0001-Fix-usage-of-setq-default-and-offer-more-suggestions.patch >From d5e89a19ee7fcfe2aa6bb35f5ad84eb17819408b Mon Sep 17 00:00:00 2001 From: Xiyue Deng Date: Sat, 23 Dec 2023 16:12:44 -0800 Subject: [PATCH] Fix usage of `setq-default' and offer more suggestions cd61af0 changed from default-major-mode to major-mode in the first code sample but didn't change the rest. This patch fixes this and add some explanations of why use `setq-default' instead of `setq'. In addition, it gives background on suggesting using text-mode as default mode and suggest other alternatives. * doc/lispintro/emacs-lisp-intro.texi (Text and Auto-fill): Fix usage of `setq-default' and offer more suggestions. (Bug#67848) --- doc/lispintro/emacs-lisp-intro.texi | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/doc/lispintro/emacs-lisp-intro.texi b/doc/lispintro/emacs-lisp-intro.texi index 4a0e8dfa1fc..26a405361de 100644 --- a/doc/lispintro/emacs-lisp-intro.texi +++ b/doc/lispintro/emacs-lisp-intro.texi @@ -16892,8 +16892,12 @@ remember to look here to remind myself. @node Text and Auto-fill @section Text and Auto Fill Mode -Now we come to the part that turns on Text mode and -Auto Fill mode. +Now we come to the part that turns on Text mode and Auto Fill +mode.@footnote{This section suggests settings that are more suitable +for writers. For programmers, the default mode will be set to the +corresponding prog-mode automatically based on the type of the file. +And it's perfectly fine if you want to keep the fundamental mode as +the default mode.} @smallexample @group @@ -16945,15 +16949,19 @@ Here is the line again; how does it work? @cindex Text Mode turned on @smallexample -(setq major-mode 'text-mode) +(setq-default major-mode 'text-mode) @end smallexample @noindent This line is a short, but complete Emacs Lisp expression. -We are already familiar with @code{setq}. It sets the following -variable, @code{major-mode}, to the subsequent value, which is -@code{text-mode}. The single-quote before @code{text-mode} tells +We are already familiar with @code{setq}. We use a similar macro +@code{setq-default} to set the following variable, +@code{major-mode}@footnote{We use @code{setq-default} because +@code{text-mode} is buffer local. If we use @code{setq} it will only +apply to the current buffer, and using @code{setq-default} will also +apply this to newly created buffers.}, to the subsequent value, which +is @code{text-mode}. The single-quote before @code{text-mode} tells Emacs to deal directly with the @code{text-mode} symbol, not with whatever it might stand for. @xref{setq, , Setting the Value of a Variable}, for a reminder of how @code{setq} works. The main point -- 2.39.2 --=-=-=--