aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorwilliam.xwl <william.xwl>2005-10-26 16:14:00 +0000
committerwilliam.xwl <mwolson@gnu.org>2005-10-26 16:14:00 +0000
commitf5d80743af6db6bcc803219ae2fab253c2c2a3ed (patch)
treef69fd7b2c1826b78f8a9253d4c00041b8dea1c41
parent20d864bd4f5bec88ba5e17b8250727676e2d0fd0 (diff)
Add prefix keys support.
darcs-hash:20051026161459-e8fe6-d4a7a1426470a58e2f2935e9c2a694e6d32365b5.gz
-rw-r--r--emms-playlist-sort.el25
1 files changed, 19 insertions, 6 deletions
diff --git a/emms-playlist-sort.el b/emms-playlist-sort.el
index db79c20..6e7288d 100644
--- a/emms-playlist-sort.el
+++ b/emms-playlist-sort.el
@@ -50,12 +50,25 @@
(define-emms-playlist-sort info-year)
(define-emms-playlist-sort info-note)
-(define-key emms-playlist-mode-map (kbd "S n") 'emms-playlist-sort-by-name)
-(define-key emms-playlist-mode-map (kbd "S a") 'emms-playlist-sort-by-info-artist)
-(define-key emms-playlist-mode-map (kbd "S t") 'emms-playlist-sort-by-info-title)
-(define-key emms-playlist-mode-map (kbd "S b") 'emms-playlist-sort-by-album)
-(define-key emms-playlist-mode-map (kbd "S y") 'emms-playlist-sort-by-info-year)
-(define-key emms-playlist-mode-map (kbd "S o") 'emms-playlist-sort-by-info-note)
+;; FIXME: Should better avoid relying on setting before loading.
+(defcustom emms-playlist-sort-prefix "S"
+ "*Prefix key sequence for `emms-playlist-sort-map'.
+You should set this variable before loading this file."
+ :type 'string)
+
+(defvar emms-playlist-sort-map
+ (let ((map (make-sparse-keymap)))
+ (define-key map (kbd "n") 'emms-playlist-sort-by-name)
+ (define-key map (kbd "a") 'emms-playlist-sort-by-info-artist)
+ (define-key map (kbd "t") 'emms-playlist-sort-by-info-title)
+ (define-key map (kbd "b") 'emms-playlist-sort-by-info-album)
+ (define-key map (kbd "y") 'emms-playlist-sort-by-info-year)
+ (define-key map (kbd "o") 'emms-playlist-sort-by-info-note)
+ map))
+
+(define-key emms-playlist-mode-map
+ emms-playlist-sort-prefix
+ emms-playlist-sort-map)
(defun emms-playlist-sort (predicate)
"Sort the whole playlist buffer by PREDICATE."