2018-06-11 23:18:15 +02:00
|
|
|
;;; core/core-packages.el -*- lexical-binding: t; -*-
|
2017-02-19 06:59:55 -05:00
|
|
|
|
2019-07-22 22:25:53 +02:00
|
|
|
;; Emacs package management is opinionated, and so is Doom. Doom uses `straight'
|
|
|
|
;; to create a declarative, lazy-loaded and optionally rolling-release package
|
|
|
|
;; management system. We use `straight' over `package' because the latter is
|
|
|
|
;; tempermental. ELPA sources suffer downtime occasionally, and often fail at
|
|
|
|
;; building some packages when GNU Tar is unavailable (e.g. MacOS users start
|
|
|
|
;; with BSD tar). There are also known gnutls errors in the current stable
|
|
|
|
;; release of Emacs (26.x) which bork TLS handshakes with ELPA repos (mainly
|
|
|
|
;; gnu.elpa.org). See https://debbugs.gnu.org/cgi/bugreport.cgi?bug=3434.
|
2017-02-11 06:00:08 -05:00
|
|
|
;;
|
2019-07-22 22:25:53 +02:00
|
|
|
;; What's worse, you can only get the latest version of packages through ELPA.
|
|
|
|
;; In an ecosystem that is constantly changing, this is more frustrating than
|
|
|
|
;; convenient. Straight (and Doom) can do rolling release, but it is optional
|
|
|
|
;; (and will eventually be opt-in).
|
2017-07-14 15:23:12 +02:00
|
|
|
;;
|
2019-07-22 22:25:53 +02:00
|
|
|
;; ANyhow, interacting with this package management system is done through the
|
|
|
|
;; bin/doom script included with Doom Emacs. You'll find more about it by
|
|
|
|
;; running 'doom help' (I highly recommend you add it to your PATH), but here
|
|
|
|
;; are the highlights:
|
2017-07-14 15:23:12 +02:00
|
|
|
;;
|
2019-07-22 22:25:53 +02:00
|
|
|
;; + `bin/doom install`: a wizard that guides you through setting up Doom and
|
|
|
|
;; your private config for the first time.
|
|
|
|
;; + `bin/doom refresh`: your go-to command for making sure Doom is in optimal
|
|
|
|
;; condition. It ensures all unneeded packages are removed, all needed ones
|
|
|
|
;; are installed, and all metadata associated with them is generated.
|
|
|
|
;; + `bin/doom upgrade`: upgrades Doom Emacs and your packages to the latest
|
|
|
|
;; versions. There's also 'bin/doom update' for updating only your packages.
|
2017-02-06 00:13:24 -05:00
|
|
|
;;
|
2019-07-22 22:25:53 +02:00
|
|
|
;; How this works is: the system reads packages.el files located in each
|
|
|
|
;; activated module, your private directory (`doom-private-dir'), and one in
|
|
|
|
;; `doom-core-dir'. These contain `package!' declarations that tell DOOM what
|
|
|
|
;; plugins to install and where from.
|
2017-02-06 00:13:24 -05:00
|
|
|
;;
|
2019-07-22 22:25:53 +02:00
|
|
|
;; All that said, you can still use package.el's commands, but 'bin/doom
|
|
|
|
;; refresh' will purge ELPA packages.
|
2017-01-16 23:15:48 -05:00
|
|
|
|
2019-07-21 15:39:45 +02:00
|
|
|
(defvar doom-init-packages-p nil
|
|
|
|
"If non-nil, Doom's package management system has been initialized.")
|
|
|
|
|
2017-06-05 14:21:52 +02:00
|
|
|
(defvar doom-packages ()
|
2017-02-11 06:00:08 -05:00
|
|
|
"A list of enabled packages. Each element is a sublist, whose CAR is the
|
|
|
|
package's name as a symbol, and whose CDR is the plist supplied to its
|
2017-02-23 00:06:12 -05:00
|
|
|
`package!' declaration. Set by `doom-initialize-packages'.")
|
2017-02-11 06:00:08 -05:00
|
|
|
|
2019-12-24 00:01:17 -05:00
|
|
|
(defvar doom-pinned-packages nil
|
|
|
|
"An alist mapping package names to commit hashes; both strings.
|
|
|
|
|
|
|
|
We avoid straight's lockfiles because we want to pin packages straight from
|
|
|
|
their `package!' declarations, which is simpler than lockfiles, where version
|
|
|
|
management would be done in a whole new file that users shouldn't have to deal
|
|
|
|
with.")
|
|
|
|
|
2019-12-27 01:52:45 -05:00
|
|
|
(defvar doom-core-packages '(straight use-package)
|
2017-02-11 06:00:08 -05:00
|
|
|
"A list of packages that must be installed (and will be auto-installed if
|
|
|
|
missing) and shouldn't be deleted.")
|
|
|
|
|
2019-07-21 15:39:45 +02:00
|
|
|
(defvar doom-core-package-sources
|
|
|
|
'((org-elpa :local-repo nil)
|
|
|
|
(melpa
|
|
|
|
:type git :host github
|
|
|
|
:repo "melpa/melpa"
|
|
|
|
:no-build t)
|
|
|
|
(gnu-elpa-mirror
|
|
|
|
:type git :host github
|
|
|
|
:repo "emacs-straight/gnu-elpa-mirror"
|
|
|
|
:no-build t)
|
|
|
|
(emacsmirror-mirror
|
|
|
|
:type git :host github
|
|
|
|
:repo "emacs-straight/emacsmirror-mirror"
|
|
|
|
:no-build t))
|
|
|
|
"A list of recipes for straight's recipe repos.")
|
|
|
|
|
2017-06-05 16:45:42 +02:00
|
|
|
(defvar doom-disabled-packages ()
|
2019-07-23 12:44:03 +02:00
|
|
|
"A list of packages that should be ignored by `use-package!' and `after!'.")
|
2017-06-05 16:45:42 +02:00
|
|
|
|
2019-07-21 15:39:45 +02:00
|
|
|
|
|
|
|
;;
|
|
|
|
;;; Package managers
|
|
|
|
|
|
|
|
;; Ensure that, if we do need package.el, it is configured correctly. You really
|
|
|
|
;; shouldn't be using it, but it may be convenient for quick package testing.
|
2019-12-27 01:41:14 -05:00
|
|
|
(setq package-enable-at-startup nil
|
2019-09-24 20:49:24 -04:00
|
|
|
package-user-dir (concat doom-local-dir "elpa/")
|
|
|
|
package-gnupghome-dir (expand-file-name "gpg" package-user-dir)
|
2017-02-11 00:46:42 -05:00
|
|
|
;; I omit Marmalade because its packages are manually submitted rather
|
|
|
|
;; than pulled, so packages are often out of date with upstream.
|
2019-05-12 22:09:52 -04:00
|
|
|
package-archives
|
2019-08-28 20:14:12 -04:00
|
|
|
(let ((proto (if gnutls-verify-error "https" "http")))
|
2019-07-21 15:39:45 +02:00
|
|
|
`(("gnu" . ,(concat proto "://elpa.gnu.org/packages/"))
|
|
|
|
("melpa" . ,(concat proto "://melpa.org/packages/"))
|
|
|
|
("org" . ,(concat proto "://orgmode.org/elpa/")))))
|
2019-05-12 22:09:52 -04:00
|
|
|
|
2019-12-27 01:41:14 -05:00
|
|
|
(advice-add #'package--ensure-init-file :override #'ignore)
|
|
|
|
|
2019-07-02 23:13:01 +02:00
|
|
|
;; Don't save `package-selected-packages' to `custom-file'
|
2019-07-23 17:24:56 +02:00
|
|
|
(defadvice! doom--package-inhibit-custom-file-a (&optional value)
|
2019-07-21 15:39:45 +02:00
|
|
|
:override #'package--save-selected-packages
|
|
|
|
(if value (setq package-selected-packages value)))
|
2019-07-02 23:13:01 +02:00
|
|
|
|
2019-11-02 21:55:01 -04:00
|
|
|
;; Refresh package.el the first time you call `package-install'
|
|
|
|
(add-transient-hook! 'package-install (package-refresh-contents))
|
|
|
|
|
2019-07-21 15:39:45 +02:00
|
|
|
;;; straight
|
2019-08-21 00:26:54 -04:00
|
|
|
(setq straight-base-dir doom-local-dir
|
|
|
|
straight-repository-branch "develop"
|
2019-08-21 00:09:28 -04:00
|
|
|
straight-cache-autoloads nil ; we already do this, and better.
|
2019-07-21 15:39:45 +02:00
|
|
|
;; Doom doesn't encourage you to modify packages in place. Disabling this
|
|
|
|
;; makes 'doom refresh' instant (once everything set up), which is much
|
2019-07-23 17:30:32 +02:00
|
|
|
;; nicer UX than the several seconds modification checks.
|
2019-07-21 15:39:45 +02:00
|
|
|
straight-check-for-modifications nil
|
2019-07-23 17:30:32 +02:00
|
|
|
;; We handle package.el ourselves (and a little more comprehensively)
|
2019-07-21 15:39:45 +02:00
|
|
|
straight-enable-package-integration nil
|
|
|
|
;; Before switching to straight, `doom-local-dir' would average out at
|
2019-07-23 17:30:32 +02:00
|
|
|
;; around 100mb with half Doom's modules at ~230 packages. Afterwards, at
|
|
|
|
;; around 1gb. With shallow cloning, that is reduced to ~400mb. This
|
|
|
|
;; imposes an issue with packages that require their git history for
|
|
|
|
;; certain things to work (like magit and org), but we can deal with that
|
|
|
|
;; when we cross that bridge.
|
2019-07-21 15:39:45 +02:00
|
|
|
straight-vc-git-default-clone-depth 1
|
|
|
|
;; Prefix declarations are unneeded bulk added to our autoloads file. Best
|
|
|
|
;; we just don't have to deal with them at all.
|
2019-12-27 01:42:38 -05:00
|
|
|
autoload-compute-prefixes nil
|
|
|
|
;; We handle it ourselves
|
|
|
|
straight-fix-org nil)
|
2019-07-25 17:20:53 +02:00
|
|
|
|
2020-01-01 14:29:40 -05:00
|
|
|
|
2018-05-14 15:57:54 +02:00
|
|
|
|
|
|
|
;;
|
2019-05-12 22:09:52 -04:00
|
|
|
;;; Bootstrapper
|
2018-05-14 15:57:54 +02:00
|
|
|
|
2018-03-02 17:45:15 -05:00
|
|
|
(defun doom-initialize-packages (&optional force-p)
|
2019-07-21 15:39:45 +02:00
|
|
|
"Ensures that Doom's package system and straight.el are initialized.
|
2018-03-02 17:45:15 -05:00
|
|
|
|
2018-05-20 00:01:07 +02:00
|
|
|
If FORCE-P is non-nil, do it anyway.
|
2018-03-02 17:45:15 -05:00
|
|
|
|
2019-07-21 15:39:45 +02:00
|
|
|
This ensure `doom-packages' is populated, if isn't aren't already. Use this
|
|
|
|
before any of straight's or Doom's package management's API to ensure all the
|
|
|
|
necessary package metadata is initialized and available for them."
|
2019-08-28 16:46:39 -04:00
|
|
|
(unless doom-init-packages-p
|
2019-12-24 00:01:17 -05:00
|
|
|
(setq force-p t))
|
2019-08-15 19:52:43 -04:00
|
|
|
(when (or force-p (not (bound-and-true-p package--initialized)))
|
2019-08-23 20:33:30 -04:00
|
|
|
(doom-log "Initializing package.el")
|
2019-08-15 19:52:43 -04:00
|
|
|
(require 'package)
|
|
|
|
(package-initialize))
|
2019-08-28 16:46:39 -04:00
|
|
|
(when (or force-p (not doom-packages))
|
2019-07-22 22:28:43 +02:00
|
|
|
(doom-log "Initializing straight")
|
2019-07-21 15:39:45 +02:00
|
|
|
(setq doom-init-packages-p t)
|
2019-08-15 19:56:20 -04:00
|
|
|
(unless (fboundp 'straight--reset-caches)
|
2019-08-23 20:33:30 -04:00
|
|
|
(doom-ensure-straight)
|
2019-08-15 19:56:20 -04:00
|
|
|
(require 'straight))
|
2019-07-21 15:39:45 +02:00
|
|
|
(straight--reset-caches)
|
2019-12-24 00:01:17 -05:00
|
|
|
(setq straight-recipe-repositories nil
|
|
|
|
straight-recipe-overrides nil)
|
2019-07-21 15:39:45 +02:00
|
|
|
(mapc #'straight-use-recipes doom-core-package-sources)
|
|
|
|
(straight-register-package
|
|
|
|
`(straight :type git :host github
|
|
|
|
:repo ,(format "%s/straight.el" straight-repository-user)
|
|
|
|
:files ("straight*.el")
|
2019-08-15 19:51:36 -04:00
|
|
|
:branch ,straight-repository-branch
|
|
|
|
:no-byte-compile t))
|
2019-07-21 15:39:45 +02:00
|
|
|
(mapc #'straight-use-package doom-core-packages)
|
2019-07-22 22:28:43 +02:00
|
|
|
(doom-log "Initializing doom-packages")
|
2019-07-21 15:39:45 +02:00
|
|
|
(setq doom-disabled-packages nil
|
2019-12-24 00:01:17 -05:00
|
|
|
doom-pinned-packages nil
|
2019-07-21 15:39:45 +02:00
|
|
|
doom-packages (doom-package-list))
|
2019-12-24 00:01:17 -05:00
|
|
|
(dolist (package doom-packages)
|
|
|
|
(let ((name (car package)))
|
2019-12-31 14:10:52 -05:00
|
|
|
(with-plist! (cdr package) (recipe modules disable ignore pin)
|
2019-12-24 00:01:17 -05:00
|
|
|
(if ignore
|
|
|
|
(doom-log "Ignoring package %S" name)
|
2019-12-24 02:25:37 -05:00
|
|
|
(if (not disable)
|
|
|
|
(with-demoted-errors "Package error: %s"
|
|
|
|
(when recipe
|
|
|
|
(straight-override-recipe (cons name recipe)))
|
|
|
|
(straight-register-package name))
|
|
|
|
(doom-log "Disabling package %S" name)
|
|
|
|
(cl-pushnew name doom-disabled-packages)
|
|
|
|
;; Warn about disabled core packages
|
2019-12-31 14:10:52 -05:00
|
|
|
(when (cl-find :core modules :key #'car)
|
2019-12-24 02:25:37 -05:00
|
|
|
(print! (warn "%s\n%s")
|
|
|
|
(format "You've disabled %S" name)
|
|
|
|
(indent 2 (concat "This is a core package. Disabling it will cause errors, as Doom assumes\n"
|
2020-01-14 21:57:04 -05:00
|
|
|
"core packages are always available. Disable their minor-modes or hooks instead.")))))
|
|
|
|
(when pin
|
|
|
|
(let ((realname
|
|
|
|
(if-let* ((recipe (cdr (straight-recipes-retrieve name)))
|
|
|
|
(repo (straight-vc-local-repo-name recipe)))
|
|
|
|
repo
|
|
|
|
(symbol-name name))))
|
|
|
|
(doom-log "Pinning package %S to %S" realname pin)
|
|
|
|
(setf (alist-get realname doom-pinned-packages
|
|
|
|
nil nil #'equal)
|
|
|
|
pin)))))))))
|
2018-03-02 17:45:15 -05:00
|
|
|
|
2019-07-21 15:39:45 +02:00
|
|
|
(defun doom-ensure-straight ()
|
|
|
|
"Ensure `straight' is installed and was compiled with this version of Emacs."
|
|
|
|
(defvar bootstrap-version)
|
2019-07-29 21:03:49 +02:00
|
|
|
(let* (;; Force straight to install into ~/.emacs.d/.local/straight instead of
|
2019-07-21 15:39:45 +02:00
|
|
|
;; ~/.emacs.d/straight by pretending `doom-local-dir' is our .emacs.d.
|
2019-08-21 00:26:54 -04:00
|
|
|
(user-emacs-directory straight-base-dir)
|
|
|
|
(bootstrap-file (doom-path straight-base-dir "straight/repos/straight.el/straight.el"))
|
2019-07-29 21:03:49 +02:00
|
|
|
(bootstrap-version 5))
|
2019-08-23 20:33:30 -04:00
|
|
|
(make-directory (doom-path straight-base-dir "straight/build") 'parents)
|
2019-08-15 19:51:36 -04:00
|
|
|
(unless (featurep 'straight)
|
2019-08-23 20:33:30 -04:00
|
|
|
(unless (or (require 'straight nil t)
|
2019-08-15 19:51:36 -04:00
|
|
|
(file-readable-p bootstrap-file))
|
|
|
|
(with-current-buffer
|
|
|
|
(url-retrieve-synchronously
|
2019-08-21 00:09:28 -04:00
|
|
|
(format "https://raw.githubusercontent.com/raxod502/straight.el/%s/install.el"
|
|
|
|
straight-repository-branch)
|
2019-08-15 19:51:36 -04:00
|
|
|
'silent 'inhibit-cookies)
|
|
|
|
(goto-char (point-max))
|
|
|
|
(eval-print-last-sexp)))
|
|
|
|
(load bootstrap-file nil t))))
|
2017-02-11 06:52:38 -05:00
|
|
|
|
2017-02-06 00:13:24 -05:00
|
|
|
|
2017-02-11 00:46:42 -05:00
|
|
|
;;
|
2019-07-21 15:39:45 +02:00
|
|
|
;;; Module package macros
|
2017-01-16 23:15:48 -05:00
|
|
|
|
2019-07-22 22:30:35 +02:00
|
|
|
(cl-defmacro package!
|
2019-12-24 00:01:17 -05:00
|
|
|
(name &rest plist &key built-in recipe ignore _pin _disable)
|
2017-07-02 16:47:02 +02:00
|
|
|
"Declares a package and how to install it (if applicable).
|
|
|
|
|
|
|
|
This macro is declarative and does not load nor install packages. It is used to
|
|
|
|
populate `doom-packages' with metadata about the packages Doom needs to keep
|
|
|
|
track of.
|
|
|
|
|
2018-04-03 15:00:52 -04:00
|
|
|
Only use this macro in a module's packages.el file.
|
2017-02-04 21:07:54 -05:00
|
|
|
|
2017-02-11 00:46:42 -05:00
|
|
|
Accepts the following properties:
|
2017-02-03 20:10:40 -05:00
|
|
|
|
2018-03-26 16:44:24 -04:00
|
|
|
:recipe RECIPE
|
2019-12-24 00:01:17 -05:00
|
|
|
Specifies a straight.el recipe to allow you to acquire packages from external
|
|
|
|
sources. See https://github.com/raxod502/straight.el#the-recipe-format for
|
|
|
|
details on this recipe.
|
2018-03-26 16:44:24 -04:00
|
|
|
:disable BOOL
|
2019-09-13 13:58:43 -04:00
|
|
|
Do not install or update this package AND disable all of its `use-package!'
|
2019-12-24 00:01:17 -05:00
|
|
|
and `after!' blocks.
|
2018-03-26 16:44:24 -04:00
|
|
|
:ignore FORM
|
2018-03-26 18:15:03 -04:00
|
|
|
Do not install this package.
|
2019-12-24 00:01:17 -05:00
|
|
|
:pin STR|nil
|
|
|
|
(NOT IMPLEMENTED YET)
|
|
|
|
Pin this package to commit hash STR. Setting this to nil will unpin this
|
|
|
|
package if previously pinned.
|
|
|
|
:built-in BOOL|'prefer
|
|
|
|
Same as :ignore if the package is a built-in Emacs package. This is more to
|
|
|
|
inform help commands like `doom/help-packages' that this is a built-in
|
|
|
|
package. If set to 'prefer, the package will not be installed if it is
|
|
|
|
already provided by Emacs.
|
2018-05-15 23:11:48 +02:00
|
|
|
|
|
|
|
Returns t if package is successfully registered, and nil if it was disabled
|
|
|
|
elsewhere."
|
2017-01-16 23:15:48 -05:00
|
|
|
(declare (indent defun))
|
2019-11-17 16:43:23 -05:00
|
|
|
(when (and recipe (keywordp (car-safe recipe)))
|
|
|
|
(plist-put! plist :recipe `(quote ,recipe)))
|
2019-12-24 02:35:07 -05:00
|
|
|
;; :built-in t is basically an alias for :ignore (locate-library NAME)
|
2019-11-17 16:43:23 -05:00
|
|
|
(when built-in
|
2019-12-24 02:35:07 -05:00
|
|
|
(when (and (not ignore)
|
|
|
|
(equal built-in '(quote prefer)))
|
2019-11-17 16:43:23 -05:00
|
|
|
(setq built-in `(locate-library ,(symbol-name name) nil doom--initial-load-path)))
|
2019-11-17 17:55:06 -05:00
|
|
|
(plist-delete! plist :built-in)
|
2019-11-17 16:43:23 -05:00
|
|
|
(plist-put! plist :ignore built-in))
|
2019-10-25 02:36:02 -04:00
|
|
|
`(let* ((name ',name)
|
|
|
|
(plist (cdr (assq name doom-packages))))
|
2019-12-24 02:35:07 -05:00
|
|
|
;; Record what module this declaration was found in
|
2019-10-25 02:36:02 -04:00
|
|
|
(let ((module-list (plist-get plist :modules))
|
|
|
|
(module ',(doom-module-from-path)))
|
|
|
|
(unless (member module module-list)
|
|
|
|
(plist-put! plist :modules
|
|
|
|
(append module-list
|
|
|
|
(list module)
|
|
|
|
nil))))
|
2019-12-24 02:35:07 -05:00
|
|
|
;; Merge given plist with pre-existing one
|
2019-11-17 16:43:23 -05:00
|
|
|
(doplist! ((prop val) (list ,@plist) plist)
|
2019-10-25 02:36:02 -04:00
|
|
|
(unless (null val)
|
|
|
|
(plist-put! plist prop val)))
|
2019-11-17 16:43:23 -05:00
|
|
|
;; Some basic key validation; error if you're not using a valid key
|
|
|
|
(condition-case e
|
2019-12-26 02:40:56 -05:00
|
|
|
(when-let (recipe (plist-get plist :recipe))
|
|
|
|
(cl-destructuring-bind
|
2020-01-14 19:21:26 -05:00
|
|
|
(&key local-repo _files _flavor
|
|
|
|
_no-build _no-byte-compile _no-autoloads
|
2019-12-26 02:40:56 -05:00
|
|
|
_type _repo _host _branch _remote _nonrecursive _fork _depth)
|
|
|
|
recipe
|
|
|
|
;; Expand :local-repo from current directory
|
|
|
|
(when local-repo
|
|
|
|
(plist-put! plist :recipe
|
|
|
|
(plist-put recipe :local-repo
|
|
|
|
(expand-file-name local-repo ,(dir!)))))))
|
2019-11-17 16:43:23 -05:00
|
|
|
(error
|
|
|
|
(signal 'doom-package-error
|
|
|
|
(cons ,(symbol-name name)
|
|
|
|
(error-message-string e)))))
|
2019-12-24 02:35:07 -05:00
|
|
|
;; This is the only side-effect of this macro!
|
2019-10-25 02:36:02 -04:00
|
|
|
(setf (alist-get name doom-packages) plist)
|
2019-12-26 02:44:12 -05:00
|
|
|
(with-no-warnings
|
|
|
|
(not (plist-get plist :disable)))))
|
2017-01-28 02:02:16 -05:00
|
|
|
|
2018-03-26 02:58:22 -04:00
|
|
|
(defmacro disable-packages! (&rest packages)
|
:boom: revise advice naming convention (1/2)
This is first of three big naming convention updates that have been a
long time coming. With 2.1 on the horizon, all the breaking updates will
batched together in preparation for the long haul.
In this commit, we do away with the asterix to communicate that a
function is an advice function, and we replace it with the '-a' suffix.
e.g.
doom*shut-up -> doom-shut-up-a
doom*recenter -> doom-recenter-a
+evil*static-reindent -> +evil--static-reindent-a
The rationale behind this change is:
1. Elisp's own formatting/indenting tools would occasionally struggle
with | and * (particularly pp and cl-prettyprint). They have no
problem with / and :, fortunately.
2. External syntax highlighters (like pygmentize, discord markdown or
github markdown) struggle with it, sometimes refusing to highlight
code beyond these symbols.
3. * and | are less expressive than - and -- in communicating the
intended visibility, versatility and stability of a function.
4. It complicated the regexps we must use to search for them.
5. They were arbitrary and over-complicated to begin with, decided
on haphazardly way back when Doom was simply "my private config".
Anyhow, like how predicate functions have the -p suffix, we'll adopt the
-a suffix for advice functions, -h for hook functions and -fn for
variable functions.
Other noteable changes:
- Replaces advice-{add,remove}! macro with new def-advice!
macro. The old pair weren't as useful. The new def-advice! saves on a
lot of space.
- Removed "stage" assertions to make sure you were using the right
macros in the right place. Turned out to not be necessary, we'll
employ better checks later.
2019-07-18 15:42:52 +02:00
|
|
|
"A convenience macro for disabling packages in bulk.
|
|
|
|
Only use this macro in a module's (or your private) packages.el file."
|
2019-01-02 13:17:26 -05:00
|
|
|
(macroexp-progn
|
2019-07-21 15:39:45 +02:00
|
|
|
(cl-loop for p in packages
|
|
|
|
collect `(package! ,p :disable t))))
|
2018-03-26 02:58:22 -04:00
|
|
|
|
2020-01-14 21:39:19 -05:00
|
|
|
(defmacro unpin! (&rest targets)
|
|
|
|
"Unpin packages in TARGETS.
|
|
|
|
Elements in TARGETS can be package names (symbols), a list consisting of
|
|
|
|
(CATEGORY MODULE) where MODULE is optional, or the boolean `t'.
|
|
|
|
|
|
|
|
Each package in this list is unpinned, which means its latest version will be
|
|
|
|
installed next time you run 'doom upgrade'. If you specify a (CATEGORY), all
|
|
|
|
packages in all modules in that category will be unpinned. If you specify
|
|
|
|
(CATEGORY MODULE), only packages in that particular module will be unpinned.
|
|
|
|
|
|
|
|
Lastly, a value of `t' means unpin all packages."
|
|
|
|
(dolist (target targets)
|
|
|
|
(cond
|
|
|
|
((eq target t)
|
|
|
|
(setq doom-pinned-packages nil))
|
|
|
|
((listp target)
|
|
|
|
(cl-destructuring-bind (category &optional module) target
|
|
|
|
(dolist (pkg doom-packages)
|
|
|
|
(when-let (mod (assq category (plist-get (cdr pkg) :modules)))
|
|
|
|
(and (or (null module)
|
|
|
|
(eq (cdr mod) module))
|
|
|
|
(assq-delete-all (car pkg) doom-pinned-packages))))))
|
|
|
|
((symbolp target)
|
|
|
|
(assq-delete-all target doom-pinned-packages)))))
|
|
|
|
|
2017-01-16 23:15:48 -05:00
|
|
|
(provide 'core-packages)
|
|
|
|
;;; core-packages.el ends here
|