emms-help
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[emms-help] Save playlist when exit emacs


From: Ye Wenbin
Subject: [emms-help] Save playlist when exit emacs
Date: Thu, 23 Nov 2006 13:37:55 +0800
User-agent: Opera Mail/9.01 (Linux)

Hi, all

I wrote emms-history to save playlists when exit emacs. Next time you can
use M-x emms-history-load-saved-list to load last played lists. I think write
a command in .emacs like this is very useful:

(defun emms ()
  (interactive)
  (load "emms-init.el")
  (emms-history-load-saved-list))

emms-mark provide mark up feature for tracks in playlists. You can use
emms-mark-regexp, emms-mark-toggle, emms-mark-all and other command
to mark tracks and run some command on marked tracks. It is easy to write
other command to mark tracks or process marked tracks.

I don't known whether a command to remove duplicate track is needed. I
implement the command like this:
(defun my-uniq-list (list stringfy)
  (let ((hash (make-hash-table :test 'equal))
        str)
    (remove-if (lambda (elm)
                 (setq str (funcall stringfy elm))
                 (if (gethash str hash) t
                   (puthash str t hash) nil))
               list)))

(defun my-emms-uniq ()
  (interactive)
  (let ((emms-playlist-buffer (current-buffer)))
    (with-current-emms-playlist
      (save-excursion
        (widen)
        (let ((inhibit-read-only t)
              (current (emms-playlist-selected-track))
              (tracks (emms-playlist-tracks-in-region (point-min)
                                                      (point-max))))
          (delete-region (point-min) (point-max))
          (run-hooks 'emms-playlist-cleared-hook)
          (mapc 'emms-playlist-insert-track
                (nreverse
                 (my-uniq-list tracks 'emms-track-name)))
          (let ((pos (text-property-any (point-min)
                                        (point-max)
                                        'emms-track current)))
            (if pos
                (emms-playlist-select pos)
              (emms-playlist-first))))))))

By the way, I wrote a elisp to make the global string scrollabe like some stat line in web browser. I think it useful when using emms since there is not enough room for
global-string in mode line. Should I add it to EMMS?

--
Using Opera's revolutionary e-mail client: http://www.opera.com/mail/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]