diff options
author | Damien Elmes <emms@repose.cx> | 2006-06-16 13:27:00 +0000 |
---|---|---|
committer | Damien Elmes <emms@repose.cx> | 2006-06-16 13:27:00 +0000 |
commit | 22095d1a142dade2382cd811849e4502d975b716 (patch) | |
tree | 9303ba6a8b92579d4ffc6d67a4ae4ae472c94b74 | |
parent | 73810bc2e36ee74b2dae29bbbde5f1fd9c99d970 (diff) |
browser: fix centering when adding new tracks to the playlist
darcs-hash:20060616132746-4e3e3-177ab8c37d4b5041d47ddbc6f1a42c30413f99aa.gz
-rw-r--r-- | emms-browser.el | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/emms-browser.el b/emms-browser.el index 3056ea4..9bbc645 100644 --- a/emms-browser.el +++ b/emms-browser.el @@ -704,10 +704,13 @@ LEVEL is used to control indentation." (defun emms-browser-add-tracks () "Add all tracks at point." (interactive) - (let ((bdata (emms-browser-bdata-at-point))) - (emms-browser-add-bdata-to-playlist - bdata (emms-browser-bdata-level bdata))) - (run-hooks 'emms-browser-tracks-added-hook)) + (let ((first-new-track + (with-current-emms-playlist + (point-max)))) + (let ((bdata (emms-browser-bdata-at-point))) + (emms-browser-add-bdata-to-playlist + bdata (emms-browser-bdata-level bdata))) + (run-hook-with-args 'emms-browser-tracks-added-hook first-new-track))) (defun emms-browser-add-tracks-and-play () "Add all tracks at point, and play the first added track." @@ -874,19 +877,18 @@ configuration." 'emms-browser-hide-linked-window) ;; switch to the playlist window when adding tracks? (add-to-list 'emms-browser-tracks-added-hook - (lambda () (interactive) + (lambda (start-of-tracks) (interactive) (let (playlist-window) (when emms-browser-switch-to-playlist-on-add (emms-smart-browse)) - ;; recenter + ;; center on the first added track/group name (when (setq playlist-window (emms-browser-get-linked-window)) (with-selected-window playlist-window - ;; FIXME: how do we achieve the same behaviour as - ;; c-u when calling interactively? - (recenter)))))) + (goto-char start-of-tracks) + (recenter '(4))))))) (let (wind buf) (cond ((eq major-mode 'emms-browser-mode) |