diff options
author | Damien Elmes <emms@repose.cx> | 2006-06-08 09:07:00 +0000 |
---|---|---|
committer | Damien Elmes <emms@repose.cx> | 2006-06-08 09:07:00 +0000 |
commit | 0ac8fee949bfd85e4d7c1d3213297ab6dfeae7be (patch) | |
tree | 55e8e391f737860af97dcdda34ee0de477b9ac83 | |
parent | 4ccf4e44c94e4b7471ee0aee968a05a9a0720982 (diff) |
fix RET on trailing \n
\n isn't propertized which means hitting RET on a playlist or browser
entry fails. this patch moves the point before trying to read the
properties.
darcs-hash:20060608090703-4e3e3-56f8e91f35d92f217517222b1f1e3206f83b1825.gz
-rw-r--r-- | emms-browser.el | 11 | ||||
-rw-r--r-- | emms-playlist-mode.el | 24 |
2 files changed, 21 insertions, 14 deletions
diff --git a/emms-browser.el b/emms-browser.el index a9487da..1901e98 100644 --- a/emms-browser.el +++ b/emms-browser.el @@ -252,7 +252,6 @@ If called interactively, the new buffer is also selected." "Add a single ENTRY -> TRACKS mapping to the buffer." (emms-browser-ensure-browser-buffer) (emms-with-inhibit-read-only-t - ;; why don't we propertize the \n? (insert (emms-propertize entry 'emms-tracks tracks 'face 'emms-browser-tracks-face) "\n"))) @@ -289,9 +288,13 @@ If called interactively, the new buffer is also selected." (defun emms-browser-tracks-at (&optional pos) "Return the tracks at POS (point if not given), or nil if none." (emms-browser-ensure-browser-buffer) - (emms-with-widened-buffer - (get-text-property (or pos (point)) - 'emms-tracks))) + (save-excursion + ;; move the point to the start of the line, since the trailing new + ;; line is not propertized + (move-beginning-of-line nil) + (emms-with-widened-buffer + (get-text-property (or pos (point)) + 'emms-tracks)))) (defun emms-isearch-buffer () "Isearch through the buffer." diff --git a/emms-playlist-mode.el b/emms-playlist-mode.el index ec94c8f..6e049f2 100644 --- a/emms-playlist-mode.el +++ b/emms-playlist-mode.el @@ -173,16 +173,20 @@ non-nil, load the playlist at point into a new buffer. Otherwise play the track immediately." (interactive) - (if (not emms-playlist-mode-open-playlists) - (emms-playlist-mode-play-current-track) - (let* ((track (emms-playlist-track-at)) - (name (emms-track-get track 'name)) - (type (emms-track-get track 'type))) - (if (or (eq type 'playlist) - (and (eq type 'file) - (string-match "\\.\\(m3u\\|pls\\)\\'" name))) - (emms-playlist-mode-load-playlist) - (emms-playlist-mode-play-current-track))))) + (save-excursion + ;; move to the start of the line, in case the point is on the \n, + ;; which isn't propertized + (move-beginning-of-line nil) + (if (not emms-playlist-mode-open-playlists) + (emms-playlist-mode-play-current-track) + (let* ((track (emms-playlist-track-at)) + (name (emms-track-get track 'name)) + (type (emms-track-get track 'type))) + (if (or (eq type 'playlist) + (and (eq type 'file) + (string-match "\\.\\(m3u\\|pls\\)\\'" name))) + (emms-playlist-mode-load-playlist) + (emms-playlist-mode-play-current-track)))))) (defun emms-playlist-mode-switch-buffer () "Switch to the playlist buffer and then switch back if called again. |