branch: externals/mpdired
commit e07d7509c77c9627ecbd7d39f5c660281ec724d8
Author: Manuel Giraud <man...@ledu-giraud.fr>
Commit: Manuel Giraud <man...@ledu-giraud.fr>

    random toggle
---
 mpdired.el | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/mpdired.el b/mpdired.el
index 1fd82a38af..311c5d1ba0 100644
--- a/mpdired.el
+++ b/mpdired.el
@@ -91,6 +91,7 @@
   "v"      #'mpdired-set-volume-internal
   ;; Status toggles
   "s s"    #'mpdired-stop
+  "s r"    #'mpdired-toggle-random
   ;; Marks
   "m"      #'mpdired-mark-at-point
   "* m"    #'mpdired-mark-at-point
@@ -597,6 +598,16 @@ an optional communication buffer."
          mpdired--message "Stopping...")
     (process-send-string process "stop\n")))
 
+(defun mpdired-toggle-random ()
+  (interactive)
+  (mpdired--with-comm-buffer process nil
+    (setq mpdired--last-command 'random)
+    (let ((random
+          (with-current-buffer mpdired--main-buffer
+            (nth 3 mpdired--status))))
+      (process-send-string process
+                          (format "random %d\n" (if random 0 1))))))
+
 (defun mpdired-next-internal (&optional buffer)
   (interactive)
   (mpdired--with-comm-buffer process buffer

Reply via email to