From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Omar Polo Newsgroups: gmane.emacs.help Subject: Re: don't understand setq-default Date: Mon, 19 Apr 2021 08:40:30 +0200 Message-ID: <87pmyqg4kh.fsf@omarpolo.com> References: <87mttvx1lo.fsf@zoho.eu> <87eef7ycd9.fsf@omarpolo.com> <87blabww2u.fsf@zoho.eu> <877dkzww0r.fsf@zoho.eu> <8735vnwu8z.fsf@zoho.eu> <87blaby6xx.fsf@omarpolo.com> <87lf9fkm6l.fsf@zoho.eu> <878s5fkle1.fsf@zoho.eu> <874kg3kkwo.fsf@zoho.eu> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="7739"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: mu4e 1.4.15; emacs 28.0.50 Cc: help-gnu-emacs@gnu.org To: Emanuel Berg Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Mon Apr 19 08:41:29 2021 Return-path: Envelope-to: geh-help-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 1lYNb7-0001wP-LD for geh-help-gnu-emacs@m.gmane-mx.org; Mon, 19 Apr 2021 08:41:29 +0200 Original-Received: from localhost ([::1]:44844 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lYNb6-0006KF-Ng for geh-help-gnu-emacs@m.gmane-mx.org; Mon, 19 Apr 2021 02:41:28 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:46840) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lYNaL-0006K3-Co for help-gnu-emacs@gnu.org; Mon, 19 Apr 2021 02:40:41 -0400 Original-Received: from mail.omarpolo.com ([144.91.116.244]:64966) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lYNaG-0001t8-BH for help-gnu-emacs@gnu.org; Mon, 19 Apr 2021 02:40:41 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=omarpolo.com; s=20200327; t=1618814433; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=ZYQ+VX10GNxLojmoGn6iTLI6vQp8dRBgeuHTr9Jg2Jg=; b=rm6TWls6g2PUosKBP3UniFbwF3UlQBT/VsTObTVgPyKDT9b33oqBc61zJTPvRlIwDVV1aL HGRQ31HUEETGxZXccaD+3X79BmPNlibKmJS2JbtcS37RowKpjpgIXMwWEsQprzqk9E/zHu jjQJ64aNyx5oUACk+Y5xzSvC7RAlTmE= Original-Received: from localhost (host-87-2-232-216.retail.telecomitalia.it [87.2.232.216]) by mail.omarpolo.com (OpenSMTPD) with ESMTPSA id 2ff5d260 (TLSv1.3:TLS_AES_256_GCM_SHA384:256:NO); Mon, 19 Apr 2021 08:40:33 +0200 (CEST) Original-Received: from venera (localhost [127.0.0.1]) by localhost (OpenSMTPD) with ESMTP id 3b22a5fa; Mon, 19 Apr 2021 08:40:31 +0200 (CEST) In-reply-to: <874kg3kkwo.fsf@zoho.eu> Received-SPF: pass client-ip=144.91.116.244; envelope-from=op@omarpolo.com; helo=mail.omarpolo.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, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "help-gnu-emacs" Xref: news.gmane.io gmane.emacs.help:129064 Archived-At: Emanuel Berg via Users list for the GNU Emacs text editor writes: > Emanuel Berg via Users list for the GNU Emacs text editor wrote: > >>>> my-var >>>> ;; => foo >>> >>> And now it isn't anymore so the default is there, great. >> >> No, why isn't that 7? argh! It was a contrived example, sorry. It is 7 because inside the (with-current-buffer ...) I did a (setq-default my-var 'foo), and that affected the global value. >> I must write my own version :) > > OK, so after you say it is local with `make-local-variable' it > doesn't matter you do `setq', it won't get global that way? True > No, but that's consistent actually, you can setq other local > stuff tho I prefer `let' and do all computation before any of > it is used, but you can, that's right. > > setq isn't (always) global unless you make a typo... :) Two more points: - re space vs tabs: I didn't want to make an argument on that, I was only saying that for some buffer you *may* prefer to have tabs and in other plain spaces, but that it's up to the user, buffer-local variables are away to implement such behaviour. The example of the chat was indeed better - re "pecking order": I would only think of local and global var, with the twist that the latter comes in two flavors ("real" global var and buffer-local version.) It kinda gets more complex than that when you throw into the mix file and directory-local variable and dynamic scoping tho :P (I admit I never thought about the full implication of all those types of variables)