mirror of
https://github.com/protesilaos/dotfiles.git
synced 2026-09-10 07:16:20 -04:00
emacs: add command prot-simple-update-all-my-package-repositories
This commit is contained in:
parent
a64bae8b78
commit
efe77c1c7e
|
|
@ -17482,6 +17482,28 @@ VARIANT is either `dark' or `light'."
|
|||
(interactive (list (prot-simple--list-accessible-colors-prompt)))
|
||||
(list-colors-display (prot-simple-accessible-colors variant)))
|
||||
|
||||
;;;###autoload
|
||||
(defun prot-simple-update-all-my-package-repositories ()
|
||||
"Pull or clone all `prot-emacs-my-packages'."
|
||||
(unless (executable-find "git")
|
||||
(user-error "Cannot find git program; install it first or add it to the $PATH; aborting"))
|
||||
(unless (getenv "SSH_AUTH_SOCK")
|
||||
(user-error "Cannot find $SSH_AUTH_SOCK; check your SSH connection; aborting"))
|
||||
(dolist (package prot-emacs-my-packages)
|
||||
(condition-case error-data
|
||||
(let* ((common-directory (expand-file-name "~/Git/Projects/"))
|
||||
(default-directory (expand-file-name (symbol-name package) common-directory)))
|
||||
(if (file-directory-p default-directory)
|
||||
(shell-command-to-string "git pull")
|
||||
(let ((default-directory common-directory))
|
||||
(shell-command-to-string (format "git clone git@github.com:protesilaos/%s" package)))))
|
||||
(:success
|
||||
(message "Updated %s repository" package))
|
||||
((error user-error)
|
||||
(message "The package returned error data: %s" error-data))
|
||||
(quit
|
||||
(message "Aborted by the user")))))
|
||||
|
||||
;;;; Global minor mode to override key maps
|
||||
|
||||
(defvar prot-simple-override-mode-map (make-sparse-keymap)
|
||||
|
|
|
|||
|
|
@ -1032,6 +1032,28 @@ VARIANT is either `dark' or `light'."
|
|||
(interactive (list (prot-simple--list-accessible-colors-prompt)))
|
||||
(list-colors-display (prot-simple-accessible-colors variant)))
|
||||
|
||||
;;;###autoload
|
||||
(defun prot-simple-update-all-my-package-repositories ()
|
||||
"Pull or clone all `prot-emacs-my-packages'."
|
||||
(unless (executable-find "git")
|
||||
(user-error "Cannot find git program; install it first or add it to the $PATH; aborting"))
|
||||
(unless (getenv "SSH_AUTH_SOCK")
|
||||
(user-error "Cannot find $SSH_AUTH_SOCK; check your SSH connection; aborting"))
|
||||
(dolist (package prot-emacs-my-packages)
|
||||
(condition-case error-data
|
||||
(let* ((common-directory (expand-file-name "~/Git/Projects/"))
|
||||
(default-directory (expand-file-name (symbol-name package) common-directory)))
|
||||
(if (file-directory-p default-directory)
|
||||
(shell-command-to-string "git pull")
|
||||
(let ((default-directory common-directory))
|
||||
(shell-command-to-string (format "git clone git@github.com:protesilaos/%s" package)))))
|
||||
(:success
|
||||
(message "Updated %s repository" package))
|
||||
((error user-error)
|
||||
(message "The package returned error data: %s" error-data))
|
||||
(quit
|
||||
(message "Aborted by the user")))))
|
||||
|
||||
;;;; Global minor mode to override key maps
|
||||
|
||||
(defvar prot-simple-override-mode-map (make-sparse-keymap)
|
||||
|
|
|
|||
Loading…
Reference in a new issue