From: Stefan Monnier Date: Tue, 12 Aug 2014 16:16:00 +0000 (-0400) Subject: * lisp/mpc.el (mpc-reorder): Don't bother splitting the "active" elements X-Git-Tag: emacs-25.0.90~2635^2~679^2~475 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=c1677234a35ac49ac1dd4276a19e90ac8e62b6e6;p=emacs.git * lisp/mpc.el (mpc-reorder): Don't bother splitting the "active" elements to the first part if they're the same as the selection. --- diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 10b17d63119..7bb7415bc9c 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,8 @@ +2014-08-12 Stefan Monnier + + * mpc.el (mpc-reorder): Don't bother splitting the "active"s elements + to the first part if they're the same as the selection. + 2014-08-12 Lars Magne Ingebrigtsen * image-mode.el (image-transform-reset): New command and menu item. @@ -2080,9 +2085,9 @@ 2014-05-30 Alan Mackenzie Guard (looking-at "\\s!") from XEmacs. - * progmodes/cc-engine.el (c-state-pp-to-literal): add guard form. + * progmodes/cc-engine.el (c-state-pp-to-literal): Add guard form. -2014-05-30 Ken Olum (tiny change) +2014-05-30 Ken Olum * mail/rmail.el (rmail-delete-forward, rmail-delete-backward): The argument COUNT is now optional, to be more backward-compatible. diff --git a/lisp/mpc.el b/lisp/mpc.el index d03edf86bba..ab3fd6e7518 100644 --- a/lisp/mpc.el +++ b/lisp/mpc.el @@ -1624,7 +1624,7 @@ Return non-nil if a selection was deactivated." (setq active (if (listp active) (mpc-intersection active vals) vals)))) - (when (and (listp active)) + (when (listp active) ;; Remove the selections if they are all in conflict with ;; other constraints. (let ((deactivate t)) @@ -1638,8 +1638,14 @@ Return non-nil if a selection was deactivated." (setq selection nil) (mapc 'delete-overlay mpc-select) (setq mpc-select nil) - (mpc-tagbrowser-all-select))))) - + (mpc-tagbrowser-all-select)))) + + ;; Don't bother splitting the "active" elements to the first part if + ;; they're the same as the selection. + (when (equal (sort (copy-sequence active) #'string-lessp) + (sort (copy-sequence selection) #'string-lessp)) + (setq active 'all))) + ;; FIXME: This `mpc-sort' takes a lot of time. Maybe we should ;; be more clever and presume the buffer is mostly sorted already. (mpc-sort (if (listp active) active))