From c22c53e043cb431a572ceb406885bfbb9da09046 Mon Sep 17 00:00:00 2001 From: Yoni Rabkin Date: Sun, 27 May 2018 22:20:50 -0400 Subject: * lisp/emms-metaplaylist-mode.el: bug fix Metalplaylist buffer focus would error without a current buffer. --- lisp/emms-metaplaylist-mode.el | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) (limited to 'lisp') diff --git a/lisp/emms-metaplaylist-mode.el b/lisp/emms-metaplaylist-mode.el index 819cffb..f90312b 100644 --- a/lisp/emms-metaplaylist-mode.el +++ b/lisp/emms-metaplaylist-mode.el @@ -136,15 +136,16 @@ (defun emms-metaplaylist-mode-center-current () "Center on the current playlist buffer" (interactive) - (when (not emms-playlist-buffer) - (error "no current playlist buffer")) - (goto-char (point-min)) - (when (not - (search-forward-regexp (regexp-quote - (buffer-name emms-playlist-buffer)) - (point-max) t)) - (error "cannot not find the current playlist buffer")) - (goto-char (point-at-bol))) + (when (buffer-name emms-playlist-buffer) + (let ((p nil)) + (save-excursion + (goto-char (point-min)) + (setq p (search-forward-regexp (regexp-quote + (buffer-name emms-playlist-buffer)) + (point-max) t))) + (when (not p) (error "cannot not find the current playlist buffer")) + (goto-char p) + (goto-char (point-at-bol))))) (defun emms-metaplaylist-mode-create () "Create the meta-playlist buffer." -- cgit v1.2.3