From 92b3528cf3e6d366086e89b9a909f0c81614a064 Mon Sep 17 00:00:00 2001 From: Tino Calancha Date: Sat, 19 Nov 2016 20:48:17 +0900 Subject: [PATCH] ibuffer-exchange-filters: Simplify code * lisp/ibuf-ext.el (ibuffer-exchange-filters): Use cl-rotatef. --- lisp/ibuf-ext.el | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/lisp/ibuf-ext.el b/lisp/ibuf-ext.el index b3d14522cbd..5ef07469772 100644 --- a/lisp/ibuf-ext.el +++ b/lisp/ibuf-ext.el @@ -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 () -- 2.11.4.GIT