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 17:37:22 +0200 Message-ID: <87pncsleml.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> 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="57246"; 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, emacs-devel@gnu.org, monnier@iro.umontreal.ca, akrl@sdf.org To: Eli Zaretskii Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Tue Mar 31 17:38:15 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 1jJIxx-000EmQ-Da for ged-emacs-devel@m.gmane-mx.org; Tue, 31 Mar 2020 17:38:13 +0200 Original-Received: from localhost ([::1]:40460 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jJIxw-0005sA-DK for ged-emacs-devel@m.gmane-mx.org; Tue, 31 Mar 2020 11:38:12 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:35289) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jJIwn-00046B-CN for emacs-devel@gnu.org; Tue, 31 Mar 2020 11:37:02 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1jJIwl-0006pH-W0 for emacs-devel@gnu.org; Tue, 31 Mar 2020 11:37:01 -0400 Original-Received: from mail-lj1-x244.google.com ([2a00:1450:4864:20::244]:36256) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1jJIwj-0006nP-RM; Tue, 31 Mar 2020 11:36:58 -0400 Original-Received: by mail-lj1-x244.google.com with SMTP id b1so1900764ljp.3; Tue, 31 Mar 2020 08:36:57 -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=US44UTJFsmjwreDA1xhOjOqZHKwjbYOwTpD1KfbTlnE=; b=MGLjOKGsSjBU2EntEurBuOEY/L8+6PuoouyiXQJYBImBW736n3c1VCpWS5bZ38x+l4 K74otbOTofRazaMp3qyeoh4yqxs+xsgsurdhoS4/1UcfM4xMf9r32bizyBE5NihqpOhm DHesRYfsjD5Nx143AiRKgKlZ+XIdbdW18OR0GTcnXn6M8kjELqmyWmrAgKTo5XNdyJe3 IyeBSg4TcVa6HDkMOh5LYTgwsCY1JXXicqqCPc53IRn8Qp5UYByAqHWEzI2gwyl6TQBN 8pXejyGqXTlrz6XQuoTRrrtWfONQjDAGBabdNiMnwU7bJPl623Q8MqXuv/zJ7Is1eyIa ijCg== 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=US44UTJFsmjwreDA1xhOjOqZHKwjbYOwTpD1KfbTlnE=; b=FhRZ2Zkim5yM2cNy56nGWG0sm/BLx2FjoBij3ptZc6wMXQ58xF9tjp8kuqYo2eD8kg uzDB5t7L5tZNu0AXjyVEyj+lchIhrS1WG9vZw2UprPCjQqDm+XuhxPvl/5637+111NYo 0Gh5RoI/FuzFWd3mDrrWYl8ym04wJkMii2X1y7gTg6xw4aI1Q7l4HXIhyJWgl4Jv/eUA owIYDv8E+4TIpHjGjZzpRGA4CtyV76dQJXCon86b/n27PAoIKED8UTo5Ta7kWOsAHCLE C7HqiaHr0XCiIhYj+XpetnXFTtCuUUL80jsB0srgawusBwnNDI3Su4Gj8C/KKyMGvwSm DIhw== X-Gm-Message-State: AGi0PuZwKHpALeZ+yU0jHl5Rg0pjE/8CDZjhTxxzh534oFIYUOSkOsSq OmkZuMXTog4WP6aI3XO65ZsJTIjb X-Google-Smtp-Source: APiQypJN3GgKIWOVx6HhhXEz9UIXeEoL9XgCUCbyo+z4uUiU+k0vduTR4IxbBeHc1JkHgcZRscFDkQ== X-Received: by 2002:a2e:b896:: with SMTP id r22mr10267419ljp.43.1585669016078; Tue, 31 Mar 2020 08:36:56 -0700 (PDT) Original-Received: from localhost ([185.112.167.47]) by smtp.gmail.com with ESMTPSA id r16sm5380540ljj.40.2020.03.31.08.36.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 31 Mar 2020 08:36:55 -0700 (PDT) In-Reply-To: <83mu7w1tkc.fsf@gnu.org> (Eli Zaretskii's message of "Tue, 31 Mar 2020 17:34:59 +0300") X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::244 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:246113 Archived-At: --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On Tue, 31 Mar 2020 17:34:59 +0300 Eli Zaretskii wrote: >> In that case, could we add the "should" part (or something similar) to >> the manual (in addition to the doc string reference you describe)? > > Most probably yes, but could you show the change you had in mind for > the manual? Another attempt attached. =C5=A0t=C4=9Bp=C3=A1n --=-=-= Content-Type: text/x-patch Content-Disposition: inline; filename=0001-Clarify-documentation-on-inhibit-modification-hooks-.patch >From ccf0390392b08bcc1aa9aff24bb62dd3bb4bbfbd 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..daba03fadf 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). + +@strong{Warning:} You should 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..236346fada 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 +modifying this variable. + +See also the info node `(elisp) Change Hooks'. */); inhibit_modification_hooks = 0; DEFSYM (Qinhibit_modification_hooks, "inhibit-modification-hooks"); -- 2.26.0 --=-=-=--