From c31006f83af6b3bb87f444581ddde38b331199da Mon Sep 17 00:00:00 2001 From: Fran Burstall Date: Wed, 17 Oct 2018 21:02:50 +0100 Subject: * lisp/emms-playlist-sort.el: sort current buffer Sort the playlist in the current buffer rather than emms-current-playlist --- lisp/emms-playlist-sort.el | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) (limited to 'lisp') diff --git a/lisp/emms-playlist-sort.el b/lisp/emms-playlist-sort.el index d9fc519..e23604b 100644 --- a/lisp/emms-playlist-sort.el +++ b/lisp/emms-playlist-sort.el @@ -1,6 +1,6 @@ ;;; emms-playlist-sort.el --- sort emms playlist -;; Copyright (C) 2005, 2006, 2007, 2008, 2009 Free Software Foundation, Inc. +;; Copyright (C) 2005, 2006, 2007, 2008, 2009, 2018 Free Software Foundation, Inc. ;; Author: William Xu @@ -165,7 +165,7 @@ With a prefix argument, oldest first." (defun emms-playlist-sort (predicate) "Sort the playlist buffer by PREDICATE." - (with-current-emms-playlist + (emms-with-inhibit-read-only-t (emms-playlist-ensure-playlist-buffer) (let ((current (emms-playlist-selected-track)) (tracks (nreverse @@ -174,14 +174,12 @@ With a prefix argument, oldest first." (delete-region (point-min) (point-max)) (run-hooks 'emms-playlist-cleared-hook) (mapc 'emms-playlist-insert-track (sort tracks predicate)) - (let ((pos (text-property-any - (point-min) (point-max) 'emms-track current))) - (if pos + (let ((pos (when current (text-property-any (point-min) (point-max) + 'emms-track current)))) + (if pos (emms-playlist-select pos) - (emms-playlist-first)) - ;; (emms-playlist-mode-center-current) - (goto-char (point-min)) - )))) + (emms-playlist-first))) + (goto-char (point-min))))) (defun emms-sort-natural-order-less-p (a b) "Sort two tracks by natural order. -- cgit v1.2.3