Macros now prefixed with @, instead of suffixed with !

This commit is contained in:
Henrik Lissner 2017-02-09 04:22:08 -05:00
parent ec694649db
commit 6c06aa0ce7
26 changed files with 265 additions and 247 deletions

View file

@ -111,18 +111,18 @@ fed to `doom/packages-delete'."
;;;###autoload ;;;###autoload
(defun doom-read-packages (&optional force-p nopackages) (defun doom-read-packages (&optional force-p nopackages)
"Parses your Emacs config to keep track of packages declared with `package!' "Parses your Emacs config to keep track of packages declared with `@package'
in `doom-packages' and enabled modules in `doom-modules'." in `doom-packages' and enabled modules in `doom-modules'."
(doom-initialize) (doom-initialize)
(when (or force-p (not doom-modules) (not doom-packages)) (when (or force-p (not doom-modules) (not doom-packages))
(setq doom-modules (setq doom-modules
(let (paths mode enabled-modules) (let (paths mode enabled-modules)
(--each (doom--scrape-sexps 'doom! (f-expand "init.el" doom-emacs-dir)) (--each (doom--scrape-sexps '@doom (f-expand "init.el" doom-emacs-dir))
(dolist (module it) (dolist (module it)
(cond ((keywordp module) (cond ((keywordp module)
(setq mode module)) (setq mode module))
((not mode) ((not mode)
(error "Malformed doom! call: no namespace for %s" module)) (error "Malformed @doom call: no namespace for %s" module))
(t (t
(push (cons mode module) enabled-modules))))) (push (cons mode module) enabled-modules)))))
enabled-modules)) enabled-modules))
@ -131,8 +131,8 @@ in `doom-packages' and enabled modules in `doom-modules'."
(setq package-pinned-packages nil (setq package-pinned-packages nil
doom-packages nil) doom-packages nil)
(mapc (lambda (pkg) (cl-pushnew pkg doom-packages :key 'car)) (mapc (lambda (pkg) (cl-pushnew pkg doom-packages :key 'car))
(-map (lambda (args) (-map (lambda (mplist)
(plist! args &delete (@mplist mplist &delete
:preface :ensure :requires :no-require :bind :bind* :bind-keymap :preface :ensure :requires :no-require :bind :bind* :bind-keymap
:bind-keymap* :interpreter :mode :commands :defines :functions :bind-keymap* :interpreter :mode :commands :defines :functions
:defer :init :after :demand :config :diminish :delight)) :defer :init :after :demand :config :diminish :delight))
@ -141,7 +141,7 @@ in `doom-packages' and enabled modules in `doom-modules'."
(-flatten-n (-flatten-n
1 (mapcar (lambda (file) 1 (mapcar (lambda (file)
(when (f-exists-p file) (when (f-exists-p file)
(doom--scrape-sexps 'package! file))) (doom--scrape-sexps '@package file)))
(append (f-glob "core*.el" doom-core-dir) (append (f-glob "core*.el" doom-core-dir)
(--map (doom-module-path (car it) (cdr it) "packages.el") (--map (doom-module-path (car it) (cdr it) "packages.el")
doom-modules))))))) doom-modules)))))))

View file

@ -15,9 +15,9 @@
be a lambda or symbol.") be a lambda or symbol.")
;;;###autoload ;;;###autoload
(defmacro def-setting! (keyword arglist &optional docstring &rest forms) (defmacro @def-setting (keyword arglist &optional docstring &rest forms)
"Define a setting macro. Like `defmacro', this should return a form to be "Define a setting macro. Like `defmacro', this should return a form to be
executed when called with `set!'. FORMS are not evaluated until `set!' calls it." executed when called with `@set'. FORMS are not evaluated until `@set' calls it."
(declare (indent defun) (doc-string 3)) (declare (indent defun) (doc-string 3))
(unless (keywordp keyword) (unless (keywordp keyword)
(error "Not a valid property name: %s" keyword)) (error "Not a valid property name: %s" keyword))
@ -37,13 +37,13 @@ executed when called with `set!'. FORMS are not evaluated until `set!' calls it.
(byte-compile sym))))) (byte-compile sym)))))
;;;###autoload ;;;###autoload
(defmacro set! (keyword &rest values) (defmacro @set (keyword &rest values)
"Set an option defined by `def-setting!'. Skip if doesn't exist." "Set an option defined by `@def-setting'. Skip if doesn't exist."
(declare (indent defun)) (declare (indent defun))
(unless values (unless values
(error "Empty set! for %s" keyword)) (error "Empty @set for %s" keyword))
(cond ((not values) (cond ((not values)
(error "Empty set! for %s" keyword)) (error "Empty @set for %s" keyword))
((not (assq keyword doom-settings)) ((not (assq keyword doom-settings))
(when doom-debug-mode (when doom-debug-mode
(warn "No setting found for %s" keyword))) (warn "No setting found for %s" keyword)))

View file

@ -74,10 +74,10 @@
recentf-max-saved-items 250 recentf-max-saved-items 250
recentf-auto-cleanup 600 recentf-auto-cleanup 600
recentf-filename-handlers '(abbreviate-file-name)) recentf-filename-handlers '(abbreviate-file-name))
(quiet! (recentf-mode 1)) (@quiet (recentf-mode 1))
;; Ediff ;; Ediff
(add-hook! ediff-load (@add-hook ediff-load
(setq ediff-diff-options "-w" (setq ediff-diff-options "-w"
ediff-split-window-function 'split-window-horizontally ediff-split-window-function 'split-window-horizontally
ediff-window-setup-function 'ediff-setup-windows-plain)) ; no extra frames ediff-window-setup-function 'ediff-setup-windows-plain)) ; no extra frames
@ -93,15 +93,15 @@
;; Handles whitespace (tabs/spaces) settings externally. This way projects can ;; Handles whitespace (tabs/spaces) settings externally. This way projects can
;; specify their own formatting rules. ;; specify their own formatting rules.
(package! editorconfig :demand t (@package editorconfig :demand t
:mode ("\\.?editorconfig$" . editorconfig-conf-mode) :mode ("\\.?editorconfig$" . editorconfig-conf-mode)
:config (editorconfig-mode +1) :config (editorconfig-mode +1)
;; Show whitespace in tabs indentation mode ;; Show whitespace in tabs indentation mode
(add-hook! 'editorconfig-custom-hooks (@add-hook 'editorconfig-custom-hooks
(if indent-tabs-mode (whitespace-mode +1)))) (if indent-tabs-mode (whitespace-mode +1))))
;; Auto-close delimiters and blocks as you type ;; Auto-close delimiters and blocks as you type
(package! smartparens :demand t (@package smartparens :demand t
:init :init
(setq sp-autowrap-region nil ; let evil-surround handle this (setq sp-autowrap-region nil ; let evil-surround handle this
sp-highlight-pair-overlay nil sp-highlight-pair-overlay nil
@ -137,59 +137,66 @@
;; Autoloaded Plugins ;; Autoloaded Plugins
;; ;;
(package! ace-link :commands (ace-link-help ace-link-org)) (@package ace-link :commands (ace-link-help ace-link-org))
(package! ace-window (@package ace-window
:commands ace-window :commands ace-window
:config (setq aw-keys '(?a ?s ?d ?f ?g ?h ?j ?k ?l) :config (setq aw-keys '(?a ?s ?d ?f ?g ?h ?j ?k ?l)
aw-scope 'frame aw-scope 'frame
aw-background t)) aw-background t))
(package! avy (@package avy
:commands (avy-goto-char-2 avy-goto-line) :commands (avy-goto-char-2 avy-goto-line)
:config (setq avy-all-windows nil :config (setq avy-all-windows nil
avy-background t)) avy-background t))
(package! command-log-mode (@package command-log-mode
:commands (clm/command-log-buffer command-log-mode global-command-log-mode) :commands (command-log-mode global-command-log-mode)
:config (setq command-log-mode-is-global t)) :config
(@set :popup "*command-log*" :size 40 :align 'right :noselect t)
(setq command-log-mode-auto-show t
command-log-mode-open-log-turns-on-mode t))
(package! emr (@package emr
:commands (emr-show-refactor-menu emr-declare-command) :commands (emr-show-refactor-menu emr-declare-command)
:config (emr-initialize) :config (emr-initialize)
(define-key popup-menu-keymap [escape] 'keyboard-quit)) (define-key popup-menu-keymap [escape] 'keyboard-quit))
(package! expand-region :commands (er/expand-region er/contract-region er/mark-symbol er/mark-word)) (@package expand-region :commands (er/expand-region er/contract-region er/mark-symbol er/mark-word))
(package! goto-last-change :commands goto-last-change) (@package goto-last-change :commands goto-last-change)
(package! help-fns+ ; Improved help commands (@package help-fns+ ; Improved help commands
:commands (describe-buffer describe-command describe-file :commands (describe-buffer describe-command describe-file
describe-keymap describe-option describe-option-of-type)) describe-keymap describe-option describe-option-of-type))
(package! imenu-anywhere (@package imenu-anywhere
:commands (ido-imenu-anywhere ivy-imenu-anywhere helm-imenu-anywhere)) :commands (ido-imenu-anywhere ivy-imenu-anywhere helm-imenu-anywhere))
(package! imenu-list :commands imenu-list-minor-mode) (@package imenu-list :commands imenu-list-minor-mode)
(package! pcre2el :commands rxt-quote-pcre) (@package pcre2el :commands rxt-quote-pcre)
(package! rotate-text (@package rotate-text
:recipe (:fetcher github :repo "debug-ito/rotate-text.el") :recipe (:fetcher github :repo "debug-ito/rotate-text.el")
:commands (rotate-text rotate-text-backward) :commands (rotate-text rotate-text-backward)
:config (push '("true" "false") rotate-text-words)) :config (push '("true" "false") rotate-text-words))
(package! smart-forward (@package smart-forward
:commands (smart-up smart-down smart-backward smart-forward)) :commands (smart-up smart-down smart-backward smart-forward))
(package! smex :commands smex) (@package smex
:commands (smex smex-major-mode-commands)
:config
(setq smex-save-file (concat doom-cache-dir "/smex-items"))
(smex-initialize))
(package! swiper :commands (swiper swiper-all)) (@package swiper :commands (swiper swiper-all))
(package! wgrep (@package wgrep
:commands (wgrep-setup wgrep-change-to-wgrep-mode) :commands (wgrep-setup wgrep-change-to-wgrep-mode)
:config :config
(set! :popup "^\\*ivy-occur counsel-ag" :size 25 :select t :regexp t) (@set :popup "^\\*ivy-occur counsel-ag" :size 25 :select t :regexp t)
(setq wgrep-auto-save-buffer t) (setq wgrep-auto-save-buffer t)
(advice-add 'wgrep-abort-changes :after 'doom/popup-close) (advice-add 'wgrep-abort-changes :after 'doom/popup-close)
(advice-add 'wgrep-finish-edit :after 'doom/popup-close)) (advice-add 'wgrep-finish-edit :after 'doom/popup-close))

View file

@ -4,8 +4,8 @@
(require 's) (require 's)
(require 'f) (require 'f)
(defvar __DIR__ nil "The directory of the currently loaded file (set by `load!')") (defvar __DIR__ nil "The directory of the currently loaded file (set by `@load')")
(defvar __FILE__ nil "The full path of the currently loaded file (set by `load!')") (defvar __FILE__ nil "The full path of the currently loaded file (set by `@load')")
(defun __DIR__ () (defun __DIR__ ()
"Get the full path to the current file's parent folder." "Get the full path to the current file's parent folder."
@ -26,15 +26,15 @@
byte-compile-current-file) byte-compile-current-file)
(error "__FILE__ is unset"))) (error "__FILE__ is unset")))
(package! anaphora (@package anaphora
:commands (awhen aif acond awhile)) :commands (awhen aif acond awhile))
(package! async (@package async
:commands (async-start :commands (async-start
async-start-process async-start-process
async-byte-recompile-directory)) async-byte-recompile-directory))
(package! persistent-soft (@package persistent-soft
:preface (defvar pcache-directory (concat doom-cache-dir "pcache/")) :preface (defvar pcache-directory (concat doom-cache-dir "pcache/"))
:commands (persistent-soft-exists-p :commands (persistent-soft-exists-p
persistent-soft-fetch persistent-soft-fetch
@ -46,12 +46,12 @@
;; Library ;; Library
;; ;;
(defmacro λ! (&rest body) (defmacro @λ (&rest body)
"A shortcut for inline interactive lambdas." "A shortcut for inline interactive lambdas."
(declare (doc-string 1)) (declare (doc-string 1))
`(lambda () (interactive) ,@body)) `(lambda () (interactive) ,@body))
(defmacro after! (feature &rest forms) (defmacro @after (feature &rest forms)
"A smart wrapper around `with-eval-after-load'. Supresses warnings during "A smart wrapper around `with-eval-after-load'. Supresses warnings during
compilation." compilation."
(declare (indent defun) (debug t)) (declare (indent defun) (debug t))
@ -64,14 +64,22 @@ compilation."
'with-no-warnings) 'with-no-warnings)
(with-eval-after-load ',feature ,@forms))) (with-eval-after-load ',feature ,@forms)))
(defmacro quiet! (&rest forms) (defmacro @quiet (&rest forms)
"Run FORMS without making any noise (no messages)." "Run FORMS without making any noise."
`(cl-letf (((symbol-function 'load-file) (lambda (file) (load file nil t))) `(progn
((symbol-function 'message) (lambda (&rest _))) (fset 'doom--old-write-region-fn (symbol-function 'write-region))
(inhibit-message t)) (cl-letf ((standard-output (lambda (&rest _)))
,@forms)) ((symbol-function 'load-file) (lambda (file) (load file nil t)))
((symbol-function 'message) (lambda (&rest _)))
((symbol-function 'write-region)
(lambda (start end filename &optional append visit lockname mustbenew)
(unless visit (setq visit 'no-message))
(doom--old-write-region-fn start end filename append visit lockname mustbenew)))
(inhibit-message t)
(save-silently t))
,@forms)))
(defmacro add-hook! (hook &rest func-or-forms) (defmacro @add-hook (hook &rest func-or-forms)
"A convenience macro for `add-hook'. "A convenience macro for `add-hook'.
HOOK can be one hook or a list of hooks. If the hook(s) are not quoted, -hook is HOOK can be one hook or a list of hooks. If the hook(s) are not quoted, -hook is
@ -82,14 +90,14 @@ will be wrapped in a lambda. A list of symbols will expand into a series of
add-hook calls. add-hook calls.
Examples: Examples:
(add-hook! 'some-mode-hook 'enable-something) (@add-hook 'some-mode-hook 'enable-something)
(add-hook! some-mode '(enable-something and-another)) (@add-hook some-mode '(enable-something and-another))
(add-hook! '(one-mode-hook second-mode-hook) 'enable-something) (@add-hook '(one-mode-hook second-mode-hook) 'enable-something)
(add-hook! (one-mode second-mode) 'enable-something) (@add-hook (one-mode second-mode) 'enable-something)
(add-hook! (one-mode second-mode) (setq v 5) (setq a 2))" (@add-hook (one-mode second-mode) (setq v 5) (setq a 2))"
(declare (indent defun) (debug t)) (declare (indent defun) (debug t))
(unless func-or-forms (unless func-or-forms
(error "add-hook!: FUNC-OR-FORMS is empty")) (error "@add-hook: FUNC-OR-FORMS is empty"))
(let* ((val (car func-or-forms)) (let* ((val (car func-or-forms))
(quoted-p (eq (car-safe hook) 'quote)) (quoted-p (eq (car-safe hook) 'quote))
(hook (if quoted-p (cadr hook) hook)) (hook (if quoted-p (cadr hook) hook))
@ -107,7 +115,7 @@ Examples:
(-list hook))))) (-list hook)))))
funcs)))) funcs))))
(defmacro associate! (mode &rest plist) (defmacro @associate (mode &rest plist)
"Associate a major or minor mode to certain patterns and project files." "Associate a major or minor mode to certain patterns and project files."
(declare (indent 1)) (declare (indent 1))
(unless noninteractive (unless noninteractive
@ -118,7 +126,7 @@ Examples:
(pred (plist-get plist :when))) (pred (plist-get plist :when)))
(cond ((or files in pred) (cond ((or files in pred)
(when (and files (not (or (listp files) (stringp files)))) (when (and files (not (or (listp files) (stringp files))))
(user-error "associate! :files expects a string or list of strings")) (user-error "@associate :files expects a string or list of strings"))
(let ((hook-name (intern (format "doom--init-mode-%s" mode)))) (let ((hook-name (intern (format "doom--init-mode-%s" mode))))
(macroexp-progn (macroexp-progn
(list `(defun ,hook-name () (list `(defun ,hook-name ()
@ -138,10 +146,10 @@ Examples:
(match (match
`(add-to-list ',(if minor 'doom-auto-minor-mode-alist 'auto-mode-alist) `(add-to-list ',(if minor 'doom-auto-minor-mode-alist 'auto-mode-alist)
(cons ,match ',mode))) (cons ,match ',mode)))
(t (user-error "associate! invalid rules for mode [%s] (in %s) (match %s) (files %s)" (t (user-error "@associate invalid rules for mode [%s] (in %s) (match %s) (files %s)"
mode in match files)))))) mode in match files))))))
;; Register keywords for proper indentation (see `map!') ;; Register keywords for proper indentation (see `@map')
(put ':prefix 'lisp-indent-function 'defun) (put ':prefix 'lisp-indent-function 'defun)
(put ':map 'lisp-indent-function 'defun) (put ':map 'lisp-indent-function 'defun)
(put ':map* 'lisp-indent-function 'defun) (put ':map* 'lisp-indent-function 'defun)
@ -151,7 +159,7 @@ Examples:
(put ':leader 'lisp-indent-function 'defun) (put ':leader 'lisp-indent-function 'defun)
(put ':localleader 'lisp-indent-function 'defun) (put ':localleader 'lisp-indent-function 'defun)
(defmacro map! (&rest rest) (defmacro @map (&rest rest)
"A nightmare of a key-binding macro that will use `evil-define-key*', "A nightmare of a key-binding macro that will use `evil-define-key*',
`define-key', `local-set-key' and `global-set-key' depending on context and `define-key', `local-set-key' and `global-set-key' depending on context and
plist key flags. It was designed to make binding multiple keys more concise, plist key flags. It was designed to make binding multiple keys more concise,
@ -193,7 +201,7 @@ Conditional keybinds
(:unless [CONDITION] [...]) (:unless [CONDITION] [...])
Example Example
(map! :map magit-mode-map (@map :map magit-mode-map
:m \"C-r\" 'do-something ; assign C-r in motion state :m \"C-r\" 'do-something ; assign C-r in motion state
:nv \"q\" 'magit-mode-quit-window ; assign to 'q' in normal and visual states :nv \"q\" 'magit-mode-quit-window ; assign to 'q' in normal and visual states
\"C-x C-r\" 'a-global-keybind \"C-x C-r\" 'a-global-keybind
@ -217,7 +225,7 @@ Example
(cond (cond
;; it's a sub expr ;; it's a sub expr
((listp key) ((listp key)
(push (macroexpand `(map! ,@key)) forms)) (push `(@map ,@key) forms))
;; it's a flag ;; it's a flag
((keywordp key) ((keywordp key)
@ -229,10 +237,10 @@ Example
(pcase key (pcase key
(:prefix (setq prefix (concat prefix (kbd (pop rest))))) (:prefix (setq prefix (concat prefix (kbd (pop rest)))))
(:map (setq keymaps (-list (pop rest)))) (:map (setq keymaps (-list (pop rest))))
(:unset `(,(macroexpand `(map! ,(kbd (pop rest)))))) (:unset `((@map ,(kbd (pop rest)))))
(:after (prog1 `((after! ,(pop rest) ,(macroexpand `(map! ,@rest)))) (setq rest '()))) (:after (prog1 `((@after ,(pop rest) (@map ,@rest))) (setq rest '())))
(:when (prog1 `((if ,(pop rest) ,(macroexpand `(map! ,@rest)))) (setq rest '()))) (:when (prog1 `((if ,(pop rest) (@map ,@rest))) (setq rest '())))
(:unless (prog1 `((if (not ,(pop rest)) ,(macroexpand `(map! ,@rest)))) (setq rest '()))) (:unless (prog1 `((if (not ,(pop rest)) (@map ,@rest))) (setq rest '())))
(otherwise ; might be a state prefix (otherwise ; might be a state prefix
(mapc (lambda (letter) (mapc (lambda (letter)
(cond ((assoc letter state-map) (cond ((assoc letter state-map)

View file

@ -76,7 +76,7 @@ if you have byte-compiled your configuration (as intended).")
(autoload 'use-package "use-package" nil nil 'macro) (autoload 'use-package "use-package" nil nil 'macro)
(advice-add 'package-delete :after 'doom*package-delete) (advice-add 'package-delete :after 'doom*package-delete)
(defmacro doom! (&rest packages) (defmacro @doom (&rest packages)
"DOOM Emacs bootstrap macro. List the modules to load. Benefits from "DOOM Emacs bootstrap macro. List the modules to load. Benefits from
byte-compilation." byte-compilation."
(let (mode) (let (mode)
@ -84,7 +84,7 @@ byte-compilation."
(cond ((keywordp p) (cond ((keywordp p)
(setq mode p)) (setq mode p))
((not mode) ((not mode)
(error "No namespace specified on `doom!' for %s" p)) (error "No namespace specified on `@doom' for %s" p))
((eq p '*) ((eq p '*)
(let ((mode-name (substring (symbol-name mode) 1))) (let ((mode-name (substring (symbol-name mode) 1)))
(--map (setq doom-modules (append doom-modules (list (cons mode (f-base it))))) (--map (setq doom-modules (append doom-modules (list (cons mode (f-base it)))))
@ -93,7 +93,7 @@ byte-compilation."
(setq doom-modules (append doom-modules (list (cons mode p)))))))) (setq doom-modules (append doom-modules (list (cons mode p))))))))
(unless noninteractive (unless noninteractive
`(let (file-name-handler-alist) `(let (file-name-handler-alist)
,@(mapcar (lambda (pkg) `(load! ,(car pkg) ,(cdr pkg))) ,@(mapcar (lambda (pkg) `(@load ,(car pkg) ,(cdr pkg)))
doom-modules) doom-modules)
(when (display-graphic-p) (when (display-graphic-p)
@ -159,22 +159,22 @@ avoided to speed up startup."
(defvar __PACKAGE__ nil "The name of the current package.") (defvar __PACKAGE__ nil "The name of the current package.")
(defalias 'use-package! 'use-package (defalias '@use-package 'use-package
"A `use-package' alias. It exists so DOOM configs adhere to the naming "A `use-package' alias. It exists so DOOM configs adhere to the naming
conventions of DOOM emacs. Note that packages are deferred by default. conventions of DOOM emacs. Note that packages are deferred by default.
By DOOM conventions, using this instead of `package!' means you are configuring By DOOM conventions, using this instead of `@package' means you are configuring
a package regardless of whether it's installed or not, while `package!' is used a package regardless of whether it's installed or not, while `@package' is used
to declare how to install/setup a package.") to declare how to install/setup a package.")
(defmacro package! (name &rest plist) (defmacro @package (name &rest plist)
"Declares a package. This does not load nor install them explicitly. "Declares a package. This does not load nor install them explicitly.
If used in `doom-core-dir', this is a wrapper for `use-package!' (all packages If used in `doom-core-dir', this is a wrapper for `@use-package' (all packages
are deferred by default), and takes the same arguments as `use-package'. are deferred by default), and takes the same arguments as `use-package'.
If used outside of `doom-core-dir' (i.e. in packages.el files within modules), If used outside of `doom-core-dir' (i.e. in packages.el files within modules),
this macro serves a purely declarative purpose and doesn't call `use-package!'. this macro serves a purely declarative purpose and doesn't call `@use-package'.
These calls are parsed by `doom-read-packages' to build `doom-packages'. These calls are parsed by `doom-read-packages' to build `doom-packages'.
Adds a few custom properties in either case: Adds a few custom properties in either case:
@ -190,20 +190,20 @@ Adds a few custom properties in either case:
(mapc (lambda (key) (setq plist (use-package-plist-delete plist key))) (mapc (lambda (key) (setq plist (use-package-plist-delete plist key)))
'(:recipe :pin :needs)) '(:recipe :pin :needs))
`(let ((__PACKAGE__ ',name)) `(let ((__PACKAGE__ ',name))
(use-package! ,name ,@plist))) (@use-package ,name ,@plist)))
(defmacro load! (module &optional submodule file) (defmacro @load (module &optional submodule file)
"Load a module from `doom-modules-dir' when both MODULE and SUBMODULE is "Load a module from `doom-modules-dir' when both MODULE and SUBMODULE is
provided (both symbols). If FILE is non-nil, append it to the resulting path. If provided (both symbols). If FILE is non-nil, append it to the resulting path. If
SUBMODULE is nil, MODULE is loaded relative to the current file (see `__DIR__'). SUBMODULE is nil, MODULE is loaded relative to the current file (see `__DIR__').
When SUBMODULE is nil, FILE isn't used. When SUBMODULE is nil, FILE isn't used.
Examples: Examples:
(load! :lang emacs-lisp) (@load :lang emacs-lisp)
Loads modules/lang/emacs-lisp/FILE.el (defaults to config.el). Loads modules/lang/emacs-lisp/FILE.el (defaults to config.el).
(load! +local-module) (@load +local-module)
Loads +local-module.el relative to `__DIR__' or `doom-core-dir'." Loads +local-module.el relative to `__DIR__' or `doom-core-dir'."
(let (path file) (let (path file)
@ -243,7 +243,7 @@ Examples:
(defun doom/reload () (defun doom/reload ()
"Reload `load-path', `doom-modules' and `doom-packages' by "Reload `load-path', `doom-modules' and `doom-packages' by
reinitializing doom and parsing config files for `package!' and `doom!' calls. reinitializing doom and parsing config files for `@package' and `@doom' calls.
There are few reasons to use this." There are few reasons to use this."
(interactive) (interactive)
(doom-initialize t) (doom-initialize t)

View file

@ -36,7 +36,7 @@
map) map)
"Active keymap in popup windows.") "Active keymap in popup windows.")
(def-setting! :popup (&rest rules) (@def-setting :popup (&rest rules)
"Prepend a new popup rule to `shackle-rules'." "Prepend a new popup rule to `shackle-rules'."
(if (not (-all-p 'listp rules)) (if (not (-all-p 'listp rules))
`(cl-pushnew ',rules shackle-rules :key 'car :test 'equal) `(cl-pushnew ',rules shackle-rules :key 'car :test 'equal)
@ -59,7 +59,7 @@
;; Bootstrap ;; Bootstrap
;; ;;
(package! shackle :demand t (@package shackle :demand t
:init :init
(setq shackle-default-alignment 'below (setq shackle-default-alignment 'below
shackle-select-reused-windows t) shackle-select-reused-windows t)
@ -70,7 +70,7 @@
;;; Baseline popup-window rules ;;; Baseline popup-window rules
;; :noesc and :modeline are custom settings and are not part of shackle. See ;; :noesc and :modeline are custom settings and are not part of shackle. See
;; `doom*popup-init' and `doom-popup-buffer' for how they're used. ;; `doom*popup-init' and `doom-popup-buffer' for how they're used.
(set! :popup (@set :popup
'("^ ?\\*doom:.+\\*$" :size 40 :modeline t :regexp t) '("^ ?\\*doom:.+\\*$" :size 40 :modeline t :regexp t)
'("^ ?\\*doom .+\\*$" :size 30 :noselect t :regexp t) '("^ ?\\*doom .+\\*$" :size 30 :noselect t :regexp t)
'("^\\*.+-Profiler-Report .+\\*$" :size 0.3 :regexp t) '("^\\*.+-Profiler-Report .+\\*$" :size 0.3 :regexp t)
@ -183,7 +183,7 @@ prevent popups from messaging up the UI (or vice versa)."
;; Hacks ;; Hacks
;; ;;
(after! evil (@after evil
(let ((map doom-popup-mode-map)) (let ((map doom-popup-mode-map))
(define-key map [remap evil-window-delete] 'doom/popup-close) (define-key map [remap evil-window-delete] 'doom/popup-close)
(define-key map [remap evil-window-move-very-bottom] 'ignore) (define-key map [remap evil-window-move-very-bottom] 'ignore)
@ -257,12 +257,12 @@ the command buffer."
(advice-add 'windmove-find-other-window :override 'doom*ignore-window-parameters-in-popups)) (advice-add 'windmove-find-other-window :override 'doom*ignore-window-parameters-in-popups))
;; (after! magit ;; (@after magit
;; ;; Don't open files (from magit) within the magit popup ;; ;; Don't open files (from magit) within the magit popup
;; (advice-add 'magit-display-file-buffer-traditional :around 'doom*popups-save)) ;; (advice-add 'magit-display-file-buffer-traditional :around 'doom*popups-save))
(after! neotree (@after neotree
(defun doom*popups-save-neotree (orig-fun &rest args) (defun doom*popups-save-neotree (orig-fun &rest args)
"Prevents messing up the neotree buffer on window changes." "Prevents messing up the neotree buffer on window changes."
(let ((neo-p (and (featurep 'neotree) (neo-global--window-exists-p)))) (let ((neo-p (and (featurep 'neotree) (neo-global--window-exists-p))))
@ -289,7 +289,7 @@ the command buffer."
(advice-add 'evil-window-move-far-right :around 'doom*popups-save-neotree)) (advice-add 'evil-window-move-far-right :around 'doom*popups-save-neotree))
(add-hook! org-load (@add-hook org-load
;; Ensures org-src-edit yields control of its buffer to shackle. ;; Ensures org-src-edit yields control of its buffer to shackle.
(defun doom*org-src-switch-to-buffer (buffer context) (pop-to-buffer buffer)) (defun doom*org-src-switch-to-buffer (buffer context) (pop-to-buffer buffer))
(advice-add 'org-src-switch-to-buffer :override 'doom*org-src-switch-to-buffer) (advice-add 'org-src-switch-to-buffer :override 'doom*org-src-switch-to-buffer)
@ -321,8 +321,8 @@ the command buffer."
(setq org-agenda-archives-mode nil (setq org-agenda-archives-mode nil
org-agenda-buffer nil)))) org-agenda-buffer nil))))
(after! org-agenda (@after org-agenda
(after! evil (@after evil
(evil-define-key* 'motion org-agenda-mode-map (evil-define-key* 'motion org-agenda-mode-map
[escape] 'doom/popup-org-agenda-quit [escape] 'doom/popup-org-agenda-quit
(kbd "ESC") 'doom/popup-org-agenda-quit)) (kbd "ESC") 'doom/popup-org-agenda-quit))
@ -332,8 +332,8 @@ the command buffer."
(define-key map "Q" 'doom/popup-org-agenda-quit)))) (define-key map "Q" 'doom/popup-org-agenda-quit))))
(after! repl-toggle (@after repl-toggle
(add-hook! doom-popup-close (@add-hook doom-popup-close
(setq rtog/--last-buffer nil))) (setq rtog/--last-buffer nil)))
(provide 'core-popups) (provide 'core-popups)

View file

@ -4,7 +4,7 @@
;; tools for digging through project files and exposing an API I can use to make ;; tools for digging through project files and exposing an API I can use to make
;; other plugins/features project-aware. ;; other plugins/features project-aware.
(package! projectile :demand t (@package projectile :demand t
:init :init
(setq projectile-cache-file (concat doom-cache-dir "/projectile.cache") (setq projectile-cache-file (concat doom-cache-dir "/projectile.cache")
projectile-completion-system 'ivy projectile-completion-system 'ivy

View file

@ -45,8 +45,8 @@
;; show typed keystrokes in minibuffer ;; show typed keystrokes in minibuffer
(setq echo-keystrokes 0.02) (setq echo-keystrokes 0.02)
;; ...but hide them while isearch is active ;; ...but hide them while isearch is active
(add-hook! isearch-mode (setq echo-keystrokes 0)) (@add-hook isearch-mode (setq echo-keystrokes 0))
(add-hook! isearch-mode-end (setq echo-keystrokes 0.02)) (@add-hook isearch-mode-end (setq echo-keystrokes 0.02))
;; A minor mode for toggling the mode-line ;; A minor mode for toggling the mode-line
(defvar doom--hidden-modeline-format nil (defvar doom--hidden-modeline-format nil
@ -90,7 +90,7 @@ disabled.")
(foreground-color . ,doom-ui-default-foreground)) (foreground-color . ,doom-ui-default-foreground))
default-frame-alist)) default-frame-alist))
;; no fringe in the minibuffer ;; no fringe in the minibuffer
(add-hook! (emacs-startup minibuffer-setup) (@add-hook (emacs-startup minibuffer-setup)
(set-window-fringes (minibuffer-window) 0 0 nil))) (set-window-fringes (minibuffer-window) 0 0 nil)))
@ -101,7 +101,7 @@ disabled.")
;; I modified the built-in `hideshow' package to enable itself when needed. A ;; I modified the built-in `hideshow' package to enable itself when needed. A
;; better, more vim-like code-folding plugin would be the `origami' plugin, but ;; better, more vim-like code-folding plugin would be the `origami' plugin, but
;; until certain breaking bugs are fixed in it, I won't switch over. ;; until certain breaking bugs are fixed in it, I won't switch over.
(use-package! hideshow ; built-in (@use-package hideshow ; built-in
:commands (hs-minor-mode hs-toggle-hiding hs-already-hidden-p) :commands (hs-minor-mode hs-toggle-hiding hs-already-hidden-p)
:init :init
(defun doom*autoload-hideshow () (defun doom*autoload-hideshow ()
@ -110,7 +110,7 @@ disabled.")
(advice-add 'evil-toggle-fold :before 'doom*autoload-hideshow)) (advice-add 'evil-toggle-fold :before 'doom*autoload-hideshow))
;; Show uninterrupted indentation markers with some whitespace voodoo. ;; Show uninterrupted indentation markers with some whitespace voodoo.
(package! highlight-indent-guides (@package highlight-indent-guides
:commands highlight-indent-guides-mode :commands highlight-indent-guides-mode
:config :config
(setq highlight-indent-guides-method 'character) (setq highlight-indent-guides-method 'character)
@ -152,7 +152,7 @@ file."
(set-buffer-modified-p nil)) (set-buffer-modified-p nil))
nil) nil)
(add-hook! highlight-indent-guides-mode (@add-hook highlight-indent-guides-mode
(if highlight-indent-guides-mode (if highlight-indent-guides-mode
(progn (progn
(doom|inject-trailing-whitespace) (doom|inject-trailing-whitespace)
@ -161,44 +161,44 @@ file."
(delete-trailing-whitespace)))) (delete-trailing-whitespace))))
;; Some modes don't adequately highlight numbers, therefore... ;; Some modes don't adequately highlight numbers, therefore...
(package! highlight-numbers :commands highlight-numbers-mode) (@package highlight-numbers :commands highlight-numbers-mode)
;; Line highlighting ;; Line highlighting
(use-package! hl-line ; built-in (@use-package hl-line ; built-in
:config :init
;; stickiness doesn't play nice with emacs 25+ ;; stickiness doesn't play nice with emacs 25+
(setq hl-line-sticky-flag nil (setq hl-line-sticky-flag nil
global-hl-line-sticky-flag nil)) global-hl-line-sticky-flag nil))
;; Line number column. A faster (or equivalent, in the worst case) line number ;; Line number column. A faster (or equivalent, in the worst case) line number
;; plugin than the built-in `linum'. ;; plugin than the built-in `linum'.
(package! nlinum (@package nlinum
:commands nlinum-mode :commands nlinum-mode
:preface (defvar nlinum-format "%4d ") :preface (defvar nlinum-format "%4d ")
:init :init
(add-hook! (@add-hook
(markdown-mode prog-mode scss-mode web-mode conf-mode groovy-mode (markdown-mode prog-mode scss-mode web-mode conf-mode groovy-mode
nxml-mode snippet-mode php-mode) nxml-mode snippet-mode php-mode)
'nlinum-mode) 'nlinum-mode)
:config :config
;; Optimization: calculate line number column width beforehand ;; Optimization: calculate line number column width beforehand
(add-hook! nlinum-mode (@add-hook nlinum-mode
(setq nlinum--width (length (save-excursion (goto-char (point-max)) (setq nlinum--width (length (save-excursion (goto-char (point-max))
(format-mode-line "%l"))))) (format-mode-line "%l")))))
;; Disable nlinum explicitly before making a frame, otherwise nlinum throws ;; Disable nlinum explicitly before making a frame, otherwise nlinum throws
;; linum face errors that prevent the frame from spawning. ;; linum face errors that prevent the frame from spawning.
(add-hook! '(before-make-frame-hook after-make-frame-functions) (@add-hook '(before-make-frame-hook after-make-frame-functions)
(nlinum-mode -1))) (nlinum-mode -1)))
;; Helps us distinguish stacked delimiter pairs. Especially in parentheses-drunk ;; Helps us distinguish stacked delimiter pairs. Especially in parentheses-drunk
;; languages like Lisp. ;; languages like Lisp.
(package! rainbow-delimiters (@package rainbow-delimiters
:commands rainbow-delimiters-mode :commands rainbow-delimiters-mode
:config (setq rainbow-delimiters-max-face-count 3) :config (setq rainbow-delimiters-max-face-count 3)
:init :init
(add-hook! (emacs-lisp-mode lisp-mode js-mode css-mode c-mode-common) (@add-hook (emacs-lisp-mode lisp-mode js-mode css-mode c-mode-common)
'rainbow-delimiters-mode)) 'rainbow-delimiters-mode))
(provide 'core-ui) (provide 'core-ui)

View file

@ -5,12 +5,12 @@
;; strives to make Emacs a much better vim than vim was. ;; strives to make Emacs a much better vim than vim was.
(defvar +evil-leader "," (defvar +evil-leader ","
"The <leader> key, used by the `map!' macro for :leader bindings.") "The <leader> key, used by the `@map' macro for :leader bindings.")
(defvar +evil-localleader "\\" (defvar +evil-localleader "\\"
"The <localleader> key, used by the `map!' macro for :localleader bindings.") "The <localleader> key, used by the `@map' macro for :localleader bindings.")
(def-setting! :evil-state (&rest mode-state-list) (@def-setting :evil-state (&rest mode-state-list)
"Set the initialize STATE of MODE using `evil-set-initial-state'." "Set the initialize STATE of MODE using `evil-set-initial-state'."
(if (-all-p 'listp mode-state-list) (if (-all-p 'listp mode-state-list)
(macroexp-progn (macroexp-progn
@ -29,7 +29,7 @@
;; evil-mode ;; evil-mode
;; ;;
(use-package! evil :demand t (@use-package evil :demand t
:init :init
(setq evil-want-C-u-scroll t (setq evil-want-C-u-scroll t
evil-want-visual-char-semi-exclusive t evil-want-visual-char-semi-exclusive t
@ -45,7 +45,7 @@
evil-insert-skip-empty-lines t) evil-insert-skip-empty-lines t)
:config :config
(set! :popup (@set :popup
'("*evil-registers*" :size 0.3) '("*evil-registers*" :size 0.3)
'("*Command Line*" :size 8)) '("*Command Line*" :size 8))
@ -76,7 +76,7 @@
(Man-mode . emacs) (Man-mode . emacs)
(grep-mode . emacs)))) (grep-mode . emacs))))
(defsubst +evil--textobj! (key inner-fn &optional outer-fn) (defsubst +evil--textobj (key inner-fn &optional outer-fn)
"Define a text object." "Define a text object."
(define-key evil-inner-text-objects-map key inner-fn) (define-key evil-inner-text-objects-map key inner-fn)
(define-key evil-outer-text-objects-map key (or outer-fn inner-fn))) (define-key evil-outer-text-objects-map key (or outer-fn inner-fn)))
@ -145,19 +145,19 @@
;; Plugins ;; Plugins
;; ;;
(use-package! evil-args (@use-package evil-args
:commands (evil-inner-arg evil-outer-arg :commands (evil-inner-arg evil-outer-arg
evil-forward-arg evil-backward-arg evil-forward-arg evil-backward-arg
evil-jump-out-args) evil-jump-out-args)
:init (+evil--textobj! "a" 'evil-inner-arg 'evil-outer-arg)) :init (+evil--textobj "a" 'evil-inner-arg 'evil-outer-arg))
(use-package! evil-commentary (@use-package evil-commentary
:commands (evil-commentary evil-commentary-yank evil-commentary-line) :commands (evil-commentary evil-commentary-yank evil-commentary-line)
:config (evil-commentary-mode 1)) :config (evil-commentary-mode 1))
(use-package! evil-easymotion (@use-package evil-easymotion
:defer 1 :defer 1
:config :config
(defvar +evil--snipe-repeat-fn) (defvar +evil--snipe-repeat-fn)
@ -183,7 +183,7 @@
(evil-snipe-enable-incremental-highlight))))) (evil-snipe-enable-incremental-highlight)))))
(use-package! evil-embrace (@use-package evil-embrace
:after evil-surround :after evil-surround
:config :config
(setq evil-embrace-show-help-p nil) (setq evil-embrace-show-help-p nil)
@ -229,15 +229,15 @@
;; Add extra pairs ;; Add extra pairs
(add-hook 'LaTeX-mode-hook 'embrace-LaTeX-mode-hook) (add-hook 'LaTeX-mode-hook 'embrace-LaTeX-mode-hook)
(add-hook 'org-mode-hook 'embrace-org-mode-hook) (add-hook 'org-mode-hook 'embrace-org-mode-hook)
(add-hook! emacs-lisp-mode (@add-hook emacs-lisp-mode
(embrace-add-pair ?\` "`" "'")) (embrace-add-pair ?\` "`" "'"))
(add-hook! (emacs-lisp-mode lisp-mode) (@add-hook (emacs-lisp-mode lisp-mode)
(embrace-add-pair-regexp ?f "([^ ]+ " ")" '+evil--embrace-elisp-fn)) (embrace-add-pair-regexp ?f "([^ ]+ " ")" '+evil--embrace-elisp-fn))
(add-hook! (org-mode latex-mode) (@add-hook (org-mode latex-mode)
(embrace-add-pair-regexp ?l "\\[a-z]+{" "}" '+evil--embrace-latex))) (embrace-add-pair-regexp ?l "\\[a-z]+{" "}" '+evil--embrace-latex)))
(use-package! evil-escape (@use-package evil-escape
:commands evil-escape-mode :commands evil-escape-mode
:init :init
(defun +evil|escape-disable () (evil-escape-mode -1)) (defun +evil|escape-disable () (evil-escape-mode -1))
@ -252,7 +252,7 @@
evil-escape-delay 0.25)) evil-escape-delay 0.25))
(use-package! evil-exchange (@use-package evil-exchange
:commands evil-exchange :commands evil-exchange
:config :config
(defun +evil*exchange-off () (defun +evil*exchange-off ()
@ -260,7 +260,7 @@
(advice-add 'evil-force-normal-state :after '+evil*exchange-off)) (advice-add 'evil-force-normal-state :after '+evil*exchange-off))
(use-package! evil-indent-plus (@use-package evil-indent-plus
:commands (evil-indent-plus-i-indent :commands (evil-indent-plus-i-indent
evil-indent-plus-a-indent evil-indent-plus-a-indent
evil-indent-plus-i-indent-up evil-indent-plus-i-indent-up
@ -268,16 +268,16 @@
evil-indent-plus-i-indent-up-down evil-indent-plus-i-indent-up-down
evil-indent-plus-a-indent-up-down) evil-indent-plus-a-indent-up-down)
:init :init
(+evil--textobj! "i" 'evil-indent-plus-i-indent 'evil-indent-plus-a-indent) (+evil--textobj "i" 'evil-indent-plus-i-indent 'evil-indent-plus-a-indent)
(+evil--textobj! "I" 'evil-indent-plus-i-indent-up 'evil-indent-plus-a-indent-up) (+evil--textobj "I" 'evil-indent-plus-i-indent-up 'evil-indent-plus-a-indent-up)
(+evil--textobj! "J" 'evil-indent-plus-i-indent-up-down 'evil-indent-plus-a-indent-up-down)) (+evil--textobj "J" 'evil-indent-plus-i-indent-up-down 'evil-indent-plus-a-indent-up-down))
(use-package! evil-matchit (@use-package evil-matchit
:commands (evilmi-jump-items evilmi-text-object global-evil-matchit-mode) :commands (evilmi-jump-items evilmi-text-object global-evil-matchit-mode)
:config (global-evil-matchit-mode 1) :config (global-evil-matchit-mode 1)
:init :init
(+evil--textobj! "%" 'evilmi-text-object) (+evil--textobj "%" 'evilmi-text-object)
(defun +evil/matchit-or-toggle-fold () (defun +evil/matchit-or-toggle-fold ()
"If on a fold-able element, toggle the fold (`hs-toggle-hiding'). Otherwise, "If on a fold-able element, toggle the fold (`hs-toggle-hiding'). Otherwise,
@ -288,7 +288,7 @@ if on a delimiter, jump to the matching one (`evilmi-jump-items')."
(call-interactively 'evilmi-jump-items)))) (call-interactively 'evilmi-jump-items))))
(use-package! evil-multiedit (@use-package evil-multiedit
:commands (evil-multiedit-match-all :commands (evil-multiedit-match-all
evil-multiedit-match-and-next evil-multiedit-match-and-next
evil-multiedit-match-and-prev evil-multiedit-match-and-prev
@ -302,20 +302,20 @@ if on a delimiter, jump to the matching one (`evilmi-jump-items')."
:config (evil-multiedit-default-keybinds)) :config (evil-multiedit-default-keybinds))
(use-package! evil-textobj-anyblock (@use-package evil-textobj-anyblock
:commands (evil-numbers/inc-at-pt evil-numbers/dec-at-pt) :commands (evil-numbers/inc-at-pt evil-numbers/dec-at-pt)
:init :init
(+evil--textobj! "B" 'evil-textobj-anyblock-inner-block 'evil-textobj-anyblock-a-block)) (+evil--textobj "B" 'evil-textobj-anyblock-inner-block 'evil-textobj-anyblock-a-block))
(use-package! evil-search-highlight-persist :demand t (@use-package evil-search-highlight-persist :demand t
:commands (evil-textobj-anyblock-inner-block evil-textobj-anyblock-a-block) :commands (evil-textobj-anyblock-inner-block evil-textobj-anyblock-a-block)
:config :config
(global-evil-search-highlight-persist t) (global-evil-search-highlight-persist t)
(advice-add 'evil-force-normal-state :after 'evil-search-highlight-persist-remove-all)) (advice-add 'evil-force-normal-state :after 'evil-search-highlight-persist-remove-all))
(use-package! evil-snipe :demand t (@use-package evil-snipe :demand t
:init :init
(setq evil-snipe-smart-case t (setq evil-snipe-smart-case t
evil-snipe-repeat-keys nil ; using space to repeat evil-snipe-repeat-keys nil ; using space to repeat
@ -331,12 +331,12 @@ if on a delimiter, jump to the matching one (`evilmi-jump-items')."
(evil-snipe-mode 1) (evil-snipe-mode 1)
(evil-snipe-override-mode 1) (evil-snipe-override-mode 1)
;; Switch to evil-easymotion/avy after first snipe ;; Switch to evil-easymotion/avy after first snipe
(map! :map evil-snipe-parent-transient-map (@map :map evil-snipe-parent-transient-map
"C-;" (λ! (require 'evil-easymotion) "C-;" (@λ (require 'evil-easymotion)
(call-interactively +evil--snipe-repeat-fn)))) (call-interactively +evil--snipe-repeat-fn))))
(use-package! evil-surround (@use-package evil-surround
:commands (global-evil-surround-mode :commands (global-evil-surround-mode
evil-surround-edit evil-surround-edit
evil-Surround-edit evil-Surround-edit
@ -344,7 +344,7 @@ if on a delimiter, jump to the matching one (`evilmi-jump-items')."
:config (global-evil-surround-mode 1)) :config (global-evil-surround-mode 1))
(use-package! evil-visualstar (@use-package evil-visualstar
:commands (global-evil-visualstar-mode :commands (global-evil-visualstar-mode
evil-visualstar/begin-search evil-visualstar/begin-search
evil-visualstar/begin-search-forward evil-visualstar/begin-search-forward
@ -353,7 +353,7 @@ if on a delimiter, jump to the matching one (`evilmi-jump-items')."
;; A side-panel for browsing my project files. Inspired by vim's NERDTree. ;; A side-panel for browsing my project files. Inspired by vim's NERDTree.
(use-package! neotree (@use-package neotree
:commands (neotree-show :commands (neotree-show
neotree-hide neotree-hide
neotree-toggle neotree-toggle
@ -384,13 +384,13 @@ if on a delimiter, jump to the matching one (`evilmi-jump-items')."
"^#.*#$")) "^#.*#$"))
:config :config
(set! :evil-state 'neotree-mode 'motion) (@set :evil-state 'neotree-mode 'motion)
;; Adding keybindings to `neotree-mode-map' wouldn't work for me (they get ;; Adding keybindings to `neotree-mode-map' wouldn't work for me (they get
;; overridden when the neotree buffer is spawned). So we bind them in a hook. ;; overridden when the neotree buffer is spawned). So we bind them in a hook.
(add-hook 'neo-after-create-hook '+evil|neotree-init-keymap) (add-hook 'neo-after-create-hook '+evil|neotree-init-keymap)
(defun +evil|neotree-init-keymap (&rest _) (defun +evil|neotree-init-keymap (&rest _)
(map! :Lm "\\\\" 'evil-window-prev (@map :Lm "\\\\" 'evil-window-prev
:Lm "RET" 'neotree-enter :Lm "RET" 'neotree-enter
:Lm "<return>" 'neotree-enter :Lm "<return>" 'neotree-enter
:Lm "ESC ESC" 'neotree-hide :Lm "ESC ESC" 'neotree-hide

View file

@ -1,20 +1,20 @@
;; -*- no-byte-compile: t; -*- ;; -*- no-byte-compile: t; -*-
;;; feature/evil/packages.el ;;; feature/evil/packages.el
(package! evil) (@package evil)
(package! evil-args) (@package evil-args)
(package! evil-commentary) (@package evil-commentary)
(package! evil-easymotion) (@package evil-easymotion)
(package! evil-embrace) (@package evil-embrace)
(package! evil-escape) (@package evil-escape)
(package! evil-exchange) (@package evil-exchange)
(package! evil-indent-plus) (@package evil-indent-plus)
(package! evil-matchit) (@package evil-matchit)
(package! evil-multiedit) (@package evil-multiedit)
(package! evil-numbers) (@package evil-numbers)
(package! evil-textobj-anyblock) (@package evil-textobj-anyblock)
(package! evil-search-highlight-persist) (@package evil-search-highlight-persist)
(package! evil-snipe) (@package evil-snipe)
(package! evil-surround) (@package evil-surround)
(package! evil-visualstar) (@package evil-visualstar)
(package! neotree) (@package neotree)

View file

@ -1,43 +1,43 @@
;;; feature/version-control/+git.el ;;; feature/version-control/+git.el
(use-package! gitconfig-mode (@use-package gitconfig-mode
:mode "/\\.?git/?config$" :mode "/\\.?git/?config$"
:mode "/\\.gitmodules$" :mode "/\\.gitmodules$"
:init (add-hook 'gitconfig-mode-hook 'flyspell-mode)) :init (add-hook 'gitconfig-mode-hook 'flyspell-mode))
(use-package! gitignore-mode (@use-package gitignore-mode
:mode "/\\.?git/?config$" :mode "/\\.?git/?config$"
:mode "/\\.gitmodules$") :mode "/\\.gitmodules$")
(use-package! git-gutter-fringe (@use-package git-gutter-fringe
:commands git-gutter-mode :commands git-gutter-mode
:init (add-hook! (text-mode prog-mode conf-mode) 'git-gutter-mode) :init (@add-hook (text-mode prog-mode conf-mode) 'git-gutter-mode)
:config :config
(set! :popup "^\\*git-gutter.+\\*$" :regexp t :size 15 :noselect t) (@set :popup "^\\*git-gutter.+\\*$" :regexp t :size 15 :noselect t)
;; Update git-gutter on focus (in case I was using git externally) ;; Update git-gutter on focus (in case I was using git externally)
(add-hook 'focus-in-hook 'git-gutter:update-all-windows) (add-hook 'focus-in-hook 'git-gutter:update-all-windows)
(after! evil (@after evil
;; Refreshing git-gutter on ESC ;; Refreshing git-gutter on ESC
(advice-add 'evil-force-normal-state :after 'git-gutter))) (advice-add 'evil-force-normal-state :after 'git-gutter)))
(use-package! browse-at-remote (@use-package browse-at-remote
:commands (browse-at-remote/browse browse-at-remote/get-url)) :commands (browse-at-remote/browse browse-at-remote/get-url))
(use-package! magit (@use-package magit
:commands magit-status :commands magit-status
:config :config
(set! :popup "^\\*magit.+" :regexp t) (@set :popup "^\\*magit.+" :regexp t)
(after! evil-snipe (@after evil-snipe
;; evil-snipe conflicts with magit ;; evil-snipe conflicts with magit
(add-hook 'magit-mode-hook 'turn-off-evil-snipe-override-mode))) (add-hook 'magit-mode-hook 'turn-off-evil-snipe-override-mode)))
(use-package! evil-magit (@use-package evil-magit
:when (featurep 'evil) :when (featurep 'evil)
:after magit) :after magit)

View file

@ -1,20 +1,20 @@
;;; feature/version-control/config.el ;;; feature/version-control/config.el
(provide '+version-control) (provide '+version-control)
(load! +git) (@load +git)
;; (load! +hg) ;; (@load +hg)
(after! vc-annotate (@after vc-annotate
(set! :popup (@set :popup
'("*vc-diff*" :size 15 :noselect t) '("*vc-diff*" :size 15 :noselect t)
'("*vc-change-log*" :size 15 :select t) '("*vc-change-log*" :size 15 :select t)
'(vc-annotate-mode :same t)) '(vc-annotate-mode :same t))
(set! :evil-state (@set :evil-state
'(vc-annotate-mode normal) '(vc-annotate-mode normal)
'(vc-git-log-view-mode normal)) '(vc-git-log-view-mode normal))
(map! :map vc-annotate-mode-map (@map :map vc-annotate-mode-map
:n "q" 'kill-this-buffer :n "q" 'kill-this-buffer
:n "d" 'vc-annotate-show-diff-revision-at-line :n "d" 'vc-annotate-show-diff-revision-at-line
:n "D" 'vc-annotate-show-changeset-diff-revision-at-line :n "D" 'vc-annotate-show-changeset-diff-revision-at-line

View file

@ -5,11 +5,11 @@
;; n/a ;; n/a
;;; +git ;;; +git
(package! browse-at-remote) (@package browse-at-remote)
(package! evil-magit :needs evil) (@package evil-magit :needs evil)
(package! git-gutter-fringe) (@package git-gutter-fringe)
(package! gitconfig-mode) (@package gitconfig-mode)
(package! gitignore-mode) (@package gitignore-mode)
(package! magit) (@package magit)
;;; TODO +hg ;;; TODO +hg

View file

@ -389,7 +389,7 @@ the workspace and move to the next."
;;;###autoload (autoload '+workspace:switch-next "feature/workspaces/autoload" nil t) ;;;###autoload (autoload '+workspace:switch-next "feature/workspaces/autoload" nil t)
;;;###autoload (autoload '+workspace:switch-previous "feature/workspaces/autoload" nil t) ;;;###autoload (autoload '+workspace:switch-previous "feature/workspaces/autoload" nil t)
(after! evil (@after evil
(evil-define-command +workspace:save-session (&optional name) (evil-define-command +workspace:save-session (&optional name)
"Ex wrapper around `+workspace/save-session'." "Ex wrapper around `+workspace/save-session'."
(interactive "<a>") (+workspace/save-session name)) (interactive "<a>") (+workspace/save-session name))

View file

@ -4,7 +4,7 @@
;; file-based session persistence. The switch from workgroups2 was motivated by ;; file-based session persistence. The switch from workgroups2 was motivated by
;; performance. Workgroups2 wasn't entirely stable either. ;; performance. Workgroups2 wasn't entirely stable either.
(use-package! persp-mode :demand t (@use-package persp-mode :demand t
:init :init
(setq persp-autokill-buffer-on-remove 'kill-weak (setq persp-autokill-buffer-on-remove 'kill-weak
persp-nil-name "main" persp-nil-name "main"
@ -15,6 +15,8 @@
persp-switch-to-added-buffer nil) persp-switch-to-added-buffer nil)
:config :config
(@add-hook emacs-startup (persp-mode 1))
;; Ensure unreal/popup buffers aren't saved ;; Ensure unreal/popup buffers aren't saved
(push (lambda (buf) (doom-popup-p (get-buffer-window buf))) (push (lambda (buf) (doom-popup-p (get-buffer-window buf)))
persp-filter-save-buffers-functions) persp-filter-save-buffers-functions)
@ -43,7 +45,7 @@
(when plist (doom-popup--init window plist))))) (when plist (doom-popup--init window plist)))))
(advice-add 'persp-load-state-from-file :after '+workspaces*reinit-popups)) (advice-add 'persp-load-state-from-file :after '+workspaces*reinit-popups))
(after! ivy (@after ivy
(defun +workspaces|ivy-ignore-non-persp-buffers (b) (defun +workspaces|ivy-ignore-non-persp-buffers (b)
(when persp-mode (when persp-mode
(let ((persp (get-current-persp))) (let ((persp (get-current-persp)))

View file

@ -1,5 +1,5 @@
;; -*- no-byte-compile: t; -*- ;; -*- no-byte-compile: t; -*-
;;; feature/workspaces/packages.el ;;; feature/workspaces/packages.el
(package! persp-mode) (@package persp-mode)

View file

@ -1,12 +1,13 @@
;;; lang/emacs-lisp/config.el ;;; lang/emacs-lisp/config.el
(provide '+emacs-lisp) (provide '+emacs-lisp)
(use-package! elisp-mode (@use-package elisp-mode
:mode ("/Cask$" . emacs-lisp-mode) :mode ("/Cask$" . emacs-lisp-mode)
:init :init
(add-hook! emacs-lisp-mode '(highlight-quoted-mode auto-compile-on-save-mode +emacs-lisp|hook)) (@add-hook emacs-lisp-mode '(highlight-quoted-mode auto-compile-on-save-mode +emacs-lisp|hook))
:config :config
(map! :map emacs-lisp-mode-map (@map :map emacs-lisp-mode-map
:m "gd" '+emacs-lisp/find-function :m "gd" '+emacs-lisp/find-function
:leader :m "gd" '+emacs-lisp/find-function-other-window) :leader :m "gd" '+emacs-lisp/find-function-other-window)
@ -37,8 +38,8 @@
(push i imenu-generic-expression)))) (push i imenu-generic-expression))))
(after! debug ;; elisp debugging (@after debug ;; elisp debugging
(map! :map debugger-mode-map (@map :map debugger-mode-map
:n "RET" 'debug-help-follow :n "RET" 'debug-help-follow
:n "n" 'debugger-step-through :n "n" 'debugger-step-through
:n "c" 'debugger-continue)) :n "c" 'debugger-continue))
@ -48,17 +49,17 @@
;; Plugins ;; Plugins
;; ;;
(use-package! auto-compile (@use-package auto-compile
:commands auto-compile-on-save-mode :commands auto-compile-on-save-mode
:config :config
(setq auto-compile-display-buffer nil (setq auto-compile-display-buffer nil
auto-compile-use-mode-line nil)) auto-compile-use-mode-line nil))
(use-package! highlight-quoted (@use-package highlight-quoted
:commands highlight-quoted-mode) :commands highlight-quoted-mode)
(use-package! slime (@use-package slime
:config (setq inferior-lisp-program "clisp")) :config (setq inferior-lisp-program "clisp"))

View file

@ -1,6 +1,6 @@
;; -*- no-byte-compile: t; -*- ;; -*- no-byte-compile: t; -*-
;;; lang/emacs-lisp/packages.el ;;; lang/emacs-lisp/packages.el
(package! auto-compile) (@package auto-compile)
(package! highlight-quoted) (@package highlight-quoted)
(package! slime) (@package slime)

View file

@ -169,7 +169,7 @@
:match "/screeps/.+$" :match "/screeps/.+$"
:modes (nodejs-project-mode)) :modes (nodejs-project-mode))
(add-hook! screeps-project-mode (@add-hook screeps-project-mode
(when (eq major-mode 'js2-mode) (when (eq major-mode 'js2-mode)
(add-to-list 'flycheck-disabled-checkers 'javascript-jshint) (add-to-list 'flycheck-disabled-checkers 'javascript-jshint)
(setq js2-additional-externs (append '("_") screeps-objects screeps-constants)))) (setq js2-additional-externs (append '("_") screeps-objects screeps-constants))))

View file

@ -1,7 +1,7 @@
;; lang/javascript/config.el ;; lang/javascript/config.el
(provide '+javascript) (provide '+javascript)
(use-package! js2-mode (@use-package js2-mode
:mode "\\.js$" :mode "\\.js$"
:interpreter "node" :interpreter "node"
:init :init
@ -10,17 +10,17 @@
js2-mode-show-parse-errors nil) js2-mode-show-parse-errors nil)
:config :config
(add-hook! '(tern-mode flycheck-mode highlight-indent-guides-mode)) (@add-hook '(tern-mode flycheck-mode highlight-indent-guides-mode))
;; Only way to conform switch-case indentation to editorconfig's config ;; Only way to conform switch-case indentation to editorconfig's config
(add-hook! (setq js-switch-indent-offset js-indent-level)) (@add-hook (setq js-switch-indent-offset js-indent-level))
(map! :map js2-mode-map :localleader :nv ";" 'doom/append-semicolon) (@map :map js2-mode-map :localleader :nv ";" 'doom/append-semicolon)
(set! :repl nodejs-repl) (@set :repl nodejs-repl)
(set! :company-backends tern) (@set :company-backends tern)
(set! :electric-chars ?\} ?\) ?.) (@set :electric-chars ?\} ?\) ?.)
(set! :electric-words "||" "&&") (@set :electric-words "||" "&&")
(set! :emr (@set :emr
(:v js2r-extract-function "extract function") (:v js2r-extract-function "extract function")
(:v js2r-extract-method "extract method") (:v js2r-extract-method "extract method")
(:v js2r-introduce-parameter "introduce parameter") (:v js2r-introduce-parameter "introduce parameter")
@ -48,13 +48,13 @@
(:n js2r-forward-slurp "forward slurp") (:n js2r-forward-slurp "forward slurp")
(:n js2r-forward-barf "forward barf"))) (:n js2r-forward-barf "forward barf")))
(use-package! js2-refactor :after emr) (@use-package js2-refactor :after emr)
(use-package! company-tern :commands company-tern :after tern) (@use-package company-tern :commands company-tern :after tern)
(use-package! jsx-mode :mode "\\.jsx$") (@use-package jsx-mode :mode "\\.jsx$")
(use-package! coffee-mode (@use-package coffee-mode
:mode "\\.coffee$" :mode "\\.coffee$"
:init (setq coffee-indent-like-python-mode t)) :init (setq coffee-indent-like-python-mode t))

View file

@ -1,10 +1,10 @@
;; -*- no-byte-compile: t; -*- ;; -*- no-byte-compile: t; -*-
;;; lang/javascript/packages.el ;;; lang/javascript/packages.el
(package! coffee-mode) (@package coffee-mode)
(package! company-tern :needs +company) (@package company-tern :needs +company)
(package! js2-mode) (@package js2-mode)
(package! js2-refactor) (@package js2-refactor)
(package! jsx-mode) (@package jsx-mode)
(package! tern) (@package tern)

View file

@ -15,7 +15,7 @@
(message "Running: %s" command) (message "Running: %s" command)
(shell-command command))) (shell-command command)))
(defmacro +macos--open-with! (id &optional app dir) (defmacro +macos@open-with (id &optional app dir)
`(defun ,(intern (format "+macos/%s" id)) () `(defun ,(intern (format "+macos/%s" id)) ()
(interactive) (interactive)
(+macos-open-with ,app ,dir))) (+macos-open-with ,app ,dir)))
@ -27,22 +27,22 @@
(browse-url buffer-file-name)) (browse-url buffer-file-name))
;;;###autoload (autoload '+macos/open-in-default-program "os/macos/autoload" nil t) ;;;###autoload (autoload '+macos/open-in-default-program "os/macos/autoload" nil t)
(+macos--open-with! open-in-default-program) (+macos@open-with open-in-default-program)
;;;###autoload (autoload '+macos/reveal-in-finder "os/macos/autoload" nil t) ;;;###autoload (autoload '+macos/reveal-in-finder "os/macos/autoload" nil t)
(+macos--open-with! reveal-in-finder "Finder" default-directory) (+macos@open-with reveal-in-finder "Finder" default-directory)
;;;###autoload (autoload '+macos/reveal-project-in-finder "os/macos/autoload" nil t) ;;;###autoload (autoload '+macos/reveal-project-in-finder "os/macos/autoload" nil t)
(+macos--open-with! reveal-project-in-finder "Finder" (doom-project-root)) (+macos@open-with reveal-project-in-finder "Finder" (doom-project-root))
;;;###autoload (autoload '+macos/send-to-transmit "os/macos/autoload" nil t) ;;;###autoload (autoload '+macos/send-to-transmit "os/macos/autoload" nil t)
(+macos--open-with! send-to-transmit "Transmit") (+macos@open-with send-to-transmit "Transmit")
;;;###autoload (autoload '+macos/send-cwd-to-transmit "os/macos/autoload" nil t) ;;;###autoload (autoload '+macos/send-cwd-to-transmit "os/macos/autoload" nil t)
(+macos--open-with! send-cwd-to-transmit "Transmit" default-directory) (+macos@open-with send-cwd-to-transmit "Transmit" default-directory)
;;;###autoload (autoload '+macos/send-to-launchbar "os/macos/autoload" nil t) ;;;###autoload (autoload '+macos/send-to-launchbar "os/macos/autoload" nil t)
(+macos--open-with! send-to-launchbar "LaunchBar") (+macos@open-with send-to-launchbar "LaunchBar")
;;;###autoload (autoload '+macos/send-project-to-launchbar "os/macos/autoload" nil t) ;;;###autoload (autoload '+macos/send-project-to-launchbar "os/macos/autoload" nil t)
(+macos--open-with! send-project-to-launchbar "LaunchBar" (doom-project-root)) (+macos@open-with send-project-to-launchbar "LaunchBar" (doom-project-root))

View file

@ -28,7 +28,7 @@
(require 'osx-clipboard) (require 'osx-clipboard)
(osx-clipboard-mode +1))) (osx-clipboard-mode +1)))
(after! evil (@after evil
;; On OSX, stop copying each visual state move to the clipboard: ;; On OSX, stop copying each visual state move to the clipboard:
;; https://bitbucket.org/lyro/evil/issue/336/osx-visual-state-copies-the-region-on ;; https://bitbucket.org/lyro/evil/issue/336/osx-visual-state-copies-the-region-on
;; Most of this code grokked from: ;; Most of this code grokked from:

View file

@ -1,5 +1,5 @@
;; -*- no-byte-compile: t; -*- ;; -*- no-byte-compile: t; -*-
;;; os/macos/packages.el ;;; os/macos/packages.el
(package! exec-path-from-shell) (@package exec-path-from-shell)
(package! osx-clipboard) (@package osx-clipboard)

View file

@ -38,24 +38,10 @@
(window-divider-mode +1) (window-divider-mode +1)
;; Causes a flash around the cursor when it moves across a "large" distance.
;; Usually between windows, or across files. This makes it easier to keep track
;; where your cursor is, which I find helpful on my 30" 2560x1600 display.
(use-package! beacon :demand t
:config
(beacon-mode +1)
(setq beacon-color (let ((bg (face-attribute 'highlight :background nil t)))
(if (eq bg 'unspecified)
(face-attribute 'highlight :foreground nil t)
bg))
beacon-blink-when-buffer-changes t
beacon-blink-when-point-moves-vertically 10))
;; Apply the doom-one theme from `doom-themes' for full compatibility; gives ;; Apply the doom-one theme from `doom-themes' for full compatibility; gives
;; Emacs a look inspired by Dark One in Atom. ;; Emacs a look inspired by Dark One in Atom.
;; <https://github.com/hlissner/emacs-doom-theme> ;; <https://github.com/hlissner/emacs-doom-theme>
(use-package! doom-themes :demand t (@use-package doom-themes :demand t
:load-path "~/work/plugins/emacs-doom-theme" :load-path "~/work/plugins/emacs-doom-theme"
:config :config
(load-theme +doom-theme t) (load-theme +doom-theme t)
@ -77,8 +63,22 @@
(require 'doom-nlinum)) (require 'doom-nlinum))
;; Causes a flash around the cursor when it moves across a "large" distance.
;; Usually between windows, or across files. This makes it easier to keep track
;; where your cursor is, which I find helpful on my 30" 2560x1600 display.
(@use-package beacon :demand t
:config
(beacon-mode +1)
(setq beacon-color (let ((bg (face-attribute 'highlight :background nil t)))
(if (eq bg 'unspecified)
(face-attribute 'highlight :foreground nil t)
bg))
beacon-blink-when-buffer-changes t
beacon-blink-when-point-moves-vertically 10))
;; Nicer folded overlays that stand out a bit more ;; Nicer folded overlays that stand out a bit more
(after! hideshow (@after hideshow
(defface doom-folded-face '((t (:foreground "#555" :background "#888"))) (defface doom-folded-face '((t (:foreground "#555" :background "#888")))
"Face to hightlight `hideshow' overlays." "Face to hightlight `hideshow' overlays."
:group 'hideshow) :group 'hideshow)
@ -90,7 +90,7 @@
;; Show diffs with subtle lines in the fringe ;; Show diffs with subtle lines in the fringe
(after! git-gutter-fringe (@after git-gutter-fringe
;; places the git gutter outside the margins. ;; places the git gutter outside the margins.
(setq-default fringes-outside-margins t) (setq-default fringes-outside-margins t)
;; thin fringe bitmaps ;; thin fringe bitmaps

View file

@ -1,6 +1,6 @@
;; -*- no-byte-compile: t; -*- ;; -*- no-byte-compile: t; -*-
;;; ui/doom/packages.el ;;; ui/doom/packages.el
(package! beacon) (@package beacon)
(package! doom-themes) (@package doom-themes)