GNU bug report logs - #60333
[PATCH] whitespace: Update bob, eob markers in base and indirect buffers

Previous Next

Package: emacs;

Reported by: Richard Hansen <rhansen <at> rhansen.org>

Date: Mon, 26 Dec 2022 06:22:02 UTC

Severity: normal

Tags: patch

Full log


Message #44 received at 60333 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Richard Hansen <rhansen <at> rhansen.org>,
 Stefan Monnier <monnier <at> iro.umontreal.ca>
Cc: 60333 <at> debbugs.gnu.org, yantar92 <at> posteo.net
Subject: Re: bug#60333: [PATCH] whitespace: Update bob,
 eob markers in base and indirect buffers
Date: Thu, 12 Jan 2023 11:33:15 +0200
> Cc: 60333 <at> debbugs.gnu.org
> Date: Thu, 29 Dec 2022 03:11:11 -0500
> From: Richard Hansen <rhansen <at> rhansen.org>
> 
> On 12/28/22 09:44, Stefan Monnier wrote:
> >>> "Expose" is the wrong term, because we don't have that info ready to
> >>> be exposed.  We'd either have to create&maintain that list, or compute
> >>> it on-demand when requested.
> > [...]
> >> 1. Maintain internal indirect buffer list associated with buffers in C
> > 
> > That's the "create&maintain that list" option.
> > Personally I don't like it: I'd like to reduce the amount of support we
> > provide in C for indirect buffers rather than increase it.
> 
> What alternative would you prefer?
> 
> How about something like this in a shared location (e.g., simple.el next 
> to `clone-indirect-buffer'):
> 
>      (defvar indirect-buffers--cached nil)
> 
>      (defun indirect-buffers--invalidate-cache ()
>        (setq indirect-buffers--cached nil)
>        (remove-hook 'buffer-list-update-hook
>                     #'indirect-buffers--invalidate-cache))
> 
>      (defun indirect-buffers ()
>        (unless indirect-buffers--cached
>          (setq indirect-buffers--cached '(nil nil))
>          (dolist (buf (buffer-list))
>            (let ((base (buffer-base-buffer buf)))
>               (when base
>                (push buf (plist-get indirect-buffers--cached base)))))
>          (add-hook 'buffer-list-update-hook
>                    #'indirect-buffers--invalidate-cache))
>        indirect-buffers--cached)
> 
> Other options I can see:
> 
>    #1: Apply this patch as-is, keep Org as-is, and live with the code 
> duplication.
>    #2: Reject this patch and keep Org as-is.
>    #3: Advise `make-indirect-buffer'.  The advice would record new 
> indirect buffers and add a `kill-buffer-hook' function to clean up the 
> entry.  (Note, however, that `make-indirect-buffer' is a primitive 
> function.)
>    #4: Fix Bug#46982.  (One possible approach that maintains backwards 
> compatibility:  Teach `after-change-functions' to look for a symbol 
> property that means "run me not just for changes made in this buffer, 
> but also if a change is made in this buffer's base/indirect buffer".)

And this.




This bug report was last modified 2 years and 215 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.