diff options
author | Yoni Rabkin <yoni@rabkins.net> | 2018-05-27 22:20:50 -0400 |
---|---|---|
committer | Yoni Rabkin <yoni@rabkins.net> | 2018-05-27 22:20:50 -0400 |
commit | c22c53e043cb431a572ceb406885bfbb9da09046 (patch) | |
tree | ba6d7d96af5f3413fbbc41d9a042e2284ca9c897 | |
parent | 9e3e94526175359da902529fd60de00ab2a538ea (diff) |
* lisp/emms-metaplaylist-mode.el: bug fix
Metalplaylist buffer focus would error without a current buffer.
-rw-r--r-- | lisp/emms-metaplaylist-mode.el | 19 |
1 files changed, 10 insertions, 9 deletions
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." |