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:09:27 +0000 Message-ID: References: <5358b04b-70cb-bbaf-1887-bd83613e9c2b@gmail.com> <00b0c4e4-a02f-8c9f-ef52-7ad5a65798d1@gmail.com> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="001a113cc1e86a567e055b0a762b" X-Trace: blaine.gmane.org 1507475397 12037 195.159.176.226 (8 Oct 2017 15:09:57 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Sun, 8 Oct 2017 15:09:57 +0000 (UTC) To: =?UTF-8?Q?Cl=C3=A9ment_Pit=2DClaudel?= , emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sun Oct 08 17:09:53 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 1e1DDA-0001X7-Bs for ged-emacs-devel@m.gmane.org; Sun, 08 Oct 2017 17:09:48 +0200 Original-Received: from localhost ([::1]:54017 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1e1DDD-0002Za-3d for ged-emacs-devel@m.gmane.org; Sun, 08 Oct 2017 11:09:51 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:51093) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1e1DD1-0002ZO-Pf for emacs-devel@gnu.org; Sun, 08 Oct 2017 11:09:44 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1e1DD0-0001z7-SL for emacs-devel@gnu.org; Sun, 08 Oct 2017 11:09:39 -0400 Original-Received: from mail-oi0-x22d.google.com ([2607:f8b0:4003:c06::22d]:48103) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1e1DD0-0001yw-N6 for emacs-devel@gnu.org; Sun, 08 Oct 2017 11:09:38 -0400 Original-Received: by mail-oi0-x22d.google.com with SMTP id h200so9073603oib.4 for ; Sun, 08 Oct 2017 08:09:38 -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=NjGr0YHujlSHzzy80AsL2l7YyeMy5f7pNeL8LtLVkhg=; b=L30dtO5dsx5E8Yckj4lqXhBWrU2rTUiX5UyX43/kyp24dR17kMBopzJQt5JEogG1iY SiccoMoZP8PEINDJ1eUgHGvNJvjxC57H8drjzoVZ0/JI/B/EbZrx/EYIXGhe+ctMx5br C9jW0krfaOD9/JyMSHNIdBK3+vo4vDU/qvPOaZpuVzI07pSxc9ZwO9IF1iCjQvSXgWE/ 1FjVQJc3b3aFrrQw9jzls0PTYj2/1Pu9b394f4YvR8Ju64bo2Hfe/QMdbXfOa/02uhyX z8xk/hSA/7N8gK9Im/tmyVIaTCcFQKk9+PEzmC5WuyayUvBrOS1bkwj6dSGb4yZeWt1m s4NA== 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=NjGr0YHujlSHzzy80AsL2l7YyeMy5f7pNeL8LtLVkhg=; b=rEnkCQ5mqLSLrmaU29gUegYJ5t+gwaLPTwyDdL6dufbnnGPKaBK9S+5FCfmZY3DZtQ baFCKbvoDDGXicc0s9lfKT+buf8ZhfRkbGmME1MAE+t364cEfR0oQfj1mqdYPPtZXI5h PjpuYBoLeyI1SyukpvYciU4qX60AYgW8TeSQKaRWL7nBWAu6Vi6KJucleMJxsp8qaaJT 9+JN58/sKtxfeUZB7jalOjwtUetZlBcAiAFXt1DgTUlCHrwFfR2JF3A771nSXHC1KyBz Tmf0+K8smGB/NttjigYfIXD4VE29nUAqXh+VagY6qSw7EuLVpwP7LXz/TILCS2ahi3fa F/aQ== X-Gm-Message-State: AMCzsaWN88fXcX37vB2sANwak1r22Ek9YzJ5BKhxbko5hVDtsQoQyJs6 br4xFimjGbOzr1JwAvuXdFrBog/f8XLurteJe/8= X-Google-Smtp-Source: AOwi7QCqdqTJw5OFN7c0R2utXn8XR1lnTKt52yE6icj9CFljQ8F2LwuAedLwxieeCz+QGfIxZEqvE/iNFj6M+Y+c438= X-Received: by 10.202.61.65 with SMTP id k62mr4065918oia.418.1507475378032; Sun, 08 Oct 2017 08:09:38 -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::22d 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:219247 Archived-At: --001a113cc1e86a567e055b0a762b Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable John Wiegley schrieb am Mi., 20. Sep. 2017 um 17:38 Uhr: > >>>>> "CP" =3D=3D Cl=C3=A9ment Pit-Claudel writes= : > > CP> I'm not too sure: take the example of visual-line-mode: how do you ma= ke > CP> that idempotent without explicitly checking whether the mode has > already > CP> been activated? > > Also, is there a motivation for introducing this new requirement, seeing = as > how we've never had such a restriction in the past? > Some cases I've come across (for lsp-mode, which is currently not idempotent): - Enabling a minor mode in both a parent and a derived mode hook. - Restoring buffers from the desktop file. In such cases minor modes are activated twice, causing errors if they are not idempotent. --001a113cc1e86a567e055b0a762b Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable


John W= iegley <jwiegley@gmail.com>= schrieb am Mi., 20. Sep. 2017 um 17:38=C2=A0Uhr:
>>>>> "CP" =3D=3D Cl=C3=A9ment Pit-= Claudel <cpit= claudel@gmail.com> writes:

CP> I'm not too sure: take the example of visual-line-mode: how do y= ou make
CP> that idempotent without explicitly checking whether the mode has alr= eady
CP> been activated?

Also, is there a motivation for introducing this new requirement, seeing as=
how we've never had such a restriction in the past?

Some cases I've come across (for lsp-m= ode, which is currently not idempotent):
- Enabling a minor mode = in both a parent and a derived mode hook.
- Restoring buffers fro= m the desktop file.
In such cases minor modes are activated twice= , causing errors if they are not idempotent.=C2=A0
--001a113cc1e86a567e055b0a762b--