From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.ciao.gmane.io!not-for-mail From: =?utf-8?B?xaB0xJtww6FuIE7Em21lYw==?= Newsgroups: gmane.emacs.devel Subject: Re: Reliable after-change-functions (via: Using incremental parsing in Emacs) Date: Tue, 31 Mar 2020 05:56:55 +0200 Message-ID: <87y2rhkwhk.fsf@gmail.com> References: <83o8sf3r7i.fsf@gnu.org> <2E218879-0F24-4A20-B210-263C8D0BEEA4@gmail.com> <87o8sdn0ot.fsf@gmail.com> <09E90C25-6119-44D4-85F2-A9CC4196FFE4@gmail.com> <83a73x3bh1.fsf@gnu.org> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Injection-Info: ciao.gmane.io; posting-host="ciao.gmane.io:159.69.161.202"; logging-data="39094"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) Cc: Eli Zaretskii , emacs-devel , Stefan Monnier , akrl@sdf.org To: Yuan Fu Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Tue Mar 31 05:57:56 2020 Return-path: Envelope-to: ged-emacs-devel@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jJ82F-000A4X-Nv for ged-emacs-devel@m.gmane-mx.org; Tue, 31 Mar 2020 05:57:55 +0200 Original-Received: from localhost ([::1]:60040 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jJ82E-0001tG-Lx for ged-emacs-devel@m.gmane-mx.org; Mon, 30 Mar 2020 23:57:54 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:32823) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jJ80v-0008DV-S4 for emacs-devel@gnu.org; Mon, 30 Mar 2020 23:56:34 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1jJ80u-0000fL-MW for emacs-devel@gnu.org; Mon, 30 Mar 2020 23:56:33 -0400 Original-Received: from mail-lf1-x134.google.com ([2a00:1450:4864:20::134]:42755) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1jJ80s-0000eK-LT; Mon, 30 Mar 2020 23:56:30 -0400 Original-Received: by mail-lf1-x134.google.com with SMTP id s13so4927442lfb.9; Mon, 30 Mar 2020 20:56:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:in-reply-to:references:user-agent:date :message-id:mime-version; bh=OkxCnLtlpjziX4SPRuKHHwafrnkFFtl4pLwH13TK9n0=; b=iCJr2liIq4BEGrFvu8QFl7aK+wVy5Xbs9iVtHw5yQ9g8smcjtNIb5kfRZFlIXCDKBJ 1QxFZ1A2L/1opYlLFSjR5FAQPzkmEy8ntf91ttBs93pUAnAFfrrlWHrbHuTnGv1+NgaN dYW15/RKOeG9s5cOPxvnkA5gB8XmP53Z4DedE9fhF43SJI0vLjgoq9KuIxg4W9m63hk4 hMnjOqJpNfGFvPuwWNU0jJ4l/RpTpEyzxnpg8Nytz1HAXoPzJ0lr9v4AesPNmEx5g7vh ZAJ+h1EMoiVAWRAKojvLIoAB2h9DLCJGB4PfzcmUkyOyjXMQxhZuxkUKHKo/TfHxBy5Q wFZQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:in-reply-to:references :user-agent:date:message-id:mime-version; bh=OkxCnLtlpjziX4SPRuKHHwafrnkFFtl4pLwH13TK9n0=; b=IQ7dTAsuMVXqUA9zMXoaaEP8xiifl9PA1Z5D2XfTb9Ggjfdff/fIqDynQEj4/lYlxc VnehMO2d9c005WD1flmzresXPIWNcG2MsnHxI0xz3PLwbFkB54DxipbWm4vanmo5Wzf/ kTURG25/eDsPyCV43CdbLTXpT2SsUIGuofCPy0DIVhE3sOJDbVQajFAIaWh7WAUHpLdN P+QBY15wh8fS7UCAQj/FnD+VHoNwvUgTcJm/h2hDGX4zOtN0vevaBgzLcRlVdh+V/nVb dIQ7CcnB7juS2z9xD6HDNCCiGvoohuTTdPlZ74eATBi+PedrYcsP/OLtayOEqy9wtgs4 nZLA== X-Gm-Message-State: AGi0PuaeLoS3UTPrRj/8gC3s4yDmd3H2T3Kus9EOkF2hJrlLl8pBztLi ptk5ykBnldm2Hrow+m0pOMyI7jTW X-Google-Smtp-Source: APiQypJeo+kQWPIpNipX2lMvUyF2GqwLhoPYshAsNI4EWX1J/p7kvdH8VTyUSXx926YUoYpdt/ti1w== X-Received: by 2002:a19:a93:: with SMTP id 141mr9866260lfk.107.1585626989016; Mon, 30 Mar 2020 20:56:29 -0700 (PDT) Original-Received: from localhost ([185.112.167.47]) by smtp.gmail.com with ESMTPSA id g8sm8942852ljl.45.2020.03.30.20.56.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 30 Mar 2020 20:56:28 -0700 (PDT) In-Reply-To: (Yuan Fu's message of "Mon, 30 Mar 2020 15:21:10 -0400") X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::134 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.23 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-mx.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.io gmane.emacs.devel:246076 Archived-At: --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On Mon, 30 Mar 2020 15:21:10 -0400 Yuan Fu wrote: >> IMO, inhibit-modification-hooks is for when some code makes a >> temporary change, or a change that no one is supposed to care about, >> like changing faces. Any other case is a bug. > > I see. Then I suggest mentioning it (when you should use the variable) in= the documentation of `inhibit-modification-hooks'. I think the explanation in (info "(elisp) Change Hooks") is quite good, but the doc string had better clarify the usage as well. How about the attached patch? --=20 =C5=A0t=C4=9Bp=C3=A1n --=-=-= Content-Type: text/x-patch Content-Disposition: inline; filename=0001-Clarify-inhibit-modification-hooks-intended-usage-in.patch >From df7e9e1eb9e9ead46c9c8596d7f844e8b7f4d10b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=A0t=C4=9Bp=C3=A1n=20N=C4=9Bmec?= Date: Tue, 31 Mar 2020 05:38:50 +0200 Subject: [PATCH] Clarify inhibit-modification-hooks intended usage in its doc string Cf. bug#40332 and the discussion at https://lists.gnu.org/archive/html/emacs-devel/2020-03/msg00921.html --- src/insdel.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/insdel.c b/src/insdel.c index 21acf0e61d..a9fb25a27d 100644 --- a/src/insdel.c +++ b/src/insdel.c @@ -2397,7 +2397,13 @@ syms_of_insdel (void) as well as hooks attached to text properties and overlays. Setting this variable non-nil also inhibits file locks and checks whether files are locked by another Emacs session, as well as -handling of the active region per `select-active-regions'. */); +handling of the active region per `select-active-regions'. + +This variable should only be used for modifications that do not result +in lasting changes to buffer text contents (for example face changes or +temporary modifications). If you only need to delay change hooks during +a series of changes (typically for performance reasons), you can use +`combine-change-calls' or `combine-after-change-calls' instead. */); inhibit_modification_hooks = 0; DEFSYM (Qinhibit_modification_hooks, "inhibit-modification-hooks"); -- 2.26.0 --=-=-=--