Skip to content

Commit

Permalink
fix(use-package): add missing backported functions
Browse files Browse the repository at this point in the history
  • Loading branch information
abougouffa committed Dec 1, 2024
1 parent 9e1ef29 commit 3065ff7
Showing 1 changed file with 21 additions and 1 deletion.
22 changes: 21 additions & 1 deletion core/me-backports.el
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,26 @@

(add-to-list 'use-package-keywords :vc)

(defun use-package-split-list (pred xs)
(let ((ys (list nil)) (zs (list nil)) flip)
(cl-dolist (x xs)
(if flip
(nconc zs (list x))
(if (funcall pred x)
(progn (setq flip t)
(nconc zs (list x)))
(nconc ys (list x)))))
(cons (cdr ys) (cdr zs))))

(defun use-package-split-when (pred xs)
(unless (seq-empty-p xs)
(pcase-let* ((`(,first . ,rest) (if (funcall pred (car xs))
(cons (car xs) (cdr xs))
(use-package-split-list pred xs)))
(`(,val . ,recur) (use-package-split-list pred rest)))
(cons (cons first val)
(use-package-split-when pred recur)))))

(defvar use-package-vc-prefer-newest nil)

(defun use-package-vc-install (arg &optional local-path)
Expand Down Expand Up @@ -81,7 +101,7 @@
(`(,(pred keywordp) . ,(pred listp)) ; list + guess name
(use-package-normalize--vc-arg (cons name arg)))
(`(,(pred symbolp) . ,(or (pred listp) ; list/version string + name
(pred stringp)))
(pred stringp)))
(use-package-normalize--vc-arg arg))
(_ (use-package-error "Unrecognized argument to :vc")))))

Expand Down

0 comments on commit 3065ff7

Please sign in to comment.