diff --git a/bin/doom-doctor b/bin/doom-doctor index ac162f863..2fe9c2241 100755 --- a/bin/doom-doctor +++ b/bin/doom-doctor @@ -4,17 +4,24 @@ ":"; [[ $VERSION == *\ 2[0-2].[0-1].[0-9] ]] && { echo "You're running $VERSION"; echo "That version is too old to run the doctor. Check your PATH"; echo; exit 2; } ":"; exec emacs --quick --script "$0"; exit 0 -;; Uses a couple simple heuristics to locate issues with your environment that -;; could interfere with running or setting up DOOM Emacs. +;; The Doom doctor is essentially one big, self-contained elisp shell script +;; that uses a series of simple heuristics to diagnose common issues on your +;; system. Issues that could intefere with Doom Emacs. +;; +;; Doom module may optionally have a doctor.el file to run their own heuristics +;; in. Doctor scripts may run in versions of Emacs as old as Emacs 23, so you +;; are limited to very basic standard library calls (e.g. avoid cl, subr-x, and +;; any Doom dependencies). -;; In case it isn't defined (in really old versions of Emacs, like the one that -;; ships with MacOS). +;; In really old versions of Emacs `user-emacs-directory' isn't defined (defvar user-emacs-directory (expand-file-name "../" (file-name-directory load-file-name))) (unless (file-directory-p user-emacs-directory) (error "Couldn't find a Doom config!")) (unless noninteractive (error "This script must not be run from an interactive session.")) +(when (getenv "DEBUG") + (setq debug-on-error t)) (require 'pp) @@ -117,10 +124,10 @@ ;; --- is emacs set up properly? ------------------------------ -(when (version< emacs-version "25.1") +(when (version< emacs-version "25.3") (error! "Important: Emacs %s detected [%s]" emacs-version (executable-find "emacs")) (explain! - "DOOM only supports >= 25.1. Perhaps your PATH wasn't set up properly." + "DOOM only supports >= 25.3. Perhaps your PATH wasn't set up properly." (when (eq system-type 'darwin) (concat "\nMacOS users should use homebrew (https://brew.sh) to install Emacs\n" " brew install emacs --with-modules --with-imagemagick --with-cocoa")))) @@ -166,7 +173,7 @@ font font-dest) (explain! "You can install it by running `M-x all-the-icons-install-fonts' within Emacs.\n\n" "This could also mean you've installed them in non-standard locations, in which " - "case, ignore this warning.")))))) + "case feel free to ignore this warning.")))))) ;; gnutls-cli & openssl (section! "Checking gnutls/openssl...") @@ -289,6 +296,9 @@ (or (cdr-safe ex) (car ex))) (setq doom-modules nil))) +(section! "Checking Doom core for irregularities...") +(load (expand-file-name "doctor.el" doom-core-dir) nil 'nomessage) + (when (bound-and-true-p doom-modules) (section! "Checking your enabled modules...") (let ((indent 4)) @@ -296,22 +306,21 @@ (maphash (lambda (key plist) (let ((prefix (format "%s" (color 1 "(%s %s) " (car key) (cdr key))))) - (condition-case ex + (condition-case-unless-debug ex (let ((doctor-file (doom-module-path (car key) (cdr key) "doctor.el")) - (packages-file (doom-module-path (car key) (cdr key) "packages.el")) - doom-packages) - (when (or (file-exists-p doctor-file) - (file-exists-p packages-file)) - (let ((doom--stage 'packages)) - (when (load packages-file t t) - (cl-loop for (name . plist) in doom-packages - unless (or (doom-package-prop name :disable) - (doom-package-prop name :ignore t) - (package-built-in-p name) - (package-installed-p name)) - do (error! "%s is not installed" name))) - (let ((doom--stage 'doctor)) - (load doctor-file t t))))) + (packages-file (doom-module-path (car key) (cdr key) "packages.el"))) + (cl-loop with doom--stage = 'packages + for name in (let (doom-packages + doom-disabled-packages) + (load packages-file 'noerror 'nomessage) + (mapcar #'car doom-packages)) + unless (or (doom-package-prop name :disable) + (doom-package-prop name :ignore t) + (package-built-in-p name) + (package-installed-p name)) + do (error! "%s is not installed" name)) + (let ((doom--stage 'doctor)) + (load doctor-file 'noerror 'nomessage))) (file-missing (error! "%s" (error-message-string ex))) (error (error! "Syntax error: %s" ex))))) doom-modules))) diff --git a/core/autoload/buffers.el b/core/autoload/buffers.el index 2d0002714..08bcc4889 100644 --- a/core/autoload/buffers.el +++ b/core/autoload/buffers.el @@ -227,9 +227,10 @@ windows, switch to `doom-fallback-buffer'. Otherwise, delegate to original (doom-visible-buffers))) ;; if we end up back where we start (or previous-buffer ;; returns nil), we have nowhere left to go - (memq (previous-buffer) (list buf 'nil))) - (switch-to-buffer (doom-fallback-buffer)))) - (kill-buffer buf))) + (memq (switch-to-prev-buffer nil t) (list buf 'nil))) + (switch-to-buffer (doom-fallback-buffer))) + (unless (delq (selected-window) (get-buffer-window-list buf nil t)) + (kill-buffer buf))))) ((funcall orig-fn))))) @@ -251,7 +252,8 @@ If DONT-SAVE, don't prompt to save modified buffers (discarding their changes)." (set-buffer-modified-p nil))) (kill-buffer buffer) (cl-loop for win in windows - if (doom-real-buffer-p (window-buffer win)) + if (and (window-live-p win) + (doom-unreal-buffer-p (window-buffer win))) do (with-selected-window win (previous-buffer))))) ;;;###autoload diff --git a/core/autoload/cli.el b/core/autoload/cli.el index 166f68747..ec9481937 100644 --- a/core/autoload/cli.el +++ b/core/autoload/cli.el @@ -45,7 +45,9 @@ (defun doom//upgrade (&optional yes) "TODO" (interactive "P") - (doom--run "upgrade" yes)) + (doom--run "upgrade" yes) + (when (y-or-n-p "You must restart Emacs for the upgrade to take effect. Restart?") + (doom/restart-and-restore))) ;;;###autoload (defun doom//install (&optional yes) diff --git a/core/autoload/debug.el b/core/autoload/debug.el index 06c8164e8..cc7f177c9 100644 --- a/core/autoload/debug.el +++ b/core/autoload/debug.el @@ -62,7 +62,7 @@ ready to be pasted in a bug report on github." (or (ignore-errors (require 'use-package) (cl-loop for (name . plist) in (doom-find-packages :private t) - if (use-package-plist-delete (copy-sequence plist) :private) + if (use-package-plist-delete (copy-sequence plist) :modules) collect (format "%s" (cons name it)) else collect (symbol-name name))) diff --git a/core/autoload/sessions.el b/core/autoload/sessions.el index b617dedc5..1ba92fd85 100644 --- a/core/autoload/sessions.el +++ b/core/autoload/sessions.el @@ -52,7 +52,7 @@ ;;;###autoload (defun doom-restore-session-handler (&rest _) "TODO" - (doom-load-session)) + (add-hook 'window-setup-hook #'doom-load-session 'append)) ;;;###autoload (add-to-list 'command-switch-alist (cons "--restore" #'doom-restore-session-handler)) diff --git a/core/cli/quickstart.el b/core/cli/quickstart.el index 8c89b10ec..dac3d13dd 100644 --- a/core/cli/quickstart.el +++ b/core/cli/quickstart.el @@ -60,6 +60,9 @@ packages and regenerates the autoloads file." (doom-packages-install doom-auto-accept) (print! "Regenerating autoloads files") (doom-reload-autoloads nil 'force-p) + (when (y-or-n-p "Download and install all-the-icon's fonts?") + (require 'all-the-icons) + (all-the-icons-install-fonts 'yes)) (print! (bold (green "\nFinished! Doom is ready to go!\n"))) (with-temp-buffer (doom-template-insert "QUICKSTART_INTRO") diff --git a/core/core-modules.el b/core/core-modules.el index 0542a0225..f91778076 100644 --- a/core/core-modules.el +++ b/core/core-modules.el @@ -248,17 +248,17 @@ non-nil, return paths of possible modules, activated or otherwise." `((fset ',fn (lambda (&rest _) (doom-log "Loading deferred package %s from %s" ',name ',fn) - (condition-case e (require ',name) + (condition-case e + (require ',name) ((debug error) (message "Failed to load deferred package %s: %s" ',name e))) - (dolist (hook (cdr (assq ',name doom--deferred-packages-alist))) - (if (functionp hook) - (advice-remove hook #',fn) - (remove-hook hook #',fn))) - (setq doom--deferred-packages-alist - (delq (assq ',name doom--deferred-packages-alist) - doom--deferred-packages-alist)) - (fmakunbound ',fn)))) + (when-let* ((deferral-list (assq ',name doom--deferred-packages-alist))) + (dolist (hook (cdr deferral-list)) + (if (functionp hook) + (advice-remove hook #',fn) + (remove-hook hook #',fn))) + (setq doom--deferred-packages-alist + (delq deferral-list doom--deferred-packages-alist)))))) (let (forms) (dolist (hook hooks forms) (push (if (functionp hook) diff --git a/core/core-projects.el b/core/core-projects.el index 13e1320f0..d6c0b0bc1 100644 --- a/core/core-projects.el +++ b/core/core-projects.el @@ -1,7 +1,8 @@ ;;; core-projects.el -*- lexical-binding: t; -*- (def-package! projectile - :hook (doom-init-ui . projectile-mode) + :after-call (after-find-file dired-before-readin-hook minibuffer-setup-hook) + :commands (projectile-project-root projectile-project-name projectile-project-p) :init (setq projectile-cache-file (concat doom-cache-dir "projectile.cache") projectile-enable-caching (not noninteractive) @@ -14,6 +15,7 @@ :config (add-hook 'dired-before-readin-hook #'projectile-track-known-projects-find-file-hook) + (projectile-mode +1) (global-set-key [remap evil-jump-to-tag] #'projectile-find-tag) (global-set-key [remap find-tag] #'projectile-find-tag) diff --git a/core/core-ui.el b/core/core-ui.el index a112c6030..300bc26d9 100644 --- a/core/core-ui.el +++ b/core/core-ui.el @@ -121,12 +121,6 @@ behavior). Do not set this directly, this is let-bound in `doom|init-theme'.") (setq doom-theme theme) (run-hooks 'doom-load-theme-hook))) -(defun doom|protect-visible-buffer () - "Don't kill the current buffer if it is visible in another window (bury it -instead). Meant for `kill-buffer-query-functions'." - (not (and (not (member (substring (buffer-name) 0 1) '(" " "*"))) - (delq (selected-window) (get-buffer-window-list nil nil t))))) - (defun doom|protect-fallback-buffer () "Don't kill the scratch buffer. Meant for `kill-buffer-query-functions'." (not (eq (current-buffer) (doom-fallback-buffer)))) @@ -527,7 +521,6 @@ frames, however. There's always `doom/reload-theme' if you need it!" (run-hook-wrapped 'doom-init-ui-hook #'doom-try-run-hook) (add-to-list 'kill-buffer-query-functions #'doom|protect-fallback-buffer nil 'eq) - (add-to-list 'kill-buffer-query-functions #'doom|protect-visible-buffer nil 'eq) (add-hook 'after-change-major-mode-hook #'doom|highlight-non-default-indentation) ;; Reload theme if the display device has changed diff --git a/core/doctor.el b/core/doctor.el new file mode 100644 index 000000000..8487cf324 --- /dev/null +++ b/core/doctor.el @@ -0,0 +1,29 @@ +;;; core/doctor.el -*- lexical-binding: t; -*- + +(defun file-size (file &optional dir) + (setq file (expand-file-name file dir)) + (when (file-exists-p file) + (/ (nth 7 (file-attributes file)) + 1024.0))) + +;; Check for oversized problem files in cache that may cause unusual/tremendous +;; delays or freezing. This shouldn't happen often. +(dolist (file (list "savehist" + "projectile.cache")) + (let* ((path (expand-file-name file doom-core-dir)) + (size (file-size path))) + (when (and (numberp size) (> size 2000)) + (warn! "%s is too large (%.02fmb). This may cause freezes or odd startup delays" + (file-relative-name path doom-core-dir) + (/ size 1024)) + (explain! "Consider deleting it from your system (manually)")))) + +(when! (not (executable-find "fd")) + (warn! "Couldn't find the `fd' binary; project file searches will be slightly slower")) + +(let ((default-directory "~")) + (require 'projectile) + (when! (cl-find-if #'projectile-file-exists-p projectile-project-root-files-bottom-up) + (warn! "Your $HOME is recognized as a project root") + (explain! "Doom will disable bottom-up root search, which may reduce the accuracy of project\n" + "detection."))) diff --git a/core/test/test-core-ui.el b/core/test/test-core-ui.el index fec4d57c6..0ace0bc73 100644 --- a/core/test/test-core-ui.el +++ b/core/test/test-core-ui.el @@ -4,32 +4,6 @@ (require 'core-ui) (describe "core/ui" - (describe "doom|protect-visible-buffer" - :var (kill-buffer-query-functions wconf a b) - (before-each - (setq a (switch-to-buffer (get-buffer-create "a")) - b (get-buffer-create "b") - kill-buffer-query-functions '(doom|protect-visible-buffer) - wconf (current-window-configuration)) - (delete-other-windows)) - - (after-each - (let (kill-buffer-query-functions kill-buffer-hook) - (kill-buffer a) - (kill-buffer b)) - (set-window-configuration wconf)) - - (it "shouldn't kill buffers that are visible in more than one window" - (with-temp-buffer-window - (switch-to-buffer a) (split-window) - (switch-to-buffer b) (split-window) - (switch-to-buffer a) - (expect (kill-buffer) :to-be nil) - - (select-window (get-buffer-window b)) - (expect (kill-buffer))))) - - (describe "doom|protect-fallback-buffer" :var (kill-buffer-query-functions a b) (before-all diff --git a/modules/README.org b/modules/README.org index 7a26494de..a660b4c6a 100644 --- a/modules/README.org +++ b/modules/README.org @@ -15,7 +15,7 @@ * :feature Broad modules that bring essential IDE functionality to Emacs. -+ [[file:feature/debugger/README.org][debugger]]: A (nigh-)universal debugger in Emacs ++ debugger: A (nigh-)universal debugger in Emacs + [[file:feature/eval/README.org][eval]]: REPL & code evaluation support for a variety of languages + [[file:feature/evil/README.org][evil]] =+everywhere=: Vim in Emacs + [[file:feature/file-templates/README.org][file-templates]]: Auto-inserted templates in blank new files @@ -27,8 +27,8 @@ Broad modules that bring essential IDE functionality to Emacs. Swappable completion modules for quickly narrowing down lists of candidates. + [[file:completion/company/README.org][company]] =+auto +childframe=: The ultimate code completion backend -+ [[file:completion/helm/README.org][helm]] =+fuzzy +childframe=: *Another* search engine for love and life -+ [[file:completion/ido/README.org][ido]]: The /other/ *other* search engine for love and life ++ helm =+fuzzy +childframe=: *Another* search engine for love and life ++ ido: The /other/ *other* search engine for love and life + [[file:completion/ivy/README.org][ivy]] =+fuzzy +childframe=: /The/ search engine for love and life * :ui @@ -39,18 +39,18 @@ Aesthetic modules that affect the Emacs interface or user experience. + [[file:ui/doom-dashboard/README.org][doom-dashboard]]: + [[file:ui/doom-quit/README.org][doom-quit]]: + [[file:ui/evil-goggles/README.org][evil-goggles]]: -+ [[file:ui/fci/README.org][fci]]: ++ fci: + [[file:ui/hl-todo/README.org][hl-todo]]: + [[file:ui/modeline/README.org][modeline]]: + [[file:ui/nav-flash/README.org][nav-flash]]: + [[file:ui/neotree/README.org][neotree]]: -+ [[file:ui/treemacs/README.org][treemacs]]: ++ treemacs: + [[file:ui/popup/README.org][popup]] =+all +defaults=: Makes temporary/disposable windows less intrusive -+ [[file:ui/pretty-code/README.org][pretty-code]]: ++ pretty-code: + [[file:ui/tabbar/README.org][tabbar]]: + [[file:ui/unicode/README.org][unicode]]: -+ [[file:ui/vc-gutter/README.org][vc-gutter]]: -+ [[file:ui/vi-tilde-fringe/README.org][vi-tilde-fringe]]: ++ vc-gutter: ++ vi-tilde-fringe: + [[file:ui/window-select/README.org][window-select]]: * :editor @@ -59,112 +59,113 @@ Modules that affect and augment your ability to write and edit text. + [[file:editor/fold/README.org][fold]]: universal code folding + [[file:editor/format/README.org][format]] =+onsave=: + [[file:editor/lispy/README.org][lispy]]: -+ [[file:editor/multiple-cursors/README.org][multiple-cursors]]: ++ multiple-cursors: + [[file:editor/parinfer/README.org][parinfer]]: -+ [[file:editor/rotate-text/README.org][rotate-text]]: ++ rotate-text: * :emacs Modules that reconfigure packages or features built into Emacs -+ [[file:emacs/dired/README.org][dired]] =+ranger +icons=: -+ [[file:emacs/electric/README.org][electric]]: -+ [[file:emacs/eshell/README.org][eshell]]: -+ [[file:emacs/imenu/README.org][imenu]]: -+ [[file:emacs/term/README.org][term]]: -+ [[file:emacs/vc/README.org][vc]]: ++ dired =+ranger +icons=: ++ electric: ++ eshell: ++ imenu: ++ term: ++ vc: * :tools Small modules that give Emacs access to external tools & services. -+ [[file:tools/ansible/README.org][ansible]]: -+ [[file:tools/docker/README.org][docker]]: ++ ansible: ++ docker: + [[file:tools/editorconfig/README.org][editorconfig]]: + [[file:tools/ein/README.org][ein]]: -+ [[file:tools/flyspell/README.org][flyspell]]: Spell checking -+ [[file:tools/flycheck/README.org][flycheck]]: Live error/warning highlights -+ [[file:tools/gist/README.org][gist]]: ++ flyspell: Spell checking ++ flycheck: Live error/warning highlights ++ gist: + [[file:tools/lsp/README.org][lsp]]: -+ [[file:tools/macos/README.org][macos]]: -+ [[file:tools/make/README.org][make]]: -+ [[file:tools/magit/README.org][magit]]: -+ [[file:tools/password-store/README.org][password-store]]: -+ [[file:tools/pdf/README.org][pdf]]: -+ [[file:tools/prodigy/README.md][prodigy]]: -+ [[file:tools/rgb/README.org][rgb]]: -+ [[file:tools/terraform/README.org][terraform]]: -+ [[file:tools/tmux/README.org][tmux]]: -+ [[file:tools/upload/README.org][upload]]: ++ macos: ++ make: ++ magit: ++ password-store: ++ pdf: ++ prodigy: ++ rgb: ++ terraform: ++ tmux: ++ upload: + [[file:tools/wakatime/README.org][wakatime]]: -+ [[file:tools/vterm/README.org][vterm]]: ++ vterm: * :lang Modules that bring support for a language or group of languages to Emacs. -+ [[file:lang/assembly/README.org][assembly]]: ++ assembly: + [[file:lang/cc/README.org][cc]] =+lsp=: -+ [[file:lang/clojure/README.org][clojure]]: -+ [[file:lang/common-lisp/README.org][common-lisp]]: ++ clojure: ++ common-lisp: + [[file:lang/coq/README.org][coq]]: -+ [[file:lang/crystal/README.org][crystal]]: ++ crystal: + [[file:lang/csharp/README.org][csharp]]: -+ [[file:lang/data/README.org][data]]: -+ [[file:lang/erlang/README.org][erlang]]: -+ [[file:lang/elixir/README.org][elixir]]: -+ [[file:lang/elm/README.org][elm]]: -+ [[file:lang/emacs-lisp/README.org][emacs-lisp]]: ++ data: ++ erlang: ++ elixir: ++ elm: ++ emacs-lisp: + [[file:lang/ess/README.org][ess]]: + [[file:lang/go/README.org][go]] =+lsp=: + [[file:lang/haskell/README.org][haskell]] =+intero +dante=: -+ [[file:lang/hy/README.org][hy]]: ++ hy: + [[file:lang/idris/README.org][idris]]: -+ [[file:lang/java/README.org][java]] =+meghanada=: ++ java =+meghanada=: + [[file:lang/javascript/README.org][javascript]] =+lsp=: -+ [[file:lang/julia/README.org][julia]]: ++ julia: + [[file:lang/latex/README.org][latex]]: -+ [[file:lang/ledger/README.org][ledger]]: -+ [[file:lang/lua/README.org][lua]]: -+ [[file:lang/markdown/README.org][markdown]]: ++ ledger: ++ lua: ++ markdown: + [[file:lang/nim/README.org][nim]]: -+ [[file:lang/nix/README.org][nix]]: ++ nix: + [[file:lang/ocaml/README.org][ocaml]] =+lsp=: + [[file:lang/org/README.org][org]] =+attach +babel +capture +export +present +ipython=: + [[file:lang/perl/README.org][perl]]: + [[file:lang/php/README.org][php]] =+lsp=: -+ [[file:lang/plantuml/README.org][plantuml]]: -+ [[file:lang/purescript/README.org][purescript]]: -+ [[file:lang/python/README.org][python]] =+lsp=: -+ [[file:lang/qt/README.org][qt]]: -+ [[file:lang/racket/README.org][racket]]: ++ plantuml: ++ purescript: ++ python =+lsp=: ++ qt: ++ racket: + [[file:lang/rest/README.org][rest]]: -+ [[file:lang/ruby/README.org][ruby]] =+lsp=: ++ ruby =+lsp=: + [[file:lang/rust/README.org][rust]] =+lsp=: -+ [[file:lang/scala/README.org][scala]]: ++ scala: + [[file:lang/sh/README.org][sh]] =+fish +lsp=: + [[file:lang/solidity/README.org][solidity]]: -+ [[file:lang/swift/README.org][swift]]: -+ [[file:lang/web/README.org][web]] =+lsp=: -+ [[file:lang/vala/README.org][vala]]: ++ swift: ++ web =+lsp=: ++ vala: * :app -Large, opinionated modules that transform and take over Emacs to serve +Large, opinionated modules that transform and take over Emacs, i.e. +Doom-specific porcelains. -+ [[file:app/calendar/README.org][calendar]]: ++ calendar: + [[file:app/email/README.org][email]] =+gmail=: + [[file:app/irc/README.org][irc]]: -+ [[file:app/regex/README.org][regex]]: -+ [[file:app/rss/README.org][rss]] =+org=: -+ [[file:app/twitter/README.org][twitter]]: ++ regex: ++ rss =+org=: ++ twitter: + [[file:app/write/README.org][write]] =+wordnut +langtool=: * :collab Modules that enable collaborative programming over the internet. -+ [[file:collab/floobits/README.org][floobits]]: -+ [[file:collab/impatient-mode/README.org][impatient-mode]]: ++ floobits: ++ impatient-mode: * :config Modules that configure Emacs one way or another, or focus on making it easier for you to customize it yourself. -+ [[file:config/literate/README.org][literate]]: ++ literate: + [[file:config/default/README.org][default]] =+bindings +smartparens=: diff --git a/modules/completion/ivy/autoload/ivy.el b/modules/completion/ivy/autoload/ivy.el index e416c7160..c05856ea0 100644 --- a/modules/completion/ivy/autoload/ivy.el +++ b/modules/completion/ivy/autoload/ivy.el @@ -35,7 +35,7 @@ temporary/special buffers in `font-lock-comment-face'." ;; Library (defun +ivy--switch-buffer-preview () - (let (ivy-use-virtual-buffers) + (let (ivy-use-virtual-buffers ivy--virtual-buffers) (counsel--switch-buffer-update-fn))) (defalias '+ivy--switch-buffer-preview-all #'counsel--switch-buffer-update-fn) diff --git a/modules/config/default/+evil-bindings.el b/modules/config/default/+evil-bindings.el index 406421bcc..f5ce134b5 100644 --- a/modules/config/default/+evil-bindings.el +++ b/modules/config/default/+evil-bindings.el @@ -409,8 +409,9 @@ :nv "N" #'evil-mc-make-and-goto-last-cursor :nv "p" #'evil-mc-make-and-goto-prev-cursor :nv "P" #'evil-mc-make-and-goto-first-cursor + :nv "q" #'evil-mc-undo-all-cursors :nv "t" #'+multiple-cursors/evil-mc-toggle-cursors - :nv "u" #'evil-mc-undo-all-cursors + :nv "u" #'evil-mc-undo-last-added-cursor :nv "z" #'+multiple-cursors/evil-mc-make-cursor-here) (:after evil-mc :map evil-mc-key-map diff --git a/modules/editor/multiple-cursors/config.el b/modules/editor/multiple-cursors/config.el index 687a35b87..86ec2bb0c 100644 --- a/modules/editor/multiple-cursors/config.el +++ b/modules/editor/multiple-cursors/config.el @@ -17,6 +17,7 @@ (defvar evil-mc-key-map (make-sparse-keymap)) :config (global-evil-mc-mode +1) + (setq evil-mc-enable-bar-cursor (not (or IS-MAC IS-WINDOWS))) (after! smartparens ;; Make evil-mc cooperate with smartparens better diff --git a/modules/feature/evil/+commands.el b/modules/feature/evil/+commands.el index 72ed9c464..82dedee36 100644 --- a/modules/feature/evil/+commands.el +++ b/modules/feature/evil/+commands.el @@ -66,10 +66,6 @@ buffers." ;; ;; Commands -;;; these are defined in feature/evil -;;(evil-ex-define-cmd "al[ign]" #'+evil:align) -;;(evil-ex-define-cmd "g[lobal]" #'+evil:global) - ;;; Custom commands ;; Editing (evil-ex-define-cmd "@" #'+evil:macro-on-all-lines) ; TODO Test me @@ -151,7 +147,7 @@ buffers." ;;; Project tools (evil-ex-define-cmd "compile" #'+evil:compile) (evil-ex-define-cmd "mak[e]" #'+evil:make) -(evil-ex-define-cmd "debug" #'+debug/run) +;; (evil-ex-define-cmd "debug" #'+debug/run) (evil-ex-define-cmd "er[rors]" #'flycheck-list-errors) ;;; File operations @@ -161,8 +157,8 @@ buffers." ;;; Sessions/tabs (evil-ex-define-cmd "sclear" #'+workspace/kill-session) -(evil-ex-define-cmd "sl[oad]" #'+workspace:load-session) -(evil-ex-define-cmd "ss[ave]" #'+workspace:save-session) +(evil-ex-define-cmd "sl[oad]" #'doom/quickload-session) +(evil-ex-define-cmd "ss[ave]" #'doom/quicksave-session) (evil-ex-define-cmd "tabc[lose]" #'+workspace:delete) (evil-ex-define-cmd "tabclear" #'doom/kill-all-buffers) (evil-ex-define-cmd "tabl[ast]" #'+workspace/switch-to-last) diff --git a/modules/feature/evil/README.org b/modules/feature/evil/README.org index b3b089d1d..a39ad4af9 100644 --- a/modules/feature/evil/README.org +++ b/modules/feature/evil/README.org @@ -4,26 +4,25 @@ #+STARTUP: inlineimages * Table of Contents :TOC_3:noexport: -- [[Description][Description]] - - [[Module Flags][Module Flags]] - - [[Plugins][Plugins]] - - [[Hacks][Hacks]] -- [[Prerequisites][Prerequisites]] -- [[Features][Features]] - - [[Ported vim plugins][Ported vim plugins]] - - [[Custom Text Objects][Custom Text Objects]] - - [[Custom Ex Commands][Custom Ex Commands]] - - [[A hybrid code-folding system][A hybrid code-folding system]] - - [[Differences from vim][Differences from vim]] -- [[Configuration][Configuration]] - - [[Removing evil-mode][Removing evil-mode]] +- [[#description][Description]] + - [[#module-flags][Module Flags]] + - [[#plugins][Plugins]] + - [[#hacks][Hacks]] +- [[#prerequisites][Prerequisites]] +- [[#features][Features]] + - [[#ported-vim-plugins][Ported vim plugins]] + - [[#custom-text-objects][Custom Text Objects]] + - [[#custom-ex-commands][Custom Ex Commands]] +- [[#configuration][Configuration]] + - [[#removing-evil-mode][Removing evil-mode]] + - [[#restoring-old-substitution-behavior-on-ss][Restoring old substitution behavior on s/S]] * Description This holy module brings the vim experience to Emacs. ** Module Flags -+ =+everywhere= Enables evilified keybinds everywhere possible, utilizing the - ~evil-collection~ plugin. ++ =+everywhere= Enables evilified keybinds everywhere possible. Uses the + [[https://github.com/emacs-evil/evil-collection][evil-collection]] plugin as a foundation. ** Plugins + [[https://github.com/emacs-evil/evil][evil]] @@ -48,10 +47,9 @@ This holy module brings the vim experience to Emacs. + When a window is split, the new window will be focused. + The o/O keys will respect and continue commented lines (can be disabled by setting ~+evil-want-o/O-to-continue-comments~ to ~nil~). -+ From visual mode, =*= and =#= will search for the current selection instead of ++ In visual mode, =*= and =#= will search for the current selection instead of the word-at-point. -+ The ~:g[lobal]~ ex command has been modified to highlight matches - incrementally. ++ The ~:g[lobal]~ ex command has been modified to highlight matches. + More of vim's filename modifiers are supported in ex commands (like ~:p~, ~:p:h~ or ~:t~) than vanilla evil-mode offers. + A custom filename modifier is available in Doom: ~:P~, which expands to the @@ -64,64 +62,115 @@ This module has no external prerequisites. ** Ported vim plugins The following vim plugins have been ported to evil: -| Vim Plugin | Emacs Plugin | Keybind(s) | -|-----------------------+--------------------------------+---------------------| -| vim-commentary | evil-commentary | omap =gc= | -| vim-easymotion | evil-easymotion | omap =gs= | -| vim-seek or vim-sneak | evil-snipe | mmap =s=/=S= | -| vim-surround | evil-embrace and evil-surround | vmap =S=, omap =ys= | +| Vim Plugin | Emacs Plugin | Keybind(s) | +|-----------------------+--------------------------------+--------------------------------------| +| vim-commentary | evil-commentary | omap =gc= | +| vim-easymotion | evil-easymotion | omap =gs= | +| vim-seek or vim-sneak | evil-snipe | mmap =s=/=S=, omap =z=/=Z= & =x=/=x= | +| vim-surround | evil-embrace and evil-surround | vmap =S=, omap =ys= | In other modules: -+ The tools/neotree & tools/treemacs modules contain a =NERDTree= equivalent. -+ The editor/multiple-cursors module contains: - + ~vim-multiedit~ => evil-multiedit - + ~vim-multiple-cursors~ => evil-mc ++ The tools/neotree & tools/treemacs modules provide a =NERDTree= equivalent. ++ The editor/multiple-cursors module contains functionality equal to the + following vim plugins: + + evil-multiedit => vim-multiedit + + evil-mc => vim-multiple-cursors ** Custom Text Objects -+ A list of new text objects: - + Blocks: ~B~ (from ~evil-textobj-anyblock~) - + Args: ~a~ (from ~evil-args~) - + Indentation: ~i~ / ~I~ / ~J~ (from ~evil-indent-plus~) +This module provides a couple extra text objects, along with the built-in ones. +For posterity, here are the built-in ones: + ++ =w W= words ++ =s= sentences ++ =p= paragraphs ++ =b= parenthesized blocks ++ =b ( ) { } [ ] < >= braces, parentheses and brackets ++ =' " `= quotes ++ =t= tags ++ =o= symbols + +And these are text objects added by this module: + ++ =B= any block delimited by braces, parentheses or backets (provided by + ~evil-textobj-anyblock~) ++ =a= C-style fucntion arguments (provided by ~evil-args~) ++ =i I J= By indentation (I includes on line above and J includes one line + below) (provided by ~evil-indent-plus~) ++ =x= XML attributes (provided by ~exato~) ** Custom Ex Commands -| Ex Command | Description | -|----------------------+----------------------------------------------------------------------------------| -| ~:al[ign][!] REGEXP~ | Align text to the first match of REGEXP. If BANG, align all matches on each line | -| ~:mv[!] NEWPATH~ | Move the current file to NEWPATH | -| ~:cp[!] NEWPATH~ | Copy the current file to NEWPATH | -| ~:rm[!] [PATH]~ | Delete the current buffer's file and buffer | - -** A hybrid code-folding system -This module combines ~vimish-fold~ and ~hideshow~. The former allows arbitrary -folds and the latter allows folds on markers and indentation. Together, they -create a more consistent (and feature-complete) code-folding system. - -Most vim folding keys should work, e.g. =zr=, =zm=, =za=, =zo=, etc. - -** Differences from vim -+ Column-wise ranges in ex commands are enabled by default. i.e. the range in - =:'<,'>s/a/b= will only affects the visual selection, not full lines (see - ~evil-ex-visual-char-range~). -+ =:g= will incrementally highlight buffer matches. +| Ex Command | Description | +|----------------------+--------------------------------------------------------------------------------------| +| ~:@~ | Apply macro on selected lines | +| ~:ag[!] REGEXP~ | Perform a project search with ag | +| ~:agcwd[!] REGEXP~ | Perform a project search with ag | +| ~:al[ign] REGEXP~ | Align text that matches REGEXP | +| ~:al[ign][!] REGEXP~ | Align text to the first match of REGEXP. If BANG, align all matches on each line | +| ~:cp[!] NEWPATH~ | Copy the current file to NEWPATH | +| ~:dash QUERY~ | Look up QUERY (or the symbol at point) in dash docsets | +| ~:dehtml [INPUT]~ | HTML decode selected text / inserts result if INPUT is given | +| ~:enhtml [INPUT]~ | HTML encode selected text / inserts result if INPUT is given | +| ~:grep[!]~ | Perform a project search with git-grep | +| ~:grepcwd[!]~ | Perform a project search with git-grep | +| ~:iedit REGEXP~ | Invoke iedit on all matches for REGEXP | +| ~:k[ill]all[!]~ | Kill all buffers (if BANG, affect buffer across workspaces) | +| ~:k[ill]b~ | Kill all buried buffers | +| ~:k[ill]m[!] REGEXP~ | Kill buffers whose name matches REGEXP (if BANG, affect buffers across workspaces) | +| ~:k[ill]o~ | Kill all other buffers besides the selected one | +| ~:k[ill]~ | Kill the current buffer | +| ~:lo[okup] QUERY~ | Look up QUERY on an online search engine | +| ~:mc REGEXP~ | Invoke multiple cursors on all matches for REGEXP | +| ~:mv[!] NEWPATH~ | Move the current file to NEWPATH | +| ~:na[rrow]~ | Narrow the buffer to the selection | +| ~:pad~ | Open a scratch pad for running code quickly | +| ~:pt[!]~ | Perform a project search with pt | +| ~:ptcwd[!]~ | Perform a project search with pt | +| ~:ral[ign] REGEXP~ | Right-align text that matches REGEXP | +| ~:repl~ | Open a REPL and/or copy the current selection to it | +| ~:retab~ | Convert indentation to the default within the selection | +| ~:rev[erse]~ | Reverse the selected lines | +| ~:rg[!]~ | Perform a project search with ripgrep | +| ~:rgcwd[!]~ | Perform a project search with rigprep | +| ~:rm[!] [PATH]~ | Delete the current buffer's file and buffer | +| ~:tcd[!]~ | Send =cd X= to tmux. X = the project root if BANG, X = ~default-directory~ otherwise | * Configuration ** Removing evil-mode You must do two things to remove Evil: 1. Remove =:feature evil= from =~/.doom.d/init.el=, -2. Run ~bin/doom refresh~ to clean up lingering dependencies and refresh yuor +2. Run ~doom refresh~ to clean up lingering dependencies and refresh yuor autoloads files. -3. [OPTIONAL] You may want a new ~doom-leader-alt-key~ and - ~doom-localleader-alt-key~. By default, these are bound to =M-SPC= and =M-SPC - m=. +3. [OPTIONAL] You may want to assign new values to ~doom-leader-alt-key~ and + ~doom-localleader-alt-key~. These are bound to =C-c= and =C-c l= by default. #+begin_quote Ignore ~doom-leader-key~ and ~doom-localleader-key~, they don't apply to non-evil sessions. #+end_quote -Note that evil-specific configuration and keybinds (defined with ~map!~) will be -ignored without evil present (and stripped out when byte-compiling). +Evil-specific configuration and keybindings (defined with ~map!~) will be +ignored without =:feature evil= present (and omitted when byte-compiling). -Unfortunately, since Doom was designed by a vimmer, for vimmers, little -consideration into a keybinding scheme for vanilla Emacs users. +Keep in mind that, at the time of this writing, Doom was designed by a vimmer, +for vimmers. Little consideration has been put into designing a keybind scheme +for vanilla Emacs users (though it's being worked on!). + +That means that much of Doom's functionality will be orphaned in an evil-less +setup. You'll have to set your own keybinds. + +I suggest studying [[file:../../config/default/+emacs-bindings.el][config/default/+emacs-bindings.el]] to see what keybinds are +available for non-evil users. Otherwise, you may find inspiration [[file:../../../docs/example_configs.org][on the example +Doom configurations page]]. + +** Restoring old substitution behavior on s/S +Doom replaces the =s= and =S= keys with the =evil-snipe= package (a port of +vim-seek/vim-sneak for 2-character versions of f/F/t/T). + +To disable evil-snipe on s/S, you can either: + +1. Disable ~evil-snipe-mode~ by adding ~(after! evil-snipe (evil-snipe-mode + -1))~ to =$DOOMDIR/config.el=, +2. Or disable =evil-snipe= completely with ~(package! evil-snipe :disable t)~ + added to =$DOOMDIR/packages.el=, but this will also disable incremental + highlighting for the f/F/t/T motions keys. diff --git a/modules/lang/emacs-lisp/autoload.el b/modules/lang/emacs-lisp/autoload.el index 59847ec3d..e85c851ff 100644 --- a/modules/lang/emacs-lisp/autoload.el +++ b/modules/lang/emacs-lisp/autoload.el @@ -10,7 +10,7 @@ to a pop up buffer." (require 'pp) (let ((result (let ((debug-on-error t) - (doom--current-module (doom-module-from-path buffer-file-name))) + (doom--current-module (ignore-errors (doom-module-from-path buffer-file-name)))) (eval (read (concat "(progn " (buffer-substring-no-properties beg end) diff --git a/modules/lang/emacs-lisp/config.el b/modules/lang/emacs-lisp/config.el index 805505d3c..63faeb3bc 100644 --- a/modules/lang/emacs-lisp/config.el +++ b/modules/lang/emacs-lisp/config.el @@ -124,6 +124,7 @@ This marks a foldable marker for `outline-minor-mode' in elisp buffers.") (def-package! elisp-demos :defer t :init + (advice-add 'describe-function-1 :after #'elisp-demos-advice-describe-function-1) (advice-add 'helpful-update :after #'elisp-demos-advice-helpful-update)) diff --git a/modules/lang/javascript/config.el b/modules/lang/javascript/config.el index c31ae716f..a4b46b448 100644 --- a/modules/lang/javascript/config.el +++ b/modules/lang/javascript/config.el @@ -160,14 +160,15 @@ ;; navigation (set-lookup-handlers! 'tide-mode :async t :definition #'tide-jump-to-definition - :references #'tide-references - :documentation #'tide-documentation-at-point) + :references #'tide-references) ;; resolve to `doom-project-root' if `tide-project-root' fails (advice-add #'tide-project-root :override #'+javascript*tide-project-root) ;; cleanup tsserver when no tide buffers are left (add-hook! 'tide-mode-hook (add-hook 'kill-buffer-hook #'+javascript|cleanup-tide-processes nil t)) + (define-key tide-mode-map [remap +lookup/documentation] #'tide-documentation-at-point) + (map! :localleader :map tide-mode-map "R" #'tide-restart-server diff --git a/modules/lang/org/config.el b/modules/lang/org/config.el index 559087b1c..9632f266b 100644 --- a/modules/lang/org/config.el +++ b/modules/lang/org/config.el @@ -76,6 +76,7 @@ (add-hook 'org-load-hook #'+org|setup-evil-keybinds) (add-hook 'evil-org-mode-hook #'evil-normalize-keymaps) :config + (add-hook 'org-open-at-point-functions #'evil-set-jump) ;; change `evil-org-key-theme' instead (advice-add #'evil-org-set-key-theme :override #'ignore) (def-package! evil-org-agenda diff --git a/modules/ui/doom-dashboard/config.el b/modules/ui/doom-dashboard/config.el index 0c2fb29ef..cfaa23df9 100644 --- a/modules/ui/doom-dashboard/config.el +++ b/modules/ui/doom-dashboard/config.el @@ -114,7 +114,7 @@ PLIST can have the following properties: return t))) #'+doom-dashboard-initial-buffer)) -(add-hook 'doom-init-ui-hook #'+doom-dashboard|init) +(add-hook 'doom-init-ui-hook #'+doom-dashboard|init 'append) ;; diff --git a/modules/ui/doom/config.el b/modules/ui/doom/config.el index 67f740e2b..26082e7e8 100644 --- a/modules/ui/doom/config.el +++ b/modules/ui/doom/config.el @@ -27,6 +27,7 @@ :init (unless doom-theme (setq doom-theme 'doom-one)) + :config ;; improve integration w/ org-mode (add-hook 'doom-load-theme-hook #'doom-themes-org-config) ;; more Atom-esque file icons for neotree/treemacs diff --git a/modules/ui/popup/README.org b/modules/ui/popup/README.org index 9a36b1270..3545e7f76 100644 --- a/modules/ui/popup/README.org +++ b/modules/ui/popup/README.org @@ -1,50 +1,59 @@ -#+TITLE: :feature popup +#+TITLE: :ui popup -This module provides a highly customizable popup window management system. +* Table of Contents :TOC: +- [[#description][Description]] + - [[#module-flags][Module Flags]] +- [[#prerequisites][Prerequisites]] +- [[#configuration][Configuration]] + - [[#set-popup-rule-and-set-popup-rules][~set-popup-rule!~ and ~set-popup-rules!~]] + - [[#disabling-aggressive-mode-line-hiding-in-popups][Disabling aggressive mode-line hiding in popups]] +- [[#appendix][Appendix]] + - [[#commands][Commands]] + - [[#library][Library]] + - [[#hacks][Hacks]] + +* Description +This module provides a customizable popup window management system. -#+begin_quote Not all windows are created equally. Some are less important. Some I want gone once they have served their purpose, like code output or a help buffer. Others I want to stick around, like a scratch buffer or org-capture popup. More than that, popups ought to be be the second class citizens of my editor; -spawned off to the side, discarded with the simple push of a button -(Escape/C-g), and easily restored if I want to see them again. Of course, this -system should clean up after itself and kill off buffers I mark as transient. -#+end_quote +spawned off to the side, discarded with the push of a button (e.g. =ESC= or +=C-g=), and easily restored if I want to see them again. Of course, this system +should clean up after itself and kill off buffers I mark as transient. -* Table of Contents :TOC: -- [[Configuration][Configuration]] - - [[~set-popup-rules!~][~set-popup-rules!~]] - - [[Disabling aggressive mode-line hiding in popups][Disabling aggressive mode-line hiding in popups]] -- [[Appendix][Appendix]] - - [[Commands][Commands]] - - [[Library][Library]] - - [[Hacks][Hacks]] +** Module Flags ++ =+all= Enables fallback rules to ensure all temporary/special buffers (whose + name begins with a space or asterix) are treated as popups. ++ =+defaults= Enables reasonable default popup rules for a variety of buffers. + +* Prerequisites +This module has no external prerequisites. * Configuration -** ~set-popup-rules!~ -This module has one setting for defining your own rules for popups: +** ~set-popup-rule!~ and ~set-popup-rules!~ +This module has two functions for defining your own rules for popups: #+BEGIN_SRC emacs-lisp +(set-popup-rule! PREDICATE &key IGNORE ACTIONS SIDE SIZE WIDTH HEIGHT SLOT VSLOT TTL QUIT SELECT MODELINE AUTOSAVE PARAMETERS) (set-popup-rules! &rest RULESETS) #+END_SRC -+ ~RULESETS~ consist of a function or regexp string that matches the buffer's - name, and a list of settings. See ~display-buffer~'s, - ~display-window-parameters~'s, and ~+popup-window-parameters~'s documentation - for what parameters are supported. +~PREDICATE~ is a predicate function or regexp string to match against the +buffer's name. To see what the other keywords do, check out the documentation +for ~set-popup-rule!~ (=SPC h f set-popup-rule!=). +#+begin_quote Rules are added to ~display-buffer-alist~, which instructs ~display-buffer~ calls on how to set up windows for buffers that meet certain conditions. -#+begin_quote The ~switch-to-buffer~ command (and its ~switch-to-buffer-*~ variants) are not affected by ~display-buffer-alist~. #+end_quote -Here are a couple example rules: - +e.g. #+BEGIN_SRC emacs-lisp (set-popup-rules! '(("^ \\*" :slot -1) ; fallback rule for special buffers @@ -57,25 +66,27 @@ Here are a couple example rules: #+END_SRC Omitted parameters in a ~set-popup-rules!~ will use the defaults set in -~+popup-default-alist~ and ~+popup-default-parameters~. +~+popup-defaults~. ** Disabling aggressive mode-line hiding in popups -There are two ways to go about this. You can turn on modelines by changing the -default ~'modeline~ window parameter in ~+popup-default-parameters~: +There are two ways to go about this. -#+BEGIN_SRC emacs-lisp -;; put in private/$USER/config.el -(map-put +popup-default-parameters 'modeline t) -#+END_SRC +1. Turn on modelines by changing the ~:modeline~ property in ~+popup-defaults~: -This will ensure all popups have a modeline /by default/, but allows you to override this on a per-popup basis. + #+BEGIN_SRC emacs-lisp + ;; put in private/$USER/config.el + (map-put +popup-defaults :modeline t) + #+END_SRC -*Alternatively*, you can disable modeline-hiding entirely: + This will ensure all popups have a modeline /by default/, but allows you to + override this on a per-popup basis. -#+BEGIN_SRC emacs-lisp -;; put in private/$USER/config.el -(remove-hook '+popup-buffer-mode-hook '+popup|set-modeline) -#+END_SRC +2. Disable modeline-hiding entirely: + + #+BEGIN_SRC emacs-lisp + ;; in ~/.doom.d/config.el + (remove-hook '+popup-buffer-mode-hook #'+popup|set-modeline-on-enable) + #+END_SRC * Appendix ** Commands diff --git a/modules/ui/popup/autoload/settings.el b/modules/ui/popup/autoload/settings.el index 56a092f61..ad4bead4f 100644 --- a/modules/ui/popup/autoload/settings.el +++ b/modules/ui/popup/autoload/settings.el @@ -166,7 +166,9 @@ PLIST can be made up of any of the following properties: An alist of custom window parameters. See `(elisp)Window Parameters'. If any of these are omitted, defaults derived from `+popup-defaults' will be -used." +used. + +\(fn PREDICATE &key IGNORE ACTIONS SIDE SIZE WIDTH HEIGHT SLOT VSLOT TTL QUIT SELECT MODELINE AUTOSAVE PARAMETERS)" (declare (indent defun)) (push (+popup--make predicate plist) +popup--display-buffer-alist) (when (bound-and-true-p +popup-mode)