Fix doom/bump-module command

Also allows you to bump :core now.
This commit is contained in:
Henrik Lissner 2020-05-15 05:32:48 -04:00
parent 76b133fd98
commit 2b8388079b
No known key found for this signature in database
GPG key ID: 5F6C0EA160557395

View file

@ -144,12 +144,9 @@ Grabs the latest commit id of the package using 'git'."
If SELECT (prefix arg) is non-nil, prompt you to choose a specific commit for If SELECT (prefix arg) is non-nil, prompt you to choose a specific commit for
each package." each package."
(interactive (interactive
(append (let* ((module (completing-read
(mapcar #'intern
(split-string
(completing-read
"Bump module: " "Bump module: "
(let ((modules (doom-module-list 'all))) (let ((modules (cons (list :core) (doom-module-list 'all))))
(mapcar (lambda (m) (mapcar (lambda (m)
(if (listp m) (if (listp m)
(format "%s %s" (car m) (cdr m)) (format "%s %s" (car m) (cdr m))
@ -157,17 +154,27 @@ each package."
(append (list ":private") (append (list ":private")
(delete-dups (mapcar #'car modules)) (delete-dups (mapcar #'car modules))
modules))) modules)))
nil t nil nil) nil t nil nil))
" " t)) (module (split-string module " " t)))
(list current-prefix-arg))) (list (intern (car module))
(if-let (packages-file (if (eq category :private) (ignore-errors (intern (cadr module)))
(doom-glob doom-private-dir "packages.el") current-prefix-arg)))
(doom-module-locate-path category module "packages.el"))) (mapc (lambda (module)
(if-let (packages-file
(pcase category
(:private (doom-glob doom-private-dir "packages.el"))
(:core (doom-glob doom-core-dir "packages.el"))
(_ (doom-module-locate-path category module "packages.el"))))
(with-current-buffer (with-current-buffer
(or (get-file-buffer packages-file) (or (get-file-buffer packages-file)
(find-file-noselect packages-file)) (find-file-noselect packages-file))
(doom/bump-packages-in-buffer select)) (doom/bump-packages-in-buffer select)
(user-error "Module %s %s has no packages.el file"))) (save-buffer))
(message "Module %s has no packages.el file" (cons category module))))
(if module
(list (cons category module))
(cl-remove-if-not (lambda (m) (eq (car m) category))
(cons (list :core) (doom-module-list 'all))))))
;;;###autoload ;;;###autoload
(defun doom/bump-package (package) (defun doom/bump-package (package)