aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoryonirabkin <yonirabkin>2005-10-04 19:30:00 +0000
committeryonirabkin <mwolson@gnu.org>2005-10-04 19:30:00 +0000
commit3cd3a11cc7d754f34711144c51392548915928a7 (patch)
tree435d56d89e3768bdb928e6c291d0e91c02ec3b58
parent5917c93f567e70cfcb6122fc140f603557207788 (diff)
emms-playlist-mode-switch-buffer
darcs-hash:20051004193020-be80e-d83b29d6a6fd07b0884a9876685ce650229cbaf7.gz
-rw-r--r--emms-playlist-mode.el16
1 files changed, 16 insertions, 0 deletions
diff --git a/emms-playlist-mode.el b/emms-playlist-mode.el
index 1e41624..15cb442 100644
--- a/emms-playlist-mode.el
+++ b/emms-playlist-mode.el
@@ -27,6 +27,9 @@
(defvar emms-playlist-mode-selected-overlay-marker nil
"Marker for last selected track. Use for updating the display.")
+(defvar emms-playlist-mode-switched-buffer nil
+ "Last buffer visited before calling `emms-playlist-mode-switch-buffer'.")
+
;; The marker is unique for each playlist buffer
(make-variable-buffer-local
'emms-playlist-mode-selected-overlay-marker)
@@ -170,6 +173,19 @@ FUN should be a function."
(emms-playlist-mode-kill-track))
(t (error "Cannot kill content at point")))))
+(defun emms-playlist-mode-switch-buffer ()
+ "Switch to the playlist buffer and then switch back if called again.
+
+This function switches to the current Emms playlist buffer and
+remembers the buffer switched from. When called again the
+function switches back to the remembered buffer."
+ (interactive)
+ (if (eq (current-buffer)
+ emms-playlist-buffer)
+ (switch-to-buffer emms-playlist-mode-switched-buffer)
+ (setq emms-playlist-mode-switched-buffer (current-buffer))
+ (switch-to-buffer emms-playlist-buffer)))
+
;;; --------------------------------------------------------
;;; Overlay
;;; --------------------------------------------------------