all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Tino Calancha <tino.calancha@gmail.com>
To: 24997@debbugs.gnu.org
Cc: tino.calancha@gmail.com
Subject: bug#24997: 26.0.50; ibuffer-decompose-filter has side effects on error
Date: Sun, 27 Nov 2016 12:54:30 +0900	[thread overview]
Message-ID: <877f7py3ux.fsf@gmail.com> (raw)
In-Reply-To: <878tsa6453.fsf@gmail.com> (Tino Calancha's message of "Wed, 23 Nov 2016 16:34:32 +0900")


Previous patch had undesirable side effects on `ibuffer-saved-filters'.
Updated patch:

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
From ffca1e2c713f39a0782b359279693e9e4245f791 Mon Sep 17 00:00:00 2001
From: Tino Calancha <tino.calancha@gmail.com>
Date: Sun, 27 Nov 2016 12:46:19 +0900
Subject: [PATCH] ibuffer-decompose-filter: Avoid side effects on error

* lisp/ibuf-ext.el (ibuffer-decompose-filter):
Update 'ibuffer-filtering-qualifiers' only if there is no error (Bug#24997).
---
 lisp/ibuf-ext.el | 39 +++++++++++++++++----------------------
 1 file changed, 17 insertions(+), 22 deletions(-)

diff --git a/lisp/ibuf-ext.el b/lisp/ibuf-ext.el
index 5ef0746..63db1e6 100644
--- a/lisp/ibuf-ext.el
+++ b/lisp/ibuf-ext.el
@@ -840,29 +840,24 @@ ibuffer-decompose-filter
 be a complex filter like (OR [name: foo] [mode: bar-mode]), will be
 turned into two separate filters [name: foo] and [mode: bar-mode]."
   (interactive)
-  (when (null ibuffer-filtering-qualifiers)
+  (unless ibuffer-filtering-qualifiers
     (error "No filters in effect"))
-  (let ((lim (pop ibuffer-filtering-qualifiers)))
-    (pcase (car lim)
-      (`or
-       (setq ibuffer-filtering-qualifiers (append
-					  (cdr lim)
-					  ibuffer-filtering-qualifiers)))
-      (`saved
-       (let ((data
-	      (assoc (cdr lim)
-		     ibuffer-saved-filters)))
-	 (unless data
-	   (ibuffer-filter-disable)
-	   (error "Unknown saved filter %s" (cdr lim)))
-	 (setq ibuffer-filtering-qualifiers (append
-					    (cadr data)
-					    ibuffer-filtering-qualifiers))))
-      (`not
-       (push (cdr lim)
-	     ibuffer-filtering-qualifiers))
-      (_
-       (error "Filter type %s is not compound" (car lim)))))
+  (let* ((filters ibuffer-filtering-qualifiers)
+         (head (cdar filters))
+         (tail (cdr filters))
+         (value
+          (pcase (caar filters)
+            (`or (nconc head tail))
+            (`saved
+             (let ((data (assoc head ibuffer-saved-filters)))
+               (unless data
+                 (ibuffer-filter-disable)
+                 (error "Unknown saved filter %s" head))
+               (append (cadr data) tail)))
+            (`not (cons head tail))
+            (_
+             (error "Filter type %s is not compound" (caar filters))))))
+    (setq ibuffer-filtering-qualifiers value))
   (ibuffer-update nil t))
 
 ;;;###autoload
-- 
2.10.2

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
In GNU Emacs 26.0.50.1 (x86_64-pc-linux-gnu, GTK+ Version 3.22.3)
 of 2016-11-26 built on calancha-pc
Repository revision: 416adda38521c6246f77877c57843264fa4ae711





      parent reply	other threads:[~2016-11-27  3:54 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-11-23  7:34 bug#24997: 26.0.50; ibuffer-decompose-filter has side effects on error Tino Calancha
2016-11-23 15:44 ` Eli Zaretskii
2016-11-24  1:57   ` Tino Calancha
2016-12-07 11:50     ` Tino Calancha
2016-11-27  3:54 ` Tino Calancha [this message]

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=877f7py3ux.fsf@gmail.com \
    --to=tino.calancha@gmail.com \
    --cc=24997@debbugs.gnu.org \
    /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.