From 88f57b8804b6df32844770ece036075e1a1ac64d Mon Sep 17 00:00:00 2001 From: yoni-r Date: Mon, 26 Jun 2006 16:04:00 +0000 Subject: emms-playlist-mode-window-width defcustom + emms-playlist-mode-center-when-go darcs-hash:20060626160415-85c19-b96c96fccb4ef99f70e98f1e83e0a88e4113f41b.gz --- emms-playlist-mode.el | 27 ++++++++++++++++++++------- 1 file changed, 20 insertions(+), 7 deletions(-) diff --git a/emms-playlist-mode.el b/emms-playlist-mode.el index c955b26..4ed2d89 100644 --- a/emms-playlist-mode.el +++ b/emms-playlist-mode.el @@ -50,9 +50,6 @@ (defvar emms-playlist-mode-switched-buffer nil "Last buffer visited before calling `emms-playlist-mode-switch-buffer'.") -(defvar emms-playlist-mode-window-width -25 - "Width for the emms-playlist-mode pop-up window.") - (make-variable-buffer-local 'emms-playlist-mode-selected-overlay) @@ -68,6 +65,18 @@ composed of other playlists." :type 'boolean :group 'emms-playlist-mode) +(defcustom emms-playlist-mode-window-width 25 + "*Determine the width of the Emms popup window. +The value should a positive integer." + :type 'integer + :group 'emms-playlist-mode) + +(defcustom emms-playlist-mode-center-when-go nil + "*Determine whether to center on the currently selected track. +This is true for every invocation of `emms-playlist-mode-go'." + :type 'boolean + :group 'emms-playlist-mode) + ;;; -------------------------------------------------------- ;;; Faces ;;; -------------------------------------------------------- @@ -406,15 +415,19 @@ When NO-NEWLINE is non-nil, do not insert a newline after the track." (switch-to-buffer emms-playlist-buffer) (when (and (not (eq major-mode 'emms-playlist-mode)) emms-playlist-buffer-p) - (emms-playlist-mode)))) + (emms-playlist-mode)) + (when emms-playlist-mode-center-when-go + (emms-playlist-mode-center-current)))) (defun emms-playlist-mode-go-popup (&optional window-width) - "Popup emms-playlist buffer as a side window. Default value for -WINDOW-WIDTH is `emms-playlist-mode-window-width'." + "Popup emms-playlist buffer as a side window. + +Default value for WINDOW-WIDTH is `emms-playlist-mode-window-width'. +WINDOW-WIDTH should be a positive integer." (interactive) (setq emms-playlist-mode-window-width (or window-width emms-playlist-mode-window-width)) - (split-window-horizontally emms-playlist-mode-window-width) + (split-window-horizontally (- emms-playlist-mode-window-width)) (other-window 1) (emms-playlist-mode-go)) -- cgit v1.2.3