From: Noam Postavsky <npostavs@gmail.com>
To: Tino Calancha <tino.calancha@gmail.com>
Cc: 32731@debbugs.gnu.org
Subject: bug#32731: 26.1.50; Ibuffer filter by mode: Handle >1 mode names
Date: Thu, 13 Sep 2018 15:09:41 -0400 [thread overview]
Message-ID: <CAM-tV-9h8O6jADjYFnmEYDiyNUcun4SqYfhHWYKTR4Sn+yfEtQ@mail.gmail.com> (raw)
In-Reply-To: <87bm919s5y.fsf@calancha-pc.dy.bbexcite.jp>
On 13 September 2018 at 14:19, Tino Calancha <tino.calancha@gmail.com> wrote:
> +;;;###autoload
> +(defun ibuffer-filter-by-used-modes(modes)
> + "Limit current view to buffers with major mode in MODES.
> +MODES is a list of mode names (symbols).
> +When called interactively, accept the mode names separated by commas."
> + (interactive
> + (let* ((buf (ibuffer-current-buffer))
> + (default (if (and buf (buffer-live-p buf))
> + (symbol-name (buffer-local-value
> + 'major-mode buf)))))
> + (list
> + (mapcar #'intern
> + (split-string
> + (completing-read
> + (if default
> + (format "Filter by major mode (default %s): " default)
> + "Filter by major mode: ")
> + (ibuffer-list-buffer-modes)
> + nil nil nil nil default)
> + "\\s-*,\\s-*" t)))))
This will use completion only for the first mode, right? Perhaps
completing-read-multiple would make more sense here.
> + (setq modes (delete-dups modes))
> + (mapc #'ibuffer-filter-by-used-mode modes)
> + (let ((nb_modes (length modes)))
> + (when (>= nb_modes 2)
> + (cl-loop repeat (- nb_modes 2) do (ibuffer-or-filter))
> + (message nil)
What's this `message' call for?
> + (ibuffer-or-filter))))
Maybe it's simpler to construct the filter directly? As in:
(push `(or ,@(mapcar (lambda (m) `(used-mode . ,m)) modes))
ibuffer-filtering-qualifiers)
(ibuffer-update nil t)
next prev parent reply other threads:[~2018-09-13 19:09 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-09-13 18:19 bug#32731: 26.1.50; Ibuffer filter by mode: Handle >1 mode names Tino Calancha
2018-09-13 19:09 ` Noam Postavsky [this message]
2018-09-13 20:04 ` Tino Calancha
2018-09-13 20:38 ` Tino Calancha
2018-09-13 23:39 ` Noam Postavsky
2018-09-15 9:15 ` Tino Calancha
2018-09-15 12:42 ` Noam Postavsky
2018-09-17 17:44 ` Tino Calancha
2018-09-17 18:27 ` Eli Zaretskii
2018-09-17 19:53 ` Tino Calancha
2018-09-18 7:14 ` Eli Zaretskii
2018-09-18 23:19 ` Noam Postavsky
2018-09-19 9:23 ` Tino Calancha
2018-09-19 9:42 ` Eli Zaretskii
2018-09-21 8:37 ` Tino Calancha
2018-09-22 9:14 ` Eli Zaretskii
2018-09-22 13:00 ` Noam Postavsky
2018-09-23 1:37 ` Richard Stallman
2018-09-23 12:01 ` Noam Postavsky
2018-09-24 8:27 ` Tino Calancha
2018-09-24 19:58 ` Richard Stallman
2018-09-24 20:48 ` Tino Calancha
2018-09-24 21:14 ` Eli Zaretskii
2018-09-25 8:14 ` Robert Pluim
2018-09-25 9:24 ` Eli Zaretskii
2018-09-25 23:03 ` Richard Stallman
2018-09-29 9:49 ` Tino Calancha
2018-09-24 8:36 ` Tino Calancha
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=CAM-tV-9h8O6jADjYFnmEYDiyNUcun4SqYfhHWYKTR4Sn+yfEtQ@mail.gmail.com \
--to=npostavs@gmail.com \
--cc=32731@debbugs.gnu.org \
--cc=tino.calancha@gmail.com \
/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).