From 3cd3a11cc7d754f34711144c51392548915928a7 Mon Sep 17 00:00:00 2001 From: yonirabkin Date: Tue, 4 Oct 2005 19:30:00 +0000 Subject: emms-playlist-mode-switch-buffer darcs-hash:20051004193020-be80e-d83b29d6a6fd07b0884a9876685ce650229cbaf7.gz --- emms-playlist-mode.el | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) 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 ;;; -------------------------------------------------------- -- cgit v1.2.3