From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: =?UTF-8?Q?Cl=c3=a9ment_Pit-Claudel?= Newsgroups: gmane.emacs.devel Subject: Re: Should mode commands be idempotent? Date: Wed, 20 Sep 2017 09:24:11 +0200 Message-ID: <00b0c4e4-a02f-8c9f-ef52-7ad5a65798d1@gmail.com> References: <5358b04b-70cb-bbaf-1887-bd83613e9c2b@gmail.com> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Trace: blaine.gmane.org 1505892291 21892 195.159.176.226 (20 Sep 2017 07:24:51 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Wed, 20 Sep 2017 07:24:51 +0000 (UTC) User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.3.0 To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Wed Sep 20 09:24:46 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 1duZNF-0005JK-Ka for ged-emacs-devel@m.gmane.org; Wed, 20 Sep 2017 09:24:45 +0200 Original-Received: from localhost ([::1]:47195 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1duZNN-0007Ca-0T for ged-emacs-devel@m.gmane.org; Wed, 20 Sep 2017 03:24:53 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:40391) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1duZMm-0007CG-Dp for emacs-devel@gnu.org; Wed, 20 Sep 2017 03:24:17 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1duZMj-0006ol-Qj for emacs-devel@gnu.org; Wed, 20 Sep 2017 03:24:16 -0400 Original-Received: from mail-wm0-x236.google.com ([2a00:1450:400c:c09::236]:49320) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1duZMj-0006lD-KY for emacs-devel@gnu.org; Wed, 20 Sep 2017 03:24:13 -0400 Original-Received: by mail-wm0-x236.google.com with SMTP id e71so4450989wmg.4 for ; Wed, 20 Sep 2017 00:24:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:references:from:message-id:date:user-agent:mime-version :in-reply-to:content-language:content-transfer-encoding; bh=MhDsjoFy1TBP5iXuFWYE0Ngihwgd6tClhwBpKYfpMjs=; b=Hw+B37BMG8B+RGC9WnZ4ASM2C0GDr51a6rJ29KFzu6GasQW3HrwT2RsNlReFqCWe46 zz4W1ONieuK+YV+HLtsdB42yVYNwbl74pp42xcTPHXp10rrGGd4V0JvW3ejLl1zFY/xs 2kJot2zQYh3/rPmideXOZIOItpCcoTYCOnUA2JKMPgEiph/cpLYcCb3vL27YRf829NXV LOFbpHMtbqEfvCAP/tTbaifNzwCPHy9zpaBuKMDKRXts0ccYIJWkBxRmF3cOLzjaMISj HYcniUut4eJ7cjJTthRFgagWkw3hkj6FvWfebxlHMr8Jfyfel6uwqOwxJSD9d1H1Y+rJ DlxA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=MhDsjoFy1TBP5iXuFWYE0Ngihwgd6tClhwBpKYfpMjs=; b=DGxECagTkbSkz3FV4DryBlBsR4RuIoBk6mS0WyPG30dYA8ifT00u/c4zKQX4pPhtQ9 XKBtwEQe0lAAYwHFtIvo78m72cFcLDHqAPTbvSHVVD6ETb/RawtSE3aQ4i6bmJgBmWMq jpNIlN8i2U+MjZ7Rqqz2OiAW/cc6D5HABRSsRifvd/X96Z+lmoaYFanbamzSwhqDJSq7 sK9zWsTvaOmvMgn51y+yJDStHOAFrFxLrFnXdmYkbyyo7+67yZk04FKCbK8NUJjgrBoC KL2i/Ug6wyoRxRjPb6O/SSuhWjXZObCZFKZhMQE8lyKnF71CQXD92NTGmAtBgjFyVF+E Gd9w== X-Gm-Message-State: AHPjjUiIt7aTbe8XcrG7lGunZ5n2cV8SPOl8tx8e57a6oI7+M8iQaBiF Ol1PG3sXPQO2LJNGRI/tdAaT5oEP X-Google-Smtp-Source: AOwi7QDF4EZ0qjH7OJOFC0VI3v4Q3uIt0rl+FsuC7Ciuf84VHvxCdLB+mUkncTu7R9W7wM8H4lNXMA== X-Received: by 10.28.105.156 with SMTP id z28mr3396472wmh.73.1505892252368; Wed, 20 Sep 2017 00:24:12 -0700 (PDT) Original-Received: from [192.168.1.82] (43.225.24.109.rev.sfr.net. [109.24.225.43]) by smtp.gmail.com with ESMTPSA id k11sm1070500wrc.90.2017.09.20.00.24.11 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 20 Sep 2017 00:24:11 -0700 (PDT) In-Reply-To: Content-Language: en-GB X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:400c:c09::236 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:218572 Archived-At: On 2017-09-20 00:29, Stefan Monnier wrote: >> Is there a way inside of a minor mode to check if it was already >> enabled before the current call, short of having a second variable >> for that? > > It shouldn't be needed: the idempotence should emerge naturally from the > way the code is written, rather than being the result of special tests > to detect that particular situation. I'm not too sure: take the example of visual-line-mode: how do you make that idempotent without explicitly checking whether the mode has already been activated?