From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Ihor Radchenko Newsgroups: gmane.emacs.bugs Subject: bug#46982: 28.0.50; after-change-functions in an indirect buffer are not called if the change is done while base buffer is active (and vice versa) Date: Sun, 07 Mar 2021 12:36:01 +0800 Message-ID: <87h7lnk2by.fsf@localhost> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="35106"; mail-complaints-to="usenet@ciao.gmane.io" To: 46982@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sun Mar 07 05:33:11 2021 Return-path: Envelope-to: geb-bug-gnu-emacs@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 1lIl6M-00091M-GG for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 07 Mar 2021 05:33:10 +0100 Original-Received: from localhost ([::1]:32850 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lIl6L-0006hY-1a for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 06 Mar 2021 23:33:09 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:45976) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lIl6E-0006hP-Py for bug-gnu-emacs@gnu.org; Sat, 06 Mar 2021 23:33:02 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]:55415) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lIl6E-0001Yb-Hw for bug-gnu-emacs@gnu.org; Sat, 06 Mar 2021 23:33:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1lIl6E-00071R-En for bug-gnu-emacs@gnu.org; Sat, 06 Mar 2021 23:33:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Ihor Radchenko Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 07 Mar 2021 04:33:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 46982 X-GNU-PR-Package: emacs X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.161509152626925 (code B ref -1); Sun, 07 Mar 2021 04:33:02 +0000 Original-Received: (at submit) by debbugs.gnu.org; 7 Mar 2021 04:32:06 +0000 Original-Received: from localhost ([127.0.0.1]:38728 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lIl5J-00070C-Gr for submit@debbugs.gnu.org; Sat, 06 Mar 2021 23:32:06 -0500 Original-Received: from lists.gnu.org ([209.51.188.17]:34456) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lIl5H-000705-Mo for submit@debbugs.gnu.org; Sat, 06 Mar 2021 23:32:04 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:45886) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lIl5H-0006f8-Eu for bug-gnu-emacs@gnu.org; Sat, 06 Mar 2021 23:32:03 -0500 Original-Received: from mail-pg1-x52a.google.com ([2607:f8b0:4864:20::52a]:34868) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lIl5F-0001IS-KX for bug-gnu-emacs@gnu.org; Sat, 06 Mar 2021 23:32:03 -0500 Original-Received: by mail-pg1-x52a.google.com with SMTP id t25so4179801pga.2 for ; Sat, 06 Mar 2021 20:32:00 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id:mime-version; bh=sXVSmfMs66Vumcp+dIrxxfQ0ScMZhdwjup23MSukp48=; b=VGoDVcvN7XjFe7oqDkt4PHHqGdtgXlu7muAlVRICYD6QK5HHWohYyjdDiJyJ/mnKlg zkUkmZW8TRoqpsTp0odiAy5aSu4YM+DPuJEPTdKGdIBIEr8CAi1bSWd4wznU2n2qzQJt WY6f+0LMFN9BUxHaDsY8gNAW5PHp94LlhNuqi3z7/glO/qQwVK7hsDsQ3fULIuUvOge1 wNt7rCSW/OAxdRWPiluWvGidJ7yfTi7aBvW6oysDNUlO22jUuKV5qreRSMMb6aDbuejN /ab3w01oqIochVSTyXeNR4aVQsFcZzW26f6nHuuZbEjtADZToUo4/bZiywt2wYkTe5vT uHzA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:mime-version; bh=sXVSmfMs66Vumcp+dIrxxfQ0ScMZhdwjup23MSukp48=; b=POykb5DKzUu/i154mntVwJZycaNSm+pt+qJ59mTVNuMGsBbOlkQnm176MStcIGNqS0 ANc1w8wXvrrC1DBvA5JeNxmfdlnbrNRp09juqzR3DJzIFYFOp3jZsGCJk4dEaUEkgOcs xwHeM2PGj2jqxuq3DmSLnRav9h/lKVgKBoqCpIoHRbVcGC2iDX5N3zFBIuHOvtGmYmxe yQT71xUXtwVThx6QZJ2w+z6DlxU8RFu4/wpj/nnhLYfCMCqXbTE4TjlQCJoWZxfoySFB rDpuF91u+aCaia+NZFE6+pyFYXpHijFXAd2CNnBSsiOqLFdcVwhe5kI5QvXu/f+jqt6B /yyA== X-Gm-Message-State: AOAM531X67/pFCQrPrdtHLfQVnYDHmAVAR02wKkLsx6xM3ZG+9Z4n7au VmRpUDN9yAqLFO8mvnKqWMa20HTiRvQk5Q== X-Google-Smtp-Source: ABdhPJzBecW1GCl5ytngAwZ2DyyKBhSS966+1ESh9CtQ5HCm92OoZqnNSWC6hLu3BHNbZJrd2Z/3WA== X-Received: by 2002:a63:2321:: with SMTP id j33mr15218059pgj.120.1615091518587; Sat, 06 Mar 2021 20:31:58 -0800 (PST) Original-Received: from localhost ([104.250.131.79]) by smtp.gmail.com with ESMTPSA id y1sm16295082pjr.3.2021.03.06.20.31.57 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 06 Mar 2021 20:31:58 -0800 (PST) Received-SPF: pass client-ip=2607:f8b0:4864:20::52a; envelope-from=yantar92@gmail.com; helo=mail-pg1-x52a.google.com X-Spam_score_int: -17 X-Spam_score: -1.8 X-Spam_bar: - X-Spam_report: (-1.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_ENVFROM_END_DIGIT=0.25, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list 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-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:201714 Archived-At: Steps to reproduce: 1. emacs -Q 2. M-x clone-indirect-buffer 3. M-: (setq-local after-change-functions (append after-change-functions '((lambda (&rest _) (message "Buffer 1"))))) 4. C-x o 5. M-: (setq-local after-change-functions (append after-change-functions '((lambda (&rest _) (message "Buffer 2"))))) 6. Type something. "Buffer 2" message is displayed. "Buffer 1" message is _not_ displayed. 7. C-x o 8. Type something. "Buffer 1" message is displayed. "Buffer 2" message is _not_ displayed. Expected behaviour: Since changes in direct buffer would automatically change text in the indirect buffer, I expect the changes to trigger all the after-change-functions in all the indirect buffers and the base buffer, regardless of which buffer was active when changes were made. The current behaviour can potentially break major modes using after-change-functions if base buffer and indirect buffer do not have the same major mode. For my use-case, an after-change-function I want to implement depends on buffer-local variable (which is set to different values in the base and indirect buffers) and I expect it to run in both buffers. Current Emacs behaviour leaves me with no options to handle changes made not in current buffer, even though they do change the text in other (indirect or base) buffer. On the other hand, running after-change-functions in every indirect/base buffer may lead to multiple invocations of the same function. Maybe, Emacs can examine something like 'run-indirect symbol for each element in after-change-functions and run the functions containing the symbol in all the connected buffers upon change. Best, Ihor In GNU Emacs 28.0.50 (build 1, x86_64-pc-linux-gnu, cairo version 1.16.0) of 2021-02-20 built on localhost Repository revision: 39792cf62987ecc1a772f6a2027d6b32c70e8312 Repository branch: feature/native-comp Windowing system distributor 'The X.Org Foundation', version 11.0.12010000 System Description: Gentoo/Linux Configured using: 'configure --prefix=/usr --build=x86_64-pc-linux-gnu --host=x86_64-pc-linux-gnu --mandir=/usr/share/man --infodir=/usr/share/info --datadir=/usr/share --sysconfdir=/etc --localstatedir=/var/lib --disable-silent-rules --docdir=/usr/share/doc/emacs-28.0.9999 --htmldir=/usr/share/doc/emacs-28.0.9999/html --libdir=/usr/lib64 --program-suffix=-emacs-28-vcs --includedir=/usr/include/emacs-28-vcs --infodir=/usr/share/info/emacs-28-vcs --localstatedir=/var --enable-locallisppath=/etc/emacs:/usr/share/emacs/site-lisp --without-compress-install --without-hesiod --without-pop --with-file-notification=inotify --with-pdumper --enable-acl --with-dbus --with-modules --without-gameuser --with-libgmp --without-gpm --with-json --without-kerberos --without-kerberos5 --without-lcms2 --with-xml2 --without-mailutils --with-selinux --with-gnutls --without-libsystemd --with-threads --with-wide-int --with-zlib --with-sound=oss --with-x --without-ns --without-gconf --without-gsettings --without-toolkit-scroll-bars --with-gif --with-jpeg --with-png --with-rsvg --with-tiff --with-xpm --with-imagemagick --with-xft --with-cairo --with-harfbuzz --without-libotf --without-m17n-flt --with-x-toolkit=no --with-dumping=pdumper --with-nativecomp 'CFLAGS=-march=native -pipe -O2' CPPFLAGS= 'LDFLAGS=-Wl,-O1 -Wl,--as-needed'' Configured features: ACL CAIRO DBUS FREETYPE GIF GLIB GMP GNUTLS HARFBUZZ IMAGEMAGICK JPEG JSON LIBSELINUX LIBXML2 MODULES NATIVE_COMP NOTIFY INOTIFY OLDXMENU PDUMPER PNG RSVG SOUND THREADS TIFF X11 XDBE XIM XPM ZLIB Important settings: value of $LC_COLLATE: C value of $LANG: en_US.utf8 locale-coding-system: utf-8-unix Major mode: Lisp Interaction Minor modes in effect: org-edna-mode: t eros-mode: t pdf-occur-global-minor-mode: t TeX-PDF-mode: t which-key-mode: t global-aggressive-indent-mode: t aggressive-indent-mode: t diredfl-global-mode: t dired-async-mode: t winner-mode: t recentf-mode: t helm-adaptive-mode: t helm-global-mode: t helm-mode: t helm--remap-mouse-mode: t async-bytecomp-package-mode: t eval-sexp-fu-flash-mode: t global-highlight-parentheses-mode: t highlight-parentheses-mode: t el-patch-use-package-mode: t global-git-commit-mode: t magit-auto-revert-mode: t shell-dirtrack-mode: t hl-todo-mode: t pretty-symbols-mode: t company-mode: t persistent-scratch-autosave-mode: t savehist-mode: t boon-mode: t boon-local-mode: t global-hl-line-mode: t global-page-break-lines-mode: t page-break-lines-mode: t shackle-mode: t golden-ratio-mode: t gcmh-mode: t override-global-mode: t straight-use-package-mode: t straight-package-neutering-mode: t global-eldoc-mode: t eldoc-mode: t electric-indent-mode: t mouse-wheel-mode: t global-prettify-symbols-mode: t prettify-symbols-mode: t file-name-shadow-mode: t global-font-lock-mode: t font-lock-mode: t window-divider-mode: t auto-composition-mode: t auto-encryption-mode: t auto-compression-mode: t line-number-mode: t transient-mark-mode: t abbrev-mode: t Features: (shadow emacsbug sendmail helm-misc avy font-latex context-en context plain-tex tex-buf ...) Memory information: ((conses 16 32697775 2032831) (symbols 48 96430 1) (strings 32 2157335 426732) (string-bytes 1 82214460) (vectors 16 799796) (vector-slots 8 11991333 1566948) (floats 8 211915 16922) (intervals 56 1417577 35086) (buffers 992 180))