From: Richard Hansen <rhansen@rhansen.org>
To: Stefan Monnier <monnier@iro.umontreal.ca>,
Ihor Radchenko <yantar92@posteo.net>
Cc: 60333@debbugs.gnu.org
Subject: bug#60333: [PATCH] whitespace: Update bob, eob markers in base and indirect buffers
Date: Thu, 29 Dec 2022 03:11:11 -0500 [thread overview]
Message-ID: <45afa067-f63d-e013-a547-ea4ef0c27935@rhansen.org> (raw)
In-Reply-To: <jwvv8lv380b.fsf-monnier+emacs@gnu.org>
[-- Attachment #1.1: Type: text/plain, Size: 2040 bytes --]
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".)
Thanks,
Richard
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
next prev parent reply other threads:[~2022-12-29 8:11 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-12-26 6:21 bug#60333: [PATCH] whitespace: Update bob, eob markers in base and indirect buffers Richard Hansen
2022-12-27 6:34 ` Ihor Radchenko
2022-12-27 12:24 ` Eli Zaretskii
2022-12-27 14:50 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-12-28 13:48 ` Ihor Radchenko
2022-12-28 14:44 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-12-29 8:11 ` Richard Hansen [this message]
2023-01-12 9:33 ` Eli Zaretskii
2023-01-12 16:21 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-12-29 11:20 ` Ihor Radchenko
2022-12-29 14:30 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-12-29 20:45 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-12-28 14:51 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-12-29 6:54 ` Richard Hansen
2023-01-12 9:32 ` Eli Zaretskii
2023-01-12 16:15 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=45afa067-f63d-e013-a547-ea4ef0c27935@rhansen.org \
--to=rhansen@rhansen.org \
--cc=60333@debbugs.gnu.org \
--cc=monnier@iro.umontreal.ca \
--cc=yantar92@posteo.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).