[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emms-patches] darcs patch: Add emms-mark and emms-history
From: |
Wenbin Ye |
Subject: |
[Emms-patches] darcs patch: Add emms-mark and emms-history |
Date: |
Thu, 23 Nov 2006 13:10:46 +0800 |
Tue Nov 21 17:39:51 CST 2006 address@hidden
* Add emms-mark and emms-history
New patches:
[Add emms-mark and emms-history
address@hidden {
addfile ./emms-history.el
hunk ./emms-history.el 1
+;;; emms-history.el.gz ---
+
+;; Copyright 2006 Ye Wenbin
+;;
+;; Author: address@hidden
+;; Time-stamp: <Ye Wenbin 2006-11-21 16:57:59>
+;; Version: $Id: emms-history.el,v 0.0 <2006-11-21 16:30:22> ywb Exp $
+;; Keywords:
+;; X-URL: not distributed yet
+
+;; This program is free software; you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation; either version 2, or (at your option)
+;; any later version.
+;;
+;; This program is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+;; GNU General Public License for more details.
+;;
+;; You should have received a copy of the GNU General Public License
+;; along with this program; if not, write to the Free Software
+;; Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+;;; Commentary:
+
+;; Save playlists when exit emacs.
+;; Next time use M-x emms-playlist-load-saved-list to load saved
+;; playlist
+
+;; Put this file into your load-path and the following into your ~/.emacs:
+;; (require 'emms-history)
+
+;;; Code:
+
+(provide 'emms-history)
+(require 'emms)
+(eval-when-compile
+ (require 'cl))
+
+(defvar emms-history-saved-list-file "~/.emacs.d/.emms-history")
+
+(defun emms-history-save-on-exit ()
+ (when (stringp emms-history-saved-list-file)
+ (let ((oldbuf emms-playlist-buffer)
+ emms-playlist-buffer playlists)
+ (save-excursion
+ (dolist (buf (remove-if-not 'buffer-live-p
+ (emms-playlist-buffer-list)))
+ (set-buffer buf)
+ (when (> (buffer-size) 0) ; make sure there is track in the buffer
+ (setq emms-playlist-buffer buf
+ playlists
+ (cons
+ (list (buffer-name)
+ (or
+ (and emms-playlist-selected-marker
+ (marker-position emms-playlist-selected-marker))
+ (point-min))
+ (save-excursion
+ (widen)
+ (nreverse
+ (emms-playlist-tracks-in-region (point-min)
+ (point-max)))))
+ playlists))))
+ (with-temp-buffer
+ (insert "(\n;; active playlist\n")
+ (prin1 (buffer-name oldbuf) (current-buffer))
+ (insert "\n;; playlists: ((BUFFER_NAME SELECT_POSITION TRACKS)
...)\n")
+ (prin1 playlists (current-buffer))
+ (insert "\n;; play method\n")
+ (prin1 `((emms-repeat-track . ,emms-repeat-track)
+ (emms-repeat-playlist . ,emms-repeat-playlist))
+ (current-buffer))
+ (insert "\n)")
+ (write-file emms-history-saved-list-file))))))
+
+(add-hook 'kill-emacs-hook 'emms-history-save-on-exit)
+
+(defun emms-history-load-saved-list ()
+ (interactive)
+ (when (and (stringp emms-history-saved-list-file)
+ (file-exists-p emms-history-saved-list-file))
+ (let (history buf)
+ (with-temp-buffer
+ (insert-file-contents emms-history-saved-list-file)
+ (setq history (read (current-buffer)))
+ (dolist (playlist (cadr history))
+ (with-current-buffer (emms-playlist-new (car playlist))
+ (setq emms-playlist-buffer (current-buffer))
+ (if (string= (car playlist) (car history))
+ (setq buf (current-buffer)))
+ (mapc 'emms-playlist-insert-track
+ (nth 2 playlist))
+ (condition-case nil
+ (emms-playlist-select (cadr playlist))
+ (error nil))))
+ (setq emms-playlist-buffer buf)
+ (dolist (method (nth 2 history))
+ (set (car method) (cdr method)))
+ (emms-start)))))
+
+;;; emms-history.el ends here
addfile ./emms-mark.el
hunk ./emms-mark.el 1
+;;; emms-mark.el.gz ---
+
+;; Copyright 2006 Ye Wenbin
+;;
+;; Author: address@hidden
+;; Time-stamp: <Ye Wenbin 2006-11-21 17:02:28>
+;; Version: $Id: emms-mark.el,v 0.0 <2006-11-21 14:06:38> ywb Exp $
+;; Keywords:
+;; X-URL: not distributed yet
+
+;; This program is free software; you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation; either version 2, or (at your option)
+;; any later version.
+;;
+;; This program is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+;; GNU General Public License for more details.
+;;
+;; You should have received a copy of the GNU General Public License
+;; along with this program; if not, write to the Free Software
+;; Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+;;; Commentary:
+
+;; Provide mark operation to tracks
+
+;; Put this file into your load-path and the following into your ~/.emacs:
+;; (require 'emms-mark)
+
+;;; Code:
+
+(provide 'emms-mark)
+(require 'emms)
+(eval-when-compile
+ (require 'cl))
+
+;;{{{ set new description-function
+(defun emms-mark-track-description (track)
+ "Return a description of the current track."
+ (concat " " ; for mark char
+ (let ((artist (emms-track-get track 'info-artist))
+ (title (emms-track-get track 'info-title)))
+ (if (and artist title)
+ (format "%s - %s" artist title)
+ (emms-track-simple-description track)))))
+
+(setq emms-track-description-function 'emms-mark-track-description)
+;;}}}
+
+;;{{{ functions to mark tracks
+(defvar emms-mark-char ?*)
+(defvar emms-mark-face-alist
+ '((?* . font-lock-warning-face)
+ (?\040 . emms-playlist-track-face)))
+
+(defun emms-mark-track (&optional arg)
+ (interactive "p")
+ (or arg (setq arg 1))
+ (let ((face (assoc-default emms-mark-char emms-mark-face-alist))
+ buffer-read-only track)
+ (save-excursion
+ (beginning-of-line)
+ (while (and (not (eobp))
+ (> arg 0))
+ (setq track (get-text-property (point) 'emms-track))
+ (delete-char 1)
+ (insert (propertize (string emms-mark-char)
+ 'emms-track track))
+ (backward-char 1)
+ (put-text-property (point) (progn (forward-line 1) (point))
+ 'face face)
+ (setq arg (1- arg))))))
+
+(defun emms-mark-unmark-track (&optional arg)
+ (interactive "p")
+ (let ((emms-mark-char ?\040))
+ (emms-mark-track arg)))
+
+(defun emms-mark-forward (arg)
+ (interactive "p")
+ (emms-mark-track arg)
+ (forward-line arg))
+
+(defun emms-mark-unmark-forward (arg)
+ (interactive "p")
+ (emms-mark-unmark-track arg)
+ (forward-line arg))
+
+(defun emms-mark-all ()
+ (interactive)
+ (save-excursion
+ (goto-char (point-min))
+ (emms-mark-track (count-lines (point-min) (point-max)))))
+
+(defun emms-mark-unmark-all ()
+ (interactive)
+ (emms-mark-do-with-marked-track 'emms-mark-unmark-track))
+
+(defun emms-mark-regexp (regexp)
+ (interactive "sMark track match: ")
+ (save-excursion
+ (goto-char (point-min))
+ (while (re-search-forward regexp nil t)
+ (emms-mark-track 1)
+ (forward-line 1))))
+
+(defun emms-mark-unmark-regexp (regexp)
+ (interactive "sUnmark track match: ")
+ (let ((emms-mark-char ?\040))
+ (emms-mark-regexp regexp)))
+
+(defun emms-mark-toggle ()
+ (interactive)
+ (save-excursion
+ (goto-char (point-min))
+ (let (buffer-read-only)
+ (while (not (eobp))
+ (if (eq ?\040 (following-char))
+ (emms-mark-track)
+ (emms-mark-unmark-track))
+ (forward-line 1)))))
+;;}}}
+
+;;{{{ functions to operate marked tracks
+(defun emms-mark-do-with-marked-track (func)
+ (let ((regexp (format "^[%c]" emms-mark-char)))
+ (save-excursion
+ (goto-char (point-min))
+ (while (re-search-forward regexp nil t)
+ (backward-char 1) ; move to beginning of line
+ (funcall func)))))
+
+(defun emms-mark-mapcar-marked-track (func)
+ (let (result)
+ (save-excursion
+ (goto-char (point-min))
+ (while (re-search-forward "^[*]" nil t)
+ (backward-char 1) ; move to beginning of line
+ (setq result (cons (funcall func) result)))
+ (nreverse result))))
+
+(defun emms-mark-delete-marked-tracks ()
+ (interactive)
+ (emms-with-inhibit-read-only-t
+ (emms-mark-do-with-marked-track
+ (lambda nil (delete-region (point)
+ (progn (forward-line 1) (point)))))))
+
+(defun emms-mark-kill-marked-tracks ()
+ (interactive)
+ (let (tracks buffer-read-only)
+ (emms-mark-do-with-marked-track
+ (lambda nil
+ (setq tracks
+ (concat tracks
+ (delete-and-extract-region (point)
+ (progn (forward-line 1)
(point)))))))
+ (kill-new tracks)))
+
+(defun emms-mark-copy-marked-tracks ()
+ (interactive)
+ (let (tracks)
+ (emms-mark-do-with-marked-track
+ (lambda nil
+ (setq tracks
+ (concat tracks
+ (buffer-substring (point)
+ (progn (forward-line 1) (point)))))))
+ (kill-new tracks)))
+;;}}}
+
+(let ((map emms-playlist-mode-map))
+ (define-key map "m" 'emms-mark-forward)
+ (define-key map "u" 'emms-mark-unmark-forward)
+ (define-key map "U" 'emms-mark-unmark-all)
+ (define-key map "t" 'emms-mark-toggle)
+ (define-key map "%m" 'emms-mark-regexp)
+ (define-key map "%u" 'emms-mark-unmark-regexp))
+
+;;; emms-mark.el ends here
}
Context:
[emms-info-mp3info.el: Replace `emms-iconv' with decode-coding-string and
address@hidden
encode-coding-string.
]
[emms.el: Fix bug introduced by recent changes to
emms-playlist-set-playlist-buffer
Michael Olson <address@hidden>**20061119204738]
[Default to current buffer when setting the current EMMS playlist buffer.
Michael Olson <address@hidden>**20061119053410]
[manual: Add documentation for new emms-playlist-mode keybindings
Michael Olson <address@hidden>**20061119052935]
[emms-playlist-mode: Bind "b" key to emms-playlist-set-playlist-buffer.
Michael Olson <address@hidden>**20061119052907]
[emms-playlist-mode: Implement adding the thing at point to the current
playlist. If it is a playlist, add its contents instead. Map this to the "a"
key.
Michael Olson <address@hidden>**20061119052254]
[emms.el: In emms-playlist-set-playlist-buffer, prompt user from available EMMS
playlist buffers rather than all buffers, and display feedback upon setting the
current buffer, since this is not an easy change to see
Michael Olson <address@hidden>**20061119052023]
[emms.el: Fix compiler warning
Michael Olson <address@hidden>**20061119051946]
[Don't add subdirectories for directory and playlist-directory source insert
methods
Michael Olson <address@hidden>**20061119041900]
[emms-playing-time.el: New variable `emms-playing-time-style', it
address@hidden
supports two styles at present, `time' and `bar'.
]
[bind SPC to `scroll-up' in emms-playlist-mode and update manual.
address@hidden
[emms-player-mpd: Deal with change in output when getting supported file types
Michael Olson <address@hidden>**20061028042119]
[emms.el: Move macros to the top of the file.
address@hidden
[NEWS: Add entry for recent emms-player-mpd change
Michael Olson <address@hidden>**20061023125738]
[emms-player-mpd: Handle errors that occur when we begin playback
Michael Olson <address@hidden>**20061022215310]
[NEWS: Version 2 is version 2.0
address@hidden
[emms-playlist-mode: Handle case where selection has not been set but user
wants to delete a region
Michael Olson <address@hidden>**20061022201724]
[emms-playlist-mode: Fix typo in hook name
Michael Olson <address@hidden>**20061022022812]
[emms-player-mpd: Update version recommendation
Michael Olson <address@hidden>**20061022012223]
[emms-player-mpd: Work properly with tracks inserted by emms-browser
Michael Olson <address@hidden>**20061022011050]
[Add NEWS items since version 2.1
Michael Olson <address@hidden>**20061017222117]
[emms-player-mplayer.el: Mplayer also supports .vob files.
address@hidden
[emms-player-mpd: When using the emms-volume interface, allow the user to
specify the amount of change in the volume
Michael Olson <address@hidden>**20061017220404]
[Documentation cleanups in emms-player-mpd and emms-source-playlist
Michael Olson <address@hidden>**20061017215345]
[Since emms-player-seeked-to-functions and emms-player-time-set-functions hooks
do the same thing, replace the former with the latter
Michael Olson <address@hidden>**20061017210238]
[emms-browser: Fix compiler warning
Michael Olson <address@hidden>**20061017205310]
[emms-player-mpd: Implement seek-to support
Michael Olson <address@hidden>**20061017205106]
[FluidSynth midi file player
address@hidden
[Added delYsid
address@hidden
[jackd-support-for-emacs
address@hidden
jackd is a pro-audio server which can be used as a backend for
alsaplayer, mplayer, and lots of other linux audio apps.
This module allows to start jackd from within emacs, and
connect/disconnect jack client ports.
]
[browser: ensure the RNG is seeded before use
Damien Elmes <address@hidden>**20061011151535]
[browser: require sort (fixes bug with sort-fold-case being void)
Damien Elmes <address@hidden>**20061010125718]
[fix faulty emms-playlist-mode keybinding, fix due to William and Damien.
address@hidden
[Added seeking to the playlist keymap, and updated the manual.
address@hidden
[emms-player-mpd: Only display error if we are certain that url.el is not
up-to-date
Michael Olson <address@hidden>**20061004032213]
[seek-for-alsaplayer
address@hidden
Add relative seek support for alsaplayer
]
[midi-files-via-timidity
address@hidden
A simple-player definition for timidity
]
[emms-playing-time.el: Minor cleanups.
address@hidden
[emms-lyrics.el: Minor Cleanups.
address@hidden
[pause-for-alsaplayer
address@hidden
Get pause/resume working for alsaplayer
]
[mms-for-mplayer
address@hidden
mplayer also supports mms:// URLs
]
[DoTheRightThing with player pausing and emms-bookmarks.el
address@hidden
[Added emms-bookmarks.el
address@hidden
[Added `emms-pause' to emms-playlist-mode.el bound to to ``P''.
address@hidden
[browser: add deletion started/finished message
Damien Elmes <address@hidden>**20060923051128]
[Added a link to the online version of the manual.
address@hidden
[emms-playing-time.el now works with `seek-to'.
address@hidden
[Added `seek-to' to emms.el and emms-player-mplayer.el.
address@hidden
[browser/cache: support deleting files, make emms-cache-dirty a defsubst
Damien Elmes <address@hidden>**20060922090553]
[TAG 2.1
address@hidden
Patch bundle hash:
be04f49fde30b2b2489227e1bfd329b06a858f24
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Emms-patches] darcs patch: Add emms-mark and emms-history,
Wenbin Ye <=