branch: externals/denote-sequence commit 5356636c29a8df610ce8dfe6c54eece83071b4b5 Author: Protesilaos Stavrou <i...@protesilaos.com> Commit: Protesilaos Stavrou <i...@protesilaos.com>
Move the sort functions further up --- denote-sequence.el | 44 ++++++++++++++++++++++---------------------- 1 file changed, 22 insertions(+), 22 deletions(-) diff --git a/denote-sequence.el b/denote-sequence.el index 1423a0be02..e0ae9f491b 100644 --- a/denote-sequence.el +++ b/denote-sequence.el @@ -564,6 +564,28 @@ means to pad the full length of the sequence." "=") (string-pad s 32 32 :pad-from-start)))) +(defun denote-sequence-sort-sequences (sequences) + "Sort SEQUENCES according to their sequence. +Also see `denote-sequence-sort-files'." + (sort + sequences + (lambda (sequence1 sequence2) + (string< + (denote-sequence--pad sequence1 'all) + (denote-sequence--pad sequence2 'all))))) + +(defun denote-sequence-sort-files (files-with-sequence) + "Sort FILES-WITH-SEQUENCE according to their sequence. +Also see `denote-sequence-sort-sequences'." + (sort + files-with-sequence + (lambda (file-with-sequence-1 file-with-sequence-2) + (let ((s1 (denote-retrieve-filename-signature file-with-sequence-1)) + (s2 (denote-retrieve-filename-signature file-with-sequence-2))) + (string< + (denote-sequence--pad s1 'all) + (denote-sequence--pad s2 'all)))))) + (defun denote-sequence--get-largest-by-order (sequences type) "Sort SEQUENCES of TYPE to get largest in order, using `denote-sequence--pad'." (car @@ -988,28 +1010,6 @@ Optional ID-ONLY has the same meaning as the `denote-link' command." (description (denote-get-link-description file))) (denote-link file type description id-only))) -(defun denote-sequence-sort-sequences (sequences) - "Sort SEQUENCES according to their sequence. -Also see `denote-sequence-sort-files'." - (sort - sequences - (lambda (sequence1 sequence2) - (string< - (denote-sequence--pad sequence1 'all) - (denote-sequence--pad sequence2 'all))))) - -(defun denote-sequence-sort-files (files-with-sequence) - "Sort FILES-WITH-SEQUENCE according to their sequence. -Also see `denote-sequence-sort-sequences'." - (sort - files-with-sequence - (lambda (file-with-sequence-1 file-with-sequence-2) - (let ((s1 (denote-retrieve-filename-signature file-with-sequence-1)) - (s2 (denote-retrieve-filename-signature file-with-sequence-2))) - (string< - (denote-sequence--pad s1 'all) - (denote-sequence--pad s2 'all)))))) - (defvar denote-sequence-history nil "Minibuffer history of `denote-sequence-prompt'.")