branch: externals/denote-sequence
commit ec11d1c457e4374f81cc4bef430b3d1becf7d247
Author: Protesilaos Stavrou <i...@protesilaos.com>
Commit: Protesilaos Stavrou <i...@protesilaos.com>

    Make stylistic changes to denote-sequence-increment
---
 denote-sequence.el | 19 +++++++++++--------
 1 file changed, 11 insertions(+), 8 deletions(-)

diff --git a/denote-sequence.el b/denote-sequence.el
index 1d0783ec45..a9a4045c4d 100644
--- a/denote-sequence.el
+++ b/denote-sequence.el
@@ -292,28 +292,31 @@ which case convert the entirety of it.  Also see 
`denote-sequence-scheme'."
 
 (defun denote-sequence-increment (string)
   "Increment number represented by STRING and return it as a string.
-STRING is part of a sequence, not the entirety of it."
+STRING is part of a sequence, not the entirety of it.
+
+Also see `denote-sequence-decrement'."
   (cond
    ((denote-sequence--numeric-partial-p string)
     (number-to-string (+ (string-to-number string) 1)))
    ((denote-sequence--alphanumeric-partial-p string)
     (let* ((letters (split-string string "" :omit-nulls))
-           (length-1 (= (length letters) 1))
+           (length-1-p (= (length letters) 1))
            (first (car letters))
            (reverse (nreverse (copy-sequence letters)))
            (last (car reverse)))
       (cond
-       ((and length-1 (string= "z" first))
+       ((and length-1-p (string= "z" first))
         "za")
-       (length-1
+       (length-1-p
         (char-to-string (+ (string-to-char first) 1)))
        ((string= "z" last)
         (apply #'concat (append letters (list "a"))))
        (t
-        (let ((last last))
-          (apply #'concat
-                 (append (butlast letters)
-                         (list (char-to-string (+ (string-to-char last) 
1))))))))))
+        (apply #'concat
+               (append (butlast letters)
+                       (list (char-to-string (+ (string-to-char last) 
1)))))))))
+   (t
+    (error "The string `%s' must contain only numbers or letters" string))))
 
 (defun denote-sequence-decrement (string)
   "Decrement number represented by STRING and return it as a string.

Reply via email to