* bug#28826: 27.0.50; Ibuffer filters should be idempotent
@ 2017-10-14 2:56 Tino Calancha
2017-10-20 13:14 ` Tino Calancha
0 siblings, 1 reply; 2+ messages in thread
From: Tino Calancha @ 2017-10-14 2:56 UTC (permalink / raw)
To: 28826
emacs -Q
M-x ibuffer RET
/n s RET
/n s RET ; again
;; ibuffer-filtering-qualifiers contains twice the filter
;; You can read on top:
;; Ibuffer by recency [buffer name: s] [buffer name: s]
--8<-----------------------------cut here---------------start------------->8---
commit d65a5a22981dccc69a6e26cde1e567d109e884b3
Author: Tino Calancha <tino.calancha@gmail.com>
Date: Sat Oct 14 11:30:32 2017 +0900
Make ibuffer filters idempotent
* lisp/ibuf-ext.el (ibuffer-push-filter): Check if the
filter is already in effect (Bug#28826).
* lisp/ibuf-macs.el (define-ibuffer-filter):
Report to user if the filter was already enabled.
diff --git a/lisp/ibuf-ext.el b/lisp/ibuf-ext.el
index 686bc392b6..097a7b3b43 100644
--- a/lisp/ibuf-ext.el
+++ b/lisp/ibuf-ext.el
@@ -1034,7 +1034,8 @@ ibuffer-pop-filter
(defun ibuffer-push-filter (filter-specification)
"Add FILTER-SPECIFICATION to `ibuffer-filtering-qualifiers'."
- (push filter-specification ibuffer-filtering-qualifiers))
+ (unless (member filter-specification ibuffer-filtering-qualifiers)
+ (push filter-specification ibuffer-filtering-qualifiers)))
;;;###autoload
(defun ibuffer-decompose-filter ()
diff --git a/lisp/ibuf-macs.el b/lisp/ibuf-macs.el
index e0c91e20ed..c30067f2f5 100644
--- a/lisp/ibuf-macs.el
+++ b/lisp/ibuf-macs.el
@@ -301,12 +301,16 @@ ibuffer-save-marks
(defun ,fn-name (qualifier)
,(or documentation "This filter is not documented.")
(interactive (list ,reader))
- (ibuffer-push-filter (cons ',name qualifier))
- (message "%s"
- (format ,(concat (format "Filter by %s added: " description)
- " %s")
- qualifier))
- (ibuffer-update nil t))
+ (if (null (ibuffer-push-filter (cons ',name qualifier)))
+ (message "%s"
+ (format ,(concat (format "Filter by %s already applied: " description)
+ " %s")
+ qualifier))
+ (message "%s"
+ (format ,(concat (format "Filter by %s added: " description)
+ " %s")
+ qualifier))
+ (ibuffer-update nil t)))
(push (list ',name ,description
(lambda (buf qualifier)
(condition-case nil
--8<-----------------------------cut here---------------end--------------->8---
In GNU Emacs 27.0.50 (build 16, x86_64-pc-linux-gnu, GTK+ Version 3.22.11)
of 2017-10-14
Repository revision: 78479a3984047a8153b43571e6b5ebfb674223a4
^ permalink raw reply related [flat|nested] 2+ messages in thread
* bug#28826: 27.0.50; Ibuffer filters should be idempotent
2017-10-14 2:56 bug#28826: 27.0.50; Ibuffer filters should be idempotent Tino Calancha
@ 2017-10-20 13:14 ` Tino Calancha
0 siblings, 0 replies; 2+ messages in thread
From: Tino Calancha @ 2017-10-20 13:14 UTC (permalink / raw)
To: 28826-done
Tino Calancha <tino.calancha@gmail.com> writes:
> emacs -Q
> M-x ibuffer RET
> /n s RET
> /n s RET ; again
> ;; ibuffer-filtering-qualifiers contains twice the filter
> ;; You can read on top:
> ;; Ibuffer by recency [buffer name: s] [buffer name: s]
>
Fixed in master branch as commit "Make ibuffer filters idempotent"
(ee6fe8378a28444cb4913abca4af742f736e9b45)
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2017-10-20 13:14 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-10-14 2:56 bug#28826: 27.0.50; Ibuffer filters should be idempotent Tino Calancha
2017-10-20 13:14 ` Tino Calancha
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.