GNU bug report logs - #58934
28.2; define-ibuffer-filter should let you compute a function on the qualifier before each update

Previous Next

Package: emacs;

Reported by: Sean Devlin <spd <at> toadstyle.org>

Date: Mon, 31 Oct 2022 22:50:01 UTC

Severity: normal

Found in version 28.2

To reply to this bug, email your comments to 58934 AT debbugs.gnu.org.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#58934; Package emacs. (Mon, 31 Oct 2022 22:50:01 GMT) Full text and rfc822 format available.

Acknowledgement sent to Sean Devlin <spd <at> toadstyle.org>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Mon, 31 Oct 2022 22:50:02 GMT) Full text and rfc822 format available.

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

From: Sean Devlin <spd <at> toadstyle.org>
To: bug-gnu-emacs <at> gnu.org
Subject: 28.2; define-ibuffer-filter should let you compute a function on  the
 qualifier before each update
Date: Mon, 31 Oct 2022 18:49:08 -0400
Hi folks,

Ibuffer provides a macro define-ibuffer-filter to let users define their
own interactive filters. When the filter is invoked, ibuffer reads a
value from the user and stores it in a buffer-local list of
qualifiers. During each update, ibuffer evaluates the body of the filter
for each buffer and qualifier and hides the buffers that do not pass the
test.

Sometimes, it is useful to compute a function on the qualifier before
using the result to test the buffer. For example, suppose you were to
define the following project-based filter:

(define-ibuffer-filter project
    "Limit current view to buffers with project matching QUALIFIER."
  (:description "project"
   :reader (project-current t))
  (seq-contains-p (project-buffers qualifier) buf))

The intermediate list of project buffers is computed repeatedly when we
update ibuffer, even though it depends only on the qualifier and not on
the individual buffer to be tested. This can be expensive if the user
has lots of buffers open.

It would be useful if define-ibuffer-filter had some keyword to specify
some precomputation over the qualifier once per ibuffer update.

While we could do this precomputation when the filter is read, this
would lead to stale results on future updates. For example, if we open
new project buffers, those changes would not be reflected during future
updates, i.e. those buffers would be hidden incorrectly.

Thanks for any help!

In GNU Emacs 28.2
System Description:  macOS

Configured using:
'configure --disable-silent-rules
--enable-locallisppath=/opt/homebrew/share/emacs/site-lisp
--infodir=/opt/homebrew/Cellar/emacs/28.2/share/info/emacs
--prefix=/opt/homebrew/Cellar/emacs/28.2 --with-gnutls --without-x
--with-xml2 --without-dbus --with-modules --without-ns
--without-imagemagick --without-selinux'

Configured features:
ACL GMP GNUTLS JSON LIBXML2 MODULES NOTIFY KQUEUE PDUMPER THREADS ZLIB

Important settings:
  value of $LANG: en_US.UTF-8
  locale-coding-system: utf-8-unix

Major mode: Lisp Interaction

Minor modes in effect:
  tooltip-mode: t
  global-eldoc-mode: t
  eldoc-mode: t
  show-paren-mode: t
  electric-indent-mode: t
  menu-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  blink-cursor-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  line-number-mode: t
  indent-tabs-mode: t
  transient-mark-mode: t

Load-path shadows:
None found.

Features:
(mailalias mailclient browse-url url url-proxy url-privacy url-expand
url-methods url-history url-cookie url-domsuf url-util url-parse
url-vars mailcap help-mode pp shadow regexp-opt sort mail-extr emacsbug
message rmc puny dired dired-loaddefs rfc822 mml mml-sec epa derived epg
rfc6068 epg-config gnus-util rmail tool-bar rmail-loaddefs auth-source
cl-seq eieio eieio-core cl-macs eieio-loaddefs password-cache json map
text-property-search time-date subr-x seq mm-decode mm-bodies mm-encode
mail-parse rfc2231 mailabbrev gmm-utils mailheader cl-loaddefs cl-lib
sendmail rfc2047 rfc2045 ietf-drums mm-util mail-prsvr mail-utils
term/xterm xterm byte-opt gv bytecomp byte-compile cconv iso-transl
tooltip eldoc paren electric uniquify ediff-hook vc-hooks
lisp-float-type elisp-mode tabulated-list replace newcomment text-mode
lisp-mode prog-mode register page tab-bar menu-bar rfn-eshadow isearch
easymenu timer select mouse jit-lock font-lock syntax font-core
term/tty-colors frame minibuffer cl-generic cham georgian utf-8-lang
misc-lang vietnamese tibetan thai tai-viet lao korean japanese eucjp-ms
cp51932 hebrew greek romanian slovak czech european ethiopic indian
cyrillic chinese composite emoji-zwj charscript charprop case-table
epa-hook jka-cmpr-hook help simple abbrev obarray cl-preloaded nadvice
button loaddefs faces cus-face macroexp files window text-properties
overlay sha1 md5 base64 format env code-pages mule custom widget
hashtable-print-readable backquote threads kqueue multi-tty
make-network-process emacs)

Memory information:
((conses 16 66399 9810)
(symbols 48 7124 3)
(strings 32 21563 2028)
(string-bytes 1 682323)
(vectors 16 12435)
(vector-slots 8 141712 14429)
(floats 8 28 313)
(intervals 56 818 108)
(buffers 992 13))




This bug report was last modified 1 year and 177 days ago.

Previous Next


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