From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: "Herring, Davis" Newsgroups: gmane.emacs.devel Subject: Re: Should mode commands be idempotent? Date: Tue, 10 Oct 2017 23:15:57 +0000 Message-ID: <1507677356975.84569@lanl.gov> 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; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable X-Trace: blaine.gmane.org 1507677440 29161 195.159.176.226 (10 Oct 2017 23:17:20 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Tue, 10 Oct 2017 23:17:20 +0000 (UTC) Cc: Stefan Monnier , "emacs-devel@gnu.org" To: John Wiegley , Drew Adams Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Wed Oct 11 01:17:16 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 1e23lz-0006uG-VW for ged-emacs-devel@m.gmane.org; Wed, 11 Oct 2017 01:17:16 +0200 Original-Received: from localhost ([::1]:37730 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1e23m5-0002yL-S9 for ged-emacs-devel@m.gmane.org; Tue, 10 Oct 2017 19:17:21 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:33390) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1e23ls-0002wx-PF for emacs-devel@gnu.org; Tue, 10 Oct 2017 19:17:09 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1e23lo-0007oZ-JG for emacs-devel@gnu.org; Tue, 10 Oct 2017 19:17:08 -0400 Original-Received: from proofpoint7.lanl.gov ([204.121.3.46]:44003) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1e23lo-0007mT-9u for emacs-devel@gnu.org; Tue, 10 Oct 2017 19:17:04 -0400 Original-Received: from pps.filterd (proofpoint7.lanl.gov [127.0.0.1]) by proofpoint7.lanl.gov (8.16.0.21/8.16.0.21) with SMTP id v9AND1J8008380; Tue, 10 Oct 2017 17:15:58 -0600 Original-Received: from mailrelay2.lanl.gov (mailrelay2.lanl.gov [128.165.4.103]) by proofpoint7.lanl.gov with ESMTP id 2dewa7sxa5-1; Tue, 10 Oct 2017 17:15:57 -0600 Original-Received: from localhost (localhost.localdomain [127.0.0.1]) by mailrelay2.lanl.gov (Postfix) with ESMTP id C5732EB9D52; Tue, 10 Oct 2017 17:15:57 -0600 (MDT) X-NIE-2-Virus-Scanner: amavisd-new at mailrelay2.lanl.gov Original-Received: from EXG13-P-MBX07.win.lanl.gov (exg13-p-mbx07.win.lanl.gov [128.165.106.124]) by mailrelay2.lanl.gov (Postfix) with ESMTP id B028DEB9D4F; Tue, 10 Oct 2017 17:15:57 -0600 (MDT) Original-Received: from EXG13-P-MBX06.win.lanl.gov (2002:80a5:6a2c::80a5:6a2c) by EXG13-P-MBX07.win.lanl.gov (2002:80a5:6a7c::80a5:6a7c) with Microsoft SMTP Server (TLS) id 15.0.1293.2; Tue, 10 Oct 2017 17:15:57 -0600 Original-Received: from EXG13-P-MBX06.win.lanl.gov ([fe80::4463:3d40:30a5:dc80]) by EXG13-P-MBX06.win.lanl.gov ([fe80::4463:3d40:30a5:dc80%19]) with mapi id 15.00.1293.006; Tue, 10 Oct 2017 17:15:57 -0600 Thread-Topic: Should mode commands be idempotent? Thread-Index: AQHTNvjqe40mhTQAP0+h5ggxdaasFqLdx+ID In-Reply-To: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ms-exchange-transport-fromentityheader: Hosted x-originating-ip: [128.165.106.201] X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:, , definitions=2017-10-10_08:, , signatures=0 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 suspectscore=0 malwarescore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1707230000 definitions=main-1710100329 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [generic] [fuzzy] X-Received-From: 204.121.3.46 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:219363 Archived-At: [Sorry this is so late: I only caught up on this upon seeing the manual pat= ch.]=0A= =0A= > The statement I made only applies if the command is called in immediate= =0A= > succession. That is, the function is *itself* idempotent; it doesn't guar= antee=0A= > that intervening effects are somehow negated.=0A= =0A= There is a reasonable candidate condition, at least for minor modes, that i= s broader than this: if a minor mode has state, that state should not be re= initialized if the minor mode was already enabled before it is "enabled aga= in". For example, according to this principle compilation-minor-mode shoul= d not discard its markers if it is called again -- precisely because of oth= er changes made between the calls.=0A= =0A= For major modes, kill-all-local-variables tends to prevent this sort of ide= mpotence. This is not really a problem: since only one major mode can be a= ctive at a time, it makes sense to consider a second call to actually _repl= ace_ the previous "instance" of the major mode. There also isn't much reas= on to call major mode functions from places like hooks that might unexpecte= dly re-execute them.=0A= =0A= Davis=