]> git.eshelyaron.com Git - emacs.git/commitdiff
ibuffer-exchange-filters: Simplify code
authorTino Calancha <tino.calancha@gmail.com>
Sat, 19 Nov 2016 11:48:17 +0000 (20:48 +0900)
committerTino Calancha <tino.calancha@gmail.com>
Sat, 19 Nov 2016 11:48:17 +0000 (20:48 +0900)
* lisp/ibuf-ext.el (ibuffer-exchange-filters): Use cl-rotatef.

lisp/ibuf-ext.el

index b3d14522cbdff8351a1f38b6d096da7e2d53aa9c..5ef074697722106adeeac11848d6fc48142cdb5c 100644 (file)
@@ -869,14 +869,11 @@ turned into two separate filters [name: foo] and [mode: bar-mode]."
 (defun ibuffer-exchange-filters ()
   "Exchange the top two filters on the stack in this buffer."
   (interactive)
-  (when (< (length ibuffer-filtering-qualifiers)
-          2)
-    (error "Need two filters to exchange"))
-  (let ((first (pop ibuffer-filtering-qualifiers))
-       (second (pop ibuffer-filtering-qualifiers)))
-    (push first ibuffer-filtering-qualifiers)
-    (push second ibuffer-filtering-qualifiers))
-  (ibuffer-update nil t))
+  (let ((filters ibuffer-filtering-qualifiers))
+    (when (< (length filters) 2)
+      (error "Need two filters to exchange"))
+    (cl-rotatef (car filters) (cadr filters))
+    (ibuffer-update nil t)))
 
 ;;;###autoload
 (defun ibuffer-negate-filter ()