diff --git a/core/autoload/help.el b/core/autoload/help.el index 8b825635d..ce33d49e0 100644 --- a/core/autoload/help.el +++ b/core/autoload/help.el @@ -217,12 +217,16 @@ whose car is the list of faces and cadr is the list of overlay faces." (list faces overlays)))))) ;;;###autoload -(defun doom//open-manual () +(defalias 'doom/help 'doom/open-manual) + +;;;###autoload +(defun doom/open-manual () + "TODO" (interactive) (find-file (expand-file-name "index.org" doom-docs-dir))) ;;;###autoload -(defun doom//reload (&optional force-p) +(defun doom/reload (&optional force-p) "Reloads your config. This is experimental! If called from a noninteractive session, this will try to communicate with a @@ -236,15 +240,16 @@ init.el and config.el. Then runs `doom-reload-hook'." (cond ((and noninteractive (not (daemonp))) (require 'server) (if (not (server-running-p)) - (doom//reload-autoloads force-p) + (doom-reload-autoloads force-p) (print! "Reloading active Emacs session...") (print! (bold "%%s") - (if (server-eval-at server-name '(doom//reload)) + (if (server-eval-at server-name '(doom/reload)) (green "Done!") (red "There were issues!"))))) - ((let ((load-prefer-newer t)) - (doom//reload-autoloads force-p) + ((progn + (require 'core-packages) + (doom-reload-autoloads force-p) (doom-initialize 'force) (with-demoted-errors "PRIVATE CONFIG ERROR: %s" (doom-initialize-modules 'force)) diff --git a/core/autoload/packages.el b/core/autoload/packages.el index a2e2ecdef..c23ef0607 100644 --- a/core/autoload/packages.el +++ b/core/autoload/packages.el @@ -230,7 +230,7 @@ containing (PACKAGE-SYMBOL OLD-VERSION-LIST NEW-VERSION-LIST). If INCLUDE-FROZEN-P is non-nil, check frozen packages as well. -Used by `doom//packages-update'." +Used by `doom-packages-update'." (doom-initialize-packages t) (doom-refresh-packages-maybe doom-debug-mode) (require 'async) @@ -279,7 +279,7 @@ Used by `doom//packages-update'." "Return a list of symbols representing packages that are no longer needed or depended on. -Used by `doom//packages-autoremove'." +Used by `doom-packages-autoremove'." (let ((package-selected-packages (mapcar #'car (doom-get-packages :ignored nil :disabled nil)))) (append (package--removable-packages) @@ -298,7 +298,7 @@ the package symbol, and whose CDR is a plist taken from that package's If INCLUDE-IGNORED-P is non-nil, includes missing packages that are ignored, i.e. they have an :ignore property. -Used by `doom//packages-install'." +Used by `doom-packages-install'." (doom-initialize-packages) (cl-loop for (name . plist) in (doom-get-packages :ignored (if include-ignored-p 'any) :disabled nil) @@ -450,9 +450,8 @@ calls." ;; ;;;###autoload -(defun doom//packages-install (&optional auto-accept-p) +(defun doom-packages-install (&optional auto-accept-p) "Interactive command for installing missing packages." - (interactive "P") (print! "Looking for packages to install...") (let ((packages (reverse (doom-get-missing-packages)))) (cond ((not packages) @@ -511,9 +510,8 @@ calls." success))))) ;;;###autoload -(defun doom//packages-update (&optional auto-accept-p) +(defun doom-packages-update (&optional auto-accept-p) "Interactive command for updating packages." - (interactive "P") (print! "Looking for outdated packages...") (let ((packages (cl-sort (cl-copy-list (doom-get-outdated-packages)) #'string-lessp :key #'car))) @@ -555,9 +553,8 @@ calls." success))))) ;;;###autoload -(defun doom//packages-autoremove (&optional auto-accept-p) +(defun doom-packages-autoremove (&optional auto-accept-p) "Interactive command for auto-removing orphaned packages." - (interactive "P") (print! "Looking for orphaned packages...") (let ((packages (doom-get-orphaned-packages))) (cond ((not packages) @@ -609,7 +606,8 @@ calls." ;; Replace with Doom variants ;;;###autoload -(advice-add #'package-autoremove :override #'doom//packages-autoremove) -;;;###autoload -(advice-add #'package-install-selected-packages :override #'doom//packages-install) +(advice-add #'package-autoremove :override (λ! (doom-packages-autoremove current-prefix-arg))) + +;;;###autoload +(advice-add #'package-install-selected-packages :override (λ! (doom-packages-install current-prefix-arg))) diff --git a/core/autoload/ui.el b/core/autoload/ui.el index a3056e886..82f89cdf7 100644 --- a/core/autoload/ui.el +++ b/core/autoload/ui.el @@ -95,7 +95,7 @@ presentations." (set-frame-font doom-font t t))) ;;;###autoload -(defun doom//reload-theme () +(defun doom/reload-theme () "Reset the current color theme and fonts." (interactive) (let ((theme (or (car-safe custom-enabled-themes) doom-theme))) diff --git a/core/core-dispatcher.el b/core/core-dispatcher.el index 2e74acf62..f6bac5709 100644 --- a/core/core-dispatcher.el +++ b/core/core-dispatcher.el @@ -14,8 +14,8 @@ (defvar doom-auto-accept (getenv "YES") "If non-nil, Doom will auto-accept any confirmation prompts during batch -commands like `doom//packages-install', `doom//packages-update' and -`doom//packages-autoremove'.") +commands like `doom-packages-install', `doom-packages-update' and +`doom-packages-autoremove'.") (defconst doom--dispatch-command-alist ()) (defconst doom--dispatch-alias-alist ()) @@ -213,21 +213,19 @@ recompile. Run this whenever you: (string-match-p "[^ \t\n]" (buffer-string)) (error "Failed to check working tree in %s" dir))))) -(defun doom//refresh (&optional force-p) +(defun doom-refresh (&optional force-p) "Ensure Doom is in a working state by checking autoloads and packages, and recompiling any changed compiled files. This is the shotgun solution to most problems with doom." - (interactive "P") - (doom//reload-doom-autoloads force-p) + (doom-reload-doom-autoloads force-p) (unwind-protect - (progn (ignore-errors (doom//packages-autoremove doom-auto-accept)) - (ignore-errors (doom//packages-install doom-auto-accept))) - (doom//reload-package-autoloads force-p) - (doom//byte-compile nil 'recompile))) + (progn (ignore-errors (doom-packages-autoremove doom-auto-accept)) + (ignore-errors (doom-packages-install doom-auto-accept))) + (doom-reload-package-autoloads force-p) + (doom-byte-compile nil 'recompile))) -(defun doom//upgrade () +(defun doom-upgrade () "Upgrade Doom to the latest version non-destructively." - (interactive) (require 'vc-git) (let* ((gitdir (expand-file-name ".git" doom-emacs-dir)) (branch (vc-git--symbolic-ref doom-emacs-dir)) @@ -251,29 +249,28 @@ problems with doom." (unless (zerop (process-file "git" nil buf nil "fetch" "--tags" doom-repo-remote branch)) (error "Failed to fetch from upstream")) - (when - (let ((current-rev (vc-git-working-revision doom-emacs-dir)) - (rev (string-trim (shell-command-to-string (format "git rev-parse %s/%s" doom-repo-remote branch))))) - (unless rev - (error "Couldn't detect Doom's version. Is %s a repo?" - (abbreviate-file-name doom-emacs-dir))) - (when (equal current-rev rev) - (user-error "Doom is up to date!")) - (message "Updates for Doom are available!\n\n Old revision: %s\n New revision: %s\n" - current-rev rev) - ;; TODO Display newsletter diff - (unless (or doom-auto-accept (y-or-n-p "Proceed?")) - (error "Aborted")) - (message "Removing byte-compiled files from your config (if any)") - (doom//clean-byte-compiled-files) - (unless (zerop (process-file "git" nil buf nil "reset" "--hard" - (format "%s/%s" doom-repo-remote branch))) - (error "An error occurred while checking out the latest commit\n\n%s" - (buffer-string))) - (unless (equal (vc-git-working-revision doom-emacs-dir) rev) - (error "Failed to checkout latest commit.\n\n%s" (buffer-string))) - (doom//refresh 'force) - (message "Done! Please restart Emacs for changes to take effect")))) + (let ((current-rev (vc-git-working-revision doom-emacs-dir)) + (rev (string-trim (shell-command-to-string (format "git rev-parse %s/%s" doom-repo-remote branch))))) + (unless rev + (error "Couldn't detect Doom's version. Is %s a repo?" + (abbreviate-file-name doom-emacs-dir))) + (when (equal current-rev rev) + (user-error "Doom is up to date!")) + (message "Updates for Doom are available!\n\n Old revision: %s\n New revision: %s\n" + current-rev rev) + ;; TODO Display newsletter diff + (unless (or doom-auto-accept (y-or-n-p "Proceed?")) + (error "Aborted")) + (message "Removing byte-compiled files from your config (if any)") + (doom-clean-byte-compiled-files) + (unless (zerop (process-file "git" nil buf nil "reset" "--hard" + (format "%s/%s" doom-repo-remote branch))) + (error "An error occurred while checking out the latest commit\n\n%s" + (buffer-string))) + (unless (equal (vc-git-working-revision doom-emacs-dir) rev) + (error "Failed to checkout latest commit.\n\n%s" (buffer-string))) + (doom-refresh 'force) + (message "Done! Please restart Emacs for changes to take effect"))) (user-error (message "%s Aborting." (error-message-string e))) (error @@ -281,12 +278,11 @@ problems with doom." (car e) (buffer-string)))))))) -(defun doom//quickstart () +(defun doom-quickstart () "Quickly deploy a private module and Doom. This deploys a barebones config to `doom-private-dir', installs all missing packages and regenerates the autoloads file." - (interactive) (let ((short-private-dir (abbreviate-file-name doom-private-dir))) (if (file-directory-p doom-private-dir) (print! (yellow "%s directory already exists. Skipping." short-private-dir)) @@ -307,9 +303,9 @@ packages and regenerates the autoloads file." (with-temp-file config-file (insert "")) (print! (green "Done!"))))) (print! "Installing plugins") - (doom//packages-install) + (doom-packages-install) (print! "Regenerating autoloads files") - (doom//reload-autoloads nil 'force-p) + (doom-reload-autoloads nil 'force-p) (print! (bold (green "\nFinished! Doom is ready to go!\n"))) (with-temp-buffer (doom-template-insert "QUICKSTART_INTRO") @@ -357,24 +353,22 @@ it exists." short-name (car ex) (error-message-string ex)))))) -(defun doom//reload-autoloads (&optional file force-p) +(defun doom-reload-autoloads (&optional file force-p) "Reloads FILE (an autoload file), if it needs reloading. FILE should be one of `doom-autoload-file' or `doom-package-autoload-file'. If it is nil, it will try to reload both. If FORCE-P (universal argument) do it even if it doesn't need reloading!" - (interactive - (list nil current-prefix-arg)) (or (null file) (stringp file) (signal 'wrong-type-argument (list 'stringp file))) (cond ((equal file doom-autoload-file) - (doom//reload-doom-autoloads force-p)) + (doom-reload-doom-autoloads force-p)) ((equal file doom-package-autoload-file) - (doom//reload-package-autoloads force-p)) + (doom-reload-package-autoloads force-p)) ((progn - (doom//reload-doom-autoloads force-p) - (doom//reload-package-autoloads force-p))))) + (doom-reload-doom-autoloads force-p) + (doom-reload-package-autoloads force-p))))) ;; @@ -493,7 +487,7 @@ even if it doesn't need reloading!" (when (re-search-forward "^;;\\(;[^\n]*\\| no-byte-compile: t\\)\n" nil t) (replace-match "" t t))) -(defun doom//reload-doom-autoloads (&optional force-p) +(defun doom-reload-doom-autoloads (&optional force-p) "Refreshes the autoloads.el file, specified by `doom-autoload-file', if necessary (or if FORCE-P is non-nil). @@ -503,7 +497,6 @@ Emacs where to find lazy-loaded functions. This should be run whenever your `doom!' block, or a module autoload file, is modified." - (interactive) (let* ((default-directory doom-emacs-dir) (doom-modules (doom-modules)) (targets @@ -538,7 +531,7 @@ modified." (message "Generating new autoloads.el") (make-directory (file-name-directory doom-autoload-file) t) (with-temp-file doom-autoload-file - (doom--generate-header 'doom//reload-doom-autoloads) + (doom--generate-header 'doom-reload-doom-autoloads) (save-excursion (doom--generate-autoloads (reverse enabled-targets))) ;; Replace autoload paths (only for module autoloads) with absolute @@ -596,7 +589,7 @@ modified." (goto-char (match-beginning 1)) (kill-sexp))) -(defun doom//reload-package-autoloads (&optional force-p) +(defun doom-reload-package-autoloads (&optional force-p) "Compiles `doom-package-autoload-file' from the autoloads files of all installed packages. It also caches `load-path', `Info-directory-list', `doom-disabled-packages', `package-activated-list' and `auto-mode-alist'. @@ -605,7 +598,6 @@ Will do nothing if none of your installed packages have been modified. If FORCE-P (universal argument) is non-nil, regenerate it anyway. This should be run whenever your `doom!' block or update your packages." - (interactive) (if (and (not force-p) (not doom-emacs-changed-p) (file-exists-p doom-package-autoload-file) @@ -620,7 +612,7 @@ This should be run whenever your `doom!' block or update your packages." (let (case-fold-search) (doom-delete-autoloads-file doom-package-autoload-file) (with-temp-file doom-package-autoload-file - (doom--generate-header 'doom//reload-package-autoloads) + (doom--generate-header 'doom-reload-package-autoloads) (save-excursion ;; Cache the important and expensive-to-initialize state here. (doom--generate-var-cache) @@ -643,7 +635,7 @@ This should be run whenever your `doom!' block or update your packages." ;; Byte compilation ;; -(defun doom//byte-compile (&optional modules recompile-p) +(defun doom-byte-compile (&optional modules recompile-p) "Byte compiles your emacs configuration. init.el is always byte-compiled by this. @@ -656,12 +648,10 @@ WARNING: byte-compilation yields marginal gains and makes debugging new issues difficult. It is recommended you don't use it unless you understand the reprecussions. -Use `doom//clean-byte-compiled-files' or `make clean' to reverse +Use `doom-clean-byte-compiled-files' or `make clean' to reverse byte-compilation. If RECOMPILE-P is non-nil, only recompile out-of-date files." - (interactive - (list nil current-prefix-arg)) (let ((default-directory doom-emacs-dir) (total-ok 0) (total-fail 0) @@ -704,8 +694,8 @@ If RECOMPILE-P is non-nil, only recompile out-of-date files." (message "Aborting.") (cl-return-from 'byte-compile))) (unless recompile-p - (doom//clean-byte-compiled-files) - (doom//reload-autoloads)) + (doom-clean-byte-compiled-files) + (doom-reload-autoloads)) (let (doom-emacs-changed-p noninteractive) ;; But first we must be sure that Doom and your private config have @@ -767,13 +757,12 @@ If RECOMPILE-P is non-nil, only recompile out-of-date files." "There were breaking errors." (error-message-string ex) "Reverting changes...") - (quiet! (doom//clean-byte-compiled-files)) + (quiet! (doom-clean-byte-compiled-files)) (print! (yellow "Finished (nothing was byte-compiled)")))))))) -(defun doom//clean-byte-compiled-files () +(defun doom-clean-byte-compiled-files () "Delete all the compiled elc files in your Emacs configuration and private module. This does not include your byte-compiled, third party packages.'" - (interactive) (cl-loop with default-directory = doom-emacs-dir for path in (append (doom-files-in doom-emacs-dir :match "\\.elc$" :depth 0) (doom-files-in doom-private-dir :match "\\.elc$" :depth 1) diff --git a/core/core-packages.el b/core/core-packages.el index 54f4e0ef6..2933791eb 100644 --- a/core/core-packages.el +++ b/core/core-packages.el @@ -6,12 +6,9 @@ ;; ;; The three key commands are: ;; -;; + `bin/doom install` or `doom//packages-install': Installs packages that are -;; wanted, but not installed. -;; + `bin/doom update` or `doom//packages-update': Updates packages that are -;; out-of-date. -;; + `bin/doom autoremove` or `doom//packages-autoremove': Uninstalls packages -;; that are no longer needed. +;; + `bin/doom install`: Installs packages that are wanted, but not installed. +;; + `bin/doom update`: Updates packages that are out-of-date. +;; + `bin/doom autoremove`: Uninstalls packages that are no longer needed. ;; ;; This system reads packages.el files located in each activated module (and one ;; in `doom-core-dir'). These contain `package!' blocks that tell DOOM what diff --git a/core/core-tests.el b/core/core-tests.el index efcb89a8b..10db96efe 100644 --- a/core/core-tests.el +++ b/core/core-tests.el @@ -1,16 +1,15 @@ ;;; core/core-tests.el -*- lexical-binding: t; -*- -(defun doom//run-tests (&optional modules) +(defun doom-run-tests (&optional modules) "Run all loaded tests, specified by MODULES (a list of module cons cells) or command line args following a double dash (each arg should be in the 'module/submodule' format). If neither is available, run all tests in all enabled modules." - (interactive) (let (noninteractive) ;; Core libraries aren't fully loaded in a noninteractive session, so we ;; reload it with `noninteractive' set to nil to force them to. - (quiet! (doom//reload-autoloads)) + (quiet! (doom-reload-autoloads)) (doom-initialize t)) (let ((target-paths ;; Convert targets into a list of string paths, pointing to the root diff --git a/core/core-ui.el b/core/core-ui.el index 21a2305f8..d2d8147d2 100644 --- a/core/core-ui.el +++ b/core/core-ui.el @@ -30,7 +30,7 @@ shorter major mode name in the mode-line. See `doom|set-mode-name'.") (defvar doom-load-theme-hook nil "Hook run when the theme (and font) is initialized (or reloaded -with `doom//reload-theme').") +with `doom/reload-theme').") (defvar doom-before-switch-window-hook nil "Hook run before `switch-window' or `switch-frame' are called. See @@ -578,7 +578,7 @@ frame's window-system, the theme will be reloaded.") ;; out daemon and emacsclient frames. ;; ;; There will still be issues with simultaneous gui and terminal (emacsclient) -;; frames, however. There's always `doom//reload-theme' if you need it! +;; frames, however. There's always `doom/reload-theme' if you need it! (defun doom|init-theme-in-frame (frame) "Reloads the theme in new daemon or tty frames." (when (and (framep frame) diff --git a/core/core.el b/core/core.el index b67f37553..c64cb65f7 100644 --- a/core/core.el +++ b/core/core.el @@ -70,10 +70,10 @@ Use this for files that change often, like cache files.") XDG directory conventions if ~/.config/doom exists.") (defconst doom-autoload-file (concat doom-local-dir "autoloads.el") - "Where `doom//reload-doom-autoloads' will generate its core autoloads file.") + "Where `doom-reload-doom-autoloads' will generate its core autoloads file.") (defconst doom-package-autoload-file (concat doom-local-dir "autoloads.pkg.el") - "Where `doom//reload-package-autoloads' will generate its package.el autoloads + "Where `doom-reload-package-autoloads' will generate its package.el autoloads file.") diff --git a/core/test/test-core.el b/core/test/test-core.el index 437df8173..4e69aa1e4 100644 --- a/core/test/test-core.el +++ b/core/test/test-core.el @@ -11,8 +11,8 @@ (spy-on 'require) (spy-on 'load) - (spy-on 'doom//reload-doom-autoloads) - (spy-on 'doom//reload-package-autoloads) + (spy-on 'doom-reload-doom-autoloads) + (spy-on 'doom-reload-package-autoloads) (spy-on 'doom-initialize-autoloads) (spy-on 'doom-ensure-core-directories) (spy-on 'doom-ensure-core-packages) diff --git a/modules/config/default/+bindings.el b/modules/config/default/+bindings.el index 8fb861da9..346832cbd 100644 --- a/modules/config/default/+bindings.el +++ b/modules/config/default/+bindings.el @@ -628,8 +628,8 @@ :desc "View *Messages*" :n "m" #'view-echo-area-messages :desc "Describe mode" :n "M" #'describe-mode :desc "Toggle profiler" :n "p" #'doom/toggle-profiler - :desc "Reload theme" :n "r" #'doom//reload-theme - :desc "Reload private config" :n "R" #'doom//reload + :desc "Reload theme" :n "r" #'doom/reload-theme + :desc "Reload private config" :n "R" #'doom/reload :desc "Describe DOOM setting" :n "s" #'doom/describe-setters :desc "Describe variable" :n "v" #'describe-variable :desc "Print Doom version" :n "V" #'doom/version diff --git a/modules/ui/doom/config.el b/modules/ui/doom/config.el index 81846cb29..6dbac3128 100644 --- a/modules/ui/doom/config.el +++ b/modules/ui/doom/config.el @@ -30,7 +30,7 @@ :config ;; Reload common faces when reloading doom-themes live (defun +doom*reload-common (&rest _) (load "doom-themes-common.el" nil t)) - (advice-add #'doom//reload-theme :before #'+doom*reload-common) + (advice-add #'doom/reload-theme :before #'+doom*reload-common) ;; improve integration w/ org-mode (add-hook 'doom-load-theme-hook #'doom-themes-org-config)