aboutsummaryrefslogtreecommitdiff
path: root/lisp
diff options
context:
space:
mode:
authorWilliam Xu <william.xwl@gmail.com>2009-08-06 18:50:21 +0800
committerWilliam Xu <william.xwl@gmail.com>2009-08-06 18:50:21 +0800
commitf64f5d9b9b3b1546d247033198504f164c2919ee (patch)
tree55e88ee4836135ced78fe02da094aad997810e69 /lisp
parent97344c85a0657e479177620daa5b3bdc956e31fb (diff)
parent3e001aacb45633583282001d49634e080deaf8d7 (diff)
Merge branch 'master' of ssh://xwl@git.sv.gnu.org/srv/git/emms
Diffstat (limited to 'lisp')
-rw-r--r--lisp/emms-history.el2
-rw-r--r--lisp/emms-lyrics.el2
-rw-r--r--lisp/emms-player-mpd.el2
-rw-r--r--lisp/emms-playlist-mode.el3
-rw-r--r--lisp/emms-score.el2
-rw-r--r--lisp/emms-source-playlist.el8
-rw-r--r--lisp/emms-streams.el2
-rw-r--r--lisp/emms.el21
8 files changed, 32 insertions, 10 deletions
diff --git a/lisp/emms-history.el b/lisp/emms-history.el
index 7526e87..feba6c7 100644
--- a/lisp/emms-history.el
+++ b/lisp/emms-history.el
@@ -112,7 +112,7 @@ Emacs."
(file-exists-p emms-history-file))
(let (history buf)
(with-temp-buffer
- (insert-file-contents emms-history-file)
+ (emms-insert-file-contents emms-history-file)
(setq history (read (current-buffer)))
(dolist (playlist (cadr history))
(with-current-buffer (emms-playlist-new (car playlist))
diff --git a/lisp/emms-lyrics.el b/lisp/emms-lyrics.el
index 1645351..1e15c2e 100644
--- a/lisp/emms-lyrics.el
+++ b/lisp/emms-lyrics.el
@@ -254,7 +254,7 @@ FILE should be under the same directory as the music file, or under
(when (and file (file-exists-p file))
(with-temp-buffer
(let ((coding-system-for-read emms-lyrics-coding-system))
- (insert-file-contents file)
+ (emms-insert-file-contents file)
(while (search-forward-regexp "\\[[0-9:.]+\\].*" nil t)
(let ((lyric-string (match-string 0))
(time 0)
diff --git a/lisp/emms-player-mpd.el b/lisp/emms-player-mpd.el
index 539dce6..fa8f911 100644
--- a/lisp/emms-player-mpd.el
+++ b/lisp/emms-player-mpd.el
@@ -775,7 +775,7 @@ Execute CALLBACK with CLOSURE as its first argument when done.
This handles both m3u and pls type playlists."
;; This is useful for playlists of playlists
(with-temp-buffer
- (insert-file-contents playlist)
+ (emms-insert-file-contents playlist)
(emms-player-mpd-add-buffer-contents (current-buffer) closure callback)))
(defun emms-player-mpd-add-streamlist (url closure callback)
diff --git a/lisp/emms-playlist-mode.el b/lisp/emms-playlist-mode.el
index 0ded269..7f4d776 100644
--- a/lisp/emms-playlist-mode.el
+++ b/lisp/emms-playlist-mode.el
@@ -447,9 +447,10 @@ It creates a buffer called \"filename\", and restores the contents
of the saved playlist inside."
(interactive "fFile: ")
(let* ((s)
- (buffer (find-file-noselect filename))
+ (buffer (get-buffer-create filename))
(name (buffer-name buffer)))
(with-current-buffer buffer
+ (emms-insert-file-contents filename)
(setq s (read (buffer-string))))
(kill-buffer buffer)
(with-current-buffer (emms-playlist-new name)
diff --git a/lisp/emms-score.el b/lisp/emms-score.el
index a606c25..71e65a3 100644
--- a/lisp/emms-score.el
+++ b/lisp/emms-score.el
@@ -249,7 +249,7 @@ See also `emms-next-noerror'."
(puthash (car elt) (cdr elt) emms-score-hash))
(read
(with-temp-buffer
- (insert-file-contents emms-score-file)
+ (emms-insert-file-contents emms-score-file)
(buffer-string))))
;; when file not exists, make empty but valid score file
(emms-score-save-hash)))
diff --git a/lisp/emms-source-playlist.el b/lisp/emms-source-playlist.el
index 57a299d..b7677ec 100644
--- a/lisp/emms-source-playlist.el
+++ b/lisp/emms-source-playlist.el
@@ -177,7 +177,7 @@ See `emms-source-playlist-formats' for a list of supported formats."
t)))
(mapc #'emms-playlist-insert-track
(with-temp-buffer
- (insert-file-contents file)
+ (emms-insert-file-contents file)
(goto-char (point-min))
(let ((format (emms-source-playlist-determine-format)))
(if format
@@ -234,7 +234,7 @@ OUT should be the buffer where tracks are stored in the native EMMS format."
t)))
(mapc #'emms-playlist-insert-track
(with-temp-buffer
- (insert-file-contents file)
+ (emms-insert-file-contents file)
(goto-char (point-min))
(when (not (emms-source-playlist-native-p))
(error "Not a native EMMS playlist file."))
@@ -307,7 +307,7 @@ OUT should be the buffer where tracks are stored in m3u format."
t)))
(mapc #'emms-playlist-insert-track
(with-temp-buffer
- (insert-file-contents file)
+ (emms-insert-file-contents file)
(goto-char (point-min))
(when (not (emms-source-playlist-m3u-p))
(error "Not an m3u playlist file."))
@@ -388,7 +388,7 @@ OUT should be the buffer where tracks are stored in pls format."
t)))
(mapc #'emms-playlist-insert-track
(with-temp-buffer
- (insert-file-contents file)
+ (emms-insert-file-contents file)
(goto-char (point-min))
(when (not (emms-source-playlist-pls-p))
(error "Not a pls playlist file."))
diff --git a/lisp/emms-streams.el b/lisp/emms-streams.el
index bece71e..b81abe7 100644
--- a/lisp/emms-streams.el
+++ b/lisp/emms-streams.el
@@ -323,7 +323,7 @@ POPUP-HEIGHT is the height of the new frame, defaulting to
(let ((file (expand-file-name file)))
(if (file-readable-p file)
(with-temp-buffer
- (insert-file-contents-literally file)
+ (emms-insert-file-contents file)
(goto-char (point-min))
(read (current-buffer)))
emms-stream-default-list)))
diff --git a/lisp/emms.el b/lisp/emms.el
index 750781d..3c5402d 100644
--- a/lisp/emms.el
+++ b/lisp/emms.el
@@ -528,6 +528,27 @@ See `completing-read' for a description of ARGS."
(require 'emms-compat)
+;;; Utility functions
+
+(defun emms-insert-file-contents (filename &optional visit)
+ "Insert the contents of file FILENAME after point.
+Do character code conversion and end-of-line conversion, but none
+of the other unnecessary things like format decoding or
+`find-file-hook'.
+
+If VISIT is non-nil, the buffer's visited filename
+and last save file modtime are set, and it is marked unmodified.
+If visiting and the file does not exist, visiting is completed
+before the error is signaled."
+ (let ((format-alist nil)
+ (after-insert-file-functions nil)
+ (inhibit-file-name-handlers
+ (append '(jka-compr-handler image-file-handler epa-file-handler)
+ inhibit-file-name-handlers))
+ (inhibit-file-name-operation 'insert-file-contents))
+ (insert-file-contents filename visit)))
+
+
;;; Dictionaries
;; This is a simple helper data structure, used by both players