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 18:18:57 +0200 Message-ID: <87lfnglcpa.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> <87y2rhkwhk.fsf@gmail.com> <83zhbw1x7f.fsf@gnu.org> <87tv24lk8a.fsf@gmail.com> <83mu7w1tkc.fsf@gnu.org> <87pncsleml.fsf@gmail.com> <83eet81pod.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="117040"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) Cc: casouri@gmail.com, akrl@sdf.org, monnier@iro.umontreal.ca, emacs-devel@gnu.org To: Eli Zaretskii Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Tue Mar 31 18:20:17 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 1jJJcf-000ULT-3L for ged-emacs-devel@m.gmane-mx.org; Tue, 31 Mar 2020 18:20:17 +0200 Original-Received: from localhost ([::1]:41396 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jJJce-00042u-3p for ged-emacs-devel@m.gmane-mx.org; Tue, 31 Mar 2020 12:20:16 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:41911) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jJJb2-0001Ks-Vp for emacs-devel@gnu.org; Tue, 31 Mar 2020 12:18:38 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1jJJb1-00085Y-JN for emacs-devel@gnu.org; Tue, 31 Mar 2020 12:18:36 -0400 Original-Received: from mail-lf1-x12e.google.com ([2a00:1450:4864:20::12e]:33345) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1jJJaz-00084K-OV; Tue, 31 Mar 2020 12:18:34 -0400 Original-Received: by mail-lf1-x12e.google.com with SMTP id x200so10652886lff.0; Tue, 31 Mar 2020 09:18:33 -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=TI02L2aZFksc07mUO+eXDpyr+jDR+hFJRsopEE5OzHo=; b=KBfjev7XTj6n6qHLxLDB1dSHiHBZosWrlAo/X7n/EV+89OzU83hb+hzBdcHwLDBua9 Gejy9E2PI5vhb0ETojpQIMOTe/s0R4IlStLy7M6gsnzD2t5MnWMFv/SoqqWREcUV5fz7 BPi8jhFKBLVs7XVWt+avcSoCMaXyFMsVK4copK8+2plwq1Gm5HZn3W0NU/aYvM8y8MhX PWGF1QUrubqOKr13IcCZ5km0ixOGeo1Hvy0iW0gzbAU/Oh2dXu+sDSdQMd0Wjv2sbua+ syDkLTx9GGNqqCd+g6WWixcV/GdWWQctSWewWX7UlR0ni6auW9gj5thzghtOwh14Utxj LqTw== 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=TI02L2aZFksc07mUO+eXDpyr+jDR+hFJRsopEE5OzHo=; b=p0HxU5pT1LJTEgYFrVi82GwCYTFh55DsJ2Zx0Kf5hQyHhJYafrVYqflf8G/Dj5yRUf swO74p/d+pptsVSQXBhWOqH3XvXzE9k8FY3201fFTLqIpgiy42ldhjNfJPSxr4+vz2yr 5d5Szx3HrDrtSoOoNtbt/9W2XlU1Sw8dtlQasOfQowCg1ufKAoC81nxIpa4LwBb7sfh4 iEeS16rMlVCX64hpUQv66evKsm2ZBSCa55HIusAZmJ/GaqQ5PCN36ATuFvKr+rOnDpeF 0nIYoY0inag2FJaDs0+ocWOVEDjlUKo5EPleDtcNpZKc6qmCLxproZrslflHGDD99+/A mYhw== X-Gm-Message-State: AGi0PuZ38EUY3e+lbKs1KxP3+gQ0qOVUrdr+zpmB9vT+DI3rEgXxsq6T VrVpeh8eFFd1ueaYdkqSJXffwRDo X-Google-Smtp-Source: APiQypJB96DOXlf6FD+geQPuuWxVD0/7AcJ0OsBB0dugxY7QeOWnkFmU0prPNI8jwj9HSMffqcGqyg== X-Received: by 2002:a19:7e01:: with SMTP id z1mr11738976lfc.196.1585671510742; Tue, 31 Mar 2020 09:18:30 -0700 (PDT) Original-Received: from localhost ([185.112.167.47]) by smtp.gmail.com with ESMTPSA id w29sm11600151lfq.27.2020.03.31.09.18.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 31 Mar 2020 09:18:29 -0700 (PDT) In-Reply-To: <83eet81pod.fsf@gnu.org> (Eli Zaretskii's message of "Tue, 31 Mar 2020 18:58:58 +0300") X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::12e 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:246119 Archived-At: --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On Tue, 31 Mar 2020 18:58:58 +0300 Eli Zaretskii wrote: >> +@strong{Warning:} You should only bind this variable for modifications > > I'd prefer to remove the warning, and say "We recommend that..." > rather than "You should only...". > >> +To delay change hooks during a series of changes, use >> +`combine-change-calls' or `combine-after-change-calls' instead of >> +modifying this variable. > ^^^^^^^^^ > "binding" Updated version attached, thank you. =C5=A0t=C4=9Bp=C3=A1n --=-=-= Content-Type: text/x-patch Content-Disposition: inline; filename=0001-Clarify-documentation-on-inhibit-modification-hooks-.patch >From 8e2a5a8c8381c85d138f34d37931c52c289da2ba 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 documentation on inhibit-modification-hooks intended usage Cf. bug#40332 and the discussion at https://lists.gnu.org/archive/html/emacs-devel/2020-03/msg00921.html --- doc/lispref/text.texi | 7 +++++++ src/insdel.c | 8 +++++++- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/doc/lispref/text.texi b/doc/lispref/text.texi index 3bb055a68d..0d32c571b7 100644 --- a/doc/lispref/text.texi +++ b/doc/lispref/text.texi @@ -5776,4 +5776,11 @@ Change Hooks may cause recursive calls to the modification hooks, so be sure to prepare for that (for example, by binding some variable which tells your hook to do nothing). + +We recommend that you only bind this variable for modifications that +do not result in lasting changes to buffer text contents (for example +face changes or temporary modifications). If you need to delay change +hooks during a series of changes (typically for performance reasons), +use @code{combine-change-calls} or @code{combine-after-change-calls} +instead. @end defvar diff --git a/src/insdel.c b/src/insdel.c index 21acf0e61d..dfa1cc311c 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'. + +To delay change hooks during a series of changes, use +`combine-change-calls' or `combine-after-change-calls' instead of +binding this variable. + +See also the info node `(elisp) Change Hooks'. */); inhibit_modification_hooks = 0; DEFSYM (Qinhibit_modification_hooks, "inhibit-modification-hooks"); -- 2.26.0 --=-=-=--