diff options
author | Pierre Neidhardt <ambrevar@gmail.com> | 2018-04-09 18:11:32 +0530 |
---|---|---|
committer | Pierre Neidhardt <ambrevar@gmail.com> | 2018-04-09 23:09:34 +0530 |
commit | 4b7b660acaae68ea1b2945e7a14971bcb37ed0eb (patch) | |
tree | bf9a514d20bb2f0307200b52b588f4a32a642115 /lisp | |
parent | 5f0194d5f49aa6ae09e35bfd1f5c816787b106db (diff) |
* lisp/emms-browser.el: Add 'emms-browser-toggle-subitems-recursively
It enables Org-style browsing.
Diffstat (limited to 'lisp')
-rw-r--r-- | lisp/emms-browser.el | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/lisp/emms-browser.el b/lisp/emms-browser.el index 6c0f4ca..b65caf2 100644 --- a/lisp/emms-browser.el +++ b/lisp/emms-browser.el @@ -1098,6 +1098,23 @@ If DIRECTION is 1, move forward, otherwise move backwards." (cl-assert (emms-browser-move-up-level)) (emms-browser-kill-subitems)))) +(defun emms-browser-toggle-subitems-recursively () + "Recursively toggle all subitems under the current line. +If there is no more subitems to expand, collapse the current node." + (interactive) + (let ((current-level (emms-browser-level-at-point)) + first-expandable-level) + (save-excursion + (while (or (and (emms-browser-subitems-exist) + (not (emms-browser-subitems-visible)) + (or (and (not first-expandable-level) + (setq first-expandable-level (emms-browser-level-at-point))) + (= first-expandable-level (emms-browser-level-at-point))) + (emms-browser-show-subitems)) + (emms-browser-find-entry-more-than-level current-level)))) + (unless first-expandable-level + (emms-browser-kill-subitems)))) + (defun emms-browser-show-subitems () "Show subitems under the current line." (unless (emms-browser-subitems-visible) |