From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.devel Subject: Re: Should mode commands be idempotent? Date: Wed, 20 Sep 2017 21:11:59 -0400 Message-ID: References: NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: blaine.gmane.org 1505956382 15269 195.159.176.226 (21 Sep 2017 01:13:02 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Thu, 21 Sep 2017 01:13:02 +0000 (UTC) User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.0.50 (gnu/linux) To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Thu Sep 21 03:12:58 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 1duq2z-0003XR-Qp for ged-emacs-devel@m.gmane.org; Thu, 21 Sep 2017 03:12:57 +0200 Original-Received: from localhost ([::1]:51300 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1duq35-0006EH-Lr for ged-emacs-devel@m.gmane.org; Wed, 20 Sep 2017 21:13:03 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:37590) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1duq2H-0006EA-5o for emacs-devel@gnu.org; Wed, 20 Sep 2017 21:12:14 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1duq2C-0007R7-7f for emacs-devel@gnu.org; Wed, 20 Sep 2017 21:12:13 -0400 Original-Received: from [195.159.176.226] (port=52723 helo=blaine.gmane.org) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1duq2B-0007Pl-W6 for emacs-devel@gnu.org; Wed, 20 Sep 2017 21:12:08 -0400 Original-Received: from list by blaine.gmane.org with local (Exim 4.84_2) (envelope-from ) id 1duq21-0000PG-Kg for emacs-devel@gnu.org; Thu, 21 Sep 2017 03:11:57 +0200 X-Injected-Via-Gmane: http://gmane.org/ Original-Lines: 29 Original-X-Complaints-To: usenet@blaine.gmane.org Cancel-Lock: sha1:JhPQHnqL03t80IKag6gJVIv/Te0= X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 195.159.176.226 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:218616 Archived-At: >> I'll return the question: when/why would a major-mode or a minor-mode >> not want to be idempotent? Can you cite at least one example? > I don't need to. There should be some reasons given for making > a change, especially a change that attempt to restrict users, > whether by tooling or convention. Philip gave the reason in the first email: "it's generally expected that mode commands (both major and minor) are reasonably idempotent". Of course, we wouldn't decide on such a rule without weighing the pros and cons. But given that he mentioned one pro, we'd need at the very least one cons before deciding it's a bad idea (no matter how weak the pro). Hence my question again (which is already implicitly contained in Philip's original message): When/why would a major-mode or a minor-mode not want to be idempotent? Can you cite at least one example? And of course, no restriction of the sort discussed here would limit what the end user can do (we can't technically impose such a restriction, we can only declare it's bad style). In practice, such a restriction would probably allow the user to do more things (because he can now rely on the idempotency in his code): what you take on one side, allows to give on the other. Stefan