From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Pip Cet Newsgroups: gmane.emacs.bugs Subject: bug#36190: 27.0.50; `put-text-property' etc. with buffer argument calls current buffer's `after-change-functions' Date: Thu, 13 Jun 2019 20:57:08 +0000 Message-ID: References: <83h88tzbly.fsf@gnu.org> <835zp9z4oj.fsf@gnu.org> <83y325xnk0.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="155474"; mail-complaints-to="usenet@blaine.gmane.org" Cc: 36190@debbugs.gnu.org To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Thu Jun 13 22:58:24 2019 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([209.51.188.17]) by blaine.gmane.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1hbWng-000eH5-I0 for geb-bug-gnu-emacs@m.gmane.org; Thu, 13 Jun 2019 22:58:24 +0200 Original-Received: from localhost ([::1]:45600 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hbWnf-0000UP-Kx for geb-bug-gnu-emacs@m.gmane.org; Thu, 13 Jun 2019 16:58:23 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:41923) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hbWnL-0000U7-N4 for bug-gnu-emacs@gnu.org; Thu, 13 Jun 2019 16:58:04 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hbWnK-0001ma-Fb for bug-gnu-emacs@gnu.org; Thu, 13 Jun 2019 16:58:03 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:50903) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hbWnK-0001lg-8Y for bug-gnu-emacs@gnu.org; Thu, 13 Jun 2019 16:58:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1hbWnK-0007Zx-60 for bug-gnu-emacs@gnu.org; Thu, 13 Jun 2019 16:58:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Pip Cet Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 13 Jun 2019 20:58:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 36190 X-GNU-PR-Package: emacs Original-Received: via spool by 36190-submit@debbugs.gnu.org id=B36190.156045947229117 (code B ref 36190); Thu, 13 Jun 2019 20:58:02 +0000 Original-Received: (at 36190) by debbugs.gnu.org; 13 Jun 2019 20:57:52 +0000 Original-Received: from localhost ([127.0.0.1]:36214 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hbWn9-0007ZZ-Ns for submit@debbugs.gnu.org; Thu, 13 Jun 2019 16:57:51 -0400 Original-Received: from mail-oi1-f171.google.com ([209.85.167.171]:34078) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hbWn8-0007ZL-2k for 36190@debbugs.gnu.org; Thu, 13 Jun 2019 16:57:50 -0400 Original-Received: by mail-oi1-f171.google.com with SMTP id j184so415771oih.1 for <36190@debbugs.gnu.org>; Thu, 13 Jun 2019 13:57:49 -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 :cc; bh=KCsICQydwHom7mykAl8qP6JeHWEmJF9St/uBm5TAlyI=; b=LuScDoj6yneZdXQYhpgLNgFf0vUx5Bo7aU/EYGJHe0k1vvmIPi1P83Q6bnQoI9+buW 5a1tmqdtPG0yOHuN7/tUV3s7Vt1G9CVsiEYogCLXzDQHCozjiYnq/A0Q5ngRATlls52B EyIF3XTK/I3Imrjmvh/73jzyGriF3LezAMwgqzjFv6wqvPo4/csnwPeSDhKp6YPwJWFO wiAyLmIMFHg41HeA1xz+Nt//Aews8Vi4WpjtNRYd7o8XuWFETAf9ep15yprKx5XmqxrG wwtz0RRDGUr53/deEaqWBzS/o6kNhEVUuERfpigkBV5CF3NaqRQ3IzJsTP/XXsr+NbPy 76uw== 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:cc; bh=KCsICQydwHom7mykAl8qP6JeHWEmJF9St/uBm5TAlyI=; b=pt78dBzGmyBpfps3ItKjvAE/W2YjDDV2nlWDHIyvFIv5K2tMReEZdl/QVmI9geiyx4 sB3cXdSJWqPEDbKBUWyKdSavF4AQJ94WJcy2zZH/aL9rt2LBjyphNbnnI2BTlerMBC/T vdad+KiMzITpa7QJnyHUft+PTgNamoc+DJyy/7o6bCmMUS0rzWr02kenM/D+dEIT/4Ws Of3b8JcmhOOGDk1WcawbxGoYL03nxbC3xHToY73OB+BTLCZ7/Nfc5IgbTzzCZ2/77dx/ dy9xMniSm/BIJsdF83XZ7/laMbIGh/mBTKTZ6t3mZZCcCIgSE/xvModXJ0aOVDVq9Xk6 Wmmg== X-Gm-Message-State: APjAAAVEZdM8TMTZie1hNOb2NfHzCKIDif8FIrpCkz+m9WWymtvH4tWC bi7sGIUdCEDsH2jYGQZlkS5E7cO54zjMxO1hipA= X-Google-Smtp-Source: APXvYqxQ5NLkVJgSRR6CdnEH41CP1KgtLERbqa+iLJPPmECdEVkauGxx9aE44A6PqPmwInhGnwBc7aGO7S/FT5ujMOw= X-Received: by 2002:aca:aa93:: with SMTP id t141mr4462397oie.128.1560459464363; Thu, 13 Jun 2019 13:57:44 -0700 (PDT) In-Reply-To: <83y325xnk0.fsf@gnu.org> X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.51.188.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:160526 Archived-At: On Thu, Jun 13, 2019 at 8:01 PM Eli Zaretskii wrote: > > From: Pip Cet > > Date: Thu, 13 Jun 2019 19:42:29 +0000 > > Cc: 36190@debbugs.gnu.org > > > > > Not sure I have a clear idea of how you intend to use that additional > > > argument. Are you suggesting that we switch to that buffer? > > > > Yes: > > > > @@ -2183,6 +2184,9 @@ signal_after_change (ptrdiff_t charpos, > > ptrdiff_t lendel, ptrdiff_t lenins) > > if (inhibit_modification_hooks) > > return; > > > > + record_unwind_current_buffer (); > > + set_buffer_internal (buffer); > > Ugh! switching buffers just to run a hook! > This will kill performance > in some cases. I really don't think it will have a noticeable impact on performance, but if you can think of a scenario, we could try to fix it. > We had something similar with JSON parsing a few > months ago. > I wish we had a better alternative. (Such as not calling regular modification hooks for text property changes?) > Maybe we should warn > in the documentation that calling these functions with BUFFER being > other than the current buffer might hurt performance when > after-change-functions is non-nil. It'll hurt performance even when after-change-functions is nil, so such a warning would be overspecific. > > As a practical matter, it's hard to change the text property functions > > to use NULL when passed a nil argument > > How is it harder than passing current_buffer? The code path goes through if (NILP (object)) XSETBUFFER (object, current_buffer); > It's really a matter of stylistic preferences, but you did ask why... It was out of genuine interest, because passing NULL to implicitly specify a default argument is something that people advocate against, and that C in particular has a history of avoiding (stdout isn't NULL, and post-VAX NULL isn't an empty string, for example). Thank you for responding, and I'll change my patch accordingly.