From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: John Wiegley Newsgroups: gmane.emacs.devel Subject: Re: Should mode commands be idempotent? Date: Tue, 26 Sep 2017 11:54:44 -0700 Message-ID: References: <9f11a3c6-b113-4bf6-9dab-f894b2ad77b5@default> <55da155a-03b1-d3ed-4036-12e5a60fa26c@gmail.com> <950166e7-2766-8a3e-1bc2-a93a356f652c@gmail.com> <118feee3-5787-43b7-9c9b-06907a16a448@default> <2564c62e-a419-45d8-809f-433a6f7c3808@default> <44241233-0da3-4536-ab64-4071ecbfdac5@default> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: blaine.gmane.org 1506452101 30866 195.159.176.226 (26 Sep 2017 18:55:01 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Tue, 26 Sep 2017 18:55:01 +0000 (UTC) User-Agent: Gnus/5.130016 (Ma Gnus v0.16) Emacs/26.0 (darwin) Cc: Stefan Monnier , emacs-devel@gnu.org To: Drew Adams Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Tue Sep 26 20:54:55 2017 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 1dwv0P-0007W0-ON for ged-emacs-devel@m.gmane.org; Tue, 26 Sep 2017 20:54:53 +0200 Original-Received: from localhost ([::1]:50757 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dwv0X-0007Ia-7P for ged-emacs-devel@m.gmane.org; Tue, 26 Sep 2017 14:55:01 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:52533) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dwv0Q-0007HN-Bm for emacs-devel@gnu.org; Tue, 26 Sep 2017 14:54:55 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dwv0N-0005Lb-B7 for emacs-devel@gnu.org; Tue, 26 Sep 2017 14:54:54 -0400 Original-Received: from mail-pf0-x232.google.com ([2607:f8b0:400e:c00::232]:46989) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1dwv0N-0005LU-53 for emacs-devel@gnu.org; Tue, 26 Sep 2017 14:54:51 -0400 Original-Received: by mail-pf0-x232.google.com with SMTP id r68so5979496pfj.3 for ; Tue, 26 Sep 2017 11:54:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:in-reply-to:date:message-id:references :user-agent:mail-followup-to:mime-version; bh=Z4AlEVLdb1GBb5rRoVa1B2lJzcP8dzMPHiald56IBWs=; b=ZdbXIwqfs//GLLWwMEkjDXJsgHPslKfMGmtllvpvbwLv5/e70vntIM75KhFzHAc5VG mSCk3i9Rh+rZNvAqjmu89uz9IyuPz9SuGA5bQgiig5vRKxfMRiE1ZvL5dZnZZf1zqTVV vwKkWNQ2eltv3PvesGyeVtNeU+u0dmbjp336ZJg1mYnXYf6+X0NLxo+lhfWub62CTXMa WWfmAT2EXHoR6XtSTW5dAUXT1471Ged3fs+XvGCD6dLmPrVdnMtt3nwFXlkmuh6kCynN HwYZKxXbfQPoGPGSZvpu+HIQ8OCinPbBM7hNZzsuoU9Cq+4LYAzUXbXfa37g8YUOlvUQ Mwvg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:in-reply-to:date:message-id :references:user-agent:mail-followup-to:mime-version; bh=Z4AlEVLdb1GBb5rRoVa1B2lJzcP8dzMPHiald56IBWs=; b=MVhUXZ0i2wgV6P5VP0YoswTGYUiuB6pxkIm4W4gRyGY0TeyzIZy4LCSsrgPhBwASRR DPTRf7QUcUlAEFcjEOQkqFESbQ7UKKUUf0I6hz2h5vDvFmniwkX/FkuCWJedfy40Xw8V kZ2m/5JPSzKAk0IP+45NmJKKppGDay8gT+0x1Jl7sySe8C4yEKmo5C4h8nZ73qvlEf7U MJk4Lk0gPjHQxiLEil89pAjsCxWgkD6LxhclGoVIXZNro/EpKZJha3NUlt7eWizIj6b0 Lq6woQJKtNaYlOvLU/EsXN7rc3l4u/uhIuEPLr0wQi5+udmxKzLh5K4tM79UBGML9Qfg 69SQ== X-Gm-Message-State: AHPjjUjCfVDLVzUdY9l2zjEqXe1dekDE4rxvIZrXRTXDjOU+BaSHz/p3 62dJJJ5cl/im9atYIDhoYLmNVqKo X-Google-Smtp-Source: AOwi7QAaoCTexErcLQroaIw/1XhhYRpavxlGJOHR0KbsPaDGdXwp1z+Ap6aJ05sJQ+xTliRHxjQQtQ== X-Received: by 10.99.186.89 with SMTP id l25mr12254899pgu.212.1506452089989; Tue, 26 Sep 2017 11:54:49 -0700 (PDT) Original-Received: from Vulcan.local (76-234-69-149.lightspeed.frokca.sbcglobal.net. [76.234.69.149]) by smtp.gmail.com with ESMTPSA id j186sm16548379pfg.164.2017.09.26.11.54.47 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 26 Sep 2017 11:54:48 -0700 (PDT) X-Google-Original-From: "John Wiegley" Original-Received: by Vulcan.local (Postfix, from userid 501) id 53D8E927D067; Tue, 26 Sep 2017 11:54:47 -0700 (PDT) In-Reply-To: <44241233-0da3-4536-ab64-4071ecbfdac5@default> (Drew Adams's message of "Tue, 26 Sep 2017 11:50:13 -0700 (PDT)") Mail-Followup-To: Drew Adams , Stefan Monnier , emacs-devel@gnu.org X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:400e:c00::232 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:218809 Archived-At: >>>>> Drew Adams writes: > Good luck with such a guideline. The state of an Emacs session is _never_ > exactly the same after each time you turn on a mode - any mode, any session. > So many things change... I think we can reduce the scope of what we're saying: The statement I made only applies if the command is called in immediate succession. That is, the function is *itself* idempotent; it doesn't guarantee that intervening effects are somehow negated. That is, the following should be functionally equivalent: (foo-mode 1) (progn (foo-mode 1) (foo-mode 1)) I don't see what great difficulty this poses. If a mode author is doing thing inside `foo-mode' like changing the system or the disk, that's exactly the sort of thing our guideline seeks to prevent. -- John Wiegley GPG fingerprint = 4710 CF98 AF9B 327B B80F http://newartisans.com 60E1 46C4 BD1A 7AC1 4BA2