From f058505306bf4209943799c43c4c4ce88ec40bf6 Mon Sep 17 00:00:00 2001 From: Henrik Lissner Date: Sun, 20 May 2018 12:21:13 +0200 Subject: [PATCH] New bin/doom (eventual replacement for make) This commit adds bin/doom, which acts as the middle man that make once was (and will stay for a while, though the documentation will shift away from using it). It does everything the previous make interface did, but is faster and more flexible. bin/doom should eventually replace the makefile. bin/doom also makes it easier to run Doom outside of ~/.emacs.d and ~/.doom.d with, for example: bin/doom run -p ~/.other.doom.d/ -e ~/.other.emacs.d bin/doom.cmd is included for Windows users, but I don't recommend using it yet. It hasn't been tested nor have I ever written a batch script before. Also update init.example.el with new defaults. --- Makefile | 102 +++++------ bin/doom | 70 ++++++++ bin/doom.cmd | 14 ++ core/autoload/modules.el | 1 - core/autoload/test.el | 94 +++++----- core/core-dispatcher.el | 253 +++++++++++++++++++++++++++ core/core-packages.el | 3 + core/test/autoload-buffers.el | 25 +-- core/test/autoload-package.el | 3 + early-init.el | 5 +- init.el | 5 + init.example.el | 84 +++++---- modules/feature/evil/config.el | 2 +- modules/feature/workspaces/config.el | 2 +- 14 files changed, 493 insertions(+), 170 deletions(-) create mode 100755 bin/doom create mode 100644 bin/doom.cmd create mode 100644 core/core-dispatcher.el diff --git a/Makefile b/Makefile index 47758ab40..3d1b0a8e5 100644 --- a/Makefile +++ b/Makefile @@ -1,12 +1,11 @@ # Ensure emacs always runs from this makefile's PWD -EMACS = emacs -q --eval "(setq user-emacs-directory default-directory load-prefer-newer t)" -DOOM = $(EMACS) --batch -l init.el -DOOMI = $(subst --batch,,$(DOOM)) +DOOM = bin/doom +EMACS = emacs -q $(ARGS) -l init.el MODULES = $(patsubst modules/%/, %, $(sort $(dir $(wildcard modules/*/ modules/*/*/)))) all: - @$(DOOM) -f doom//reload-packages + @$(DOOM) reload ## Shortcuts a: autoloads @@ -20,84 +19,65 @@ ce: compile-elpa re: recompile d: doctor -quickstart: | ~/.doom.d/init.el all recompile -~/.doom.d/init.el: - @echo "Creating ~/.doom.d directory" - @mkdir ~/.doom.d && cp init.example.el ~/.doom.d/init.el - @touch ~/.doom.d/config.el +quickstart: + @$(DOOM) quickstart + ## Package management -install: | .local/autoloads.el - @$(DOOM) -f doom//packages-install - -update: | .local/autoloads.el - @$(DOOM) -f doom//packages-update - -autoremove: | .local/autoloads.el - @$(DOOM) -f doom//packages-autoremove - +install: + @$(DOOM) install +update: + @$(DOOM) update +autoremove: + @$(DOOM) autoremove autoloads: - @$(DOOM) -f doom//reload-autoloads - -upgrade: | _upgrade recompile all -_upgrade: - @git pull origin $(shell git rev-parse --abbrev-ref HEAD) + @$(DOOM) autoloads +upgrade: + @$(DOOM) upgrade ## Byte compilation -# compile -# compile-core +compile: + @$(DOOM) compile +compile-core: + @$(DOOM) compile :core +compile-private: + @$(DOOM) compile :private +compile-plugins: + @$(DOOM) compile :plugins +recompile: + @$(DOOM) recompile +clean: + @$(DOOM) clean # compile-module # compile-module/submodule -compile: | clean - @$(DOOM) -f doom//byte-compile - -compile-core: | clean - @$(DOOM) -f doom//byte-compile-core - -compile-elpa: - @$(DOOM) -f doom//byte-recompile-plugins - $(patsubst %, compile-%, $(MODULES)): | .local/autoloads.el - @$(DOOM) -f doom//byte-compile -- $(patsubst compile-%, %, $@) - -recompile: - @$(DOOM) -f doom//byte-compile -- -r - -clean: - @$(DOOM) -f doom//clean-byte-compiled-files + @$(DOOM) $@ $(subst compile-, , $@) ## Unit tests -# test -# test-core +test: + @$(DOOM) test +test-core: + @$(DOOM) test :core # test-module # test-module/submodule -test: | .local/autoloads.el - @$(DOOM) -f doom//run-tests - -test-core $(patsubst %, test-%, $(MODULES)): | .local/autoloads.el - @$(DOOM) -f doom//run-tests -- $(subst test-, , $@) - +$(patsubst %, test-%, $(MODULES)): + @$(DOOM) test $(subst test-, , $@) # run tests interactively -testi: | .local/autoloads.el - @$(DOOMI) -f doom//run-tests +testi: + @$(EMACS) -l core/autoload/doom.el -f doom//run-tests ## Utility tasks # Runs Emacs from a different folder than ~/.emacs.d; only use this for testing! run: - @$(DOOMI) $(ARGS) --eval "(run-hooks 'after-init-hook 'emacs-startup-hook 'window-setup-hook)" + @$(EMACS) +# Prints debug info about your current setup +info: + @$(DOOM) info # Diagnoses potential OS/environment issues doctor: - @$(EMACS) --script bin/doom-doctor - -# Prints debug info about your current setup -info: - @$(EMACS) --batch -l core/core.el -l core/autoload/util.el -f doom/info - -## Internal tasks -.local/autoloads.el: - @$(DOOM) -f doom-initialize-autoloads + @$(DOOM) doctor .PHONY: all compile test testi clean diff --git a/bin/doom b/bin/doom new file mode 100755 index 000000000..f4001a61a --- /dev/null +++ b/bin/doom @@ -0,0 +1,70 @@ +#!/usr/bin/env bash +":"; command -v emacs >/dev/null || { >&2 echo "Emacs isn't installed"; exit 1; } # -*-emacs-lisp-*- +":"; VERSION=$(emacs --version | head -n1) +":"; [[ $VERSION == *\ 2[0-2].[0-1].[0-9] ]] && { echo "You're running $VERSION"; echo "That version is too old to run Doom. Check your PATH"; echo; exit 2; } +":"; [[ $1 != run ]] && { exec emacs --quick --script "$0" -- $@; exit 0; } +":"; cd $(dirname "${BASH_SOURCE:-${(%):-%x}}")/.. +":"; shift; exec emacs -Q -l bin/doom $@ +":"; exit 0 + +(defun usage () + (with-temp-buffer + (insert (format! "%s %s [COMMAND] [ARGS...]\n" + (bold "Usage:") (file-name-nondirectory load-file-name)) + "\n" + "A command line interfacing for managing Doom Emacs; including\n" + "package management, diagnostics, unit tests, and byte-compilation.\n" + "\n" + "This tool also makes it trivial to launch Emacs out of a different\n" + "folder or with a different private module.\n" + "\n" + (format! (bold "Example:\n")) + " doom install\n" + " doom help update\n" + " doom compile :core lang/php lang/python\n" + " doom run\n" + " doom run -nw file.txt file2.el\n" + " doom run -p ~/.other.doom.d -e ~/.other.emacs.d -nw file.txt\n" + "\n" + (format! (bold "Options:\n")) + " -d --debug\t\tTurns on doom-debug-mode (and debug-on-error)\n" + " -e --emacsd DIR\tUse the emacs config at DIR (e.g. ~/.emacs.d)\n" + " -p --private DIR\tUse the private module at DIR (e.g. ~/.doom.d)\n\n") + (princ (buffer-string))) + (doom--dispatch-help)) + +;; +(let ((argv (cdr (cdr (cdr command-line-args)))) + (emacs-dir (expand-file-name "../" (file-name-directory load-file-name)))) + ;; Parse options + (while (ignore-errors (string-prefix-p "-" (car argv))) + (pcase (pop argv) + ((or "-d" "--debug") + (setq doom-debug-mode t)) + ((or "-p" "--private") + (setq doom-private-dir (expand-file-name (pop argv))) + (or (file-directory-p doom-private-dir) + (error "%s does not exist" doom-private-dir))) + ((or "-e" "--emacsd") + (setq emacs-dir (expand-file-name (pop argv))) + (or (file-directory-p emacs-dir) + (error "%s does not exist" emacs-dir))) + ("--") + (_))) + + ;; Bootstrap Doom + (load (expand-file-name "init" emacs-dir) + nil 'nomessage) + + (cond ((not noninteractive) + ;; Just incase you aren't using Doom! + (when (fboundp 'doom|run-all-startup-hooks) + (doom|run-all-startup-hooks))) + ((equal argv '("help")) + (usage)) + ((not argv) + (message "Expecting a command!\n") + (usage)) + ((let ((default-directory user-emacs-directory)) + (doom-dispatch argv))))) + diff --git a/bin/doom.cmd b/bin/doom.cmd new file mode 100644 index 000000000..2eeb0f2fe --- /dev/null +++ b/bin/doom.cmd @@ -0,0 +1,14 @@ +:: Forward the ./doom script to Emacs + +@ECHO OFF +PUSHD "%~dp0" >NUL + +IF %1=="run" ( + SHIFT + emacs -Q $* -l init.el -f "doom|run-all-startup-hooks" +) ELSE ( + emacs --quick --script ./doom -- $* +) + +POPD >NUL +ECHO ON diff --git a/core/autoload/modules.el b/core/autoload/modules.el index 7535b6b4a..157a40b68 100644 --- a/core/autoload/modules.el +++ b/core/autoload/modules.el @@ -59,7 +59,6 @@ This should be run whenever init.el or an autoload file is modified. Running (generate-autoload-section-trailer "") (doom--stage 'autoloads) outdated) - (doom-initialize) (dolist (path (doom-module-load-path)) (let ((auto-dir (expand-file-name "autoload" path)) (auto-file (expand-file-name "autoload.el" path))) diff --git a/core/autoload/test.el b/core/autoload/test.el index 9017e9288..431fe0111 100644 --- a/core/autoload/test.el +++ b/core/autoload/test.el @@ -1,6 +1,5 @@ ;;; core/autoload/test.el -*- lexical-binding: t; no-byte-compile: t; -*- -;;;###autoload (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 @@ -8,56 +7,53 @@ command line args following a double dash (each arg should be in the If neither is available, run all tests in all enabled modules." (interactive) - (let ((doom-modules (make-hash-table :test #'equal))) - ;; ensure DOOM is initialized - (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. - (doom-initialize t) - (run-hooks 'doom-init-hook 'pre-command-hook 'doom-after-switch-buffer-hook)) - (condition-case-unless-debug ex - (let ((target-paths - ;; Convert targets (either from MODULES or `argv') into a list of - ;; string paths, pointing to the root directory of modules - (cond ((string= (car argv) "--") ; command line - (save-match-data - (cl-loop for arg in (cdr argv) - if (string= arg "core") collect doom-core-dir - else if (string-match-p "/" arg) - nconc (cl-loop for dir in doom-modules-dirs - collect (expand-file-name arg dir)) - else - nconc (cl-loop for dir in doom-modules-dirs - for path = (expand-file-name arg dir) - if (file-directory-p path) - nconc - (cl-remove-if-not - #'file-directory-p - (directory-files path t "^[^.]" t))) - finally do (setq argv nil)))) + (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. + (doom-initialize)) + (condition-case-unless-debug ex + (let ((target-paths + ;; Convert targets (either from MODULES or `argv') into a list of + ;; string paths, pointing to the root directory of modules + (cond ((stringp (car modules)) ; command line + (save-match-data + (cl-loop for arg in modules + if (string= arg "core") collect doom-core-dir + else if (string-match-p "/" arg) + nconc (cl-loop for dir in doom-modules-dirs + collect (expand-file-name arg dir)) + else + nconc (cl-loop for dir in doom-modules-dirs + for path = (expand-file-name arg dir) + if (file-directory-p path) + nconc + (cl-remove-if-not + #'file-directory-p + (directory-files path t "^[^.]" t))) + finally do (setq argv nil)))) - (modules ; cons-cells given to MODULES - (cl-loop for (module . submodule) in modules - if (doom-module-find-path module submodule) - collect it)) + (modules ; cons-cells given to MODULES + (cl-loop for (module . submodule) in modules + if (doom-module-locate-path module submodule) + collect it)) - ((let (noninteractive) - (load (expand-file-name "init.test.el" user-emacs-directory) nil t) - (append (list doom-core-dir) (doom-module-load-path))))))) - ;; Load all the unit test files... - (dolist (path target-paths) - (let ((test-path (expand-file-name "test/" path))) - (when (file-directory-p test-path) - (dolist (test-file (reverse (doom-packages--files test-path "\\.el$"))) - (load test-file nil :noerror))))) - ;; ... then run them - (if noninteractive - (ert-run-tests-batch-and-exit) - (call-interactively #'ert-run-tests-interactively))) - ('error - (lwarn 'doom-test :error - "%s -> %s" - (car ex) (error-message-string ex)))))) + ((append (list doom-core-dir) + (doom-module-load-path)))))) + ;; Load all the unit test files... + (dolist (path target-paths) + (let ((test-path (expand-file-name "test/" path))) + (when (file-directory-p test-path) + (dolist (test-file (reverse (doom-files-under test-path :match "\\.el$"))) + (load test-file nil :noerror))))) + ;; ... then run them + (switch-to-buffer (get-buffer-create "*blank*")) + (if noninteractive + (ert-run-tests-batch-and-exit) + (call-interactively #'ert-run-tests-interactively))) + ('error + (lwarn 'doom-test :error + "%s -> %s" + (car ex) (error-message-string ex))))) ;; --- Test helpers ----------------------- diff --git a/core/core-dispatcher.el b/core/core-dispatcher.el new file mode 100644 index 000000000..c24112443 --- /dev/null +++ b/core/core-dispatcher.el @@ -0,0 +1,253 @@ +;;; -*- lexical-binding: t; no-byte-compile: t; -*- + +(load! autoload/packages) +(load! autoload/modules) +(load! autoload/debug) +(load! autoload/message) + + +;; +;; Dispatcher +;; + +(defvar doom-dispatch-command-alist () + "TODO") + +(defvar doom-dispatch-alias-alist () + "TODO") + +(defun doom--dispatch-format (desc &optional short) + (if (equal desc "TODO") + (format! (yellow "TODO")) + (with-temp-buffer + (let ((fill-column 72)) + (insert desc) + (goto-char (point-min)) + (while (re-search-forward "\n\n[^ \n]" nil t) + (fill-paragraph))) + (if (not short) + (buffer-string) + (goto-char (point-min)) + (buffer-substring-no-properties + (line-beginning-position) + (line-end-position)))))) + +(defun doom--dispatch-help (&optional command desc &rest args) + "TODO" + (if command + (princ (doom--dispatch-format desc)) + (print! (bold "%-10s\t%s\t%s" "Command:" "Alias" "Description")) + (dolist (spec (sort doom-dispatch-command-alist + (lambda (x y) (string-lessp (car x) (car y))))) + (cl-destructuring-bind (command &key desc _body) spec + (let ((alias (car (rassq command doom-dispatch-alias-alist)))) + (print! " %-10s\t%s\t%s" + command (or alias "") + (doom--dispatch-format desc t))))))) + +(defun doom-dispatch (args) + "TODO" + (let ((help (equal (car args) "help"))) + (if help (pop args)) + (cl-destructuring-bind (command &key desc body) + (let ((sym (intern (car args)))) + (or (assq sym doom-dispatch-command-alist) + (assq (cdr (assq sym doom-dispatch-alias-alist)) doom-dispatch-command-alist) + (error "Invalid command: %s" (car args)))) + (if help + (apply #'doom--dispatch-help command desc (cdr args)) + (funcall body (cdr args)))))) + +;; FIXME Clumsy way of registering commands, refactor! +(defmacro def-dispatcher! (command desc &rest body) + "TODO" + (declare (doc-string 2)) + (let* ((command (doom-enlist command)) + (cmd (car command)) + (alias (car (cdr command)))) + `(progn + ,(when alias + `(map-put doom-dispatch-alias-alist ',alias ',cmd)) + (map-put doom-dispatch-command-alist + ',cmd (list :desc ,desc :body (lambda (args) ,@body)))))) + +;; +(def-dispatcher! run + "Run Doom Emacs from bin/doom's parent directory. + +All arguments are passed on to Emacs (except for -p and -e). + + doom run + doom run -nw init.el + +Warning, this is for convenience and testing purposes, Doom will not run its +best or fastest when started in this manner.") + +(def-dispatcher! quickstart + "TODO" + (doom//quickstart)) + +(def-dispatcher! (install i) + "Installs requested plugins that aren't installed." + (doom-initialize) + (when (doom//packages-install) + (doom//reload-autoloads))) + +(def-dispatcher! (update u) + "Checks for and updates outdated plugins." + (doom-initialize) + (when (doom//packages-update) + (doom//reload-autoloads))) + +(def-dispatcher! (autoremove r) + "Removes orphaned plugins." + (doom-initialize) + (when (doom//packages-autoremove) + (doom//reload-autoloads))) + +(def-dispatcher! (autoloads a) + "Regenerates Doom's autoloads file. + +This file tells Emacs where to find your module's autoloaded functions and +plugins." + (doom-initialize) + (doom//reload-autoloads)) + +(def-dispatcher! (upgrade up) + "Checks out the latest Doom on this branch." + (doom//upgrade)) + +(def-dispatcher! (compile c) + "Byte-compiles your config or selected modules. + + compile [TARGETS...] + compile :core :private lang/python + compile feature lang + +Accepts :core, :private and :plugins as special arguments, indicating you want +to byte-compile Doom's core files, your private config or your ELPA plugins, +respectively." + (doom//byte-compile args)) + +(def-dispatcher! (recompile cc) + "Re-byte-compiles outdated *.elc files." + (doom//byte-compile args 'recompile)) + +(def-dispatcher! clean + "Delete all *.elc files." + (doom//clean-byte-compiled-files)) + +(def-dispatcher! test + "Run Doom unit tests." + (load! autoload/test) + (doom//run-tests args)) + +(def-dispatcher! info + "Output system info in markdown for bug reports." + (doom//info)) + +(def-dispatcher! (doctor d) + "Checks for issues with your current Doom config." + (load (expand-file-name "bin/doom-doctor" doom-emacs-dir) + nil t t)) + +(def-dispatcher! (version v) + "Reports the version of Doom and Emacs." + (doom//version)) + +(def-dispatcher! (reload re) + "Reload Doom. + +This is the equivalent of running autoremove, install, autoloads, then +recompile. Run this whenever you: + + 1. Modify your `doom!' block, + 2. Add or remove `package!' blocks to your config, + 3. Add or remove autoloaded functions in module autoloaded files. + 4. Update Doom outside of Doom (e.g. with git)" + (doom-initialize) + (if (let* ((doom--inhibit-reload t) + (autoremove-p (doom//packages-autoremove)) + (install-p (doom//packages-install))) + (or autoremove-p install-p)) + (doom//reload) + (doom//reload-autoloads)) + (doom//byte-compile nil 'recompile)) + + +;; +;; Quality of Life Commands +;; + +(defvar doom-remote "origin" + "TODO") + +(defun doom//upgrade () + "TODO" + (declare (interactive-only t)) + (interactive) + (let ((core-file (expand-file-name "init.el" doom-core-dir)) + (branch (vc-git--symbolic-ref core-file)) + (default-directory doom-emacs-dir)) + (unless (file-exists-p core-file) + (error "Couldn't find %s, was Doom cloned properly?" + (abbreviate-file-name core-file))) + (unless branch + (error "Couldn't detect what branch you're using. Is %s a repo?" + (abbreviate-file-name doom-emacs-dir))) + (unless (eq (vc-state core-file 'Git) 'up-to-date) + (user-error "Doom has been modified; refusing to upgrade. Stash or undo your changes")) + (with-temp-buffer + (let ((buf (current-buffer))) + (when (zerop (process-file "git" nil buf nil + "fetch" "--tags" doom-remote branch)) + (let ((current-rev (vc-git-working-revision core-file)) + (rev (shell-command-to-string (format "git rev-parse %s/%s" doom-remote branch)))) + (unless rev + (error "Couldn't detect Doom's version. Is %s a repo?" + (abbreviate-file-name doom-emacs-dir))) + (if (equal current-rev rev) + (message "Doom is up to date!") + + (when (or (getenv "YES") + (y-or-n-p "Doom is out of date, update?")) + (unless (zerop (process-file "git" nil buf nil + "checkout" (format "%s/%s" doom-remote branch))) + (error "An error occurred while checking out the latest commit")) + (when (file-exists-p (byte-compile-dest-file core-file)) + (message "Your config is byte-compiled, removing byte-compiled files") + (doom//clean-byte-compiled-files)) + (doom//reload) + (message "Done! Please restart Emacs for changes to take effect"))))))))) + +(defun doom//quickstart () + "TODO" + (declare (interactive-only t)) + (interactive) + (let ((short-private-dir (abbreviate-file-name doom-private-dir))) + (when (file-directory-p doom-private-dir) + (error "%s already exists! Aborting." short-private-dir)) + (message "Creating %s directory" short-private-dir) + (make-directory doom-private-dir) + (let ((init-file (expand-file-name "init.el" doom-private-dir))) + (if (not (file-exists-p init-file)) + (message "%sinit.el already exists. Skipping.") + (message "Copying init.example.el to %s" short-private-dir) + (copy-file (expand-file-name "init.example.el" doom-emacs-dir) + init-file))) + (let ((config-file (expand-file-name "config.el" doom-private-dir))) + (if (file-exists-p config-file) + (with-temp-file config-file + (insert "")) + (message "%sconfig.el already exists. Skipping.")))) + (doom-initialize) + (let* ((doom--inhibit-reload t) + (autoremove-p (doom//packages-autoremove)) + (install-p (doom//packages-install))) + (or autoremove-p install-p)) + (doom//reload-autoloads) + (message "\n\nDone! Doom Emacs is ready.\n") + (message "Remember to run M-x all-the-icons-install-fonts after starting Emacs for the first time.")) + +(provide 'core-dispatcher) +;;; core-dispatcher.el ends here diff --git a/core/core-packages.el b/core/core-packages.el index e1d16bfc3..08e67ad04 100644 --- a/core/core-packages.el +++ b/core/core-packages.el @@ -462,6 +462,9 @@ added, if the file exists." (autoload 'use-package "use-package" nil nil 'macro) +;; TODO :after-hook HOOK (load packages on first run of HOOK) +;; TODO Make + ;; diff --git a/core/test/autoload-buffers.el b/core/test/autoload-buffers.el index 49f27c113..98242988a 100644 --- a/core/test/autoload-buffers.el +++ b/core/test/autoload-buffers.el @@ -7,17 +7,18 @@ (dolist (bsym buffer-args) (push `(,bsym (get-buffer-create ,(symbol-name bsym))) buffers)) - `(cl-flet ((buffer-list - (lambda () - (cl-remove-if-not #'buffer-live-p (list ,@(reverse (mapcar #'car buffers))))))) - (let* ((split-width-threshold 0) - (window-min-width 0) - persp-mode - ,@buffers) - (delete-other-windows) - ,@body - (let (kill-buffer-query-functions kill-buffer-hook) - (mapc #'kill-buffer (buffer-list))))))) + `(save-window-excursion + (cl-flet ((buffer-list + (lambda () + (cl-remove-if-not #'buffer-live-p (list ,@(reverse (mapcar #'car buffers))))))) + (let* ((split-width-threshold 0) + (window-min-width 0) + persp-mode + ,@buffers) + (delete-other-windows) + ,@body + (let (kill-buffer-query-functions kill-buffer-hook) + (mapc #'kill-buffer (buffer-list)))))))) ;; (def-test! get-buffers @@ -93,7 +94,7 @@ (with-temp-buffers!! (a b c d e) (dolist (buf (list a b)) (with-current-buffer buf - (emacs-lisp-mode))) + (delay-mode-hooks (emacs-lisp-mode)))) (dolist (buf (list c d e)) (with-current-buffer buf (text-mode))) diff --git a/core/test/autoload-package.el b/core/test/autoload-package.el index 22103070f..cb5f8595e 100644 --- a/core/test/autoload-package.el +++ b/core/test/autoload-package.el @@ -1,6 +1,9 @@ ;; -*- no-byte-compile: t; -*- ;;; core/test/autoload-package.el +(require 'package) +(require 'quelpa) + (defun -pkg (name version &optional reqs) (package-desc-create :name name :version version :reqs reqs)) diff --git a/early-init.el b/early-init.el index e86bca68b..e47330734 100644 --- a/early-init.el +++ b/early-init.el @@ -11,7 +11,8 @@ ;; Faster to disable these here (before they've been initialized) (setq tool-bar-mode nil - menu-bar-mode nil) -(set-scroll-bar-mode nil) + menu-bar-mode nil + scroll-bar-mode nil) +(modify-all-frames-parameters '((vertical-scroll-bars))) ;; TODO Once Emacs 27 hits stable, perhaps replace init.el with early-init.el diff --git a/init.el b/init.el index 50621daa5..497941f17 100644 --- a/init.el +++ b/init.el @@ -27,4 +27,9 @@ ;; ;;; License: MIT +(setq user-emacs-directory (file-name-directory load-file-name) + load-prefer-newer noninteractive) + (require 'core (concat user-emacs-directory "core/core")) +(when noninteractive + (require 'core-dispatcher)) diff --git a/init.example.el b/init.example.el index 92a2163f1..6ad2287c4 100644 --- a/init.example.el +++ b/init.example.el @@ -26,9 +26,6 @@ +childframe) ; uses childframes for popups (Emacs 26+ only) :ui - (popup ; tame sudden yet inevitable temporary windows - +all ; catch all popups that start with an asterix - +defaults) ; default popup rules doom ; what makes DOOM look the way it does doom-dashboard ; a nifty splash screen for Emacs doom-modeline ; a snazzy Atom-inspired mode-line @@ -37,6 +34,9 @@ hl-todo ; highlight TODO/FIXME/NOTE tags nav-flash ; blink the current line after jumping neotree ; a project drawer, like NERDTree for vim + (popup ; tame sudden yet inevitable temporary windows + +all ; catch all popups that start with an asterix + +defaults) ; default popup rules ;tabbar ; FIXME an (incomplete) tab bar for Emacs ;unicode ; extended unicode support for various languages vi-tilde-fringe ; fringe tildes to mark beyond EOB @@ -45,68 +45,66 @@ :tools dired ; making dired pretty [functional] editorconfig ; let someone else argue about tabs vs spaces - ein ; tame Jupyter notebooks with emacs electric-indent ; smarter, keyword-based electric-indent + ;ein ; tame Jupyter notebooks with emacs eshell ; a consistent, cross-platform shell (WIP) - gist ; interacting with github gists + ;gist ; interacting with github gists imenu ; an imenu sidebar and searchable code index ;macos ; MacOS-specific commands - make ; run make tasks from Emacs + ;make ; run make tasks from Emacs ;magit ; - password-store ; password manager for nerds + ;password-store ; password manager for nerds pdf ; pdf enhancements - prodigy ; Managing external services + ;prodigy ; FIXME managing external services & code builders ;rgb ; creating color strings rotate-text ; cycle region at point between text candidates - term ; terminals in Emacs + ;term ; terminals in Emacs tmux ; an API for interacting with tmux upload ; map local to remote projects via ssh/ftp :lang - assembly ; assembly for fun or debugging - cc ; C/C++/Obj-C madness - crystal ; ruby at the speed of c - clojure ; java with a lisp - csharp ; unity, .NET, and mono shenanigans + ;assembly ; assembly for fun or debugging + ;cc ; C/C++/Obj-C madness + ;crystal ; ruby at the speed of c + ;clojure ; java with a lisp + ;csharp ; unity, .NET, and mono shenanigans data ; config/data formats ;erlang ; an elegant language for a more civilized age - elixir ; erlang done right - elm ; care for a cup of TEA? + ;elixir ; erlang done right + ;elm ; care for a cup of TEA? emacs-lisp ; drown in parentheses - ess ; emacs speaks statistics - go ; the hipster dialect - (haskell +intero) ; a language that's lazier than I am - hy ; readability of scheme w/ speed of python - (java +meghanada) ; the poster child for carpal tunnel syndrome - javascript ; all(hope(abandon(ye(who(enter(here)))))) - julia ; a better, faster MATLAB - latex ; writing papers in Emacs has never been so fun - ledger ; an accounting system in Emacs - lua ; one-based indices? one-based indices + ;ess ; emacs speaks statistics + ;go ; the hipster dialect + ;(haskell +intero) ; a language that's lazier than I am + ;hy ; readability of scheme w/ speed of python + ;(java +meghanada) ; the poster child for carpal tunnel syndrome + ;javascript ; all(hope(abandon(ye(who(enter(here)))))) + ;julia ; a better, faster MATLAB + ;latex ; writing papers in Emacs has never been so fun + ;ledger ; an accounting system in Emacs + ;lua ; one-based indices? one-based indices markdown ; writing docs for people to ignore - nim ; python + lisp at the speed of c - nix ; I hereby declare "nix geht mehr!" - ocaml ; an objective camel + ;nim ; python + lisp at the speed of c + ;nix ; I hereby declare "nix geht mehr!" + ;ocaml ; an objective camel (org ; organize your plain life in plain text +attach ; custom attachment system +babel ; running code in org +capture ; org-capture in and outside of Emacs +export ; Exporting org to whatever you want - +present ; Emacs for presentations - +publish) ; Emacs+Org as a static site generator - perl ; write code no one else can comprehend - php ; perl's insecure younger brother - plantuml ; diagrams for confusing people more - purescript ; javascript, but functional - python ; beautiful is better than ugly - rest ; Emacs as a REST client - ruby ; 1.step do {|i| p "Ruby is #{i.even? ? 'love' : 'life'}"} - rust ; Fe2O3.unwrap().unwrap().unwrap().unwrap() - scala ; java, but good + +present) ; Emacs for presentations + ;perl ; write code no one else can comprehend + ;php ; perl's insecure younger brother + ;plantuml ; diagrams for confusing people more + ;purescript ; javascript, but functional + ;python ; beautiful is better than ugly + ;rest ; Emacs as a REST client + ;ruby ; 1.step do {|i| p "Ruby is #{i.even? ? 'love' : 'life'}"} + ;rust ; Fe2O3.unwrap().unwrap().unwrap().unwrap() + ;scala ; java, but good sh ; she sells (ba|z)sh shells on the C xor - swift ; who asked for emoji variables? - typescript ; javascript, but better - web ; the tubes + ;swift ; who asked for emoji variables? + ;web ; the tubes ;; Applications are complex and opinionated modules that transform Emacs ;; toward a specific purpose. They may have additional dependencies and diff --git a/modules/feature/evil/config.el b/modules/feature/evil/config.el index 39c3830a7..dc28e4d68 100644 --- a/modules/feature/evil/config.el +++ b/modules/feature/evil/config.el @@ -61,7 +61,7 @@ evil-visual-state-cursor 'hollow) :config - (add-hook 'doom-init-hook #'evil-mode) + (add-hook 'doom-post-init-hook #'evil-mode) (evil-select-search-module 'evil-search-module 'evil-search) (set! :popup "^\\*evil-registers" '((size . 0.3))) diff --git a/modules/feature/workspaces/config.el b/modules/feature/workspaces/config.el index fd8df7a29..4b6d1f4b4 100644 --- a/modules/feature/workspaces/config.el +++ b/modules/feature/workspaces/config.el @@ -77,7 +77,7 @@ Uses `+workspaces-main' to determine the name of the main workspace." (display-buffer-in-side-window warnings '((window-height . shrink-window-if-larger-than-buffer)))))))))) - (add-hook 'doom-init-hook #'+workspaces|init t) + (add-hook 'doom-post-init-hook #'+workspaces|init t) :config (setq persp-autokill-buffer-on-remove 'kill-weak persp-nil-hidden t