unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* 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)
@ 2021-03-07  4:36 Ihor Radchenko
  2022-06-17  2:36 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
  0 siblings, 1 reply; 14+ messages in thread
From: Ihor Radchenko @ 2021-03-07  4:36 UTC (permalink / raw)
  To: 46982

Steps to reproduce:

1. emacs -Q
2. M-x clone-indirect-buffer <RET>
3. M-: (setq-local after-change-functions (append after-change-functions
   '((lambda (&rest _) (message "Buffer 1"))))) <RET>
4. C-x o
5. M-: (setq-local after-change-functions (append after-change-functions
   '((lambda (&rest _) (message "Buffer 2"))))) <RET>
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))





^ permalink raw reply	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2022-06-29 17:42 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-03-07  4:36 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) Ihor Radchenko
2022-06-17  2:36 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-06-17  5:42   ` Eli Zaretskii
2022-06-17 13:29     ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-06-17 15:28       ` Eli Zaretskii
2022-06-21 20:21       ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-06-21 23:29         ` Ihor Radchenko
2022-06-22  2:36           ` Eli Zaretskii
2022-06-29 15:19             ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-06-29 16:08               ` Eli Zaretskii
2022-06-29 17:16                 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-06-29 17:30                   ` Eli Zaretskii
2022-06-29 17:42                     ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-06-22 23:52           ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).