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: Sat, 22 Sep 2018 09:00:10 -0400 [thread overview]
Message-ID: <87r2hloffp.fsf@gmail.com> (raw)
In-Reply-To: <87zhwb6yb0.fsf@calancha-pc.dy.bbexcite.jp> (Tino Calancha's message of "Fri, 21 Sep 2018 17:37:39 +0900")
Tino Calancha <tino.calancha@gmail.com> writes:
> commit 72e332c986304775e91020c88ded1ba9d7226023
> Author: Tino Calancha <tino.calancha@gmail.com>
> Date: Fri Sep 21 17:32:57 2018 +0900
>
> Ibuffer filter by modes: Accept several mode names
>
> Extend all mode filters so that they handle >1 mode.
> For instance, if the user wants to filter all buffers in
> C or C++ mode, then s?he can call the filter interactively
If you'll pardon another nit, I suggest using "they" instead of "s?he"
which has the advantage of being a pronounceable English word.
> + (let ((,filter (cons ',name qualifier))
> + (,qualifier-str qualifier))
> + ,(when accept-list
> + `(progn
> + (unless (listp qualifier) (setq qualifier (list qualifier)))
> + ;; Reject equivalent filters: (or f1 f2) is same as (or f2 f1).
> + (setq qualifier (sort (delete-dups qualifier) #'string-lessp))
> + (setq ,filter (cons ',name (car qualifier)))
> + (setq ,qualifier-str
> + (mapconcat (lambda (m) (if (symbolp m) (symbol-name m) m))
> + qualifier ","))
> + (when (cdr qualifier) ; Compose individual filters with `or'.
> + (setq ,filter `(or ,@(mapcar (lambda (m) (cons ',name m)) qualifier))))))
> + (if (null (ibuffer-push-filter ,filter))
> + (message ,(format "Filter by %s already applied: %%s" description)
> + ,qualifier-str)
> + (message ,(format "Filter by %s added: %%s" description)
> + ,qualifier-str)
> + (ibuffer-update nil t))))
Since I'm here nitting anyway, I would tweak this code a bit:
(let ((,filter (cons ',name qualifier))
(,qualifier-desc qualifier))
,(when accept-list
`(when (listp qualifier)
(setq ,qualifier-desc
(mapconcat (lambda (m) (if (symbolp m) (symbol-name m) m))
qualifier ","))
(if (null (cdr qualifier))
(setf (cdr ,filter) (car qualifier)) ; Singleton list.
;; Reject equivalent filters: (or f1 f2) is same as (or f2 f1).
(setq qualifier (delete-consecutive-dups
(sort qualifier #'string-lessp)))
;; Compose individual filters with `or'.
(setq ,filter `(or ,@(mapcar (lambda (m) (cons ',name m))
qualifier))))))
(if (null (ibuffer-push-filter ,filter))
(message ,(format "Filter by %s already applied: %%s" description)
,qualifier-desc)
(message ,(format "Filter by %s added: %%s" description)
,qualifier-desc)
(ibuffer-update nil t)))
> (push (list ',name ,description
> (lambda (buf qualifier)
> - (condition-case nil
> - (progn ,@body)
> - (error (ibuffer-pop-filter)
> - (when (eq ',name 'predicate)
> - (error "Wrong filter predicate: %S"
> - qualifier))))))
> + (condition-case nil
> + (progn ,@body)
> + (error (ibuffer-pop-filter)
> + (when (eq ',name 'predicate)
> + (error "Wrong filter predicate: %S"
> + qualifier))))))
> ibuffer-filtering-alist)
> :autoload-end)))
I think this hunk is just changing spaces to tabs (shouldn't .dir-locals
be setting indent-tabs-mode to nil though?).
next prev parent reply other threads:[~2018-09-22 13:00 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
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 [this message]
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87r2hloffp.fsf@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 external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.