GNU bug report logs - #28826
27.0.50; Ibuffer filters should be idempotent

Previous Next

Package: emacs;

Reported by: Tino Calancha <tino.calancha <at> gmail.com>

Date: Sat, 14 Oct 2017 02:57:01 UTC

Severity: minor

Tags: patch

Found in version 27.0.50

Done: Tino Calancha <tino.calancha <at> gmail.com>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 28826 in the body.
You can then email your comments to 28826 AT debbugs.gnu.org in the normal way.

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#28826; Package emacs. (Sat, 14 Oct 2017 02:57:01 GMT) Full text and rfc822 format available.

Acknowledgement sent to Tino Calancha <tino.calancha <at> gmail.com>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Sat, 14 Oct 2017 02:57:01 GMT) Full text and rfc822 format available.

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

From: Tino Calancha <tino.calancha <at> gmail.com>
To: bug-gnu-emacs <at> gnu.org
Subject: 27.0.50; Ibuffer filters should be idempotent
Date: Sat, 14 Oct 2017 11:56:39 +0900
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 <at> 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




Added tag(s) patch. Request was from Tino Calancha <tino.calancha <at> gmail.com> to control <at> debbugs.gnu.org. (Sat, 14 Oct 2017 02:58:01 GMT) Full text and rfc822 format available.

Reply sent to Tino Calancha <tino.calancha <at> gmail.com>:
You have taken responsibility. (Fri, 20 Oct 2017 13:16:02 GMT) Full text and rfc822 format available.

Notification sent to Tino Calancha <tino.calancha <at> gmail.com>:
bug acknowledged by developer. (Fri, 20 Oct 2017 13:16:02 GMT) Full text and rfc822 format available.

Message #12 received at 28826-done <at> debbugs.gnu.org (full text, mbox):

From: Tino Calancha <tino.calancha <at> gmail.com>
To: 28826-done <at> debbugs.gnu.org
Subject: Re: bug#28826: 27.0.50; Ibuffer filters should be idempotent
Date: Fri, 20 Oct 2017 22:14:59 +0900
Tino Calancha <tino.calancha <at> 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)




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Sat, 18 Nov 2017 12:24:06 GMT) Full text and rfc822 format available.

This bug report was last modified 7 years and 271 days ago.

Previous Next


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