Browse Source

New command mpdel-pop-to-browser

single-buffer
jao 1 year ago
parent
commit
a5372c03b5
3 changed files with 13 additions and 13 deletions
  1. +2
    -2
      README.org
  2. +2
    -11
      mpdel-browser.el
  3. +9
    -0
      mpdel.el

+ 2
- 2
README.org View File

@ -187,8 +187,8 @@ or rearrange how children buffers show their contents with
group ~mpdel-browser~ for more details.
If you would like to use MPDel in single-buffer mode when traversing
your music collection entries, call ~mpdel-enable-single-buffer~ in your
init file.
your music collection entries, add the call
~(mpdel-enable-single-buffer)~ to your init file.
*** Communication with MPD


+ 2
- 11
mpdel-browser.el View File

@ -231,10 +231,7 @@ This listing is constructed using `mpdel-browser-top-level-entries'."
;;;###autoload
(defun mpdel-browser-open ()
"Open the top level MPDel browser buffer.
If MPDel is configured in single-window mode, popup to an
existing browser buffer, if any, instead of creating it."
"Open the top level MPDel browser buffer."
(interactive)
(mpdel-core-open 'browser))
@ -262,12 +259,6 @@ existing browser buffer, if any, instead of creating it."
(navigel-method mpdel navigel-entity-tablist-mode ((_e (eql stored-playlists)))
(mpdel-browser-mode))
(cl-defmethod navigel-parent-to-open ((album libmpdel-album))
"Find the parent of the given ALBUM."
(if (string-empty-p (or (libmpdel-artist-name album) ""))
(list 'albums album)
(cons (libmpdel--album-artist album) album)))
(cl-defmethod navigel-parent-to-open (_e &context (major-mode mpdel-browser-mode))
"Find parent of ENTITY when in a buffer with MAJOR-MODE `mpdel-browser-mode'."
(list (or (navigel-parent navigel-entity) 'browser)))
@ -275,7 +266,7 @@ existing browser buffer, if any, instead of creating it."
(cl-defmethod navigel-parent-to-open
(_e &context (major-mode mpdel-playlist-current-playlist-mode))
"Find parent of ENTITY when in a buffer with MAJOR-MODE `mpdel-playlist-current-playlist-mode'."
(list (mpdel-browser--find-parent-directory)))
'(browser . current-playlist))
(define-key mpdel-core-map (kbd ":") #'mpdel-browser-open)


+ 9
- 0
mpdel.el View File

@ -70,6 +70,15 @@
"Configure mpdel to reuse a single buffer when navigating or browsing."
(navigel-register-single-buffer-app 'mpdel))
;;;###autoload
(defun mpdel-pop-to-browser ()
"Pop to the MPDel buffer, reusing it if in single-buffer mode."
(interactive)
(let ((buffer (navigel-app-buffer 'mpdel)))
(if (buffer-live-p buffer)
(pop-to-buffer buffer)
(mpdel-browser-open))))
(provide 'mpdel)
;;; mpdel.el ends here


Loading…
Cancel
Save