(v2.0.8) Merge branch 'develop'

* develop: (104 commits)
  v2.0.8 bump
  lang/java: don't install meghanada when compiling
  completion/ivy: fix cyclical-load errors when compiling
  lang/javascript: remove extra parentheses causing nonvariable error
  Disable app modules by default
  lang/org: silence redundant pandoc compilation warnings
  lang/org: replace obsolete org-match-string-no-properties
  private/hlissner: minor refactor
  Update changelog
  lang/org: defvar org-capture-templates
  lang/org: lazy-load ox-pandoc
  Disable show-paren-mode in org-mode
  feature/version-control: add byte-compile cookie to +git
  Address (literal) edge cases with hl-line eob fix
  Fix hl-line mode bleeding into window in Emacs 26
  Appease byte-compiler, system-name => (system-name) #288
  app/rss: fix doom-popup-buffer call #288
  Refactor org-agenda popup integration (prevent load when compiling)
  +workspaces*auto-add-buffer: redisplay => force-mode-line-update
  lang/haskell: refactor +dante submodule
  ...
This commit is contained in:
Henrik Lissner 2017-12-17 00:09:14 -05:00
commit 8c4e6a267d
132 changed files with 1307 additions and 1210 deletions

View file

@ -11,12 +11,19 @@
* Unreleased (develop) * Unreleased (develop)
+ *Module changes:* + *Module changes:*
+ Split =lang/java= into two submodules: one for eclim, and another for + *BREAKING* Split =lang/java= into two submodules: one for eclim, and another for
meghanada. The latter is still the default, however. Also, the eclim meghanada. You will need to update your =init.el= to enable one.
submodule is experimental, since I have few opportunities to test it. submodule is experimental, since I have few opportunities to test it.
+ Add =ui/window-select= (and moved ace-window out of ~core-ui~), which offers + *BREAKING* Ace-window is no longer part of Doom core. It has been moved to
two submodules for interactive window selection/moving: ace-window and =ui/window-select=, which offers two submodules for interactive window
switch-window. selection/moving: ace-window and switch-window.
+ New module: =lang/nix=, adds support for editing nix configuration files.
Contributed by [[https://github.com/ocharles][ocharles]].
+ The =org/*= modules have been moved to =lang/org= and sub-modules therein.
With the introduction of module flags in 2.0.5, it was unnecessary that
org-mode had its own category.
+ Any module can now have an =init.el=, which will be loaded before any other
modules are loaded.
+ =general= + =general=
+ New command naming convention: ~doom//...~ -- denotes that this an + New command naming convention: ~doom//...~ -- denotes that this an
interactive command meant for: interactive command meant for:
@ -28,6 +35,17 @@
+ Autoload files can now specify a predicate cookie to tell the + Autoload files can now specify a predicate cookie to tell the
compiler/autoload reader whether or not to ignore that file. They look like compiler/autoload reader whether or not to ignore that file. They look like
~;;;###if (featurep! :feature evil)~. ~;;;###if (featurep! :feature evil)~.
+ Removed all core def-setting! definitions, because ~set!~ was intended for
cross-module configuration, where modules may or may not be enabled. This
consideration is unnecessary for Doom core configuration. The following
settings have been removed: ~:editorconfig~, ~:theme~, ~:font~,
~:variable-font~, ~:unicode-font~, ~:big-font~.
+ Address various byte-compiler warnings that crop up in Emacs 26+, including
obsolete (if|when)-let macro warnings.
+ Fix byte-compiler complaining that packages couldn't be found when that
package is unwanted (e.g. conditionally installed or disabled packages).
+ =private/{user-login-name}= is no longer a "magic" module that is
automatically loaded.
+ =core-keybinds= Add :g flag to ~map!~ for defining global keybinds along + =core-keybinds= Add :g flag to ~map!~ for defining global keybinds along
with vim keybinds, so you don't have to repeat yourself, just for a global with vim keybinds, so you don't have to repeat yourself, just for a global
binding. binding.
@ -36,15 +54,50 @@
(e.g. ELPA), and whose ~package!~ definition was later changed so that it (e.g. ELPA), and whose ~package!~ definition was later changed so that it
should be handled by another (e.g. QUELPA). This would cause "FAILED" error should be handled by another (e.g. QUELPA). This would cause "FAILED" error
messages while trying to install or update these packages (see [[https://github.com/hlissner/doom-emacs/issues/222][#222]]). messages while trying to install or update these packages (see [[https://github.com/hlissner/doom-emacs/issues/222][#222]]).
+ =core-packages= *BREAKING* Packages are no longer deferred by default. i.e.
~use-package-always-defer~ is now nil, as per the default.
+ =core-popup= Fix window-live-p error when using ~doom/other-popup~ (or its
alias, ~other-popup~).
+ =core-ui= Fix hl-line highlighting the rest of the window past end-of-file
in Emacs 26+. This is caused by a strange dynamic between hl-line and the
new line numbers feature.
+ =feature= + =feature=
+ =file-templates= Disable file templates for .dir-locals.el files. + =file-templates= Disable file templates for .dir-locals.el files.
+ =jump= New command ~+jump/online-select~, which is like ~+jump/online~, but + =jump= New command ~+jump/online-select~, which is like ~+jump/online~, but
will always prompt for which provider to use. will always prompt for which provider to use.
+ =version-control= Fix an issue with shackle not managing magit's popups
properly. This could cause the pointer to end up in the wrong places (e.g.
when you try to commit; the commit message and diff buffers pop up and the
pointer gets stuck in the diff window) (see [[https://github.com/hlissner/doom-emacs/issues/282][#282]]).
+ =completion=
+ =helm= Implement ~:agcwd~, ~:rg~, and ~:rgcwd~ commands for searching with
helm.
+ =ivy=
+ Add C-SPC binding for "previewing" the selected candidate. Useful for
previewing files in ~counsel-find-file~ or ~counsel-projectile-find-file~.
This keybinding is defined in =private/hlissner/+bindings.el=.
+ Disable "very magic" regular expressions in ivy. Specifically, parentheses
are now literal, and must be escaped to make them special. This is
consistent with evil-search regex.
+ Fix a bug where ~:rgcwd~ wasn't showing any results, due to an incorrect
option argument in the ripgrep command string.
+ =ui= + =ui=
+ =doom= This module no longer sets a default font. This is left to the user + =doom= This module no longer sets a default font. This is left to the user
to set in their own private module. Use ~(set! :font "Font Name" :size N)~ to set in their own private module. Use ~(set! :font "Font Name" :size N)~
to do so. to do so.
+ =doom-modeline= Remove the let-binds for ~all-the-icons-scale-factor~, so
that users can customize it themselves (see [[https://github.com/hlissner/doom-emacs/issues/278][#278]]).
+ =tools=
+ =password-store= Fix compatibility with Emacs 26.
+ =lang= + =lang=
+ =clojure=
+ This module has been rewritten with improved Cider and clojurescript
support, as well as new refactoring commands. Thanks to [[https://github.com/teesloane][teesloane]]!
+ =crystal=
+ Add flycheck integration for the Crystal language, powered by
~flycheck-crystal~.
+ Use the ELPA source for ~crystal-mode~. The former QUELPA source
(dotmilk's fork) is no longer maintained.
+ =sh= + =sh=
+ Improve how variables and subshells in double-quoted strings are + Improve how variables and subshells in double-quoted strings are
fontified. fontified.
@ -52,6 +105,18 @@
+ =java= + =java=
+ Polished meghanada-mode integration. + Polished meghanada-mode integration.
+ New (and optional) +eclim submodule and module flag. + New (and optional) +eclim submodule and module flag.
+ =org=
+ Fix scenario where built-in (and incorrect) version of org-mode (8.x) was loaded
instead of 9.0+.
+ This module is incredibly opinionated. More opinionated than I'd like, but
org-mode is an ongoing effort. To address this, =lang/org= has been
reorganized. Variables are now set with ~defvar~ instead of ~setq~, which
makes them more accessible for configuring from private modules.
+ Use the ELPA source for ~ob-rust~. The former QUELPA source (zweifisch's
fork) is no longer maintained.
+ Fix an over-aggressive smartparens config for org-mode that would cause
certain markers and delimiters (like spaces or square brackets) being
repeated in places you didn't want them to be, like inside a checkbox.
+ =rust= + =rust=
+ Now checks the ~RUST_SRC_PATH~ environment variable before looking for + Now checks the ~RUST_SRC_PATH~ environment variable before looking for
Rust's source in ~+rust-src-dir~. Rust's source in ~+rust-src-dir~.

View file

@ -67,7 +67,7 @@ test-core $(patsubst %, test-%, $(MODULES)): init.el .local/autoloads.el
# run tests interactively # run tests interactively
testi: init.el .local/autoloads.el testi: init.el .local/autoloads.el
@$(EMACSI) -f doom//run-tests -f ert @$(EMACSI) -f doom//run-tests
## Utility tasks ## Utility tasks

View file

@ -53,7 +53,7 @@ Inspired from http://demonastery.org/2013/04/emacs-evil-narrow-region/"
If no project is active, return all buffers." If no project is active, return all buffers."
(let ((buffers (doom-buffer-list))) (let ((buffers (doom-buffer-list)))
(if-let (project-root (if (doom-project-p) (doom-project-root))) (if-let* ((project-root (if (doom-project-p) (doom-project-root))))
(cl-loop for buf in buffers (cl-loop for buf in buffers
if (projectile-project-buffer-p buf project-root) if (projectile-project-buffer-p buf project-root)
collect buf) collect buf)
@ -148,7 +148,7 @@ real buffer is:
c) is not a special buffer (its name isn't something like *Help*) c) is not a special buffer (its name isn't something like *Help*)
If BUFFER-OR-NAME is omitted or nil, the current buffer is tested." If BUFFER-OR-NAME is omitted or nil, the current buffer is tested."
(when-let (buf (ignore-errors (window-normalize-buffer buffer-or-name))) (when-let* ((buf (ignore-errors (window-normalize-buffer buffer-or-name))))
(or (buffer-local-value 'doom-real-buffer-p buf) (or (buffer-local-value 'doom-real-buffer-p buf)
(run-hook-with-args-until-success 'doom-real-buffer-functions buf) (run-hook-with-args-until-success 'doom-real-buffer-functions buf)
(not (or (doom-popup-p buf) (not (or (doom-popup-p buf)

View file

@ -60,14 +60,14 @@ selection of all minor-modes, active or not."
(interactive) (interactive)
(unless (string-match-p "\\_<GNUTLS\\_>" system-configuration-features) (unless (string-match-p "\\_<GNUTLS\\_>" system-configuration-features)
(warn "gnutls support isn't built into Emacs, there may be problems")) (warn "gnutls support isn't built into Emacs, there may be problems"))
(if-let (bad-hosts (if-let* ((bad-hosts
(cl-loop for bad (cl-loop for bad
in '("https://wrong.host.badssl.com/" in '("https://wrong.host.badssl.com/"
"https://self-signed.badssl.com/") "https://self-signed.badssl.com/")
if (condition-case _e if (condition-case _e
(url-retrieve bad (lambda (_retrieved) t)) (url-retrieve bad (lambda (_retrieved) t))
(error nil)) (error nil))
collect bad)) collect bad)))
(error (format "tls seems to be misconfigured (it got %s)." (error (format "tls seems to be misconfigured (it got %s)."
bad-hosts)) bad-hosts))
(url-retrieve "https://badssl.com" (url-retrieve "https://badssl.com"

View file

@ -12,7 +12,7 @@ PROMPT (a string) and COMMAND (a list of command plists; see `def-menu!').")
(completing-read prompt (mapcar #'car commands))) (completing-read prompt (mapcar #'car commands)))
(defun doom--menu-read (prompt commands) (defun doom--menu-read (prompt commands)
(if-let (choice (funcall doom-menu-display-fn prompt commands)) (if-let* ((choice (funcall doom-menu-display-fn prompt commands)))
(cdr (assoc choice commands)) (cdr (assoc choice commands))
(user-error "Aborted"))) (user-error "Aborted")))

View file

@ -39,7 +39,7 @@ quelpa. Throws an error if NOERROR is nil and the package isn't installed."
((assq name package-alist) ((assq name package-alist)
'elpa) 'elpa)
((not noerror) ((not noerror)
(error "%s package not installed" name)))) (error "%s package is not installed" name))))
;;;###autoload ;;;###autoload
(defun doom-package-outdated-p (name) (defun doom-package-outdated-p (name)
@ -48,7 +48,7 @@ list, whose car is NAME, and cdr the current version list and latest version
list of the package." list of the package."
(cl-assert (symbolp name) t) (cl-assert (symbolp name) t)
(doom-initialize-packages) (doom-initialize-packages)
(when-let (desc (cadr (assq name package-alist))) (when-let* ((desc (cadr (assq name package-alist))))
(let* ((old-version (package-desc-version desc)) (let* ((old-version (package-desc-version desc))
(new-version (new-version
(pcase (doom-package-backend name) (pcase (doom-package-backend name)
@ -57,7 +57,7 @@ list of the package."
(dir (expand-file-name (symbol-name name) quelpa-build-dir)) (dir (expand-file-name (symbol-name name) quelpa-build-dir))
(inhibit-message (not doom-debug-mode)) (inhibit-message (not doom-debug-mode))
(quelpa-upgrade-p t)) (quelpa-upgrade-p t))
(if-let (ver (quelpa-checkout recipe dir)) (if-let* ((ver (quelpa-checkout recipe dir)))
(version-to-list ver) (version-to-list ver)
old-version))) old-version)))
('elpa ('elpa
@ -115,7 +115,7 @@ If INSTALLED-ONLY-P, only return packages that are installed."
(defun doom-get-depending-on (name) (defun doom-get-depending-on (name)
"Return a list of packages that depend on the package named NAME." "Return a list of packages that depend on the package named NAME."
(doom-initialize) (doom-initialize)
(when-let (desc (cadr (assq name package-alist))) (when-let* ((desc (cadr (assq name package-alist))))
(mapcar #'package-desc-name (package--used-elsewhere-p desc nil t)))) (mapcar #'package-desc-name (package--used-elsewhere-p desc nil t))))
;;;###autoload ;;;###autoload
@ -131,7 +131,7 @@ containing (PACKAGE-SYMBOL OLD-VERSION-LIST NEW-VERSION-LIST).
If INCLUDE-FROZEN-P is non-nil, check frozen packages as well. If INCLUDE-FROZEN-P is non-nil, check frozen packages as well.
Used by `doom/packages-update'." Used by `doom//packages-update'."
(let (quelpa-pkgs elpa-pkgs) (let (quelpa-pkgs elpa-pkgs)
;; Separate quelpa from elpa packages ;; Separate quelpa from elpa packages
(dolist (pkg (doom-get-packages t)) (dolist (pkg (doom-get-packages t))
@ -164,7 +164,7 @@ Used by `doom/packages-update'."
"Return a list of symbols representing packages that are no longer needed or "Return a list of symbols representing packages that are no longer needed or
depended on. depended on.
Used by `doom/packages-autoremove'." Used by `doom//packages-autoremove'."
(doom-initialize-packages t) (doom-initialize-packages t)
(let ((package-selected-packages (let ((package-selected-packages
(append (mapcar #'car doom-packages) doom-core-packages))) (append (mapcar #'car doom-packages) doom-core-packages)))
@ -183,7 +183,7 @@ the package symbol, and whose CDR is a plist taken from that package's
If INCLUDE-IGNORED-P is non-nil, includes missing packages that are ignored, If INCLUDE-IGNORED-P is non-nil, includes missing packages that are ignored,
i.e. they have an :ignore property. i.e. they have an :ignore property.
Used by `doom/packages-install'." Used by `doom//packages-install'."
(cl-loop for desc in (doom-get-packages) (cl-loop for desc in (doom-get-packages)
for (name . plist) = desc for (name . plist) = desc
if (and (or include-ignored-p if (and (or include-ignored-p
@ -255,12 +255,13 @@ example; the package name can be omitted)."
(when (doom-package-different-backend-p name) (when (doom-package-different-backend-p name)
(doom-delete-package name t)) (doom-delete-package name t))
(user-error "%s is already installed" name)) (user-error "%s is already installed" name))
(let ((plist (or plist (cdr (assq name doom-packages)))) (let* ((inhibit-message (not doom-debug-mode))
(inhibit-message (not doom-debug-mode)) (plist (or plist (cdr (assq name doom-packages))))
(recipe (plist-get plist :recipe)) (recipe (plist-get plist :recipe))
quelpa-upgrade-p) quelpa-upgrade-p)
(cond (recipe (quelpa recipe)) (if recipe
(t (package-install name))) (quelpa recipe)
(package-install name))
(when (package-installed-p name) (when (package-installed-p name)
(cl-pushnew (cons name plist) doom-packages :test #'eq :key #'car) (cl-pushnew (cons name plist) doom-packages :test #'eq :key #'car)
t))) t)))
@ -271,6 +272,8 @@ package.el as appropriate."
(doom-initialize) (doom-initialize)
(unless (package-installed-p name) (unless (package-installed-p name)
(user-error "%s isn't installed" name)) (user-error "%s isn't installed" name))
(when (doom-package-different-backend-p name)
(user-error "%s's backend has changed and must be uninstalled first" name))
(when (or force-p (doom-package-outdated-p name)) (when (or force-p (doom-package-outdated-p name))
(let ((inhibit-message (not doom-debug-mode)) (let ((inhibit-message (not doom-debug-mode))
(desc (cadr (assq name package-alist)))) (desc (cadr (assq name package-alist))))
@ -288,7 +291,7 @@ package.el as appropriate."
(package-compute-transaction () (list (list archive)))))) (package-compute-transaction () (list (list archive))))))
(package-download-transaction packages)))) (package-download-transaction packages))))
(unless (doom-package-outdated-p name) (unless (doom-package-outdated-p name)
(when-let (old-dir (package-desc-dir desc)) (when-let* ((old-dir (package-desc-dir desc)))
(when (file-directory-p old-dir) (when (file-directory-p old-dir)
(delete-directory old-dir t))) (delete-directory old-dir t)))
t)))) t))))
@ -352,7 +355,8 @@ package.el as appropriate."
(message! "Installing %s" (car pkg)) (message! "Installing %s" (car pkg))
(doom--condition-case! (doom--condition-case!
(message! " %s%s" (message! " %s%s"
(cond ((package-installed-p (car pkg)) (cond ((and (package-installed-p (car pkg))
(not (doom-package-different-backend-p (car pkg))))
(dark (white "ALREADY INSTALLED"))) (dark (white "ALREADY INSTALLED")))
((doom-install-package (car pkg) (cdr pkg)) ((doom-install-package (car pkg) (cdr pkg))
(green "DONE")) (green "DONE"))
@ -494,7 +498,7 @@ calls."
(user-error "All packages are up to date")))) (user-error "All packages are up to date"))))
(list (cdr (assq (car (assoc package package-alist)) packages))))) (list (cdr (assq (car (assoc package package-alist)) packages)))))
(cl-destructuring-bind (package old-version new-version) pkg (cl-destructuring-bind (package old-version new-version) pkg
(if-let (desc (doom-package-outdated-p package)) (if-let* ((desc (doom-package-outdated-p package)))
(let ((old-v-str (package-version-join old-version)) (let ((old-v-str (package-version-join old-version))
(new-v-str (package-version-join new-version))) (new-v-str (package-version-join new-version)))
(if (y-or-n-p (format "%s will be updated from %s to %s. Update?" (if (y-or-n-p (format "%s will be updated from %s to %s. Update?"

View file

@ -4,7 +4,7 @@
(defun doom-popup-p (&optional target) (defun doom-popup-p (&optional target)
"Return t if TARGET (a window or buffer) is a popup. Uses current window if "Return t if TARGET (a window or buffer) is a popup. Uses current window if
omitted." omitted."
(when-let (target (or target (selected-window))) (when-let* ((target (or target (selected-window))))
(cond ((bufferp target) (cond ((bufferp target)
(and (buffer-live-p target) (and (buffer-live-p target)
(buffer-local-value 'doom-popup-mode target))) (buffer-local-value 'doom-popup-mode target)))
@ -31,7 +31,7 @@ this popup, just the specified properties. Returns the new popup window."
(defun doom-popup-switch-to-buffer (buffer) (defun doom-popup-switch-to-buffer (buffer)
"Switch the current (or closest) pop-up window to BUFFER." "Switch the current (or closest) pop-up window to BUFFER."
(unless (doom-popup-p) (unless (doom-popup-p)
(if-let (popups (doom-popup-windows)) (if-let* ((popups (doom-popup-windows)))
(select-window (car popups)) (select-window (car popups))
(error "No popups to switch to"))) (error "No popups to switch to")))
(set-window-dedicated-p nil nil) (set-window-dedicated-p nil nil)
@ -113,7 +113,7 @@ window parameter."
((or 'above 'below) (window-height window)))) ((or 'above 'below) (window-height window))))
(defun doom--popup-data (window) (defun doom--popup-data (window)
(when-let (buffer (window-buffer window)) (when-let* ((buffer (window-buffer window)))
`(,(buffer-name buffer) `(,(buffer-name buffer)
:file ,(buffer-file-name buffer) :file ,(buffer-file-name buffer)
:rules ,(window-parameter window 'popup) :rules ,(window-parameter window 'popup)
@ -167,7 +167,7 @@ Returns t if popups were restored, nil otherwise."
(size (plist-get (cdr spec) :size))) (size (plist-get (cdr spec) :size)))
(when (and (not buffer) file) (when (and (not buffer) file)
(setq buffer (setq buffer
(if-let (buf (get-file-buffer file)) (if-let* ((buf (get-file-buffer file)))
(clone-indirect-buffer (buffer-name buf) nil t) (clone-indirect-buffer (buffer-name buf) nil t)
(find-file-noselect file t)))) (find-file-noselect file t))))
(when size (when size
@ -212,7 +212,7 @@ If FORCE-P is non-nil (or this function is called interactively), ignore popups'
:autoclose property. This command will never close :static popups." :autoclose property. This command will never close :static popups."
(interactive (interactive
(list (called-interactively-p 'interactive))) (list (called-interactively-p 'interactive)))
(when-let (popups (doom-popup-windows t)) (when-let* ((popups (doom-popup-windows t)))
(let (success doom-popup-remember-history) (let (success doom-popup-remember-history)
(setq doom-popup-history (delq nil (mapcar #'doom--popup-data popups))) (setq doom-popup-history (delq nil (mapcar #'doom--popup-data popups)))
(dolist (window popups success) (dolist (window popups success)
@ -225,7 +225,7 @@ If FORCE-P is non-nil (or this function is called interactively), ignore popups'
"Like `doom/popup-close-all', but kill *all* popups, including :static ones, "Like `doom/popup-close-all', but kill *all* popups, including :static ones,
without leaving any trace behind (muahaha)." without leaving any trace behind (muahaha)."
(interactive) (interactive)
(when-let (popups (doom-popup-windows)) (when-let* ((popups (doom-popup-windows)))
(let (doom-popup-remember-history) (let (doom-popup-remember-history)
(setq doom-popup-history nil) (setq doom-popup-history nil)
(mapc #'delete-window popups)))) (mapc #'delete-window popups))))
@ -251,7 +251,7 @@ without leaving any trace behind (muahaha)."
(defun doom/popup-toggle-messages () (defun doom/popup-toggle-messages ()
"Toggle *Messages* buffer." "Toggle *Messages* buffer."
(interactive) (interactive)
(if-let (win (get-buffer-window "*Messages*")) (if-let* ((win (get-buffer-window "*Messages*")))
(doom/popup-close win) (doom/popup-close win)
(doom-popup-buffer (get-buffer "*Messages*")))) (doom-popup-buffer (get-buffer "*Messages*"))))
@ -259,11 +259,11 @@ without leaving any trace behind (muahaha)."
(defun doom/other-popup (count) (defun doom/other-popup (count)
"Cycle through popup windows. Like `other-window', but for popups." "Cycle through popup windows. Like `other-window', but for popups."
(interactive "p") (interactive "p")
(if-let (popups (if (doom-popup-p) (if-let* ((popups (if (doom-popup-p)
(cdr (memq (selected-window) doom-popup-windows)) (cdr (memq (selected-window) doom-popup-windows))
(setq doom-popup-other-window (selected-window)) (setq doom-popup-other-window (selected-window))
doom-popup-windows)) doom-popup-windows)))
(select-window (nth (mod (1- count) (length popups)) popups)) (ignore-errors (select-window (nth (mod (1- count) (length popups)) popups)))
(unless (eq (selected-window) doom-popup-other-window) (unless (eq (selected-window) doom-popup-other-window)
(when doom-popup-other-window (when doom-popup-other-window
(select-window doom-popup-other-window t) (select-window doom-popup-other-window t)
@ -419,6 +419,6 @@ properties."
(with-selected-window window (with-selected-window window
(doom-popup-mode -1) (doom-popup-mode -1)
(when autokill-p (when autokill-p
(when-let (process (get-buffer-process (current-buffer))) (when-let* ((process (get-buffer-process (current-buffer))))
(set-process-query-on-exit-flag process nil)) (set-process-query-on-exit-flag process nil))
(kill-buffer (current-buffer))))))) (kill-buffer (current-buffer)))))))

View file

@ -16,7 +16,7 @@ If neither is available, run all tests in all enabled modules."
(doom-initialize-modules nil)) (doom-initialize-modules nil))
;; collect targets ;; collect targets
(cond ((and argv (equal (car argv) "--")) (cond ((and argv (equal (car argv) "--"))
(cl-loop for arg in argv (cl-loop for arg in (cdr argv)
if (equal arg "core") if (equal arg "core")
do (push (expand-file-name "test/" doom-core-dir) targets) do (push (expand-file-name "test/" doom-core-dir) targets)
else else
@ -60,9 +60,9 @@ If neither is available, run all tests in all enabled modules."
into items into items
finally do (quiet! (mapc #'load-file items))) finally do (quiet! (mapc #'load-file items)))
;; run all loaded tests ;; run all loaded tests
(when noninteractive (if noninteractive
(let (noninteractive) (ert-run-tests-batch-and-exit)
(ert-run-tests-batch-and-exit)))) (call-interactively #'ert-run-tests-interactively)))
('error ('error
(lwarn 'doom-test :error (lwarn 'doom-test :error
"%s -> %s" "%s -> %s"

View file

@ -36,8 +36,10 @@ If FORCE-P is omitted when `window-size-fixed' is non-nil, resizing will fail."
;;;###autoload ;;;###autoload
(defun doom/window-zoom () (defun doom/window-zoom ()
"Maximize and isolate the current buffer. Activate again to undo this. If the "Close other windows to focus on this one. Activate again to undo this. If the
window changes before then, the undo expires." window changes before then, the undo expires.
Alternatively, use `doom/window-enlargen'."
(interactive) (interactive)
(if (and (one-window-p) (if (and (one-window-p)
(assoc ?_ register-alist)) (assoc ?_ register-alist))
@ -48,7 +50,8 @@ window changes before then, the undo expires."
(defvar doom--window-enlargened nil) (defvar doom--window-enlargened nil)
;;;###autoload ;;;###autoload
(defun doom/window-enlargen () (defun doom/window-enlargen ()
"Enlargen the current window. Activate again to undo." "Enlargen the current window to focus on this one. Does not close other
windows (unlike `doom/window-zoom') Activate again to undo."
(interactive) (interactive)
(setq doom--window-enlargened (setq doom--window-enlargened
(if (and doom--window-enlargened (if (and doom--window-enlargened

View file

@ -47,13 +47,10 @@ modes are active and the buffer is read-only.")
(newline-mark ?\n [ ?\n]) (newline-mark ?\n [ ?\n])
(space-mark ?\ [] [?.]))) (space-mark ?\ [] [?.])))
(defun doom|ediff-use-existing-frame () ;; ediff
"Use existing frame instead of creating a new one."
(setq ediff-diff-options "-w" (setq ediff-diff-options "-w"
ediff-split-window-function #'split-window-horizontally ediff-split-window-function #'split-window-horizontally
;; no extra frames ediff-window-setup-function #'ediff-setup-windows-plain)
ediff-window-setup-function #'ediff-setup-windows-plain))
(add-hook 'ediff-load-hook #'doom|ediff-use-existing-frame)
(defun doom|dont-kill-scratch-buffer () (defun doom|dont-kill-scratch-buffer ()
"Don't kill the scratch buffer." "Don't kill the scratch buffer."
@ -115,17 +112,6 @@ with functions that require it (like modeline segments)."
buffer)) buffer))
(advice-add #'make-indirect-buffer :around #'doom*set-indirect-buffer-filename) (advice-add #'make-indirect-buffer :around #'doom*set-indirect-buffer-filename)
(defun doom*delete-trailing-whitespace (orig-fn &rest args)
"Don't affect trailing whitespace on current line."
(let ((linestr (buffer-substring-no-properties
(line-beginning-position)
(line-end-position))))
(apply orig-fn args)
(when (and (if (featurep 'evil) (evil-insert-state-p) t)
(string-match-p "^[\s\t]*$" linestr))
(insert linestr))))
(advice-add #'delete-trailing-whitespace :around #'doom*delete-trailing-whitespace)
(push '("/LICENSE$" . text-mode) auto-mode-alist) (push '("/LICENSE$" . text-mode) auto-mode-alist)
@ -150,7 +136,7 @@ with functions that require it (like modeline segments)."
;; Keep track of recently opened files ;; Keep track of recently opened files
(def-package! recentf (def-package! recentf
:init (add-hook 'doom-init-hook #'recentf-mode) :hook (doom-init . recentf-mode)
:config :config
(setq recentf-save-file (concat doom-etc-dir "recentf") (setq recentf-save-file (concat doom-etc-dir "recentf")
recentf-max-menu-items 0 recentf-max-menu-items 0
@ -171,18 +157,6 @@ with functions that require it (like modeline segments)."
;; 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.
(def-package! editorconfig (def-package! editorconfig
:demand t
:init
(def-setting! :editorconfig (action value)
":add or :remove an entry in `editorconfig-indentation-alist'."
(cond ((eq action :add)
`(push ,value editorconfig-indentation-alist))
((eq action :remove)
`(setq editorconfig-indentation-alist
(assq-delete-all ,value editorconfig-indentation-alist)))
(t (error "%s is an invalid action for :editorconfig"
action))))
:config :config
(add-hook 'doom-init-hook #'editorconfig-mode) (add-hook 'doom-init-hook #'editorconfig-mode)
@ -212,10 +186,12 @@ extension, try to guess one."
(apply orig-fn args))) (apply orig-fn args)))
(advice-add #'editorconfig-call-editorconfig-exec :around #'doom*editorconfig-smart-detection) (advice-add #'editorconfig-call-editorconfig-exec :around #'doom*editorconfig-smart-detection)
;; Editorconfig makes indentation weird in Lisp modes, so we disable it. It ;; Editorconfig makes indentation too rigid in Lisp modes, so tell
;; still applies other project settings (e.g. tabs vs spaces) though. ;; editorconfig to ignore indentation. I prefer dynamic indentation support
(set! :editorconfig :remove 'emacs-lisp-mode) ;; built into Emacs.
(set! :editorconfig :remove 'lisp-mode) (dolist (mode '(emacs-lisp-mode lisp-mode))
(setq editorconfig-indentation-alist
(assq-delete-all mode editorconfig-indentation-alist)))
(defvar whitespace-style) (defvar whitespace-style)
(defun doom|editorconfig-whitespace-mode-maybe (&rest _) (defun doom|editorconfig-whitespace-mode-maybe (&rest _)
@ -230,17 +206,16 @@ extension, try to guess one."
;; Auto-close delimiters and blocks as you type ;; Auto-close delimiters and blocks as you type
(def-package! smartparens (def-package! smartparens
:demand t
:config :config
(add-hook 'doom-init-hook #'smartparens-global-mode)
(require 'smartparens-config)
(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
sp-cancel-autoskip-on-backward-movement nil sp-cancel-autoskip-on-backward-movement nil
sp-show-pair-delay 0 sp-show-pair-delay 0
sp-max-pair-length 3) sp-max-pair-length 3)
(add-hook 'doom-init-hook #'smartparens-global-mode)
(require 'smartparens-config)
;; disable smartparens in evil-mode's replace state (they conflict) ;; disable smartparens in evil-mode's replace state (they conflict)
(add-hook 'evil-replace-state-entry-hook #'turn-off-smartparens-mode) (add-hook 'evil-replace-state-entry-hook #'turn-off-smartparens-mode)
(add-hook 'evil-replace-state-exit-hook #'turn-on-smartparens-mode) (add-hook 'evil-replace-state-exit-hook #'turn-on-smartparens-mode)
@ -250,10 +225,8 @@ extension, try to guess one."
;; Branching undo ;; Branching undo
(def-package! undo-tree (def-package! undo-tree
:demand t
:config :config
(global-undo-tree-mode +1) (add-hook 'doom-init-hook #'global-undo-tree-mode)
;; persistent undo history is known to cause undo history corruption, which ;; persistent undo history is known to cause undo history corruption, which
;; can be very destructive! So disable it! ;; can be very destructive! So disable it!
(setq undo-tree-auto-save-history nil (setq undo-tree-auto-save-history nil
@ -288,15 +261,15 @@ extension, try to guess one."
: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))
(def-package! pcre2el :commands rxt-quote-pcre) (def-package! pcre2el
:commands rxt-quote-pcre)
(def-package! smart-forward (def-package! smart-forward
:commands (smart-up smart-down smart-backward smart-forward)) :commands (smart-up smart-down smart-backward smart-forward))
(def-package! wgrep (def-package! wgrep
:commands (wgrep-setup wgrep-change-to-wgrep-mode) :commands (wgrep-setup wgrep-change-to-wgrep-mode)
:config :config (setq wgrep-auto-save-buffer t))
(setq wgrep-auto-save-buffer t))
(provide 'core-editor) (provide 'core-editor)
;;; core-editor.el ends here ;;; core-editor.el ends here

View file

@ -24,7 +24,6 @@
;; ;;
(def-package! which-key (def-package! which-key
:demand t
:config :config
(setq which-key-sort-order #'which-key-prefix-then-key-order (setq which-key-sort-order #'which-key-prefix-then-key-order
which-key-sort-uppercase-first nil which-key-sort-uppercase-first nil
@ -38,7 +37,6 @@
(def-package! hydra (def-package! hydra
:demand t
:init :init
;; In case I later need to wrap defhydra in any special functionality. ;; In case I later need to wrap defhydra in any special functionality.
(defalias 'def-hydra! 'defhydra) (defalias 'def-hydra! 'defhydra)
@ -271,7 +269,7 @@ Example
(dolist (keymap doom--keymaps) (dolist (keymap doom--keymaps)
(when (memq 'global states) (when (memq 'global states)
(push `(define-key ,keymap ,key ,def) forms)) (push `(define-key ,keymap ,key ,def) forms))
(when-let (states (delq 'global states)) (when-let* ((states (delq 'global states)))
(push `(,(if doom--defer 'evil-define-key 'evil-define-key*) (push `(,(if doom--defer 'evil-define-key 'evil-define-key*)
',states ,keymap ,key ,def) ',states ,keymap ,key ,def)
forms)))) forms))))

View file

@ -1,28 +1,16 @@
;;; core-lib.el -*- lexical-binding: t; -*- ;;; core-lib.el -*- lexical-binding: t; -*-
;; I don't use use-package for these to save on the `fboundp' lookups it does (require 'cl-lib)
;; for its :commands property. I use dolists instead of mapc to avoid extra (require 'subr-x)
;; stackframes allocated for lambdas. This is _definitely_ premature (load "async-autoloads" nil t)
;; optimization. (load "persistent-soft-autoloads" nil t)
(dolist (sym '(async-start async-start-process async-byte-recompile-directory
async-inject-variables))
(autoload sym "async"))
(dolist (sym '(persistent-soft-exists-p persistent-soft-fetch
persistent-soft-flush persistent-soft-store))
(autoload sym "persistent-soft"))
(dolist (sym '(s-center s-pad-left s-pad-right s-truncate s-chop-suffix
s-chop-suffixes s-chop-prefix s-chop-prefixes s-join s-replace
s-replace-all s-capitalize s-titleize s-split-words
s-capitalized-words s-titleized-words))
(autoload sym "s"))
(dolist (sym '(when-let if-let string-trim string-join string-blank-p string-lessp))
(autoload sym "subr-x" nil nil 'macro))
(dolist (sym '(json-read json-read-file json-read-from-string json-encode)) (dolist (sym '(json-read json-read-file json-read-from-string json-encode))
(autoload sym "json")) (autoload sym "json"))
(eval-and-compile
(when (version< emacs-version "26")
(with-no-warnings
(defalias 'if-let* #'if-let)
(defalias 'when-let* #'when-let))))
;; ;;
@ -62,8 +50,8 @@
(if (listp exp) exp (list exp))) (if (listp exp) exp (list exp)))
(defun doom-resolve-vim-path (file-name) (defun doom-resolve-vim-path (file-name)
"Take a path and resolve any vim-like filename modifiers in it. This adds "Take a path and resolve any vim-like filename modifiers in it. On top of the
support for these special modifiers: classical vim modifiers, this adds support for:
%:P Resolves to `doom-project-root'. %:P Resolves to `doom-project-root'.
@ -114,7 +102,7 @@ See http://vimdoc.sourceforge.net/htmldoc/cmdline.html#filename-modifiers."
(file-relative-name parent))))) (file-relative-name parent)))))
("s" ("s"
(if (featurep 'evil) (if (featurep 'evil)
(when-let (args (evil-delimited-arguments (substring flag 1) 2)) (when-let* ((args (evil-delimited-arguments (substring flag 1) 2)))
(let ((pattern (evil-transform-vim-style-regexp (car args))) (let ((pattern (evil-transform-vim-style-regexp (car args)))
(replace (cadr args))) (replace (cadr args)))
(replace-regexp-in-string (replace-regexp-in-string
@ -162,18 +150,17 @@ compilation."
"Run FORMS without making any noise." "Run FORMS without making any noise."
`(if doom-debug-mode `(if doom-debug-mode
(progn ,@forms) (progn ,@forms)
(fset 'doom--old-write-region-fn (symbol-function 'write-region)) (let ((old-fn (symbol-function 'write-region)))
(cl-letf ((standard-output (lambda (&rest _))) (cl-letf* ((standard-output (lambda (&rest _)))
((symbol-function 'load-file) (lambda (file) (load file nil t))) ((symbol-function 'load-file) (lambda (file) (load file nil t)))
((symbol-function 'message) (lambda (&rest _))) ((symbol-function 'message) (lambda (&rest _)))
((symbol-function 'write-region) ((symbol-function 'write-region)
(lambda (start end filename &optional append visit lockname mustbenew) (lambda (start end filename &optional append visit lockname mustbenew)
(unless visit (setq visit 'no-message)) (unless visit (setq visit 'no-message))
(doom--old-write-region-fn (funcall old-fn start end filename append visit lockname mustbenew)))
start end filename append visit lockname mustbenew)))
(inhibit-message t) (inhibit-message t)
(save-silently t)) (save-silently t))
,@forms))) ,@forms))))
(defvar doom--transient-counter 0) (defvar doom--transient-counter 0)
(defmacro add-transient-hook! (hook &rest forms) (defmacro add-transient-hook! (hook &rest forms)
@ -242,10 +229,9 @@ Body forms can access the hook's arguments through the let-bound variable
`(function ,fn) `(function ,fn)
`(lambda (&rest _) ,@args))) `(lambda (&rest _) ,@args)))
(dolist (hook hooks) (dolist (hook hooks)
(push (cond ((eq hook-fn 'remove-hook) (push (if (eq hook-fn 'remove-hook)
`(remove-hook ',hook ,fn ,local-p)) `(remove-hook ',hook ,fn ,local-p)
(t `(add-hook ',hook ,fn ,append-p ,local-p))
`(add-hook ',hook ,fn ,append-p ,local-p)))
forms))) forms)))
`(progn ,@(nreverse forms))))) `(progn ,@(nreverse forms)))))
@ -287,16 +273,19 @@ Body forms can access the hook's arguments through the let-bound variable
mode modes match files)))))) mode modes match files))))))
;; I'm a fan of concise, hassle-free front-facing configuration. Rather than ;; I needed a way to reliably cross-configure modules without worrying about
;; littering my config with `after!' blocks, and checking if features and ;; whether they were enabled or not, so I wrote `set!'. If a setting doesn't
;; modules are loaded before every line of config, I wrote `set!' as a more ;; exist at runtime, the `set!' call is ignored (and omitted when
;; robust alternative. If a setting doesn't exist at run-time, the `set!' call ;; byte-compiled).
;; is ignored. It also benefits from byte-compilation.
(defvar doom-settings nil) (defvar doom-settings nil)
(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. Like `defmacro', this should return a form to be executed
executed when called with `set!'. FORMS are not evaluated until `set!' calls it." when called with `set!'. FORMS are not evaluated until `set!' calls it.
See `doom/describe-setting' for a list of available settings.
Do not use this for configuring Doom core."
(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))
@ -308,7 +297,8 @@ executed when called with `set!'. FORMS are not evaluated until `set!' calls it.
(cl-pushnew ',(cons keyword fn) doom-settings :test #'eq :key #'car)))) (cl-pushnew ',(cons keyword fn) doom-settings :test #'eq :key #'car))))
(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. See
`doom/describe-setting' for a list of available settings."
(declare (indent defun)) (declare (indent defun))
(unless values (unless values
(error "Empty set! for %s" keyword)) (error "Empty set! for %s" keyword))

View file

@ -6,15 +6,15 @@
;; ;;
;; The three key commands are: ;; The three key commands are:
;; ;;
;; + `make install` or `doom/packages-install': Installs packages that are ;; + `make install` or `doom//packages-install': Installs packages that are
;; wanted, but not installed. ;; wanted, but not installed.
;; + `make update` or `doom/packages-update': Updates packages that are ;; + `make update` or `doom//packages-update': Updates packages that are
;; out-of-date. ;; out-of-date.
;; + `make autoremove` or `doom/packages-autoremove': Uninstalls packages that ;; + `make autoremove` or `doom//packages-autoremove': Uninstalls packages that
;; are no longer needed. ;; are no longer needed.
;; ;;
;; This system reads packages.el files located in each activated module (and one ;; This system reads packages.el files located in each activated module (and one
;; in `doom-core-dir'). These contain `package!` blocks that tell DOOM what ;; in `doom-core-dir'). These contain `package!' blocks that tell DOOM what
;; plugins to install and where from. ;; plugins to install and where from.
;; ;;
;; Why all the trouble? Because: ;; Why all the trouble? Because:
@ -42,7 +42,7 @@
;; + `package-reinstall': `doom/reinstall-package' ;; + `package-reinstall': `doom/reinstall-package'
;; + `package-delete': `doom/delete-package' ;; + `package-delete': `doom/delete-package'
;; + `package-update': `doom/update-package' ;; + `package-update': `doom/update-package'
;; + `package-autoremove': `doom/packages-autoremove' ;; + `package-autoremove': `doom//packages-autoremove'
;; + `package-refresh-contents': `doom/refresh-packages' ;; + `package-refresh-contents': `doom/refresh-packages'
;; ;;
;; See core/autoload/packages.el for more functions. ;; See core/autoload/packages.el for more functions.
@ -68,7 +68,7 @@ package's name as a symbol, and whose CDR is the plist supplied to its
`package!' declaration. Set by `doom-initialize-packages'.") `package!' declaration. Set by `doom-initialize-packages'.")
(defvar doom-core-packages (defvar doom-core-packages
'(persistent-soft quelpa use-package async) '(persistent-soft use-package quelpa async)
"A list of packages that must be installed (and will be auto-installed if "A list of packages that must be installed (and will be auto-installed if
missing) and shouldn't be deleted.") missing) and shouldn't be deleted.")
@ -92,8 +92,7 @@ base by `doom!' and for calculating how many packages exist.")
(defvar doom--refreshed-p nil) (defvar doom--refreshed-p nil)
(setq load-prefer-newer (or noninteractive doom-debug-mode) (setq package--init-file-ensured t
package--init-file-ensured t
package-user-dir (expand-file-name "elpa" doom-packages-dir) package-user-dir (expand-file-name "elpa" doom-packages-dir)
package-enable-at-startup nil package-enable-at-startup nil
package-archives package-archives
@ -110,9 +109,6 @@ base by `doom!' and for calculating how many packages exist.")
"gnutls-cli -p %p %h" "gnutls-cli -p %p %h"
"openssl s_client -connect %h:%p -no_ssl2 -no_ssl3 -ign_eof") "openssl s_client -connect %h:%p -no_ssl2 -no_ssl3 -ign_eof")
use-package-always-defer t
use-package-always-ensure nil
use-package-debug nil
use-package-verbose doom-debug-mode use-package-verbose doom-debug-mode
use-package-minimum-reported-time (if doom-debug-mode 0 0.1) use-package-minimum-reported-time (if doom-debug-mode 0 0.1)
@ -152,9 +148,9 @@ startup."
(package-refresh-contents) (package-refresh-contents)
(setq doom--refreshed-p t) (setq doom--refreshed-p t)
(package-initialize t))) (package-initialize t)))
;; We could let `package-initialize' fill `load-path', but it costs precious ;; We could let `package-initialize' fill `load-path', but it does more than
;; milliseconds and does other stuff I don't need (like load autoload ;; that alone (like load autoload files). If you want something prematurely
;; files). My premature optimization quota isn't filled yet. ;; optimizated right, ya gotta do it yourself.
;; ;;
;; Also, in some edge cases involving package initialization during a ;; Also, in some edge cases involving package initialization during a
;; non-interactive session, `package-initialize' fails to fill `load-path'. ;; non-interactive session, `package-initialize' fails to fill `load-path'.
@ -251,9 +247,10 @@ This aggressively reloads core autoload files."
(defun doom-module-from-path (path) (defun doom-module-from-path (path)
"Get module cons cell (MODULE . SUBMODULE) for PATH, if possible." "Get module cons cell (MODULE . SUBMODULE) for PATH, if possible."
(when (string-match (concat doom-modules-dir "\\([^/]+\\)/\\([^/]+\\)/") path) (when-let* ((path (file-relative-name (file-truename path) (file-truename doom-modules-dir))))
(cons (intern (concat ":" (match-string 1 path))) (let ((segments (split-string path "/")))
(intern (match-string 2 path))))) (cons (intern (concat ":" (car segments)))
(intern (cadr segments))))))
(defun doom-module-paths (&optional append-file) (defun doom-module-paths (&optional append-file)
"Returns a list of absolute file paths to activated modules, with APPEND-FILE "Returns a list of absolute file paths to activated modules, with APPEND-FILE
@ -263,14 +260,13 @@ added, if the file exists."
if (file-exists-p path) if (file-exists-p path)
collect path)) collect path))
(defun doom-module-flags (module submodule) (defun doom-module-get (module submodule)
"Returns a list of flags provided for MODULE SUBMODULE." "Returns a list of flags provided for MODULE SUBMODULE."
(and (hash-table-p doom-modules) (gethash (cons module submodule) doom-modules))
(gethash (cons module submodule) doom-modules)))
(defun doom-module-loaded-p (module submodule) (defun doom-module-enabled-p (module submodule)
"Returns t if MODULE->SUBMODULE is present in `doom-modules'." "Returns t if MODULE->SUBMODULE is present in `doom-modules'."
(and (doom-module-flags module submodule) t)) (and (doom-module-get module submodule) t))
(defun doom-module-enable (module submodule &optional flags) (defun doom-module-enable (module submodule &optional flags)
"Adds MODULE and SUBMODULE to `doom-modules', overwriting it if it exists. "Adds MODULE and SUBMODULE to `doom-modules', overwriting it if it exists.
@ -278,9 +274,12 @@ added, if the file exists."
MODULE is a keyword, SUBMODULE is a symbol. e.g. :lang 'emacs-lisp. MODULE is a keyword, SUBMODULE is a symbol. e.g. :lang 'emacs-lisp.
Used by `require!' and `depends-on!'." Used by `require!' and `depends-on!'."
(puthash (cons module submodule) (let ((key (cons module submodule)))
(doom-enlist (or flags t)) (puthash key
doom-modules)) (or (doom-enlist flags)
(gethash key doom-modules)
'(t))
doom-modules)))
(defun doom-module-pairs () (defun doom-module-pairs ()
"Returns `doom-modules' as a list of (MODULE . SUBMODULE) cons cells. The list "Returns `doom-modules' as a list of (MODULE . SUBMODULE) cons cells. The list
@ -312,16 +311,15 @@ include all modules, enabled or otherwise."
MODULES is an malformed plist of modules to load." MODULES is an malformed plist of modules to load."
(doom-initialize-modules modules) (doom-initialize-modules modules)
(when (and user-login-name
(not (doom-module-loaded-p :private (intern user-login-name))))
(doom-module-enable :private user-login-name))
`(let (file-name-handler-alist) `(let (file-name-handler-alist)
(setq doom-modules ',doom-modules) (setq doom-modules ',doom-modules)
(unless noninteractive (unless noninteractive
(load ,(doom-module-path :private user-login-name "init") t t)
,@(cl-loop for (module . submodule) in (doom-module-pairs) ,@(cl-loop for (module . submodule) in (doom-module-pairs)
collect `(require! ,module ,submodule nil t)) for module-path = (doom-module-path module submodule)
collect `(load! init ,module-path t) into inits
collect `(load! config ,module-path t) into configs
finally return (append inits configs))
(when (display-graphic-p) (when (display-graphic-p)
(require 'server) (require 'server)
@ -332,13 +330,18 @@ MODULES is an malformed plist of modules to load."
(message "Doom modules initialized")))) (message "Doom modules initialized"))))
(defmacro def-package! (name &rest plist) (defmacro def-package! (name &rest plist)
"A thin wrapper around `use-package'. "A thin wrapper around `use-package'."
;; Ignore package if NAME is in `doom-disabled-packages'
Ignores the package if its NAME is present in `doom-disabled-packages'."
(when (and (memq name doom-disabled-packages) (when (and (memq name doom-disabled-packages)
(not (memq :disabled plist))) (not (memq :disabled plist)))
(setq plist (append (list :disabled t) plist))) (setq plist (append (list :disabled t) plist)))
`(use-package ,name ,@plist)) ;; If byte-compiling, ignore this package if it doesn't meet the condition.
;; This avoids false-positive load errors.
(unless (and (bound-and-true-p byte-compile-current-file)
(or (and (plist-member plist :if) (not (eval (plist-get plist :if))))
(and (plist-member plist :when) (not (eval (plist-get plist :when))))
(and (plist-member plist :unless) (eval (plist-get plist :unless)))))
`(use-package ,name ,@plist)))
(defmacro def-package-hook! (package when &rest body) (defmacro def-package-hook! (package when &rest body)
"Reconfigures a package's `def-package!' block. "Reconfigures a package's `def-package!' block.
@ -404,20 +407,22 @@ If NOERROR is non-nil, don't throw an error if the file doesn't exist."
"Loads the module specified by MODULE (a property) and SUBMODULE (a symbol). "Loads the module specified by MODULE (a property) and SUBMODULE (a symbol).
The module is only loaded once. If RELOAD-P is non-nil, load it again." The module is only loaded once. If RELOAD-P is non-nil, load it again."
(let ((loaded-p (doom-module-loaded-p module submodule))) (when (or reload-p (not (doom-module-enabled-p module submodule)))
(when (or reload-p (not loaded-p)) (let ((module-path (doom-module-path module submodule)))
(unless loaded-p (if (not (file-directory-p module-path))
(doom-module-enable module submodule flags)) (lwarn 'doom-modules :warning "Couldn't find module '%s %s'"
module submodule)
(doom-module-enable module submodule flags)
`(condition-case-unless-debug ex `(condition-case-unless-debug ex
(load! config ,(doom-module-path module submodule) t) (load! config ,module-path t)
('error ('error
(lwarn 'doom-modules :error (lwarn 'doom-modules :error
"%s in '%s %s' -> %s" "%s in '%s %s' -> %s"
(car ex) ,module ',submodule (car ex) ,module ',submodule
(error-message-string ex))))))) (error-message-string ex))))))))
(defmacro featurep! (module &optional submodule flag) (defmacro featurep! (module &optional submodule flag)
"A convenience macro wrapper for `doom-module-loaded-p'. It is evaluated at "A convenience macro wrapper for `doom-module-enabled-p'. It is evaluated at
compile-time/macro-expansion time." compile-time/macro-expansion time."
(unless submodule (unless submodule
(let* ((path (or load-file-name byte-compile-current-file)) (let* ((path (or load-file-name byte-compile-current-file))
@ -428,8 +433,8 @@ compile-time/macro-expansion time."
module (car module-pair) module (car module-pair)
submodule (cdr module-pair)))) submodule (cdr module-pair))))
(if flag (if flag
(and (memq flag (doom-module-flags module submodule)) t) (and (memq flag (doom-module-get module submodule)) t)
(doom-module-loaded-p module submodule))) (doom-module-enabled-p module submodule)))
;; ;;
@ -466,7 +471,7 @@ Accepts the following properties:
(when pkg-pin (when pkg-pin
(plist-put plist :pin nil))) (plist-put plist :pin nil)))
(dolist (prop '(:ignore :freeze)) (dolist (prop '(:ignore :freeze))
(when-let (val (plist-get plist prop)) (when-let* ((val (plist-get plist prop)))
(plist-put plist prop (eval val)))) (plist-put plist prop (eval val))))
`(progn `(progn
(when ,(and pkg-pin t) (when ,(and pkg-pin t)
@ -495,8 +500,10 @@ loads MODULE SUBMODULE's packages.el file."
"Returns the value of the ;;;###if predicate form in FILE." "Returns the value of the ;;;###if predicate form in FILE."
(with-temp-buffer (with-temp-buffer
(insert-file-contents-literally file nil 0 256) (insert-file-contents-literally file nil 0 256)
(if (re-search-forward "^;;;###if " nil t) (if (and (re-search-forward "^;;;###if " nil t)
(eval (sexp-at-point)) (<= (line-number-at-pos) 3))
(let ((load-file-name file))
(eval (sexp-at-point)))
t))) t)))
(defun doom-packages--async-run (fn) (defun doom-packages--async-run (fn)
@ -522,8 +529,8 @@ call `doom/reload-load-path' remotely (through emacsclient)."
(cond (noninteractive (cond (noninteractive
(message "Reloading...") (message "Reloading...")
(require 'server) (require 'server)
(when (file-exists-p (if server-use-tcp server-auth-dir server-socket-dir)) (when (server-running-p)
(server-eval-at "server" '(doom//reload-load-path)))) (server-eval-at server-name '(doom//reload-load-path))))
(t (t
(doom-initialize t) (doom-initialize t)
(message "Reloaded %d packages" (length doom--package-load-path)) (message "Reloaded %d packages" (length doom--package-load-path))
@ -544,9 +551,8 @@ This should be run whenever init.el or an autoload file is modified. Running
;; This function must not use autoloaded functions or external dependencies. ;; This function must not use autoloaded functions or external dependencies.
;; It must assume nothing is set up! ;; It must assume nothing is set up!
(if (not noninteractive) (if (not noninteractive)
;; This is done "asynchroniously" to protect the current session's state. ;; This is done in another instance to protect the current session's
;; This is because `doom-initialize-packages' rereads your emacs config, ;; state. `doom-initialize-packages' will have side effects otherwise.
;; which has side effects.
(and (doom-packages--async-run 'doom//reload-autoloads) (and (doom-packages--async-run 'doom//reload-autoloads)
(load doom-autoload-file)) (load doom-autoload-file))
(doom-initialize-packages) (doom-initialize-packages)
@ -556,22 +562,21 @@ This should be run whenever init.el or an autoload file is modified. Running
(dolist (path (doom-module-paths)) (dolist (path (doom-module-paths))
(let ((auto-dir (expand-file-name "autoload" path)) (let ((auto-dir (expand-file-name "autoload" path))
(auto-file (expand-file-name "autoload.el" path))) (auto-file (expand-file-name "autoload.el" path)))
(when (and (file-exists-p auto-file) (when (file-exists-p auto-file)
(doom-packages--read-if-cookies auto-file))
(push auto-file targets)) (push auto-file targets))
(when (file-directory-p auto-dir) (when (file-directory-p auto-dir)
(dolist (file (file-expand-wildcards (expand-file-name "*.el" auto-dir) t)) (dolist (file (directory-files-recursively auto-dir "\\.el$"))
;; Make evil*.el autoload files a special case; don't load (push file targets)))))
;; them unless evil is enabled.
(when (doom-packages--read-if-cookies file)
(push file targets))))))
(when (file-exists-p doom-autoload-file) (when (file-exists-p doom-autoload-file)
(delete-file doom-autoload-file) (delete-file doom-autoload-file)
(message "Deleted old autoloads.el")) (message "Deleted old autoloads.el"))
(dolist (file (reverse targets)) (dolist (file (reverse targets))
(message (if (update-file-autoloads file nil doom-autoload-file) (message (cond ((not (doom-packages--read-if-cookies file))
"Nothing in %s" "Ignoring %s")
"Scanned %s") ((update-file-autoloads file nil doom-autoload-file)
"Nothing in %s")
(t
"Scanned %s"))
(file-relative-name file doom-emacs-dir))) (file-relative-name file doom-emacs-dir)))
(let ((buf (get-file-buffer doom-autoload-file)) (let ((buf (get-file-buffer doom-autoload-file))
current-sexp) current-sexp)
@ -616,9 +621,8 @@ If RECOMPILE-P is non-nil, only recompile out-of-date files."
(recompile-p (or recompile-p (recompile-p (or recompile-p
(and (member "-r" (cdr argv)) t)))) (and (member "-r" (cdr argv)) t))))
(if (not noninteractive) (if (not noninteractive)
;; This is done "asynchroniously" to protect the current session's ;; This is done in another instance to protect the current session's
;; state. This is because `doom-initialize-packages' rereads your emacs ;; state. `doom-initialize-packages' will have side effects otherwise.
;; config, which has side effects.
(doom-packages--async-run 'doom//byte-compile) (doom-packages--async-run 'doom//byte-compile)
(let ((total-ok 0) (let ((total-ok 0)
(total-fail 0) (total-fail 0)
@ -647,10 +651,9 @@ If RECOMPILE-P is non-nil, only recompile out-of-date files."
(let ((elc-file (byte-compile-dest-file target))) (let ((elc-file (byte-compile-dest-file target)))
(and (file-exists-p elc-file) (and (file-exists-p elc-file)
(file-newer-than-file-p file elc-file)))) (file-newer-than-file-p file elc-file))))
(let ((result (if (and (string-match-p "/autoload/.*\\.el$" target) (let ((result (if (doom-packages--read-if-cookies target)
(not (doom-packages--read-if-cookies target))) (byte-compile-file target)
'no-byte-compile 'no-byte-compile))
(byte-compile-file target)))
(short-name (file-relative-name target doom-emacs-dir))) (short-name (file-relative-name target doom-emacs-dir)))
(cl-incf (cl-incf
(cond ((eq result 'no-byte-compile) (cond ((eq result 'no-byte-compile)
@ -712,7 +715,7 @@ This excludes compiled packages in `doom-packages-dir'.'"
(advice-add #'package-delete :after #'doom*package-delete) (advice-add #'package-delete :after #'doom*package-delete)
;; It isn't safe to use `package-autoremove', so get rid of it ;; It isn't safe to use `package-autoremove', so get rid of it
(advice-add #'package-autoremove :override #'doom/packages-autoremove) (advice-add #'package-autoremove :override #'doom//packages-autoremove)
(provide 'core-packages) (provide 'core-packages)
;;; core-packages.el ends here ;;; core-packages.el ends here

View file

@ -46,6 +46,9 @@ that was/were open in `doom-popup-history'.")
when their associated popup windows are closed, despite their :autokill when their associated popup windows are closed, despite their :autokill
property.") property.")
(defvar doom-popup-mode-map (make-sparse-keymap)
"Active keymap in popup windows.")
(def-setting! :popup (&rest rules) (def-setting! :popup (&rest rules)
"Prepend a new popup rule to `shackle-rules' (see for format details). "Prepend a new popup rule to `shackle-rules' (see for format details).
@ -80,12 +83,28 @@ recognized by DOOM's popup system. They are:
`(push (list ,@rules) shackle-rules))) `(push (list ,@rules) shackle-rules)))
;;
;;
;;
(defvar doom-popup-parameters
'(:esc :modeline :transient :fit :align :size)
"TODO")
(defvar doom-popup-whitelist
'(("^ ?\\*" :size 15 :noselect t :autokill t :autoclose t))
"TODO")
(defvar doom-popup-blacklist
'("^\\*magit")
"TODO")
;; ;;
;; Bootstrap ;; Bootstrap
;; ;;
(def-package! shackle (def-package! shackle
:demand t
:init :init
(setq shackle-default-alignment 'below (setq shackle-default-alignment 'below
shackle-default-size 8 shackle-default-size 8
@ -114,7 +133,21 @@ recognized by DOOM's popup system. They are:
("^ ?\\*" :regexp t :size 15 :noselect t :autokill t :autoclose t))) ("^ ?\\*" :regexp t :size 15 :noselect t :autokill t :autoclose t)))
:config :config
(add-hook 'doom-post-init-hook #'shackle-mode) ;; NOTE This is a temporary fix while I rewrite core-popups
(defun doom-display-buffer-condition (buffer _action)
(and (cl-loop for re in doom-popup-blacklist
when (string-match-p re buffer)
return nil
finally return t)
(shackle-match buffer)))
(defun doom-display-buffer-action (buffer alist)
(shackle-display-buffer buffer alist (shackle-match buffer)))
(add-hook! doom-post-init
(setq display-buffer-alist
(cons '(doom-display-buffer-condition doom-display-buffer-action)
display-buffer-alist)))
;; no modeline in popups ;; no modeline in popups
(add-hook 'doom-popup-mode-hook #'doom|hide-modeline-in-popup) (add-hook 'doom-popup-mode-hook #'doom|hide-modeline-in-popup)
@ -133,8 +166,7 @@ recognized by DOOM's popup system. They are:
(dolist (param `(popup ,@doom-popup-window-parameters)) (dolist (param `(popup ,@doom-popup-window-parameters))
(push (cons param 'writable) window-persistent-parameters)) (push (cons param 'writable) window-persistent-parameters))
(defvar doom-popup-mode-map (let ((map doom-popup-mode-map))
(let ((map (make-sparse-keymap)))
(define-key map [escape] #'doom/popup-close-maybe) (define-key map [escape] #'doom/popup-close-maybe)
(define-key map (kbd "ESC") #'doom/popup-close-maybe) (define-key map (kbd "ESC") #'doom/popup-close-maybe)
(define-key map [remap quit-window] #'doom/popup-close-maybe) (define-key map [remap quit-window] #'doom/popup-close-maybe)
@ -144,9 +176,7 @@ recognized by DOOM's popup system. They are:
(define-key map [remap split-window-horizontally] #'ignore) (define-key map [remap split-window-horizontally] #'ignore)
(define-key map [remap split-window-vertically] #'ignore) (define-key map [remap split-window-vertically] #'ignore)
(define-key map [remap mouse-split-window-horizontally] #'ignore) (define-key map [remap mouse-split-window-horizontally] #'ignore)
(define-key map [remap mouse-split-window-vertically] #'ignore) (define-key map [remap mouse-split-window-vertically] #'ignore)))
map)
"Active keymap in popup windows."))
;; ;;
@ -212,10 +242,10 @@ recognized by DOOM's popup system. They are:
(defun doom|popup-close-maybe () (defun doom|popup-close-maybe ()
"If current window is a popup, close it. If minibuffer is open, close it. If "If current window is a popup, close it. If minibuffer is open, close it. If
not in a popup, close all popups with an :autoclose property." not in a popup, close all popups with an :autoclose property."
(cond ((doom-popup-p) (if (doom-popup-p)
(unless (doom-popup-property :noesc) (unless (doom-popup-property :noesc)
(delete-window))) (delete-window))
(t (doom/popup-close-all)))) (doom/popup-close-all)))
(add-hook '+evil-esc-hook #'doom|popup-close-maybe t) (add-hook '+evil-esc-hook #'doom|popup-close-maybe t)
;; Make evil-mode cooperate with popups ;; Make evil-mode cooperate with popups
@ -340,37 +370,7 @@ the command buffer."
(after! magit (after! magit
(set! :popup "^\\*magit" :regexp t :size 0.5 :noesc t :autokill t) (add-hook 'magit-mode-hook #'doom-hide-modeline-mode))
;; magit doesn't need much coercing. It works with shackle as is, except for
;; one problem: following non-file magit links tends to open additional
;; popups. We want all this to be contained within one window, so...
(defun doom-magit-popup-buffer (buffer)
"Pop up the magit window with shackle."
(cond ((doom-popup-p)
(prog1 (doom-popup-switch-to-buffer buffer)
(doom-hide-modeline-mode +1)))
(t
(magit-display-buffer-traditional buffer))))
(defun doom-magit-quit-window (_kill-buffer)
"Close the current magit window properly."
(let ((last (current-buffer)))
(cond ((when-let (dest (doom-buffers-in-mode
'magit-mode
(cl-loop for buf in (window-prev-buffers)
unless (eq (car buf) last)
collect (car buf))
t))
(doom-popup-switch-to-buffer (car dest)))
(kill-buffer last))
(t
(mapc #'kill-buffer
(doom-buffers-in-mode '(magit-mode magit-process-mode)
(buffer-list) t))))))
(setq magit-display-buffer-function #'doom-magit-popup-buffer
magit-bury-buffer-function #'doom-magit-quit-window))
(after! mu4e (after! mu4e
@ -415,7 +415,7 @@ that `doom*popup-save' won't break it."
(defun doom*persp-mode-restore-popups (&rest _) (defun doom*persp-mode-restore-popups (&rest _)
"Restore popup windows when loading a perspective from file." "Restore popup windows when loading a perspective from file."
(dolist (window (window-list)) (dolist (window (window-list))
(when-let (plist (doom-popup-properties window)) (when-let* ((plist (doom-popup-properties window)))
(with-selected-window window (with-selected-window window
(unless doom-popup-mode (unless doom-popup-mode
(setq-local doom-popup-rules plist) (setq-local doom-popup-rules plist)
@ -462,10 +462,10 @@ you came from."
(advice-add #'plantuml-preview-string (advice-add #'plantuml-preview-string
:around #'doom*plantuml-preview-in-popup-window)) :around #'doom*plantuml-preview-in-popup-window))
;; Ensure these settings are attached to org-load-hook as late as possible, ;; Ensure these settings are loaded as late as possible, giving other modules a
;; giving other modules a chance to add their own hooks. ;; chance to reconfigure org popup settings before the defaults kick in.
(defun doom|init-org-popups () (defun doom|init-org-popups ()
(add-hook! 'org-load-hook (add-hook! org-load
(set! :popup (set! :popup
'("*Calendar*" :size 0.4 :noselect t) '("*Calendar*" :size 0.4 :noselect t)
'(" *Org todo*" :size 5 :noselect t) '(" *Org todo*" :size 5 :noselect t)
@ -510,19 +510,18 @@ you came from."
(t (error "Invalid buffer %s" buf)))))) (t (error "Invalid buffer %s" buf))))))
(advice-add #'org-switch-to-buffer-other-window :override #'doom*org-pop-to-buffer) (advice-add #'org-switch-to-buffer-other-window :override #'doom*org-pop-to-buffer)
(after! org-agenda ;; org-agenda
(setq org-agenda-window-setup 'other-window (setq org-agenda-window-setup 'other-window
org-agenda-restore-windows-after-quit nil) org-agenda-restore-windows-after-quit nil)
;; Hide modeline in org-agenda ;; Hide modeline in org-agenda
(add-hook 'org-agenda-finalize-hook #'doom-hide-modeline-mode) (add-hook 'org-agenda-finalize-hook #'doom-hide-modeline-mode)
(add-hook 'org-agenda-finalize-hook #'org-fit-window-to-buffer) (add-hook 'org-agenda-finalize-hook #'org-fit-window-to-buffer)
;; Don't monopolize frame! ;; Don't monopolize frame!
(advice-add #'org-agenda :around #'doom*suppress-delete-other-windows) (advice-add #'org-agenda :around #'doom*suppress-delete-other-windows)
;; ensure quit keybindings work propertly ;; ensure quit keybindings work propertly
(map! :map org-agenda-mode-map (map! :map* org-agenda-mode-map
:m [escape] 'org-agenda-Quit :m [escape] 'org-agenda-Quit
:m "ESC" 'org-agenda-Quit)))) :m "ESC" 'org-agenda-Quit)))
(add-hook 'doom-init-hook #'doom|init-org-popups) (add-hook 'doom-init-hook #'doom|init-org-popups)
(provide 'core-popups) (provide 'core-popups)

View file

@ -5,7 +5,6 @@
state are passed in.") state are passed in.")
(def-package! projectile (def-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-enable-caching (not noninteractive) projectile-enable-caching (not noninteractive)

View file

@ -7,16 +7,18 @@
"A symbol representing the color theme to load.") "A symbol representing the color theme to load.")
(defvar doom-font nil (defvar doom-font nil
"The default font to use. Expects a FONT-SPEC (`font-spec').") "The default font to use. Expects a `font-spec'.")
(defvar doom-big-font nil (defvar doom-big-font nil
"The default font to use. Expects a FONT-SPEC (`font-spec').") "The default large font to use when `doom-big-font-mode' is enabled. Expects a
`font-spec'.")
(defvar doom-variable-pitch-font nil (defvar doom-variable-pitch-font nil
"The default font to use for variable-pitch text. Expects a FONT-SPEC (`font-spec').") "The default font to use for variable-pitch text. Expects a `font-spec'.")
(defvar doom-unicode-font nil (defvar doom-unicode-font nil
"Fallback font for unicode glyphs. Is ignored if :feature unicode is active.") "Fallback font for unicode glyphs. Is ignored if :feature unicode is active.
Expects a `font-spec'.")
(defvar doom-major-mode-names (defvar doom-major-mode-names
'((sh-mode . "sh") '((sh-mode . "sh")
@ -32,38 +34,6 @@ shorter major mode name in the mode-line. See `doom|set-mode-name'.")
`doom//reload-theme').") `doom//reload-theme').")
;; Settings
(def-setting! :theme (theme)
"Sets the current THEME (a symbol)."
`(unless doom-theme
(setq doom-theme ,theme)))
(def-setting! :font (family &rest spec)
"Sets the default font (if one wasn't already set). FAMILY is the name of the
font, and SPEC is a `font-spec'."
`(unless doom-font
(setq doom-font (font-spec :family ,family ,@spec))))
(def-setting! :variable-pitch-font (family &rest spec)
"Sets the default font for the variable-pitch face and minor mode (if one
wasn't already set). FAMILY is the name of the font, and SPEC is a `font-spec'."
`(unless doom-variable-pitch-font
(setq doom-variable-pitch-font (font-spec :family ,family ,@spec))))
(def-setting! :big-font (family &rest spec)
"Sets the font to use for `doom-big-font-mode' (if one wasn't already set).
FAMILY is the name of the font, and SPEC is a `font-spec'."
`(unless doom-big-font
(setq doom-big-font (font-spec :family ,family ,@spec))))
(def-setting! :unicode-font (family &rest spec)
"Sets the font to use for unicode characters (if one wasn't already set).
FAMILY is the name of the font, and SPEC is a `font-spec'. This is ignored if
the ':ui unicode' module is enabled."
`(unless doom-unicode-font
(setq doom-unicode-font (font-spec :family ,family ,@spec))))
(setq-default (setq-default
bidi-display-reordering nil ; disable bidirectional text for tiny performance boost bidi-display-reordering nil ; disable bidirectional text for tiny performance boost
blink-matching-paren nil ; don't blink--too distracting blink-matching-paren nil ; don't blink--too distracting
@ -177,7 +147,7 @@ local value, whether or not it's permanent-local. Therefore, we cycle
;; like diminish, but for major-modes. [pedantry intensifies] ;; like diminish, but for major-modes. [pedantry intensifies]
(defun doom|set-mode-name () (defun doom|set-mode-name ()
"Set the major mode's `mode-name', as dictated by `doom-major-mode-names'." "Set the major mode's `mode-name', as dictated by `doom-major-mode-names'."
(when-let (name (cdr (assq major-mode doom-major-mode-names))) (when-let* ((name (cdr (assq major-mode doom-major-mode-names))))
(setq mode-name (setq mode-name
(cond ((functionp name) (funcall name)) (cond ((functionp name) (funcall name))
((stringp name) name) ((stringp name) name)
@ -296,20 +266,42 @@ local value, whether or not it's permanent-local. Therefore, we cycle
;; Highlights the current line ;; Highlights the current line
(def-package! hl-line ; built-in (def-package! hl-line ; built-in
:init (add-hook! (prog-mode text-mode conf-mode) #'hl-line-mode) :hook ((prog-mode text-mode conf-mode) . hl-line-mode)
:config :config
;; I don't need hl-line showing in other windows. This also offers a small ;; I don't need hl-line showing in other windows. This also offers a small
;; speed boost when buffer is displayed in multiple windows. ;; speed boost when buffer is displayed in multiple windows.
(setq hl-line-sticky-flag nil (setq hl-line-sticky-flag nil
global-hl-line-sticky-flag nil) global-hl-line-sticky-flag nil)
;; On Emacs 26+, when point is on the last line, hl-line highlights bleed into
;; the rest of the window after eob. This is the fix.
(when (boundp 'display-line-numbers)
(defun doom--line-range ()
(cons (line-beginning-position)
(cond ((save-excursion
(goto-char (line-end-position))
(and (eobp) (not (bolp))))
(1- (line-end-position)))
((or (eobp) (save-excursion (forward-line) (eobp)))
(line-end-position))
(t
(line-beginning-position 2)))))
(setq hl-line-range-function #'doom--line-range))
(after! evil (after! evil
(defvar-local doom-buffer-hl-line-mode nil)
;; Disable `hl-line' in evil-visual mode (temporarily). `hl-line' can make ;; Disable `hl-line' in evil-visual mode (temporarily). `hl-line' can make
;; the selection region harder to see while in evil visual mode. ;; the selection region harder to see while in evil visual mode.
(defun doom|disable-hl-line () (hl-line-mode -1)) (defun doom|disable-hl-line ()
(when hl-line-mode
(setq doom-buffer-hl-line-mode t)
(hl-line-mode -1)))
(defun doom|enable-hl-line-maybe ()
(if doom-buffer-hl-line-mode (hl-line-mode +1)))
(add-hook 'evil-visual-state-entry-hook #'doom|disable-hl-line) (add-hook 'evil-visual-state-entry-hook #'doom|disable-hl-line)
(add-hook 'evil-visual-state-exit-hook #'hl-line-mode))) (add-hook 'evil-visual-state-exit-hook #'doom|enable-hl-line-maybe)))
;; 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.
@ -365,10 +357,10 @@ See `doom-line-numbers-style' to control the style of line numbers to display."
(add-hook! (prog-mode text-mode conf-mode) #'doom|enable-line-numbers) (add-hook! (prog-mode text-mode conf-mode) #'doom|enable-line-numbers)
;; Emacs 26+ has native line number support. ;; Emacs 26+ has native line number support.
(unless (boundp 'display-line-numbers)
;; 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 `linum-mode'. ;; plugin than `linum-mode'.
(def-package! nlinum (def-package! nlinum
:unless (boundp 'display-line-numbers)
:commands nlinum-mode :commands nlinum-mode
:init :init
(defvar doom-line-number-lpad 4 (defvar doom-line-number-lpad 4
@ -382,7 +374,6 @@ By default, this is a space character. If you use `whitespace-mode' with
`space-mark', the whitespace in line numbers will be affected (this can look `space-mark', the whitespace in line numbers will be affected (this can look
ugly). In this case, you can change this to ?\u2002, which is a unicode ugly). In this case, you can change this to ?\u2002, which is a unicode
character that looks like a space that `whitespace-mode' won't affect.") character that looks like a space that `whitespace-mode' won't affect.")
:config :config
(setq nlinum-highlight-current-line t) (setq nlinum-highlight-current-line t)
@ -417,26 +408,25 @@ character that looks like a space that `whitespace-mode' won't affect.")
;; Fixes disappearing line numbers in nlinum and other quirks ;; Fixes disappearing line numbers in nlinum and other quirks
(def-package! nlinum-hl (def-package! nlinum-hl
:unless (boundp 'display-line-numbers)
:after nlinum :after nlinum
:config :config
;; With `markdown-fontify-code-blocks-natively' enabled in `markdown-mode', ;; With `markdown-fontify-code-blocks-natively' enabled in `markdown-mode',
;; line numbers tend to vanish next to code blocks. ;; line numbers tend to vanish next to code blocks.
(advice-add #'markdown-fontify-code-block-natively (advice-add #'markdown-fontify-code-block-natively
:after #'nlinum-hl-do-markdown-fontify-region) :after #'nlinum-hl-do-markdown-fontify-region)
;; When using `web-mode's code-folding an entire range of line numbers will ;; When using `web-mode's code-folding an entire range of line numbers will
;; vanish in the affected area. ;; vanish in the affected area.
(advice-add #'web-mode-fold-or-unfold :after #'nlinum-hl-do-generic-flush) (advice-add #'web-mode-fold-or-unfold :after #'nlinum-hl-do-generic-flush)
;; Changing fonts can leave nlinum line numbers in their original size; this ;; Changing fonts can leave nlinum line numbers in their original size; this
;; forces them to resize. ;; forces them to resize.
(advice-add #'set-frame-font :after #'nlinum-hl-flush-all-windows)) (advice-add #'set-frame-font :after #'nlinum-hl-flush-all-windows))
(def-package! nlinum-relative (def-package! nlinum-relative
:unless (boundp 'display-line-numbers)
:commands nlinum-relative-mode :commands nlinum-relative-mode
:config :config
(after! evil (after! evil (nlinum-relative-setup-evil)))
(nlinum-relative-setup-evil))))
;; ;;
@ -498,7 +488,7 @@ error if it doesn't exist."
(defun doom-set-modeline (key &optional default) (defun doom-set-modeline (key &optional default)
"Set the modeline format. Does nothing if the modeline KEY doesn't exist. If "Set the modeline format. Does nothing if the modeline KEY doesn't exist. If
DEFAULT is non-nil, set the default mode-line for all buffers." DEFAULT is non-nil, set the default mode-line for all buffers."
(when-let (modeline (doom-modeline key)) (when-let* ((modeline (doom-modeline key)))
(setf (if default (setf (if default
(default-value 'mode-line-format) (default-value 'mode-line-format)
(buffer-local-value 'mode-line-format (current-buffer))) (buffer-local-value 'mode-line-format (current-buffer)))

View file

@ -18,7 +18,7 @@
;; Autoloaded functions are in core/autoload/*.el and modules/*/*/autoload.el or ;; Autoloaded functions are in core/autoload/*.el and modules/*/*/autoload.el or
;; modules/*/*/autoload/*.el. ;; modules/*/*/autoload/*.el.
(defvar doom-version "2.0.7" (defvar doom-version "2.0.8"
"Current version of DOOM emacs.") "Current version of DOOM emacs.")
(defvar doom-debug-mode (or (getenv "DEBUG") init-file-debug) (defvar doom-debug-mode (or (getenv "DEBUG") init-file-debug)
@ -94,6 +94,7 @@ melodramatic ex-vimmer disappointed with the text-editor status quo."
enable-recursive-minibuffers nil enable-recursive-minibuffers nil
debug-on-error (and (not noninteractive) doom-debug-mode) debug-on-error (and (not noninteractive) doom-debug-mode)
idle-update-delay 2 ; update ui less often idle-update-delay 2 ; update ui less often
load-prefer-newer (or noninteractive doom-debug-mode)
;; keep the point out of the minibuffer ;; keep the point out of the minibuffer
minibuffer-prompt-properties '(read-only t point-entered minibuffer-avoid-prompt face minibuffer-prompt) minibuffer-prompt-properties '(read-only t point-entered minibuffer-avoid-prompt face minibuffer-prompt)
;; History & backup settings (save nothing, that's what git is for) ;; History & backup settings (save nothing, that's what git is for)
@ -174,9 +175,7 @@ ability to invoke the debugger in debug mode."
gc-cons-percentage 0.6 gc-cons-percentage 0.6
file-name-handler-alist nil) file-name-handler-alist nil)
(require 'cl-lib)
(require 'core-packages (concat doom-core-dir "core-packages")) (require 'core-packages (concat doom-core-dir "core-packages"))
(eval-when-compile (eval-when-compile
(doom-initialize)) (doom-initialize))
(setq load-path (eval-when-compile load-path) (setq load-path (eval-when-compile load-path)

View file

@ -1,10 +1,6 @@
;; -*- no-byte-compile: t; -*- ;; -*- no-byte-compile: t; -*-
;;; core/packages.el ;;; core/packages.el
;; core packages
(package! s)
(package! f)
;; core-os.el ;; core-os.el
;; In case this config is shared across multiple computers (like mine is), let's ;; In case this config is shared across multiple computers (like mine is), let's
;; protect these from autoremoval. ;; protect these from autoremoval.

View file

@ -81,6 +81,7 @@
assembly ; assembly for fun or debugging assembly ; assembly for fun or debugging
cc ; C/C++/Obj-C madness cc ; C/C++/Obj-C madness
crystal ; ruby at the speed of c crystal ; ruby at the speed of c
clojure ; java with a lisp
csharp ; unity, .NET, and mono shenanigans csharp ; unity, .NET, and mono shenanigans
data ; config/data formats data ; config/data formats
elixir ; erlang done right elixir ; erlang done right
@ -97,6 +98,14 @@
lua ; one-based indices? one-based indices lua ; one-based indices? one-based indices
markdown ; writing docs for people to ignore markdown ; writing docs for people to ignore
ocaml ; an objective camel 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 ; centralized export system + more backends
+present ; Emacs for presentations
;; TODO +publish
)
perl ; write code no one else can comprehend perl ; write code no one else can comprehend
php ; make php less awful to work with php ; make php less awful to work with
plantuml ; diagrams for confusing people more plantuml ; diagrams for confusing people more
@ -111,25 +120,15 @@
typescript ; javascript, but better typescript ; javascript, but better
web ; the tubes web ; the tubes
:org
org ; organize your plain life in plain text
org-babel ; executable code snippets in org-mode
org-attach ; a simpler attachment system
org-capture ; a better org-capture, in or outside of Emacs
org-export ; a custom, centralized export system
org-present ; using org-mode for presentations
;org-sync ; TODO sync with mobile
;org-publish ; TODO org + blogs
;; Applications are complex and opinionated modules that transform Emacs ;; Applications are complex and opinionated modules that transform Emacs
;; toward a specific purpose. They may have additional dependencies and ;; toward a specific purpose. They may have additional dependencies and
;; should be loaded last. ;; should be loaded last.
:app :app
email ; emacs as an email client ;email ; emacs as an email client
irc ; how neckbeards socialize ;irc ; how neckbeards socialize
rss ; emacs as an RSS reader ;rss ; emacs as an RSS reader
twitter ; twitter client https://twitter.com/vnought ;twitter ; twitter client https://twitter.com/vnought
write ; emacs as a word processor (latex + org + markdown) ;write ; emacs as a word processor (latex + org + markdown)
;; Private modules named after your username are loaded automatically. ;; Private modules named after your username are loaded automatically.
;; Leaving this here is harmless though. ;; Leaving this here is harmless though.

View file

@ -13,10 +13,8 @@
password-store password-store
:lang :lang
web
:org
org org
web
:private :private
hlissner) hlissner)

View file

@ -31,7 +31,7 @@ DEFAULT-P is a boolean. If non-nil, it marks that email account as the
default/fallback account." default/fallback account."
`(after! mu4e `(after! mu4e
(let ((account-vars ,letvars)) (let ((account-vars ,letvars))
(when-let (address (cdr (assq 'user-mail-address account-vars))) (when-let* ((address (cdr (assq 'user-mail-address account-vars))))
(cl-pushnew address mu4e-user-mail-address-list :test #'equal)) (cl-pushnew address mu4e-user-mail-address-list :test #'equal))
(let ((context (make-mu4e-context (let ((context (make-mu4e-context
:name ,label :name ,label
@ -263,8 +263,7 @@ default/fallback account."
(def-package! org-mu4e (def-package! org-mu4e
:commands org-mu4e-compose-org-mode :hook (mu4e-compose-mode . org-mu4e-compose-org-mode)
:init (add-hook 'mu4e-compose-mode-hook #'org-mu4e-compose-org-mode)
:config :config
(setq org-mu4e-link-query-in-headers-mode nil (setq org-mu4e-link-query-in-headers-mode nil
org-mu4e-convert-to-html t) org-mu4e-convert-to-html t)

View file

@ -30,8 +30,7 @@ playback.")
(def-setting! :irc (server letvars) (def-setting! :irc (server letvars)
"Registers an irc server for circe." "Registers an irc server for circe."
`(after! circe `(after! circe
(cl-pushnew (cons ,server ,letvars) circe-network-options (push (cons ,server ,letvars) circe-network-options)))
:test #'equal :key #'car)))
(defvar +irc--defer-timer nil) (defvar +irc--defer-timer nil)
@ -89,7 +88,7 @@ playback.")
(defun +irc*circe-truncate-nicks () (defun +irc*circe-truncate-nicks ()
"Truncate long nicknames in chat output non-destructively." "Truncate long nicknames in chat output non-destructively."
(when-let (beg (text-property-any (point-min) (point-max) 'lui-format-argument 'nick)) (when-let* ((beg (text-property-any (point-min) (point-max) 'lui-format-argument 'nick)))
(goto-char beg) (goto-char beg)
(let ((end (next-single-property-change beg 'lui-format-argument)) (let ((end (next-single-property-change beg 'lui-format-argument))
(nick (plist-get (plist-get (text-properties-at beg) 'lui-keywords) (nick (plist-get (plist-get (text-properties-at beg) 'lui-keywords)
@ -111,8 +110,7 @@ playback.")
(def-package! circe-color-nicks (def-package! circe-color-nicks
:commands enable-circe-color-nicks :hook (circe-channel-mode . enable-circe-color-nicks)
:init (add-hook 'circe-channel-mode-hook 'enable-circe-color-nicks)
:config :config
(setq circe-color-nicks-min-constrast-ratio 4.5 (setq circe-color-nicks-min-constrast-ratio 4.5
circe-color-nicks-everywhere t)) circe-color-nicks-everywhere t))
@ -161,7 +159,7 @@ after prompt marker."
(add-hook! 'lui-mode-hook (add-hook! 'lui-mode-hook
(add-hook 'evil-insert-state-entry-hook #'+irc|evil-insert nil t)) (add-hook 'evil-insert-state-entry-hook #'+irc|evil-insert nil t))
(mapc (lambda (cmd) (cl-pushnew cmd +irc-scroll-to-bottom-on-commands)) (mapc (lambda (cmd) (push cmd +irc-scroll-to-bottom-on-commands))
'(evil-paste-after evil-paste-before evil-open-above evil-open-below))) '(evil-paste-after evil-paste-before evil-open-above evil-open-below)))
@ -192,7 +190,7 @@ Courtesy of esh-mode.el"
(defun +irc|init-lui-wrapping () (defun +irc|init-lui-wrapping ()
(setq fringes-outside-margins t (setq fringes-outside-margins t
word-wrap t word-wrap t
wrap-prefix (s-repeat (+ +irc-left-padding 3) " "))) wrap-prefix (make-string (+ +irc-left-padding 3) ? )))
(add-hook! 'lui-mode-hook #'(+irc|init-lui-margins +irc|init-lui-wrapping))) (add-hook! 'lui-mode-hook #'(+irc|init-lui-margins +irc|init-lui-wrapping)))
@ -203,5 +201,4 @@ Courtesy of esh-mode.el"
(def-package! lui-autopaste (def-package! lui-autopaste
:commands enable-lui-autopaste :hook (circe-channel-mode . enable-lui-autopaste))
:init (add-hook 'circe-channel-mode-hook 'enable-lui-autopaste))

View file

@ -261,7 +261,7 @@ __DATA__
(overlay-put ov 'category '+regex)) (overlay-put ov 'category '+regex))
(cl-incf i) (cl-incf i)
(dotimes (i 10) (dotimes (i 10)
(when-let (text (match-string i)) (when-let* ((text (match-string i)))
(save-match-data (save-match-data
(with-current-buffer +regex--groups-buffer (with-current-buffer +regex--groups-buffer
(goto-char (point-max)) (goto-char (point-max))

View file

@ -11,7 +11,7 @@
(interactive) (interactive)
(doom-kill-matching-buffers "^\\*elfeed") (doom-kill-matching-buffers "^\\*elfeed")
(dolist (file +rss-elfeed-files) (dolist (file +rss-elfeed-files)
(when-let (buf (get-file-buffer (expand-file-name file +rss-org-dir))) (when-let* ((buf (get-file-buffer (expand-file-name file +rss-org-dir))))
(kill-buffer buf)))) (kill-buffer buf))))
;;;###autoload ;;;###autoload
@ -37,11 +37,11 @@
(defun +rss-popup-pane (buf) (defun +rss-popup-pane (buf)
"Display BUF in a popup." "Display BUF in a popup."
(doom-popup-buffer buf (doom-popup-buffer buf
:align +rss-split-direction '(:align +rss-split-direction
:size 0.75 :size 0.75
:select t :select t
:autokill t :autokill t
:autoclose t)) :autoclose t)))
;;;###autoload ;;;###autoload
(defun +rss/open (entry) (defun +rss/open (entry)

View file

@ -28,7 +28,7 @@
(make-directory elfeed-db-directory t) (make-directory elfeed-db-directory t)
;; Ensure elfeed buffers are treated as real ;; Ensure elfeed buffers are treated as real
(cl-pushnew (lambda (buf) (string-match-p "^\\*elfeed" (buffer-name buf))) (push (lambda (buf) (string-match-p "^\\*elfeed" (buffer-name buf)))
doom-real-buffer-functions) doom-real-buffer-functions)
;; Enhance readability of a post ;; Enhance readability of a post

View file

@ -7,21 +7,19 @@
(interactive "<a><!>") (interactive "<a><!>")
(helm-swoop :$query search :$multiline bang)) (helm-swoop :$query search :$multiline bang))
(defvar +helm--file-last-search nil) (defun +helm--file-search (beg end query &optional directory options)
;;;###autoload (autoload '+helm:ag "completion/helm/autoload/evil" nil t)
(evil-define-command +helm:ag (beg end query &optional bang directory)
"TODO"
(interactive "<r><a><!>")
(require 'helm-ag) (require 'helm-ag)
(helm-ag--init-state) (helm-ag--init-state)
(let ((helm-ag--default-directory (or directory (doom-project-root))) (let ((helm-ag--default-directory (or directory (doom-project-root)))
(helm-ag--last-query (or query (query (or query
(if (evil-visual-state-p)
(and beg end (and beg end
(> (abs (- end beg)) 1) (> (abs (- end beg)) 1)
(setq +helm--file-last-search (rxt-quote-pcre (buffer-substring-no-properties beg end)))
(rxt-quote-pcre (buffer-substring-no-properties beg end)))) +helm--file-last-query)
+helm--file-last-search)) +helm--file-last-query))
(helm-ag-command-option (concat helm-ag-command-option (if bang " -a ")))) (helm-ag-command-option (concat helm-ag-command-option " " (string-join options " "))))
(setq helm-ag--last-query query)
(helm-attrset 'search-this-file nil helm-ag-source) (helm-attrset 'search-this-file nil helm-ag-source)
(helm-attrset 'name (helm-ag--helm-header helm-ag--default-directory) helm-ag-source) (helm-attrset 'name (helm-ag--helm-header helm-ag--default-directory) helm-ag-source)
(helm :sources '(helm-ag-source) (helm :sources '(helm-ag-source)
@ -30,16 +28,33 @@
:keymap helm-ag-map :keymap helm-ag-map
:history 'helm-ag--helm-history))) :history 'helm-ag--helm-history)))
;;;###autoload (autoload '+helm:ag-cwd "completion/helm/autoload/evil" nil t) (defvar +helm--file-last-search nil)
(evil-define-command +helm:ag-cwd (beg end query &optional bang directory) ;;;###autoload (autoload '+helm:ag "completion/helm/autoload/evil" nil t)
(evil-define-command +helm:ag (beg end query &optional bang)
"TODO" "TODO"
(interactive "<r><a><!>") (interactive "<r><a><!>")
(let ((helm-ag-command-option (if bang " -n "))) (+helm--file-search beg end query nil
(+helm:ag beg end query t default-directory))) (if bang (list "-a" "--hidden"))))
;;;###autoload ;;;###autoload (autoload '+helm:ag-cwd "completion/helm/autoload/evil" nil t)
(defun +helm:rg (&rest _) (interactive) (error "Not implemented yet")) (evil-define-command +helm:ag-cwd (beg end query &optional bang)
;;;###autoload "TODO"
(defun +helm:rg-cwd (&rest _) (interactive) (error "Not implemented yet")) (interactive "<r><a><!>")
;;;###autoload (+helm--file-search beg end query default-directory
(defun +helm:todo (&rest _) (interactive) (error "Not implemented yet")) (list "-n" (if bang "-a"))))
;;;###autoload (autoload '+helm:rg "completion/helm/autoload/evil" nil t)
(evil-define-command +helm:rg (beg end query &optional bang)
"TODO"
(interactive "<r><a><!>")
(let ((helm-ag-base-command "rg --no-heading"))
(+helm--file-search beg end query nil
(if bang (list "-uu")))))
;;;###autoload (autoload '+helm:rg-cwd "completion/helm/autoload/evil" nil t)
(evil-define-command +helm:rg-cwd (beg end query &optional bang)
"TODO"
(interactive "<r><a><!>")
(let ((helm-ag-base-command "rg --no-heading --maxdepth 1"))
(+helm--file-search beg end query default-directory
(if bang (list "-uu")))))

View file

@ -11,7 +11,6 @@
;; ;;
(def-package! helm (def-package! helm
:demand t
:init :init
(setq helm-quick-update t (setq helm-quick-update t
;; Speedier without fuzzy matching ;; Speedier without fuzzy matching
@ -77,15 +76,18 @@
(def-package! helm-locate (def-package! helm-locate
:defer t
:init (defvar helm-generic-files-map (make-sparse-keymap)) :init (defvar helm-generic-files-map (make-sparse-keymap))
:config (set-keymap-parent helm-generic-files-map helm-map)) :config (set-keymap-parent helm-generic-files-map helm-map))
(def-package! helm-bookmark (def-package! helm-bookmark
:commands helm-bookmark
:config (setq-default helm-bookmark-show-location t)) :config (setq-default helm-bookmark-show-location t))
(def-package! helm-files (def-package! helm-files
:defer t
:config :config
(setq helm-boring-file-regexp-list (setq helm-boring-file-regexp-list
(append (list "\\.projects$" "\\.DS_Store$") (append (list "\\.projects$" "\\.DS_Store$")
@ -93,6 +95,7 @@
(def-package! helm-ag (def-package! helm-ag
:defer t
:config :config
(map! :map helm-ag-edit-map (map! :map helm-ag-edit-map
[remap doom/kill-this-buffer] #'helm-ag--edit-abort [remap doom/kill-this-buffer] #'helm-ag--edit-abort

View file

@ -22,11 +22,18 @@
(ido-mode 1) (ido-mode 1)
(ido-everywhere 1) (ido-everywhere 1)
(require 'ido-ubiquitous) (require 'ido-ubiquitous)
(ido-ubiquitous-mode 1)
(defun +ido|init () (defun +ido|init ()
(require 'ido-vertical-mode) (require 'ido-vertical-mode)
(ido-vertical-mode 1)
(require 'flx-ido) (require 'flx-ido)
(flx-ido-mode +1)
(require 'crm-custom) (require 'crm-custom)
(crm-custom-mode +1)
(map! :map (ido-common-completion-map ido-completion-map ido-file-completion-map) (map! :map (ido-common-completion-map ido-completion-map ido-file-completion-map)
"C-n" #'ido-next-match "C-n" #'ido-next-match
"C-p" #'ido-prev-match "C-p" #'ido-prev-match
@ -55,12 +62,3 @@
(insert "~/") (insert "~/")
(call-interactively #'self-insert-command))))) (call-interactively #'self-insert-command)))))
(add-hook 'ido-setup-hook #'+ido|setup-home-keybind)) (add-hook 'ido-setup-hook #'+ido|setup-home-keybind))
(def-package! ido-ubiquitous :config (ido-ubiquitous-mode 1))
(def-package! ido-vertical-mode :config (ido-vertical-mode 1))
(def-package! flx-ido :config (flx-ido-mode +1))
(def-package! crm-custom :config (crm-custom-mode +1))

View file

@ -58,7 +58,7 @@
(replace-regexp-in-string " -i " " -S " counsel-rg-base-command)) (replace-regexp-in-string " -i " " -S " counsel-rg-base-command))
(args (concat (args (concat
(if all-files-p " -uu") (if all-files-p " -uu")
(unless recursion-p " --maxdepth 0")))) (unless recursion-p " --maxdepth 1"))))
(counsel-rg query directory args (format prompt args)))) (counsel-rg query directory args (format prompt args))))
('pt) ;; TODO pt search engine (necessary?) ('pt) ;; TODO pt search engine (necessary?)
(_ (error "No search engine specified"))))) (_ (error "No search engine specified")))))

View file

@ -73,9 +73,9 @@ If ARG (universal argument), open selection in other-window."
(task-tags (mapcar #'car +ivy-task-tags)) (task-tags (mapcar #'car +ivy-task-tags))
(cmd (cmd
(format "%s -H -S --no-heading -- %s %s" (format "%s -H -S --no-heading -- %s %s"
(or (when-let (bin (executable-find "rg")) (or (when-let* ((bin (executable-find "rg")))
(concat bin " --line-number")) (concat bin " --line-number"))
(when-let (bin (executable-find "ag")) (when-let* ((bin (executable-find "ag")))
(concat bin " --numbers")) (concat bin " --numbers"))
(error "ripgrep & the_silver_searcher are unavailable")) (error "ripgrep & the_silver_searcher are unavailable"))
(shell-quote-argument (shell-quote-argument
@ -144,8 +144,7 @@ counsel-rg)."
(let ((default-directory counsel--git-dir) (let ((default-directory counsel--git-dir)
(regex (counsel-unquote-regex-parens (regex (counsel-unquote-regex-parens
(setq ivy--old-re (setq ivy--old-re
(ivy--regex (ivy--regex string)))))
(counsel-unquote-regex-parens string)))))) ;; #2
(let* ((args-end (string-match " -- " extra-ag-args)) (let* ((args-end (string-match " -- " extra-ag-args))
(file (if args-end (file (if args-end
(substring-no-properties extra-ag-args (+ args-end 3)) (substring-no-properties extra-ag-args (+ args-end 3))

View file

@ -24,7 +24,6 @@ immediately runs it on the current candidate (ending the ivy session)."
;; ;;
(def-package! ivy (def-package! ivy
:demand t
:init :init
(add-hook 'doom-post-init-hook #'ivy-mode) (add-hook 'doom-post-init-hook #'ivy-mode)
:config :config
@ -57,8 +56,6 @@ immediately runs it on the current candidate (ending the ivy session)."
[remap projectile-find-file] #'counsel-projectile-find-file [remap projectile-find-file] #'counsel-projectile-find-file
[remap imenu-anywhere] #'ivy-imenu-anywhere [remap imenu-anywhere] #'ivy-imenu-anywhere
[remap execute-extended-command] #'counsel-M-x [remap execute-extended-command] #'counsel-M-x
[remap describe-function] #'counsel-describe-function
[remap describe-variable] #'counsel-describe-variable
[remap describe-face] #'counsel-describe-face) [remap describe-face] #'counsel-describe-face)
;; Show more buffer information in switch-buffer commands ;; Show more buffer information in switch-buffer commands
@ -67,7 +64,6 @@ immediately runs it on the current candidate (ending the ivy session)."
(ivy-set-display-transformer #'+ivy/switch-workspace-buffer #'+ivy-buffer-transformer) (ivy-set-display-transformer #'+ivy/switch-workspace-buffer #'+ivy-buffer-transformer)
(ivy-set-display-transformer #'counsel-recentf #'abbreviate-file-name) (ivy-set-display-transformer #'counsel-recentf #'abbreviate-file-name)
(when (featurep! :feature workspaces)
(nconc ivy-sort-functions-alist (nconc ivy-sort-functions-alist
'((persp-kill-buffer . nil) '((persp-kill-buffer . nil)
(persp-remove-buffer . nil) (persp-remove-buffer . nil)
@ -76,14 +72,14 @@ immediately runs it on the current candidate (ending the ivy session)."
(persp-window-switch . nil) (persp-window-switch . nil)
(persp-frame-switch . nil) (persp-frame-switch . nil)
(+workspace/switch-to . nil) (+workspace/switch-to . nil)
(+workspace/delete . nil))))) (+workspace/delete . nil))))
(def-package! swiper :commands (swiper swiper-all)) (def-package! swiper :commands (swiper swiper-all))
(def-package! counsel (def-package! counsel
:after ivy :requires ivy
:config :config
(require 'counsel-projectile) (require 'counsel-projectile)
(setq counsel-find-file-ignore-regexp "\\(?:^[#.]\\)\\|\\(?:[#~]$\\)\\|\\(?:^Icon?\\)") (setq counsel-find-file-ignore-regexp "\\(?:^[#.]\\)\\|\\(?:[#~]$\\)\\|\\(?:^Icon?\\)")
@ -96,10 +92,8 @@ immediately runs it on the current candidate (ending the ivy session)."
'(("O" +ivy-git-grep-other-window-action "open in other window")))) '(("O" +ivy-git-grep-other-window-action "open in other window"))))
;; 1. Remove character limit from `counsel-ag-function' ;; 1. Remove character limit from `counsel-ag-function'
;; 2. Disable ivy's over-zealous parentheses quoting behavior (if i want ;; 2. This may need to be updated frequently, to meet changes upstream
;; literal parentheses, I'll escape them myself). ;; 3. counsel-ag, counsel-rg and counsel-pt all use this function
;; 3. This may need to be updated frequently, to meet changes upstream
;; 4. counsel-ag, counsel-rg and counsel-pt all use this function
(advice-add #'counsel-ag-function :override #'+ivy*counsel-ag-function)) (advice-add #'counsel-ag-function :override #'+ivy*counsel-ag-function))
@ -144,9 +138,9 @@ immediately runs it on the current candidate (ending the ivy session)."
("i" nil) ("i" nil)
("TAB" ivy-alt-done :exit nil) ("TAB" ivy-alt-done :exit nil)
("C-j" ivy-alt-done :exit nil) ("C-j" ivy-alt-done :exit nil)
;; ("d" ivy-done :exit t)
("RET" ivy-done :exit t) ("RET" ivy-done :exit t)
("C-m" ivy-done :exit t) ("C-m" ivy-done :exit t)
("C-SPC" ivy-call-and-recenter :exit nil)
("f" ivy-call) ("f" ivy-call)
("c" ivy-toggle-calling) ("c" ivy-toggle-calling)
("m" ivy-toggle-fuzzy) ("m" ivy-toggle-fuzzy)

View file

@ -13,7 +13,7 @@
"Evaluate a region between BEG and END and display the output." "Evaluate a region between BEG and END and display the output."
(interactive "r") (interactive "r")
(let ((load-file-name buffer-file-name)) (let ((load-file-name buffer-file-name))
(if-let (runner (cdr (assq major-mode +eval-runners))) (if-let* ((runner (cdr (assq major-mode +eval-runners))))
(funcall runner beg end) (funcall runner beg end)
(quickrun-region beg end)))) (quickrun-region beg end))))

View file

@ -7,7 +7,7 @@
(or (eq (current-buffer) +eval-repl-buffer) (or (eq (current-buffer) +eval-repl-buffer)
(progn (progn
(if (and +eval-repl-buffer (buffer-live-p +eval-repl-buffer)) (if (and +eval-repl-buffer (buffer-live-p +eval-repl-buffer))
(if-let (win (get-buffer-window +eval-repl-buffer)) (if-let* ((win (get-buffer-window +eval-repl-buffer)))
(select-window win) (select-window win)
(doom-popup-buffer +eval-repl-buffer)) (doom-popup-buffer +eval-repl-buffer))
(when command (when command
@ -29,7 +29,7 @@
"Opens (or reopens) the REPL associated with the current major-mode and place "Opens (or reopens) the REPL associated with the current major-mode and place
the cursor at the prompt." the cursor at the prompt."
(interactive) (interactive)
(when-let (command (cdr (assq major-mode +eval-repls))) (when-let* ((command (cdr (assq major-mode +eval-repls))))
(when (+eval--ensure-in-repl-buffer command) (when (+eval--ensure-in-repl-buffer command)
(when (bound-and-true-p evil-mode) (when (bound-and-true-p evil-mode)
(call-interactively #'evil-append-line)) (call-interactively #'evil-append-line))

View file

@ -74,7 +74,7 @@ function that creates and returns the REPL buffer."
(defun +eval*quickrun-auto-close (&rest _) (defun +eval*quickrun-auto-close (&rest _)
"Allows us to silently re-run quickrun from within the quickrun buffer." "Allows us to silently re-run quickrun from within the quickrun buffer."
(when-let (win (get-buffer-window quickrun--buffer-name)) (when-let* ((win (get-buffer-window quickrun--buffer-name)))
(let ((inhibit-message t)) (let ((inhibit-message t))
(quickrun--kill-running-process) (quickrun--kill-running-process)
(message "")) (message ""))

View file

@ -77,7 +77,7 @@ overwrite the destination file if it exists, without confirmation."
(pcase (catch 'status (pcase (catch 'status
(let ((old-path (buffer-file-name)) (let ((old-path (buffer-file-name))
(new-path (expand-file-name new-path))) (new-path (expand-file-name new-path)))
(when-let (dest (+evil--copy-file old-path new-path force-p)) (when-let* ((dest (+evil--copy-file old-path new-path force-p)))
(delete-file old-path) (delete-file old-path)
(kill-this-buffer) (kill-this-buffer)
(find-file new-path) (find-file new-path)
@ -95,7 +95,7 @@ overwrite the destination file if it exists, without confirmation."
:repeat nil :repeat nil
(interactive "<f><!>") (interactive "<f><!>")
(pcase (catch 'status (pcase (catch 'status
(when-let (dest (+evil--copy-file (buffer-file-name) new-path force-p)) (when-let* ((dest (+evil--copy-file (buffer-file-name) new-path force-p)))
(message "File successfully copied to %s" dest))) (message "File successfully copied to %s" dest)))
('overwrite-self (error "Cannot overwrite self")) ('overwrite-self (error "Cannot overwrite self"))
('aborted (message "Aborted")) ('aborted (message "Aborted"))

View file

@ -21,7 +21,6 @@
(autoload 'goto-last-change-reverse "goto-chg") (autoload 'goto-last-change-reverse "goto-chg")
(def-package! evil (def-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
@ -181,11 +180,11 @@ across windows."
(evil-embrace-enable-evil-surround-integration) (evil-embrace-enable-evil-surround-integration)
(defun +evil--embrace-get-pair (char) (defun +evil--embrace-get-pair (char)
(if-let (pair (cdr-safe (assoc (string-to-char char) evil-surround-pairs-alist))) (if-let* ((pair (cdr-safe (assoc (string-to-char char) evil-surround-pairs-alist))))
pair pair
(if-let (pair (assoc-default char embrace--pairs-list)) (if-let* ((pair (assoc-default char embrace--pairs-list)))
(if-let (real-pair (and (functionp (embrace-pair-struct-read-function pair)) (if-let* ((real-pair (and (functionp (embrace-pair-struct-read-function pair))
(funcall (embrace-pair-struct-read-function pair)))) (funcall (embrace-pair-struct-read-function pair)))))
real-pair real-pair
(cons (embrace-pair-struct-left pair) (embrace-pair-struct-right pair))) (cons (embrace-pair-struct-left pair) (embrace-pair-struct-right pair)))
(cons char char)))) (cons char char))))
@ -209,13 +208,12 @@ across windows."
(cons (format "(%s " (or (read-string "(") "")) ")")) (cons (format "(%s " (or (read-string "(") "")) ")"))
;; Add escaped-sequence support to embrace ;; Add escaped-sequence support to embrace
(cl-pushnew (cons ?\\ (make-embrace-pair-struct (push (cons ?\\ (make-embrace-pair-struct
:key ?\\ :key ?\\
:read-function #'+evil--embrace-escaped :read-function #'+evil--embrace-escaped
:left-regexp "\\[[{(]" :left-regexp "\\[[{(]"
:right-regexp "\\[]})]")) :right-regexp "\\[]})]"))
(default-value 'embrace--pairs-list) (default-value 'embrace--pairs-list))
:key #'car)
;; Add extra pairs ;; Add extra pairs
(add-hook 'LaTeX-mode-hook #'embrace-LaTeX-mode-hook) (add-hook 'LaTeX-mode-hook #'embrace-LaTeX-mode-hook)
@ -238,7 +236,7 @@ across windows."
(add-hook 'doom-post-init-hook #'evil-escape-mode) (add-hook 'doom-post-init-hook #'evil-escape-mode)
:config :config
;; no `evil-escape' in minibuffer ;; no `evil-escape' in minibuffer
(cl-pushnew #'minibufferp evil-escape-inhibit-functions :test #'eq) (push #'minibufferp evil-escape-inhibit-functions)
(map! :irvo "C-g" #'evil-escape)) (map! :irvo "C-g" #'evil-escape))

View file

@ -4,7 +4,7 @@
tmp/ tmp/
`(let ((type-ignore (yas-choose-value '("(none)" "python" "ruby" "java" "js")))) `(let ((type-ignore (yas-choose-value '("(none)" "python" "ruby" "java" "js"))))
(s-join "\n" (string-join
(cond ((string= type-ignore "python") (cond ((string= type-ignore "python")
'("*.py[cod]" '("*.py[cod]"
"*.egg" "*.egg"
@ -20,5 +20,5 @@ tmp/
'("*.class" '("*.class"
"build")) "build"))
((string= type-ignore "js") ((string= type-ignore "js")
'("*.tern-port")) '("*.tern-port")))
)))` "\n"))`

View file

@ -13,7 +13,7 @@ RELEASE_FLAGS = -O2 -D NDEBUG -combile -fwhole-program
RELEASE_DIR = ./build/release RELEASE_DIR = ./build/release
DEBUG_DIR = ./build/debug DEBUG_DIR = ./build/debug
TARGET = ${1:appname$(s-replace " " "" yas-text)} TARGET = ${1:appname$(replace-regexp-in-string " " "" yas-text nil t)}
HEADERS = \$(shell echo include/*.h) HEADERS = \$(shell echo include/*.h)
SOURCES = \$(shell echo src/*.cpp) \$(shell echo src/**/*.cpp) SOURCES = \$(shell echo src/*.cpp) \$(shell echo src/**/*.cpp)
OBJECTS = \$(SOURCES:.cpp=.o) OBJECTS = \$(SOURCES:.cpp=.o)

View file

@ -1,12 +1,12 @@
# `(progn # `(progn
(setq-local pkgs (split-string (s-chop-prefix (concat (doom-project-root) "lib/") (file-name-sans-extension buffer-file-name)) "/" t)) (setq-local pkgs (split-string (string-remove-prefix (concat (doom-project-root) "lib/") (file-name-sans-extension buffer-file-name)) "/" t))
(setq-local pkgs-p (eq (length pkgs) 1)) (setq-local pkgs-p (eq (length pkgs) 1))
(setq-local pkg-module (s-replace " " "::" (s-titleized-words (if pkgs-p (car pkgs) (string-join (butlast pkgs) " "))))) (setq-local pkg-module (replace-regexp-in-string " " "::" (capitalize (if pkgs-p (car pkgs) (string-join (butlast pkgs) " "))) nil t))
(concat "lib/" (file-name-nondirectory buffer-file-name)))` (concat "lib/" (file-name-nondirectory buffer-file-name)))`
module `pkg-module` module `pkg-module`
`(when pkgs-p " VERSION='0.0.1'\n\n")``(concat " class " (if pkgs-p "<< self" (s-capitalize (car (last pkgs)))))` `(when pkgs-p " VERSION='0.0.1'\n\n")``(concat " class " (if pkgs-p "<< self" (capitalize (car (last pkgs)))))`
`%`${0:# Code here} `%`${0:# Code here}
end end
end end

View file

@ -35,12 +35,11 @@ Tries xref and falls back to `dumb-jump', then rg/ag, then
((and (require 'dumb-jump nil t) ((and (require 'dumb-jump nil t)
;; dumb-jump doesn't tell us if it succeeded or not ;; dumb-jump doesn't tell us if it succeeded or not
(let ((old-fn-sym (make-symbol "old-fn")) (let ((old-fn (symbol-function 'dumb-jump-get-results))
successful) successful)
(cl-letf ((old-fn-sym (symbol-function 'dumb-jump-get-results)) (cl-letf (((symbol-function 'dumb-jump-get-results)
((symbol-function 'dumb-jump-get-results)
(lambda (&optional prompt) (lambda (&optional prompt)
(let* ((plist (funcall old-fn-sym prompt)) (let* ((plist (funcall old-fn prompt))
(results (plist-get plist :results))) (results (plist-get plist :results)))
(when (and results (> (length results) 0)) (when (and results (> (length results) 0))
(setq successful t)) (setq successful t))

View file

@ -70,8 +70,8 @@ properties:
(defun +jump|init () (defun +jump|init ()
"Initialize `+jump-current-functions', used by `+jump/definition', "Initialize `+jump-current-functions', used by `+jump/definition',
`+jump/references' and `+jump/documentation'." `+jump/references' and `+jump/documentation'."
(when-let (plist (cdr (assq major-mode +jump-function-alist))) (when-let* ((plist (cdr (assq major-mode +jump-function-alist))))
(when-let (backend (plist-get plist :xref-backend)) (when-let* ((backend (plist-get plist :xref-backend)))
(make-variable-buffer-local 'xref-backend-functions) (make-variable-buffer-local 'xref-backend-functions)
(cl-pushnew backend xref-backend-functions :test #'eq)) (cl-pushnew backend xref-backend-functions :test #'eq))
(setq-local +jump-current-functions plist))) (setq-local +jump-current-functions plist)))

View file

@ -11,7 +11,7 @@ and switches to insert mode if there are editable fields."
(cl-letf (((symbol-function 'region-beginning) (lambda () evil-visual-beginning)) (cl-letf (((symbol-function 'region-beginning) (lambda () evil-visual-beginning))
((symbol-function 'region-end) (lambda () evil-visual-end))) ((symbol-function 'region-end) (lambda () evil-visual-end)))
(yas-insert-snippet)) (yas-insert-snippet))
(when-let (snippet (car-safe (yas-active-snippets))) (when-let* ((snippet (car-safe (yas-active-snippets))))
(let ((fields (yas--snippet-fields snippet))) (let ((fields (yas--snippet-fields snippet)))
(evil-insert-state +1) (evil-insert-state +1)
(unless fields (evil-change-state 'normal))))) (unless fields (evil-change-state 'normal)))))

View file

@ -1,4 +1,5 @@
;;; feature/version-control/+git.el -*- lexical-binding: t; -*- ;;; feature/version-control/+git.el -*- lexical-binding: t; -*-
;;;###if (not (featurep! -git))
(def-package! gitconfig-mode (def-package! gitconfig-mode
:mode "/\\.?git/?config$" :mode "/\\.?git/?config$"

View file

@ -27,7 +27,7 @@ repository root."
(defun +vcs/git-browse-issues () (defun +vcs/git-browse-issues ()
"Open the github issues page for current repo." "Open the github issues page for current repo."
(interactive) (interactive)
(if-let (root (+vcs-root)) (if-let* ((root (+vcs-root)))
(browse-url (concat root "/issues")) (browse-url (concat root "/issues"))
(user-error "No git root found!"))) (user-error "No git root found!")))

View file

@ -20,15 +20,15 @@
(set! :evil-state 'vc-git-log-view-mode 'normal)) (set! :evil-state 'vc-git-log-view-mode 'normal))
(def-package! smerge-mode (def-package! smerge-mode
:init :hook (find-file . +vcs|enable-smerge-mode-maybe)
(add-hook 'find-file-hook #'+vcs|enable-smerge-mode-maybe)
:config :config
(when (version< emacs-version "26") (when (version< emacs-version "26")
(with-no-warnings
(defalias #'smerge-keep-upper #'smerge-keep-mine) (defalias #'smerge-keep-upper #'smerge-keep-mine)
(defalias #'smerge-keep-lower #'smerge-keep-other) (defalias #'smerge-keep-lower #'smerge-keep-other)
(defalias #'smerge-diff-base-upper #'smerge-diff-base-mine) (defalias #'smerge-diff-base-upper #'smerge-diff-base-mine)
(defalias #'smerge-diff-upper-lower #'smerge-diff-mine-other) (defalias #'smerge-diff-upper-lower #'smerge-diff-mine-other)
(defalias #'smerge-diff-base-lower #'smerge-diff-base-other)) (defalias #'smerge-diff-base-lower #'smerge-diff-base-other)))
(def-hydra! +hydra-smerge (:hint nil (def-hydra! +hydra-smerge (:hint nil
:pre (smerge-mode 1) :pre (smerge-mode 1)

View file

@ -53,7 +53,7 @@
;;;###autoload ;;;###autoload
(defun +workspace-get (name &optional noerror) (defun +workspace-get (name &optional noerror)
"Returns a workspace (perspective hash table) named NAME." "Returns a workspace (perspective hash table) named NAME."
(when-let (persp (persp-get-by-name name)) (when-let* ((persp (persp-get-by-name name)))
(cond ((+workspace-p persp) persp) (cond ((+workspace-p persp) persp)
((not noerror) (error "'%s' is an invalid workspace" name))))) ((not noerror) (error "'%s' is an invalid workspace" name)))))

View file

@ -22,7 +22,6 @@ renamed.")
;; ;;
(def-package! persp-mode (def-package! persp-mode
:demand t
:config :config
(setq persp-autokill-buffer-on-remove 'kill-weak (setq persp-autokill-buffer-on-remove 'kill-weak
persp-nil-name "nil" persp-nil-name "nil"
@ -92,7 +91,7 @@ Allows a perspective-specific buffer list via `+workspaces-buffer-list'."
(not persp-temporarily-display-buffer) (not persp-temporarily-display-buffer)
(doom-real-buffer-p buffer)) (doom-real-buffer-p buffer))
(persp-add-buffer buffer (get-current-persp) nil) (persp-add-buffer buffer (get-current-persp) nil)
(redisplay))) (force-mode-line-update t)))
(advice-add #'switch-to-buffer :after #'+workspaces*auto-add-buffer) (advice-add #'switch-to-buffer :after #'+workspaces*auto-add-buffer)
(advice-add #'display-buffer :after #'+workspaces*auto-add-buffer)) (advice-add #'display-buffer :after #'+workspaces*auto-add-buffer))

View file

@ -35,9 +35,9 @@ compilation database is present in the project.")
(or (file-exists-p (expand-file-name (or (file-exists-p (expand-file-name
(concat (file-name-sans-extension buffer-file-name) (concat (file-name-sans-extension buffer-file-name)
".cpp"))) ".cpp")))
(when-let (file (car-safe (projectile-get-other-files (when-let* ((file (car-safe (projectile-get-other-files
buffer-file-name buffer-file-name
(projectile-current-project-files)))) (projectile-current-project-files)))))
(equal (file-name-extension file) "cpp"))))) (equal (file-name-extension file) "cpp")))))
(defun +cc-objc-header-file-p () (defun +cc-objc-header-file-p ()
@ -105,28 +105,24 @@ compilation database is present in the project.")
(def-package! modern-cpp-font-lock (def-package! modern-cpp-font-lock
:commands modern-c++-font-lock-mode :hook (c++-mode . modern-c++-font-lock-mode))
:init (add-hook 'c++-mode-hook #'modern-c++-font-lock-mode))
(def-package! irony (def-package! irony
:after cc-mode :after cc-mode
:commands irony-install-server :commands irony-install-server
:preface :preface (setq irony-server-install-prefix (concat doom-etc-dir "irony-server/"))
(setq irony-server-install-prefix (concat doom-etc-dir "irony-server/")) :hook ((c-mode c++-mode objc-mode) . irony-mode)
:init
(add-hook! (c-mode c++-mode objc-mode) #'irony-mode)
:config :config
(unless (file-directory-p irony-server-install-prefix) (unless (file-directory-p irony-server-install-prefix)
(warn "irony-mode: server isn't installed; run M-x irony-install-server")) (warn "irony-mode: server isn't installed; run M-x irony-install-server"))
;; Initialize compilation database, if present. Otherwise, fall back on ;; Initialize compilation database, if present. Otherwise, fall back on
;; `+cc-compiler-options'. ;; `+cc-compiler-options'.
(add-hook 'irony-mode-hook #'+cc|irony-init-compile-options)) (add-hook 'irony-mode-hook #'+cc|irony-init-compile-options))
(def-package! irony-eldoc (def-package! irony-eldoc
:after irony :after irony
:config (add-hook 'irony-mode-hook #'irony-eldoc)) :hook (irony-mode . irony-eldoc))
(def-package! flycheck-irony (def-package! flycheck-irony
:when (featurep! :feature syntax-checker) :when (featurep! :feature syntax-checker)
@ -157,8 +153,7 @@ compilation database is present in the project.")
(def-package! opencl-mode :mode "\\.cl$") (def-package! opencl-mode :mode "\\.cl$")
(def-package! demangle-mode (def-package! demangle-mode
:commands demangle-mode :hook llvm-mode)
:init (add-hook 'llvm-mode-hook #'demangle-mode))
(def-package! glsl-mode (def-package! glsl-mode
:mode "\\.glsl$" :mode "\\.glsl$"

View file

@ -1,9 +1,44 @@
;;; lang/clojure/config.el -*- lexical-binding: t; -*- ;;; lang/clojure/config.el -*- lexical-binding: t; -*-
(def-package! clojure-mode (def-package! clojure-mode
:mode "\\.clj$") :mode "\\.clj$"
:mode ("\\.cljs$" . clojurescript-mode)
:config
(map! :map clojure-mode-map
(:localleader
:n "'" #'cider-jack-in
:n "\"" #'cider-jack-in-clojurescript
:n "B" #'cider-switch-to-repl-buffer
:n "b" #'cider-eval-buffer
:n "n" #'cider-repl-set-ns
:n "j" #'cider-find-var
:n "d" #'cider-doc
:n "c" #'cider-repl-clear-buffer
:n "p" #'cider-eval-sexp-at-point
:n "r" #'cider-eval-region)))
(def-package! clj-refactor
:after clojure-mode
:config
;; setup some extra namespace auto completion for great awesome
(dolist (mapping '(("re-frame" . "re-frame.core")
("reagent" . "reagent.core")
("str" . "clojure.str")))
(add-to-list 'cljr-magic-require-namespaces mapping t)))
(def-package! cider (def-package! cider
:commands (cider-jack-in cider-mode) ;; NOTE: if you don't have an org directory set (the dir doesn't exist), cider jack in won't work.
:commands (cider-jack-in cider-mode cider-jack-in-clojurescript)
:config :config
(setq nrepl-hide-special-buffers t)) (setq nrepl-hide-special-buffers t)
;; settings for cider repl as a popup (prevent it from being closed on escape, especially.)
(set! :popup "^\\*cider" :regexp t :noselect t :noesc t)
;; Setup cider for clojurescript / figwheel dev.
(setq cider-cljs-lein-repl
"(do (require 'figwheel-sidecar.repl-api)
(figwheel-sidecar.repl-api/start-figwheel!)
(figwheel-sidecar.repl-api/cljs-repl))"))

View file

@ -2,4 +2,5 @@
;;; lang/clojure/packages.el ;;; lang/clojure/packages.el
(package! cider) (package! cider)
(package! clj-refactor)

View file

@ -9,3 +9,7 @@
(:exec . "%c %s") (:exec . "%c %s")
(:description . "Run Crystal script")))) (:description . "Run Crystal script"))))
(def-package! flycheck-crystal
:after crystal-mode
:config (add-hook 'crystal-mode-hook #'flycheck-mode))

View file

@ -1,5 +1,6 @@
;; -*- no-byte-compile: t; -*- ;; -*- no-byte-compile: t; -*-
;;; lang/crystal/packages.el ;;; lang/crystal/packages.el
(package! crystal-mode :recipe (:fetcher github :repo "dotmilk/emacs-crystal-mode")) (package! crystal-mode)
(package! flycheck-crystal)

View file

@ -9,7 +9,6 @@
(def-package! flycheck-elm (def-package! flycheck-elm
:after elm-mode :after (:all flycheck elm-mode)
:config :hook (flycheck-mode . flycheck-elm-setup))
(add-hook 'flycheck-mode-hook #'flycheck-elm-setup))

View file

@ -72,6 +72,7 @@
(def-package! slime (def-package! slime
:defer t
:config :config
(setq inferior-lisp-program "clisp") (setq inferior-lisp-program "clisp")
(require 'slime-fuzzy)) (require 'slime-fuzzy))

View file

@ -65,9 +65,7 @@
(def-package! go-eldoc (def-package! go-eldoc
:after go-mode :hook (go-mode . go-eldoc-setup))
:commands go-eldoc-setup
:config (add-hook 'go-mode-hook #'go-eldoc-setup))
(def-package! go-guru (def-package! go-guru

View file

@ -1,10 +1,12 @@
;;; lang/haskell/+dante.el -*- lexical-binding: t; -*- ;;; lang/haskell/+dante.el -*- lexical-binding: t; -*-
;;;###if (featurep! +dante)
(def-package! dante (def-package! dante
:after haskell-mode :after haskell-mode
:init :hook (haskell-mode . dante-mode)
(add-hook! 'haskell-mode-hook #'(dante-mode interactive-haskell-mode))
:config :config
(add-hook 'haskell-mode-hook #'interactive-haskell-mode)
(unless (executable-find "cabal") (unless (executable-find "cabal")
(warn "haskell-mode: couldn't find cabal") (warn "haskell-mode: couldn't find cabal")
(remove-hook 'haskell-mode-hook #'dante-mode)) (remove-hook 'haskell-mode-hook #'dante-mode))

View file

@ -1,9 +1,8 @@
;;; lang/haskell/+intero.el -*- lexical-binding: t; -*- ;;; lang/haskell/+intero.el -*- lexical-binding: t; -*-
;;;###if (featurep! +intero)
(def-package! intero (def-package! intero
:commands intero-mode :hook (haskell-mode . intero-mode)
:init
(add-hook 'haskell-mode-hook #'intero-mode)
:config :config
(unless (executable-find "stack") (unless (executable-find "stack")
(warn "haskell-mode: couldn't find stack, disabling intero") (warn "haskell-mode: couldn't find stack, disabling intero")
@ -16,6 +15,4 @@
(def-package! hindent (def-package! hindent
:commands hindent-mode :hook (haskell-mode . hindent-mode))
:init
(add-hook 'haskell-mode-hook #'hindent-mode))

View file

@ -1,10 +1,10 @@
;;; lang/java/+eclim.el -*- lexical-binding: t; -*- ;;; lang/java/+eclim.el -*- lexical-binding: t; -*-
;;;###if (featurep! +eclim)
;; NOTE This submodule is incomplete ;; NOTE This submodule is incomplete
(def-package! eclim (def-package! eclim
:init :hook (java-mode . eclim-mode)
(add-hook 'java-mode-hook #'eclim-mode)
:config :config
(set! :jump 'java-mode (set! :jump 'java-mode
:definition #'eclim-java-find-declaration :definition #'eclim-java-find-declaration
@ -53,6 +53,6 @@
(def-package! company-emacs-eclim (def-package! company-emacs-eclim
:when (featurep! :completion company) :when (featurep! :completion company)
:after java :after java-mode
:config :config
(set! :company-backend 'java-mode '(company-emacs-eclim))) (set! :company-backend 'java-mode '(company-emacs-eclim)))

View file

@ -1,9 +1,8 @@
;;; lang/java/+meghanada.el -*- lexical-binding: t; -*- ;;; lang/java/+meghanada.el -*- lexical-binding: t; -*-
;;;###if (featurep! +meghanada)
(def-package! meghanada (def-package! meghanada
:commands meghanada-mode :hook (java-mode . meghanada-mode)
:init
(add-hook! 'java-mode-hook #'(meghanada-mode rainbow-delimiters-mode))
:config :config
(setq meghanada-server-install-dir (concat doom-etc-dir "meghanada-server/") (setq meghanada-server-install-dir (concat doom-etc-dir "meghanada-server/")
meghanada-use-company (featurep! :completion company) meghanada-use-company (featurep! :completion company)
@ -11,11 +10,14 @@
meghanada-use-eldoc t meghanada-use-eldoc t
meghanada-use-auto-start t) meghanada-use-auto-start t)
(add-hook 'java-mode-hook #'rainbow-delimiters-mode)
;; Setup on first use ;; Setup on first use
(unless (bound-and-true-p byte-compile-current-file)
(meghanada-install-server) (meghanada-install-server)
(if (file-exists-p (meghanada--locate-server-jar)) (if (file-exists-p (meghanada--locate-server-jar))
(add-hook! 'meghanada-mode-hook #'(flycheck-mode eldoc-mode)) (add-hook! 'meghanada-mode-hook #'(flycheck-mode eldoc-mode))
(warn "java-mode: meghanada-server not installed, java-mode will run with reduced functionality")) (warn "java-mode: meghanada-server not installed, java-mode will run with reduced functionality")))
(set! :jump 'java-mode (set! :jump 'java-mode
:definition #'meghanada-jump-declaration :definition #'meghanada-jump-declaration

View file

@ -10,14 +10,14 @@ ignore the cache."
(or (and (not refresh-p) (or (and (not refresh-p)
(gethash project-root +javascript-npm-conf)) (gethash project-root +javascript-npm-conf))
(let ((package-file (expand-file-name "package.json" project-root))) (let ((package-file (expand-file-name "package.json" project-root)))
(when-let (json (and (file-exists-p package-file) (when-let* ((json (and (file-exists-p package-file)
(json-read-file package-file))) (json-read-file package-file))))
(puthash project-root json +javascript-npm-conf)))))) (puthash project-root json +javascript-npm-conf))))))
;;;###autoload ;;;###autoload
(defun +javascript-npm-dep-p (packages &optional project-root refresh-p) (defun +javascript-npm-dep-p (packages &optional project-root refresh-p)
(when-let (data (and (bound-and-true-p +javascript-npm-mode) (when-let* ((data (and (bound-and-true-p +javascript-npm-mode)
(+javascript-npm-conf project-root refresh-p))) (+javascript-npm-conf project-root refresh-p))))
(let ((deps (append (cdr (assq 'dependencies data)) (let ((deps (append (cdr (assq 'dependencies data))
(cdr (assq 'devDependencies data))))) (cdr (assq 'devDependencies data)))))
(cond ((listp packages) (cond ((listp packages)

View file

@ -15,8 +15,8 @@
(set! :electric 'js2-mode :chars '(?\} ?\) ?.)) (set! :electric 'js2-mode :chars '(?\} ?\) ?.))
(set! :jump 'js2-mode :xref-backend #'xref-js2-xref-backend) (set! :jump 'js2-mode :xref-backend #'xref-js2-xref-backend)
;; Conform switch-case indentation to editorconfig's config ;; Conform switch-case indentation to js2 normal indent
(set! :editorconfig :add '(js2-mode js2-basic-offset js-switch-indent-offset)) (defvaralias 'js-switch-indent-offset 'js2-basic-offset)
(sp-with-modes '(js2-mode rjsx-mode) (sp-with-modes '(js2-mode rjsx-mode)
(sp-local-pair "/* " " */" :post-handlers '(("| " "SPC")))) (sp-local-pair "/* " " */" :post-handlers '(("| " "SPC"))))
@ -27,7 +27,7 @@
(defun +javascript|init-flycheck-eslint () (defun +javascript|init-flycheck-eslint ()
"Favor local eslint over global installs and configure flycheck for eslint." "Favor local eslint over global installs and configure flycheck for eslint."
(when (derived-mode-p 'js-mode) (when (derived-mode-p 'js-mode)
(when-let ((exec-path (list (doom-project-expand "node_modules/.bin"))) (when-let* ((exec-path (list (doom-project-expand "node_modules/.bin")))
(eslint (executable-find "eslint"))) (eslint (executable-find "eslint")))
(setq-local flycheck-javascript-eslint-executable eslint)) (setq-local flycheck-javascript-eslint-executable eslint))
(when (flycheck-find-checker-executable 'javascript-eslint) (when (flycheck-find-checker-executable 'javascript-eslint)
@ -93,8 +93,7 @@
(def-package! tern (def-package! tern
:commands tern-mode :hook (js2-mode . tern-mode)
:init (add-hook 'js2-mode-hook #'tern-mode)
:config :config
(advice-add #'tern-project-dir :override #'doom-project-root)) (advice-add #'tern-project-dir :override #'doom-project-root))

View file

@ -67,6 +67,7 @@
(def-package! bibtex ; built-in (def-package! bibtex ; built-in
:defer t
:config :config
(setq bibtex-dialect 'biblatex (setq bibtex-dialect 'biblatex
bibtex-align-at-equal-sign t bibtex-align-at-equal-sign t

View file

@ -2,14 +2,12 @@
(def-package! ledger-mode (def-package! ledger-mode
:mode "\\.ledger$" :mode "\\.ledger$"
:commands ledger-mode
:config (setq ledger-clear-whole-transactions 1)) :config (setq ledger-clear-whole-transactions 1))
(def-package! evil-ledger (def-package! evil-ledger
:when (featurep! :feature evil) :when (featurep! :feature evil)
:after ledger-mode :hook (ledger-mode . evil-ledger-mode))
:config (add-hook 'ledger-mode-hook #'evil-ledger-mode))
(def-package! flycheck-ledger (def-package! flycheck-ledger

View file

@ -3,12 +3,11 @@
(def-package! lua-mode (def-package! lua-mode
:mode "\\.lua$" :mode "\\.lua$"
:interpreter "lua" :interpreter "lua"
:init
(add-hook 'lua-mode-hook #'flycheck-mode)
:config :config
(add-hook 'lua-mode-hook #'flycheck-mode)
(set! :electric 'lua-mode :words '("else" "end")) (set! :electric 'lua-mode :words '("else" "end"))
(set! :repl 'lua-mode #'+lua/repl) (set! :repl 'lua-mode #'+lua/repl)
;; sp's lua-specific rules are obnoxious, so we disable them ;; sp's lua-specific rules are obnoxious, so we disable them
(setq sp-pairs (delete (assq 'lua-mode sp-pairs) sp-pairs)) (setq sp-pairs (delete (assq 'lua-mode sp-pairs) sp-pairs))
@ -23,16 +22,14 @@
(def-package! company-lua (def-package! company-lua
:when (featurep! :completion company) :after (:all company lua-mode)
:after lua-mode
:config :config
(set! :company-backend 'lua-mode '(company-lua company-yasnippet))) (set! :company-backend 'lua-mode '(company-lua company-yasnippet)))
(def-package! moonscript (def-package! moonscript
:mode ("\\.moon$" . moonscript-mode) :mode ("\\.moon$" . moonscript-mode)
:config :config (defvaralias 'moonscript-indent-offset 'tab-width))
(set! :editorconfig :add '(moonscript-mode moonscript-indent-offset)))
;; ;;

View file

@ -0,0 +1,4 @@
;;; lang/nix/config.el -*- lexical-binding: t; -*-
(def-package! nix-mode
:mode "\\.nix$")

View file

@ -6,5 +6,4 @@
(def-package! merlin (def-package! merlin
:after tuareg :after tuareg
:config :hook (tuareg-mode . merlin-mode))
(add-hook 'tuareg-mode-hook #'merlin-mode))

View file

@ -1,10 +1,4 @@
;;; org/org-attach/config.el -*- lexical-binding: t; -*- ;;; lang/org/+attach.el -*- lexical-binding: t; -*-
(defvar +org-attach-dir (expand-file-name ".attach/" +org-dir)
"Where to store attachments (relative to current org file).")
(add-hook 'org-load-hook #'+org-attach|init t)
;; I believe Org's native attachment system is over-complicated and litters ;; I believe Org's native attachment system is over-complicated and litters
;; files with metadata I don't want. So I wrote my own, which: ;; files with metadata I don't want. So I wrote my own, which:
@ -21,6 +15,10 @@
;; + `+org-attach/url' ;; + `+org-attach/url'
;; + :org [FILE/URL] ;; + :org [FILE/URL]
(defvar +org-attach-dir (expand-file-name ".attach/" +org-dir)
"Where to store attachments (relative to current org file).")
(def-package! org-download (def-package! org-download
:commands (org-download-dnd org-download-dnd-base64) :commands (org-download-dnd org-download-dnd-base64)
:init :init
@ -39,10 +37,11 @@
(setq org-download-screenshot-method (setq org-download-screenshot-method
(cond (IS-MAC "screencapture -i %s") (cond (IS-MAC "screencapture -i %s")
(IS-LINUX (IS-LINUX
(cond ((executable-find "maim") (cond ((executable-find "maim") "maim -s %s")
"maim -s %s") ((executable-find "scrot") "scrot -s %s")))))
((executable-find "scrot")
"scrot -s %s"))))) ;; Ensure that relative inline image paths are relative to the attachment folder.
(advice-add #'org-display-inline-images :around #'+org-attach*relative-to-attach-dir)
;; Handle non-image files a little differently. Images should be inserted ;; Handle non-image files a little differently. Images should be inserted
;; as-is, as image previews. Other files, like pdfs or zips, should be linked ;; as-is, as image previews. Other files, like pdfs or zips, should be linked
@ -61,10 +60,11 @@
:filter-return #'+org-attach*download-fullname)) :filter-return #'+org-attach*download-fullname))
;; ;;
(defun +org-attach|init () (after! org
(setq org-attach-directory +org-attach-dir) (setq org-attach-directory +org-attach-dir)
(push +org-attach-dir projectile-globally-ignored-directories) (push (car (last (split-string +org-attach-dir "/" t)))
projectile-globally-ignored-directories)
(after! recentf (after! recentf
(push (format "%s.+$" (regexp-quote +org-attach-dir)) (push (format "%s.+$" (regexp-quote +org-attach-dir))

View file

@ -1,6 +1,4 @@
;;; org/org-babel/config.el -*- lexical-binding: t; -*- ;;; lang/org/+babel.el -*- lexical-binding: t; -*-
(add-hook 'org-load-hook #'+org-babel|init t)
(defvar +org-babel-languages (defvar +org-babel-languages
'(calc '(calc
@ -24,7 +22,8 @@
translate) ; ob-translate translate) ; ob-translate
"A list of org-babel languages to load.") "A list of org-babel languages to load.")
(defun +org-babel|init ()
(after! org
(setq org-src-fontify-natively t ; make code pretty (setq org-src-fontify-natively t ; make code pretty
org-src-preserve-indentation t ; use native major-mode indentation org-src-preserve-indentation t ; use native major-mode indentation
org-src-tab-acts-natively t org-src-tab-acts-natively t
@ -46,9 +45,4 @@
(cl-loop with fn = (if others #'not #'identity) (cl-loop with fn = (if others #'not #'identity)
for p in params for p in params
if (funcall fn (eq (car p) key)) if (funcall fn (eq (car p) key))
collect p)) collect p)))
(defun +org|src-mode-remove-header ()
"Remove header-line with keybinding help; I know the keybinds."
(setq header-line-format nil))
(add-hook 'org-src-mode-hook #'+org|src-mode-remove-header))

View file

@ -1,6 +1,4 @@
;;; org/org-capture/config.el -*- lexical-binding: t; -*- ;;; lang/org/+capture.el -*- lexical-binding: t; -*-
(add-hook 'org-load-hook #'+org-capture|init t)
;; Sets up two `org-capture' workflows that I like: ;; Sets up two `org-capture' workflows that I like:
;; ;;
@ -12,8 +10,10 @@
;; anywhere I can call org-capture (whether or not Emacs is open/running), ;; anywhere I can call org-capture (whether or not Emacs is open/running),
;; like, say, from qutebrowser, vimperator, dmenu or a global keybinding. ;; like, say, from qutebrowser, vimperator, dmenu or a global keybinding.
(setq org-default-notes-file (concat +org-dir "notes.org") (defvar +org-default-notes-file "notes.org"
org-capture-templates "TODO")
(defvar org-capture-templates
'(("t" "Todo" entry '(("t" "Todo" entry
(file+headline (expand-file-name "todo.org" +org-dir) "Inbox") (file+headline (expand-file-name "todo.org" +org-dir) "Inbox")
"* [ ] %?\n%i" :prepend t :kill-buffer t) "* [ ] %?\n%i" :prepend t :kill-buffer t)
@ -22,7 +22,12 @@
(file+headline org-default-notes-file "Inbox") (file+headline org-default-notes-file "Inbox")
"* %u %?\n%i" :prepend t :kill-buffer t))) "* %u %?\n%i" :prepend t :kill-buffer t)))
(defun +org-capture|init ()
(after! org
(defvaralias 'org-default-notes-file '+org-default-notes-file)
(setq org-default-notes-file (expand-file-name +org-default-notes-file +org-dir))
(add-hook 'org-capture-after-finalize-hook #'+org-capture|cleanup-frame) (add-hook 'org-capture-after-finalize-hook #'+org-capture|cleanup-frame)
(when (featurep! :feature evil) (when (featurep! :feature evil)

View file

@ -1,6 +1,4 @@
;;; org/org-export/config.el -*- lexical-binding: t; -*- ;;; lang/org/+export.el -*- lexical-binding: t; -*-
(add-hook 'org-load-hook #'+org-export|init t)
;; I don't have any beef with org's built-in export system, but I do wish it ;; I don't have any beef with org's built-in export system, but I do wish it
;; would export to a central directory, rather than `default-directory'. This is ;; would export to a central directory, rather than `default-directory'. This is
@ -8,16 +6,19 @@
;; refer back to old exports if needed. ;; refer back to old exports if needed.
(def-package! ox-pandoc (def-package! ox-pandoc
:defer t
:config :config
(unless (executable-find "pandoc") (when (executable-find "pandoc")
(warn "org-export: couldn't find pandoc, disabling pandoc export")) (push 'pandoc org-export-backends))
(setq org-pandoc-options (setq org-pandoc-options
'((standalone . t) '((standalone . t)
(mathjax . t) (mathjax . t)
(parse-raw . t)))) (parse-raw . t))))
;; ;;
(defun +org-export|init () (after! org
(add-transient-hook! #'org-export-dispatch (require 'ox-pandoc))
(setq org-export-directory (expand-file-name ".export" +org-dir) (setq org-export-directory (expand-file-name ".export" +org-dir)
org-export-backends '(ascii html latex md) org-export-backends '(ascii html latex md)
org-export-with-toc t org-export-with-toc t

View file

@ -1,16 +1,15 @@
;;; org/org-present/config.el -*- lexical-binding: t; -*- ;;; lang/org/+present.el -*- lexical-binding: t; -*-
(defvar +org-present-text-scale 7 (defvar +org-present-text-scale 7
"The `text-scale-amount' for `org-tree-slide-mode'.") "The `text-scale-amount' for `org-tree-slide-mode'.")
(add-hook 'org-load-hook #'+org-present|init t)
;; ;;
;; Plugins ;; Plugins
;; ;;
(def-package! ox-reveal (def-package! ox-reveal
:defer t
:config :config
(setq org-reveal-root "http://cdn.jsdelivr.net/reveal.js/3.0.0/" (setq org-reveal-root "http://cdn.jsdelivr.net/reveal.js/3.0.0/"
org-reveal-mathjax t)) org-reveal-mathjax t))
@ -44,7 +43,7 @@
;; Bootstrap ;; Bootstrap
;; ;;
(defun +org-present|init () (after! org
(require 'ox-reveal) (require 'ox-reveal)
(map! :map org-mode-map "<f8>" #'+org-present/start)) (map! :map org-mode-map "<f8>" #'+org-present/start))

View file

View file

@ -1,9 +1,9 @@
;; org/org-attach/autoload/evil.el -*- lexical-binding: t; -*- ;;; lang/org/autoload/evil.el -*- lexical-binding: t; -*-
;;;###if (featurep! :feature evil) ;;;###if (featurep! :feature evil)
;; TODO +org-attach:find ;; TODO +org-attach:find
;;;###autoload (autoload '+org-attach:uri "org/org-attach/autoload/evil" nil t) ;;;###autoload (autoload '+org-attach:uri "lang/org/autoload/evil" nil t)
(evil-define-command +org-attach:uri (uri) (evil-define-command +org-attach:uri (uri)
"Downloads the file at URL and places an org link to it at the cursor." "Downloads the file at URL and places an org link to it at the cursor."
(interactive "<f>") (interactive "<f>")

View file

@ -1,4 +1,5 @@
;;; org/org-attach/autoload/org-attach.el -*- lexical-binding: t; -*- ;;; lang/org/autoload/org-attach.el -*- lexical-binding: t; -*-
;;;###if (featurep! +attach)
(defun +org-attach--icon (path) (defun +org-attach--icon (path)
(char-to-string (char-to-string
@ -34,7 +35,7 @@
;; (goto-char (point-min)) ;; (goto-char (point-min))
;; (while (progn (org-next-link) (not org-link-search-failed)) ;; (while (progn (org-next-link) (not org-link-search-failed))
;; (setq element (org-element-context)) ;; (setq element (org-element-context))
;; (when-let (file (and (eq (org-element-type element) 'link) ;; (when-let* (file (and (eq (org-element-type element) 'link)
;; (expand-file-name (org-element-property :path element)))) ;; (expand-file-name (org-element-property :path element))))
;; (when (and (string= (org-element-property :type element) "file") ;; (when (and (string= (org-element-property :type element) "file")
;; (string= (concat (file-name-base (directory-file-name (file-name-directory file))) "/") ;; (string= (concat (file-name-base (directory-file-name (file-name-directory file))) "/")
@ -97,6 +98,8 @@ the cursor."
(delete-region (match-beginning 0) (match-end 0)) (delete-region (match-beginning 0) (match-end 0))
(newline)) (newline))
(cond ((image-type-from-file-name filename) (cond ((image-type-from-file-name filename)
(when (file-in-directory-p filename +org-attach-dir)
(setq filename (file-relative-name filename +org-dir)))
(insert (insert
(concat (if (= org-download-image-html-width 0) (concat (if (= org-download-image-html-width 0)
"" ""
@ -114,3 +117,17 @@ the cursor."
(file-relative-name filename buffer-file-name) (file-relative-name filename buffer-file-name)
(file-name-nondirectory (directory-file-name rel-path))))))) (file-name-nondirectory (directory-file-name rel-path)))))))
;;;###autoload
(defun +org-attach*relative-to-attach-dir (orig-fn &rest args)
"TODO"
(if (file-in-directory-p buffer-file-name +org-dir)
(let* ((context (save-match-data (org-element-context)))
(file (org-link-unescape (org-element-property :path context)))
(default-directory
(if (string-prefix-p
(concat "./" (car (last (split-string +org-attach-dir "/" t))))
file)
+org-dir
default-directory)))
(apply orig-fn args))
(apply orig-fn args)))

View file

@ -1,4 +1,5 @@
;;; org/org-babel/autoload.el -*- lexical-binding: t; -*- ;;; lang/org/autoload/org-babel.el -*- lexical-binding: t; -*-
;;;###if (featurep! +babel)
;;;###autoload ;;;###autoload
(defun +org-babel/edit (arg) (defun +org-babel/edit (arg)

View file

@ -1,4 +1,15 @@
;;; org/org-capture/autoload/org-capture.el -*- lexical-binding: t; -*- ;;; lang/org/autoload/org-capture.el -*- lexical-binding: t; -*-
;;;###if (featurep! +capture)
(when (featurep! :feature evil)
;;;###autoload (autoload '+org-capture:open "lang/org/autoload/org-capture" nil t)
(evil-define-operator +org-capture:open (&optional beg end)
"Evil ex interface to `+org-capture/dwim'."
:move-point nil :type inclusive
(interactive "<r>")
(+org-capture/open
(unless (or (evil-normal-state-p) (evil-insert-state-p))
(buffer-substring beg end)))))
;;;###autoload ;;;###autoload
(defun +org-capture/open (&optional string key) (defun +org-capture/open (&optional string key)
@ -7,12 +18,12 @@
Uses the capture template specified by KEY. Otherwise, prompts you for one." Uses the capture template specified by KEY. Otherwise, prompts you for one."
(interactive) (interactive)
(let ((key (or key "n"))) (let ((key (or key "n")))
(if-let (string (cond ((not (equal string "")) (if-let* ((string (cond ((not (equal string ""))
string) string)
((region-active-p) ((region-active-p)
(buffer-substring-no-properties (buffer-substring-no-properties
(region-beginning) (region-beginning)
(region-end))))) (region-end))))))
(org-capture-string string key) (org-capture-string string key)
(org-capture nil key)))) (org-capture nil key))))

View file

@ -1,4 +1,5 @@
;;; org/org-present/autoload.el -*- lexical-binding: t; -*- ;;; lang/org/autoload/org-present.el -*- lexical-binding: t; -*-
;;;###if (featurep! +present)
(defvar +org-present--overlays nil) (defvar +org-present--overlays nil)
;;;###autoload ;;;###autoload

View file

@ -290,8 +290,8 @@ with `org-cycle'). Also:
(save-excursion (save-excursion
(let ((remove (list (match-beginning 0) (match-end 0))) (let ((remove (list (match-beginning 0) (match-end 0)))
(description (if (match-end 3) (description (if (match-end 3)
(org-match-string-no-properties 3) (match-string-no-properties 3)
(org-match-string-no-properties 1)))) (match-string-no-properties 1))))
(apply #'delete-region remove) (apply #'delete-region remove)
(insert description)))) (insert description))))

265
modules/lang/org/config.el Normal file
View file

@ -0,0 +1,265 @@
;;; lang/org/config.el -*- lexical-binding: t; -*-
(defvar +org-dir (expand-file-name "~/work/org/")
"The directory where org files are kept.")
;; Ensure ELPA org is prioritized above built-in org.
(when-let* ((path (locate-library "org" nil doom--package-load-path)))
(setq load-path (delete path load-path))
(push (file-name-directory path) load-path))
;; Sub-modules
(if (featurep! +attach) (load! +attach))
(if (featurep! +babel) (load! +babel))
(if (featurep! +capture) (load! +capture))
(if (featurep! +export) (load! +export))
(if (featurep! +present) (load! +present))
;; TODO (if (featurep! +publish) (load! +publish))
;;
;; Plugins
;;
(def-package! toc-org
:commands toc-org-enable)
(def-package! org-crypt ; built-in
:commands org-crypt-use-before-save-magic
:config
(setq org-tags-exclude-from-inheritance '("crypt")
org-crypt-key user-mail-address
epa-file-encrypt-to user-mail-address))
(def-package! org-bullets
:commands org-bullets-mode)
;;
;; Bootstrap
;;
(after! org
;; Occasionally, Emacs encounters an error loading the built-in org, aborting
;; the load. This results in a broken, partially loaded state. This require
;; tries to set it straight.
(require 'org)
(defvaralias 'org-directory '+org-dir)
(org-crypt-use-before-save-magic)
(+org-init-ui)
(+org-init-keybinds)
(+org-hacks))
(add-hook! org-mode
#'(doom|disable-line-numbers ; no line numbers
org-bullets-mode ; "prettier" bullets
org-indent-mode ; margin-based indentation
toc-org-enable ; auto-table of contents
visual-line-mode ; line wrapping
+org|enable-auto-reformat-tables
+org|enable-auto-update-cookies
+org|smartparens-compatibility-config
+org|unfold-to-2nd-level-or-point
+org|show-paren-mode-compatibility
))
;;
;; Config hooks
;;
(defun +org|unfold-to-2nd-level-or-point ()
"My version of the 'overview' #+STARTUP option: expand first-level headings.
Expands the first level, but no further. If point was left somewhere deeper,
unfold to point on startup."
(unless org-agenda-inhibit-startup
(when (eq org-startup-folded t)
(outline-hide-sublevels 2))
(when (outline-invisible-p)
(ignore-errors
(save-excursion
(outline-previous-visible-heading 1)
(org-show-subtree))))))
(defun +org|smartparens-compatibility-config ()
"Instruct `smartparens' not to impose itself in org-mode."
(defun +org-sp-point-in-checkbox-p (_id action _context)
(when (eq action 'insert)
(sp--looking-at-p "\\s-*]")))
;; make delimiter auto-closing a little more conservative
(sp-with-modes 'org-mode
(sp-local-pair "*" nil :unless '(sp-point-after-word-p sp-point-before-word-p sp-point-at-bol-p))
(sp-local-pair "_" nil :unless '(sp-point-after-word-p sp-point-before-word-p))
(sp-local-pair "/" nil :unless '(sp-point-after-word-p sp-point-before-word-p +org-sp-point-in-checkbox-p))
(sp-local-pair "~" nil :unless '(sp-point-after-word-p sp-point-before-word-p))
(sp-local-pair "=" nil :unless '(sp-point-after-word-p sp-point-before-word-p))))
(defun +org|enable-auto-reformat-tables ()
"Realign tables exiting insert mode (`evil-mode')."
(when (featurep 'evil)
(add-hook 'evil-insert-state-exit-hook #'+org|realign-table-maybe nil t)))
(defun +org|enable-auto-update-cookies ()
"Update statistics cookies when saving or exiting insert mode (`evil-mode')."
(when (featurep 'evil)
(add-hook 'evil-insert-state-exit-hook #'+org|update-cookies nil t))
(add-hook 'before-save-hook #'+org|update-cookies nil t))
(defun +org|show-paren-mode-compatibility ()
"`show-paren-mode' causes flickering with indentation margins made by
`org-indent-mode', so we simply turn off show-paren-mode altogether."
(set (make-local-variable 'show-paren-mode) nil))
;;
(defun +org-init-ui ()
"Configures the UI for `org-mode'."
(setq-default
org-adapt-indentation nil
org-agenda-dim-blocked-tasks nil
org-agenda-files (directory-files +org-dir t "\\.org$" t)
org-agenda-inhibit-startup t
org-agenda-skip-unavailable-files nil
org-cycle-include-plain-lists t
org-cycle-separator-lines 1
org-entities-user '(("flat" "\\flat" nil "" "" "266D" "") ("sharp" "\\sharp" nil "" "" "266F" ""))
;; org-ellipsis " ... "
org-fontify-done-headline t
org-fontify-quote-and-verse-blocks t
org-fontify-whole-heading-line t
org-footnote-auto-label 'plain
org-hidden-keywords nil
org-hide-emphasis-markers nil
org-hide-leading-stars t
org-hide-leading-stars-before-indent-mode t
org-image-actual-width nil
org-indent-indentation-per-level 2
org-indent-mode-turns-on-hiding-stars t
org-pretty-entities nil
org-pretty-entities-include-sub-superscripts t
org-priority-faces
`((?a . ,(face-foreground 'error))
(?b . ,(face-foreground 'warning))
(?c . ,(face-foreground 'success)))
org-startup-folded t
org-startup-indented t
org-startup-with-inline-images nil
org-tags-column 0
org-todo-keywords
'((sequence "[ ](t)" "[-](p)" "[?](m)" "|" "[X](d)")
(sequence "TODO(T)" "|" "DONE(D)")
(sequence "NEXT(n)" "ACTIVE(a)" "WAITING(w)" "LATER(l)" "|" "CANCELLED(c)"))
org-use-sub-superscripts '{}
outline-blank-line t
;; LaTeX previews are too small and usually render to light backgrounds, so
;; this enlargens them and ensures their background (and foreground) match the
;; current theme.
org-preview-latex-image-directory (concat doom-cache-dir "org-latex/")
org-format-latex-options (plist-put org-format-latex-options :scale 1.5)
org-format-latex-options
(plist-put org-format-latex-options
:background (face-attribute (or (cadr (assq 'default face-remapping-alist))
'default)
:background nil t)))
;; Custom links
(org-link-set-parameters
"org"
:complete (lambda () (+org-link-read-file "org" +org-dir))
:follow (lambda (link) (find-file (expand-file-name link +org-dir)))
:face (lambda (link)
(if (file-exists-p (expand-file-name link +org-dir))
'org-link
'error))))
(defun +org-init-keybinds ()
"Sets up org-mode and evil keybindings. Tries to fix the idiosyncrasies
between the two."
(map! :map org-mode-map
"RET" #'org-return-indent
"C-c C-S-l" #'+org/remove-link
:n "C-c C-i" #'org-toggle-inline-images
:n "RET" #'+org/dwim-at-point
;; Navigate table cells (from insert-mode)
:i "C-l" #'+org/table-next-field
:i "C-h" #'+org/table-previous-field
:i "C-k" #'+org/table-previous-row
:i "C-j" #'+org/table-next-row
;; Expand tables (or shiftmeta move)
:ni "C-S-l" #'+org/table-append-field-or-shift-right
:ni "C-S-h" #'+org/table-prepend-field-or-shift-left
:ni "C-S-k" #'org-metaup
:ni "C-S-j" #'org-metadown
:n [tab] #'+org/toggle-fold
:i [tab] #'+org/indent-or-next-field-or-yas-expand
:i [backtab] #'+org/dedent-or-prev-field
:ni [M-return] (λ! (+org/insert-item 'below))
:ni [S-M-return] (λ! (+org/insert-item 'above))
:m "]]" (λ! (org-forward-heading-same-level nil) (org-beginning-of-line))
:m "[[" (λ! (org-backward-heading-same-level nil) (org-beginning-of-line))
:m "]l" #'org-next-link
:m "[l" #'org-previous-link
:m "$" #'org-end-of-line
:m "^" #'org-beginning-of-line
:n "gQ" #'org-fill-paragraph
:n "<" #'org-metaleft
:n ">" #'org-metaright
:v "<" (λ! (org-metaleft) (evil-visual-restore))
:v ">" (λ! (org-metaright) (evil-visual-restore))
;; Fix code-folding keybindings
:n "za" #'+org/toggle-fold
:n "zA" #'org-shifttab
:n "zc" #'outline-hide-subtree
:n "zC" (λ! (outline-hide-sublevels 1))
:n "zd" (lambda (&optional arg) (interactive "p") (outline-hide-sublevels (or arg 3)))
:n "zm" (λ! (outline-hide-sublevels 1))
:n "zo" #'outline-show-subtree
:n "zO" #'outline-show-all
:n "zr" #'outline-show-all
(:after org-agenda
(:map org-agenda-mode-map
:e "<escape>" #'org-agenda-Quit
:e "m" #'org-agenda-month-view
:e "C-j" #'org-agenda-next-item
:e "C-k" #'org-agenda-previous-item
:e "C-n" #'org-agenda-next-item
:e "C-p" #'org-agenda-previous-item))))
;;
(defun +org-hacks ()
"Getting org to behave."
;; Don't open separate windows
(push '(file . find-file) org-link-frame-setup)
;; Let OS decide what to do with files when opened
(setq org-file-apps
`(("\\.org$" . emacs)
(t . ,(cond (IS-MAC "open -R \"%s\"")
(IS-LINUX "xdg-open \"%s\"")))))
(defun +org|remove-occur-highlights ()
"Remove org occur highlights on ESC in normal mode."
(when (and (derived-mode-p 'org-mode)
org-occur-highlights)
(org-remove-occur-highlights)))
(add-hook '+evil-esc-hook #'+org|remove-occur-highlights)
(after! recentf
;; Don't clobber recentf with agenda files
(defun +org-is-agenda-file (filename)
(cl-find (file-truename filename) org-agenda-files
:key #'file-truename
:test #'equal))
(add-to-list 'recentf-exclude #'+org-is-agenda-file)))

View file

@ -0,0 +1,33 @@
;; -*- no-byte-compile: t; -*-
;;; lang/org/packages.el
;; NOTE This is an insecure source, but unavoidable if we want org 9.0+ (which
;; this module requires). orgmode.org offers no secure access to this repo. If
;; this bothers you, comment out this `package!' block and download
;; org-plus-contrib from orgmode.org.
(package! org-plus-contrib :recipe (:fetcher git :url "http://orgmode.org/org-mode.git"))
(package! org-bullets :recipe (:fetcher github :repo "hlissner/org-bullets"))
(package! toc-org)
(when (featurep! +attach)
(package! org-download))
(when (featurep! +babel)
(package! ob-go)
(package! ob-mongo)
(package! ob-redis)
(package! ob-restclient)
(package! ob-rust)
(package! ob-sql-mode)
(package! ob-translate))
(when (featurep! +export)
(package! ox-pandoc))
(when (featurep! +present)
(package! centered-window-mode)
(package! org-tree-slide)
(package! ox-reveal))
;; (when (featurep! +publish))

View file

@ -1,5 +1,5 @@
;; -*- no-byte-compile: t; -*- ;; -*- no-byte-compile: t; -*-
;;; org/org/test/autoload-org.el ;;; lang/org/test/autoload-org.el
(defmacro should-org-buffer! (source expected &rest body) (defmacro should-org-buffer! (source expected &rest body)
`(should-buffer! ,source ,expected `(should-buffer! ,source ,expected

View file

@ -0,0 +1,7 @@
;;; lang/org/test/org.el -*- lexical-binding: t; -*-
(when (featurep 'org)
(unload-feature 'org t))
(require! :lang org)
(require 'org (locate-library "org" nil doom--package-load-path))

View file

@ -5,11 +5,10 @@
(add-hook 'perl-mode-hook #'flycheck-mode)) (add-hook 'perl-mode-hook #'flycheck-mode))
(def-package! perl6-mode (def-package! perl6-detect)
:init (require 'perl6-detect))
(def-package! flycheck-perl6 (def-package! flycheck-perl6
:after perl6-mode
:when (featurep! :feature syntax-checker) :when (featurep! :feature syntax-checker)
:after perl6-mode
:config (add-hook 'perl6-mode-hook #'flycheck-mode)) :config (add-hook 'perl6-mode-hook #'flycheck-mode))

View file

@ -9,6 +9,6 @@ ignore the cache."
(let ((project-root (or project-root (doom-project-root)))) (let ((project-root (or project-root (doom-project-root))))
(or (and (not refresh-p) (gethash project-root +php-composer-conf)) (or (and (not refresh-p) (gethash project-root +php-composer-conf))
(let ((package-file (expand-file-name "composer.json" project-root))) (let ((package-file (expand-file-name "composer.json" project-root)))
(when-let (data (and (file-exists-p package-file) (when-let* ((data (and (file-exists-p package-file)
(json-read-file package-file))) (json-read-file package-file))))
(puthash project-root data +php-composer-conf)))))) (puthash project-root data +php-composer-conf))))))

View file

@ -7,11 +7,11 @@
(def-package! php-mode (def-package! php-mode
:mode ("\\.php[s345]?$" "\\.inc$") :mode "\\.php[s345]?$"
:mode "\\.inc$"
:interpreter "php" :interpreter "php"
:config :config
(add-hook! 'php-mode-hook (add-hook! php-mode #'(ac-php-core-eldoc-setup flycheck-mode))
#'(ac-php-core-eldoc-setup flycheck-mode))
(setq php-template-compatibility nil) (setq php-template-compatibility nil)
@ -68,8 +68,7 @@
(def-package! php-refactor-mode (def-package! php-refactor-mode
:commands php-refactor-mode :hook php-mode)
:init (add-hook 'php-mode-hook #'php-refactor-mode))
(def-package! phpunit (def-package! phpunit

View file

@ -14,7 +14,5 @@
;; (add-hook 'flycheck-mode-hook #'flycheck-purescript-setup)) ;; (add-hook 'flycheck-mode-hook #'flycheck-purescript-setup))
(def-package! psc-ide (def-package! psc-ide
:after purescript-mode :hook (purescript-mode . psc-ide-mode))
:config
(add-hook 'purescript-mode-hook #'psc-ide-mode))

View file

@ -21,7 +21,6 @@ is loaded.")
(setq python-environment-directory doom-cache-dir (setq python-environment-directory doom-cache-dir
python-indent-guess-indent-offset-verbose nil python-indent-guess-indent-offset-verbose nil
python-shell-interpreter "python") python-shell-interpreter "python")
:config :config
(add-hook! 'python-mode-hook #'(flycheck-mode highlight-numbers-mode)) (add-hook! 'python-mode-hook #'(flycheck-mode highlight-numbers-mode))
@ -56,7 +55,7 @@ is loaded.")
(defun +python|detect-pyenv-version () (defun +python|detect-pyenv-version ()
"Detect the pyenv version for the current project and set the relevant "Detect the pyenv version for the current project and set the relevant
environment variables." environment variables."
(when-let (version-str (shell-command-to-string "python --version 2>&1 | cut -d' ' -f2")) (when-let* ((version-str (shell-command-to-string "python --version 2>&1 | cut -d' ' -f2")))
(setq version-str (string-trim version-str) (setq version-str (string-trim version-str)
+python-current-version version-str) +python-current-version version-str)
(let ((pyenv-current-path (concat +python-pyenv-root "/versions/" version-str))) (let ((pyenv-current-path (concat +python-pyenv-root "/versions/" version-str)))
@ -73,17 +72,14 @@ environment variables."
(def-package! anaconda-mode (def-package! anaconda-mode
:after python :after python
:hook python-mode
:init :init
(add-hook 'python-mode-hook #'anaconda-mode)
(add-hook 'anaconda-mode-hook #'anaconda-eldoc-mode)
(setq anaconda-mode-installation-directory (concat doom-etc-dir "anaconda/") (setq anaconda-mode-installation-directory (concat doom-etc-dir "anaconda/")
anaconda-mode-eldoc-as-single-line t) anaconda-mode-eldoc-as-single-line t)
:config :config
(add-hook 'anaconda-mode-hook #'anaconda-eldoc-mode)
(set! :popup "*anaconda-mode*" :size 10 :noselect t :autoclose t :autokill t) (set! :popup "*anaconda-mode*" :size 10 :noselect t :autoclose t :autokill t)
(map! :map anaconda-mode-map :m "gd" #'anaconda-mode-find-definitions) (map! :map anaconda-mode-map :m "gd" #'anaconda-mode-find-definitions)
(advice-add #'anaconda-mode-doc-buffer :after #'doom*anaconda-mode-doc-buffer)) (advice-add #'anaconda-mode-doc-buffer :after #'doom*anaconda-mode-doc-buffer))

View file

@ -12,11 +12,12 @@
;; ;;
(def-package! ruby-mode (def-package! ruby-mode
:mode ("\\.rb$" "\\.rake$" "\\.gemspec$" "\\.?pryrc$" :mode "\\.rb$"
"/\\(Gem\\|Cap\\|Vagrant\\|Rake\\|Pod\\|Puppet\\|Berks\\)file$") :mode "\\.rake$"
:mode "\\.gemspec$"
:mode "\\.\\(pry\\|irb\\)rc$"
:mode "/\\(Gem\\|Cap\\|Vagrant\\|Rake\\|Pod\\|Puppet\\|Berks\\)file$"
:interpreter "ruby" :interpreter "ruby"
:init
(add-hook 'ruby-mode-hook #'flycheck-mode)
:config :config
(set! :company-backend 'ruby-mode '(company-dabbrev-code)) (set! :company-backend 'ruby-mode '(company-dabbrev-code))
(set! :electric 'ruby-mode :words '("else" "end" "elseif")) (set! :electric 'ruby-mode :words '("else" "end" "elseif"))
@ -24,6 +25,8 @@
;; Don't interfere with my custom RET behavior ;; Don't interfere with my custom RET behavior
(define-key ruby-mode-map [?\n] nil) (define-key ruby-mode-map [?\n] nil)
(add-hook 'ruby-mode-hook #'flycheck-mode)
;; Version management with rbenv ;; Version management with rbenv
(defun +ruby|add-version-to-modeline () (defun +ruby|add-version-to-modeline ()
"Add version string to the major mode in the modeline." "Add version string to the major mode in the modeline."
@ -40,7 +43,7 @@
(defun +ruby|detect-rbenv-version () (defun +ruby|detect-rbenv-version ()
"Detect the rbenv version for the current project and set the relevant "Detect the rbenv version for the current project and set the relevant
environment variables." environment variables."
(when-let (version-str (shell-command-to-string "ruby --version 2>&1 | cut -d' ' -f2")) (when-let* ((version-str (shell-command-to-string "ruby --version 2>&1 | cut -d' ' -f2")))
(setq version-str (string-trim version-str) (setq version-str (string-trim version-str)
+ruby-current-version version-str) +ruby-current-version version-str)
(when (member version-str +ruby-rbenv-versions) (when (member version-str +ruby-rbenv-versions)
@ -67,9 +70,7 @@ environment variables."
;; Highlight doc comments ;; Highlight doc comments
(def-package! yard-mode (def-package! yard-mode :hook ruby-mode)
:commands yard-mode
:init (add-hook 'ruby-mode-hook #'yard-mode))
(def-package! rspec-mode (def-package! rspec-mode

View file

@ -20,10 +20,10 @@
(def-package! racer (def-package! racer
:after rust-mode :after rust-mode
:preface :hook (rust-mode . racer-mode)
:init
(add-hook! 'rust-mode-hook #'(racer-mode eldoc-mode flycheck-rust-setup))
:config :config
(add-hook 'rust-mode-hook #'eldoc-mode)
(setq racer-cmd (or (executable-find "racer") (setq racer-cmd (or (executable-find "racer")
(expand-file-name "racer/target/release/racer" +rust-src-dir)) (expand-file-name "racer/target/release/racer" +rust-src-dir))
racer-rust-src-path (or (getenv "RUST_SRC_PATH") racer-rust-src-path (or (getenv "RUST_SRC_PATH")
@ -44,5 +44,6 @@
(def-package! flycheck-rust (def-package! flycheck-rust
:when (featurep! :feature syntax-checker) :when (featurep! :feature syntax-checker)
:after rust-mode :after rust-mode
:hook (flycheck-mode . flycheck-rust-setup)
:config (add-hook 'rust-mode-hook #'flycheck-mode)) :config (add-hook 'rust-mode-hook #'flycheck-mode))

View file

@ -2,17 +2,18 @@
(def-package! scala-mode (def-package! scala-mode
:mode "\\.s\\(cala\\|bt\\)$" :mode "\\.s\\(cala\\|bt\\)$"
:config :config (setq scala-indent:align-parameters t))
(setq scala-indent:align-parameters t))
(def-package! sbt-mode :after scala-mode) (def-package! sbt-mode :after scala-mode)
(def-package! ensime (def-package! ensime
:after scala-mode :commands (ensime ensime-scala-mode-hook)
:commands (ensime ensime-mode ensime-scala-mode-hook) :hook (scala-mode . ensime-mode)
:config :config
(add-hook 'ensime-mode-hook #'eldoc-mode)
(set! :company-backend 'scala-mode '(ensime-company company-yasnippet)) (set! :company-backend 'scala-mode '(ensime-company company-yasnippet))
(setq ensime-startup-snapshot-notification nil (setq ensime-startup-snapshot-notification nil
@ -21,9 +22,6 @@
;; let DOOM handle company setup ;; let DOOM handle company setup
ensime-completion-style nil) ensime-completion-style nil)
(add-hook 'scala-mode-hook #'ensime-mode)
(add-hook 'ensime-mode-hook #'eldoc-mode)
;; Fix void-variable imenu-auto-rescan error caused by `ensime--setup-imenu' ;; Fix void-variable imenu-auto-rescan error caused by `ensime--setup-imenu'
;; trying to make imenu variables buffer local before imenu is loaded. ;; trying to make imenu variables buffer local before imenu is loaded.
(require 'imenu)) (require 'imenu))

View file

@ -4,11 +4,10 @@
(def-package! swift-mode (def-package! swift-mode
:mode "\\.swift$" :mode "\\.swift$"
:init
(add-hook 'swift-mode-hook #'flycheck-mode)
:config :config
(add-hook 'swift-mode-hook #'flycheck-mode)
(set! :repl 'swift-mode #'swift-mode-run-repl) ; TODO test this (set! :repl 'swift-mode #'swift-mode-run-repl) ; TODO test this
(cl-pushnew 'swift flycheck-checkers)) (push 'swift flycheck-checkers))
(def-package! company-sourcekit (def-package! company-sourcekit

View file

@ -2,9 +2,9 @@
(def-package! typescript-mode (def-package! typescript-mode
:mode "\\.ts$" :mode "\\.ts$"
:init
(add-hook 'typescript-mode-hook #'rainbow-delimiters-mode)
:config :config
(add-hook 'typescript-mode-hook #'rainbow-delimiters-mode)
(set! :electric 'typescript-mode :chars '(?\} ?\)) :words '("||" "&&")) (set! :electric 'typescript-mode :chars '(?\} ?\)) :words '("||" "&&"))
;; TODO tide-jump-back ;; TODO tide-jump-back

View file

@ -5,8 +5,9 @@
(add-hook! (css-mode sass-mode) (add-hook! (css-mode sass-mode)
#'(yas-minor-mode-on flycheck-mode highlight-numbers-mode)) #'(yas-minor-mode-on flycheck-mode highlight-numbers-mode))
(after! smartparens
(sp-with-modes '(css-mode scss-mode less-css-mode stylus-mode) (sp-with-modes '(css-mode scss-mode less-css-mode stylus-mode)
(sp-local-pair "/*" "*/" :post-handlers '(("[d-3]||\n[i]" "RET") ("| " "SPC")))) (sp-local-pair "/*" "*/" :post-handlers '(("[d-3]||\n[i]" "RET") ("| " "SPC")))))
(map! :map* (css-mode-map scss-mode-map less-css-mode-map) (map! :map* (css-mode-map scss-mode-map less-css-mode-map)
:n "M-R" #'+css/web-refresh-browser :n "M-R" #'+css/web-refresh-browser
@ -21,15 +22,14 @@
(def-package! counsel-css (def-package! counsel-css
:when (featurep! :completion ivy) :when (featurep! :completion ivy)
:commands (counsel-css counsel-css-imenu-setup) :commands (counsel-css counsel-css-imenu-setup)
:hook (css-mode . counsel-css-imenu-setup)
:init :init
(add-hook 'css-mode-hook #'counsel-css-imenu-setup)
(map! :map* (css-mode-map scss-mode-map less-css-mode-map) (map! :map* (css-mode-map scss-mode-map less-css-mode-map)
:localleader :n ";" #'counsel-css)) :localleader :n ";" #'counsel-css))
(def-package! rainbow-mode (def-package! rainbow-mode
:commands rainbow-mode :hook (css-mode sass-mode))
:init (add-hook! (css-mode sass-mode) #'rainbow-mode))
(def-package! css-mode (def-package! css-mode

View file

@ -9,9 +9,8 @@
:mode "\\.mustache$" :mode "\\.mustache$"
:mode "\\.tsx$" :mode "\\.tsx$"
:mode "wp-content/themes/.+/.+\\.php$" :mode "wp-content/themes/.+/.+\\.php$"
:init
(add-hook 'web-mode-hook #'turn-off-smartparens-mode)
:config :config
(add-hook 'web-mode-hook #'turn-off-smartparens-mode)
(set! :company-backend 'web-mode '(company-web-html company-yasnippet)) (set! :company-backend 'web-mode '(company-web-html company-yasnippet))
(setq web-mode-enable-html-entities-fontification t) (setq web-mode-enable-html-entities-fontification t)

View file

@ -16,9 +16,7 @@
(def-package! emmet-mode (def-package! emmet-mode
:commands emmet-mode :commands emmet-mode
:preface (defvar emmet-mode-keymap (make-sparse-keymap)) :preface (defvar emmet-mode-keymap (make-sparse-keymap))
:init :hook (css-mode web-mode html-mode haml-mode nxml-mode rjsx-mode)
(add-hook! (css-mode web-mode html-mode haml-mode nxml-mode rjsx-mode)
'emmet-mode)
:config :config
(setq emmet-move-cursor-between-quotes t) (setq emmet-move-cursor-between-quotes t)
(map! :map emmet-mode-keymap (map! :map emmet-mode-keymap

View file

@ -1,4 +0,0 @@
;; -*- no-byte-compile: t; -*-
;;; org/org-attach/packages.el
(package! org-download)

View file

@ -1,10 +0,0 @@
;; -*- no-byte-compile: t; -*-
;;; org/org-babel/packages.el
(package! ob-go)
(package! ob-mongo)
(package! ob-redis)
(package! ob-restclient)
(package! ob-rust :recipe (:fetcher github :repo "zweifisch/ob-rust"))
(package! ob-sql-mode)
(package! ob-translate)

View file

@ -1,11 +0,0 @@
;;; org/org-capture/autoload/evil.el -*- lexical-binding: t; -*-
;;;###if (featurep! :feature evil)
;;;###autoload (autoload '+org-capture:open "org/org-capture/autoload/evil" nil t)
(evil-define-operator +org-capture:open (&optional beg end)
"Evil ex interface to `+org-capture/dwim'."
:move-point nil :type inclusive
(interactive "<r>")
(+org-capture/open
(unless (or (evil-normal-state-p) (evil-insert-state-p))
(buffer-substring beg end))))

Some files were not shown because too many files have changed in this diff Show more