From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Philipp Stephani Newsgroups: gmane.emacs.devel Subject: Re: Should mode commands be idempotent? Date: Sun, 08 Oct 2017 15:28:35 +0000 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: multipart/mixed; boundary="94eb2c13f0a0e4e603055b0aba20" X-Trace: blaine.gmane.org 1507476544 15821 195.159.176.226 (8 Oct 2017 15:29:04 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Sun, 8 Oct 2017 15:29:04 +0000 (UTC) To: Drew Adams , Stefan Monnier , emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sun Oct 08 17:28:59 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 1e1DVg-0002tw-6r for ged-emacs-devel@m.gmane.org; Sun, 08 Oct 2017 17:28:56 +0200 Original-Received: from localhost ([::1]:54060 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1e1DVm-0006G5-2D for ged-emacs-devel@m.gmane.org; Sun, 08 Oct 2017 11:29:02 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:54973) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1e1DVY-0006FH-Us for emacs-devel@gnu.org; Sun, 08 Oct 2017 11:28:51 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1e1DVX-0003Fw-QM for emacs-devel@gnu.org; Sun, 08 Oct 2017 11:28:48 -0400 Original-Received: from mail-oi0-x22a.google.com ([2607:f8b0:4003:c06::22a]:45762) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1e1DVX-0003FW-JE for emacs-devel@gnu.org; Sun, 08 Oct 2017 11:28:47 -0400 Original-Received: by mail-oi0-x22a.google.com with SMTP id f3so36148617oia.2 for ; Sun, 08 Oct 2017 08:28:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to; bh=kv0Z1dq4+e+eZLO+oSP5BKALLijv0iNv7XElpue8dVk=; b=rlYHlKhGu9e3GhuFI/vgt9ji99h8uU2N2VSXKRkJt49YuWjq+x+rBtCGsIBg4uxuXe rTAddOQkbp9SvjSW+GUUZkRJiz/PmZg2dAEyQXF4s3Ibd+5s7fzRGbDR8WUqPCBvqT/i pDDlMmKHbbxa05FU8Re/couXgInz7ixR9hoeYk6pmoKMwfk70hTVfJ06d3wRL5uAHAU8 2jkd/gh0kaXbhr2AG9Pg4+yixF9IIEZqcYkUvIOGYv4EaOzhSazhCzdUmmw1S/TsGQOf 0bW8GjWM9O95xySP2pHrXaYoKM7tN0EtUeV4sXlKKwW3c1eWzUqQGj8M5VdApWJwLzzu YlVA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to; bh=kv0Z1dq4+e+eZLO+oSP5BKALLijv0iNv7XElpue8dVk=; b=KQ+cEKbLrWsdFVmwT5FuYEYQFU+37NuOp/OwLGHgL/jxWebq36NHHeA1jwH9ycEl3G +ESwVCnJzaxfPeTG3wM7X5hwVnWGU9OUgts/NsKHy4+UJ8yEikyL+ZzrEVBvQakZYTgO Mp0fkZtKlDKwXFdjBUvlAUdvUAQkuroBaSer5kl6LCbeBBXCjVTq5MxGwOQg8EL1ASqn 5GOWS5ccNboD9ewGZCGdv2vaKAadOI1/3PIMwFCvLroLGO3GSwwZrYERLLJYDgBTc+rh D3S3zpV3mMdDQEia5Tijccm/I6uobHHVvCAvr47pZ0YCwRmGpOuCt6Lk0UYG0Pr2jvD1 7Ilw== X-Gm-Message-State: AMCzsaXkCwqFC1XTlscEUU771q79CR8eGY1gt7hjHVVsXQlvaMyHOJa7 3ajdrgW7xXwREdWLDSix++qgDFgzCch7SgARsQM= X-Google-Smtp-Source: AOwi7QBs1FRrEUaILXT5tYwamwhiSVrqlP+T3dhIowtn4n+a/0xmy0Wkw3HJLMWMUCchlxvTywPFwZPebP2/Hmf7HN4= X-Received: by 10.202.7.198 with SMTP id 189mr4076906oih.18.1507476526906; Sun, 08 Oct 2017 08:28:46 -0700 (PDT) In-Reply-To: X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4003:c06::22a 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:219250 Archived-At: --94eb2c13f0a0e4e603055b0aba20 Content-Type: multipart/alternative; boundary="94eb2c13f0a0e4e5ff055b0aba1e" --94eb2c13f0a0e4e5ff055b0aba1e Content-Type: text/plain; charset="UTF-8" John Wiegley schrieb am Di., 26. Sep. 2017 um 20:55 Uhr: > >>>>> 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. > Given that all current and past maintainers seem to agree, how about the following patch for the Lisp manual? --94eb2c13f0a0e4e5ff055b0aba1e Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable


John W= iegley <jwiegley@gmail.com>= schrieb am Di., 26. Sep. 2017 um 20:55=C2=A0Uhr:
>>>>> Drew Adams <drew.adams@oracle.com> writes:
> Good luck with such a guideline. The state of an Emacs session is _nev= er_
> exactly the same after each time you turn on a mode - any mode, any se= ssion.
> 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 gu= arantee
that intervening effects are somehow negated.

That is, the following should be functionally equivalent:

=C2=A0 =C2=A0 (foo-mode 1)
=C2=A0 =C2=A0 (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 exac= tly the
sort of thing our guideline seeks to prevent.

Given that all current and past maintainers seem to agree, how about= the following patch for the Lisp manual?=C2=A0
--94eb2c13f0a0e4e5ff055b0aba1e-- --94eb2c13f0a0e4e603055b0aba20 Content-Type: text/plain; charset="US-ASCII"; name="0001-Document-that-mode-commands-should-be-idempotent.txt" Content-Disposition: attachment; filename="0001-Document-that-mode-commands-should-be-idempotent.txt" Content-Transfer-Encoding: base64 Content-ID: <15efc9a2266818745061> X-Attachment-Id: 15efc9a2266818745061 RnJvbSA0NjZlZTU4NTNhMDdmOTA1OTMxNDllNGRlMDdmOTI4NDVlMDc2MTcwIE1vbiBTZXAgMTcg MDA6MDA6MDAgMjAwMQpGcm9tOiBQaGlsaXBwIFN0ZXBoYW5pIDxwaHN0QGdvb2dsZS5jb20+CkRh dGU6IFN1biwgOCBPY3QgMjAxNyAxNzoyNTozMSArMDIwMApTdWJqZWN0OiBbUE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