[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/mpdired 69b010912e 4/4: expand ordering mark space
From: |
ELPA Syncer |
Subject: |
[elpa] externals/mpdired 69b010912e 4/4: expand ordering mark space |
Date: |
Sun, 14 Apr 2024 09:58:21 -0400 (EDT) |
branch: externals/mpdired
commit 69b010912e9917f1fe5f2bfc3dc7683a1ed5278b
Author: Manuel Giraud <manuel@ledu-giraud.fr>
Commit: Manuel Giraud <manuel@ledu-giraud.fr>
expand ordering mark space
---
mpdired.el | 16 +++++++++++-----
1 file changed, 11 insertions(+), 5 deletions(-)
diff --git a/mpdired.el b/mpdired.el
index 0de089d43e..ea7b0b896d 100644
--- a/mpdired.el
+++ b/mpdired.el
@@ -342,7 +342,7 @@
"Local copy of the current song state. It is a list of form '(songid
elapsed duration).")
(defvar-local mpdired--error nil)
-(defvar-local mpdired--order-index 0)
+(defvar-local mpdired--order-index ?0)
;; I have tried to use markers here but since I often erase the
;; buffer's content, these markers are reset to 1.
@@ -979,16 +979,22 @@ otherwise."
(mpdired--mark ?D)
(mpdired-next-line))
+(defun mpdired--increment-char (char)
+ "Modular increment CHAR from in a 0-9a-z space."
+ (cond ((or (= char ?z) (< char ?0)) ?0)
+ ((= char ?9) ?a)
+ (t (1+ char))))
+
(defun mpdired-put-order-at-point ()
(interactive)
(when (eq mpdired--view 'queue)
- (when (mpdired--mark (elt (number-to-string mpdired--order-index) 0))
- (setq mpdired--order-index (mod (1+ mpdired--order-index) 10))
+ (when (mpdired--mark mpdired--order-index)
+ (setq mpdired--order-index (mpdired--increment-char
mpdired--order-index))
(mpdired-next-line))))
(defun mpdired-reset-order-index ()
(interactive)
- (setq mpdired--order-index 0))
+ (setq mpdired--order-index ?0))
(defun mpdired-toggle-marks ()
"Toggles marks."
@@ -1075,7 +1081,7 @@ otherwise."
(id (get-text-property bol 'id))
(type (get-text-property bol 'type))
(uri (get-text-property bol 'uri)))
- (when (and mark (seq-position "0123456789" mark))
+ (when (and mark (seq-position "0123456789abcdefghijklmnopqrstuvwxyz"
mark))
(push (cons mark id) result)))
(forward-line)))
(seq-sort #'(lambda (a b) (< (car a) (car b))) result)))