From 9e895e5b126ba780b648fb7ef9fbfdf9628f3e47 Mon Sep 17 00:00:00 2001 From: ry Date: Thu, 13 Jan 2022 10:07:57 -0800 Subject: [PATCH] trying to get stuff werkin --- .config/doom/config.el | 5 +- .config/doom/custom.el | 2 +- .config/doom/init.el | 2 +- .config/emacs/.dir-locals.el | 3 - .config/emacs/.github/CODEOWNERS | 159 -- .../.github/ISSUE_TEMPLATE/bug_report.yml | 95 - .../.github/ISSUE_TEMPLATE/bump_request.yml | 34 - .../emacs/.github/ISSUE_TEMPLATE/config.yml | 14 - .../ISSUE_TEMPLATE/feature_request.yml | 43 - .../emacs/.github/PULL_REQUEST_TEMPLATE.md | 16 - .config/emacs/.github/workflows/lint.yml | 18 - .config/emacs/.github/workflows/test.yml | 68 - .config/emacs/.github/workflows/triage.yml | 30 - .config/emacs/.gitignore | 38 - .config/emacs/LICENSE | 22 - .config/emacs/README.md | 247 --- .config/emacs/bin/doom | 166 -- .config/emacs/bin/doom.cmd | 25 - .config/emacs/bin/org-capture | 43 - .config/emacs/bin/org-tangle | 159 -- .config/emacs/core/autoload/buffers.el | 393 ---- .config/emacs/core/autoload/config.el | 129 -- .config/emacs/core/autoload/debug.el | 363 ---- .config/emacs/core/autoload/files.el | 347 ---- .config/emacs/core/autoload/fonts.el | 180 -- .config/emacs/core/autoload/help.el | 741 -------- .config/emacs/core/autoload/output.el | 278 --- .config/emacs/core/autoload/packages.el | 306 --- .config/emacs/core/autoload/plist.el | 93 - .config/emacs/core/autoload/process.el | 42 - .config/emacs/core/autoload/projects.el | 178 -- .config/emacs/core/autoload/sandbox.el | 183 -- .config/emacs/core/autoload/scratch.el | 199 -- .config/emacs/core/autoload/sessions.el | 131 -- .config/emacs/core/autoload/store.el | 155 -- .config/emacs/core/autoload/system.el | 108 -- .config/emacs/core/autoload/text.el | 349 ---- .config/emacs/core/autoload/themes.el | 73 - .config/emacs/core/autoload/ui.el | 246 --- .config/emacs/core/cli/autoloads.el | 232 --- .config/emacs/core/cli/byte-compile.el | 208 -- .config/emacs/core/cli/ci.el | 421 ----- .config/emacs/core/cli/debug.el | 30 - .config/emacs/core/cli/doctor.el | 276 --- .config/emacs/core/cli/env.el | 141 -- .config/emacs/core/cli/help.el | 102 - .config/emacs/core/cli/install.el | 102 - .config/emacs/core/cli/lib/debugger.el | 71 - .config/emacs/core/cli/lib/lib.el | 185 -- .config/emacs/core/cli/lib/straight-hacks.el | 120 -- .config/emacs/core/cli/packages.el | 649 ------- .config/emacs/core/cli/sync.el | 56 - .config/emacs/core/cli/test.el | 104 - .config/emacs/core/cli/upgrade.el | 149 -- .config/emacs/core/core-cli.el | 256 --- .config/emacs/core/core-editor.el | 685 ------- .config/emacs/core/core-keybinds.el | 462 ----- .config/emacs/core/core-lib.el | 750 -------- .config/emacs/core/core-modules.el | 572 ------ .config/emacs/core/core-packages.el | 600 ------ .config/emacs/core/core-projects.el | 307 --- .config/emacs/core/core-ui.el | 655 ------- .config/emacs/core/core.el | 576 ------ .config/emacs/core/packages.el | 52 - .config/emacs/core/templates/BUG_REPORT | 29 - .config/emacs/core/templates/QUICKSTART_INTRO | 19 - .config/emacs/core/templates/VANILLA_SANDBOX | 12 - .../emacs/core/templates/config.example.el | 54 - .../emacs/core/templates/packages.example.el | 50 - .../emacs/core/test/test-autoload-buffers.el | 160 -- .../emacs/core/test/test-autoload-files.el | 164 -- .../emacs/core/test/test-autoload-format.el | 44 - .../emacs/core/test/test-autoload-package.el | 5 - .config/emacs/core/test/test-core-keybinds.el | 256 --- .config/emacs/core/test/test-core-lib.el | 271 --- .config/emacs/core/test/test-core-modules.el | 23 - .config/emacs/core/test/test-core-packages.el | 5 - .config/emacs/core/test/test-core-projects.el | 40 - .config/emacs/core/test/test-core-ui.el | 106 -- .config/emacs/core/test/test-core.el | 127 -- .config/emacs/docs/contributing.org | 167 -- .config/emacs/docs/faq.org | 1344 ------------- .config/emacs/docs/getting_started.org | 1677 ----------------- .config/emacs/docs/index.org | 106 -- .config/emacs/docs/modules.org | 224 --- .config/emacs/early-init.el | 81 - .config/emacs/init.el | 57 - .config/emacs/init.example.el | 191 -- .config/emacs/modules/.gitignore | 19 - .config/emacs/modules/LICENSE | 22 - .config/emacs/modules/app/calendar/README.org | 50 - .../emacs/modules/app/calendar/autoload.el | 63 - .config/emacs/modules/app/calendar/config.el | 94 - .../emacs/modules/app/calendar/packages.el | 8 - .config/emacs/modules/app/emms/README.org | 71 - .config/emacs/modules/app/emms/autoload.el | 30 - .config/emacs/modules/app/emms/config.el | 18 - .config/emacs/modules/app/emms/packages.el | 4 - .../emacs/modules/app/everywhere/README.org | 58 - .config/emacs/modules/app/everywhere/cli.el | 5 - .../emacs/modules/app/everywhere/config.el | 35 - .../emacs/modules/app/everywhere/doctor.el | 12 - .../emacs/modules/app/everywhere/packages.el | 4 - .config/emacs/modules/app/irc/README.org | 164 -- .config/emacs/modules/app/irc/autoload/irc.el | 113 -- .config/emacs/modules/app/irc/autoload/ivy.el | 30 - .../modules/app/irc/autoload/settings.el | 18 - .../emacs/modules/app/irc/autoload/vertico.el | 23 - .config/emacs/modules/app/irc/config.el | 258 --- .config/emacs/modules/app/irc/packages.el | 5 - .config/emacs/modules/app/rss/README.org | 114 -- .config/emacs/modules/app/rss/autoload.el | 141 -- .config/emacs/modules/app/rss/config.el | 87 - .config/emacs/modules/app/rss/packages.el | 7 - .config/emacs/modules/app/twitter/README.org | 96 - .config/emacs/modules/app/twitter/autoload.el | 104 - .config/emacs/modules/app/twitter/config.el | 76 - .config/emacs/modules/app/twitter/packages.el | 5 - .../emacs/modules/checkers/grammar/README.org | 68 - .../emacs/modules/checkers/grammar/config.el | 37 - .../modules/checkers/grammar/packages.el | 5 - .../emacs/modules/checkers/spell/README.org | 195 -- .../checkers/spell/autoload/+flyspell.el | 86 - .../checkers/spell/autoload/+spell-fu.el | 116 -- .../emacs/modules/checkers/spell/config.el | 245 --- .../emacs/modules/checkers/spell/doctor.el | 10 - .../emacs/modules/checkers/spell/packages.el | 13 - .../emacs/modules/checkers/syntax/README.org | 66 - .../emacs/modules/checkers/syntax/autoload.el | 25 - .../emacs/modules/checkers/syntax/config.el | 83 - .../emacs/modules/checkers/syntax/packages.el | 9 - .../modules/completion/company/README.org | 130 -- .../modules/completion/company/autoload.el | 157 -- .../modules/completion/company/config.el | 189 -- .../modules/completion/company/packages.el | 7 - .../completion/company/test/test-company.el | 75 - .../emacs/modules/completion/helm/README.org | 169 -- .../modules/completion/helm/autoload/evil.el | 42 - .../modules/completion/helm/autoload/helm.el | 100 - .../completion/helm/autoload/posframe.el | 56 - .../emacs/modules/completion/helm/config.el | 195 -- .../emacs/modules/completion/helm/packages.el | 21 - .../emacs/modules/completion/ido/config.el | 62 - .../emacs/modules/completion/ido/packages.el | 8 - .../emacs/modules/completion/ivy/README.org | 172 -- .../modules/completion/ivy/autoload/evil.el | 14 - .../modules/completion/ivy/autoload/hydras.el | 32 - .../modules/completion/ivy/autoload/ivy.el | 384 ---- .../completion/ivy/autoload/posframe.el | 16 - .../emacs/modules/completion/ivy/config.el | 410 ---- .../emacs/modules/completion/ivy/doctor.el | 3 - .../emacs/modules/completion/ivy/packages.el | 24 - .../modules/completion/vertico/README.org | 284 --- .../completion/vertico/autoload/evil.el | 14 - .../completion/vertico/autoload/magit.el | 8 - .../completion/vertico/autoload/vertico.el | 256 --- .../completion/vertico/autoload/workspaces.el | 68 - .../modules/completion/vertico/config.el | 244 --- .../modules/completion/vertico/doctor.el | 11 - .../modules/completion/vertico/packages.el | 24 - .../modules/config/default/+emacs-bindings.el | 641 ------- .../emacs/modules/config/default/+emacs.el | 26 - .../modules/config/default/+evil-bindings.el | 770 -------- .config/emacs/modules/config/default/+evil.el | 21 - .../emacs/modules/config/default/README.org | 44 - .../config/default/autoload/default.el | 68 - .../config/default/autoload/deferred.el | 20 - .../modules/config/default/autoload/files.el | 66 - .../modules/config/default/autoload/search.el | 144 -- .../modules/config/default/autoload/text.el | 166 -- .../emacs/modules/config/default/config.el | 479 ----- .../emacs/modules/config/default/packages.el | 9 - .../emacs/modules/config/literate/README.org | 106 -- .../emacs/modules/config/literate/autoload.el | 75 - .config/emacs/modules/config/literate/cli.el | 6 - .../emacs/modules/editor/evil/+commands.el | 108 -- .config/emacs/modules/editor/evil/README.org | 200 -- .../modules/editor/evil/autoload/advice.el | 233 --- .../modules/editor/evil/autoload/embrace.el | 40 - .../modules/editor/evil/autoload/evil.el | 188 -- .../emacs/modules/editor/evil/autoload/ex.el | 192 -- .../modules/editor/evil/autoload/files.el | 31 - .../editor/evil/autoload/textobjects.el | 68 - .../editor/evil/autoload/unimpaired.el | 200 -- .config/emacs/modules/editor/evil/config.el | 622 ------ .config/emacs/modules/editor/evil/init.el | 331 ---- .config/emacs/modules/editor/evil/packages.el | 38 - .../modules/editor/evil/test/test-evil.el | 69 - .../modules/editor/file-templates/README.org | 83 - .../modules/editor/file-templates/autoload.el | 135 -- .../modules/editor/file-templates/config.el | 169 -- .../modules/editor/file-templates/packages.el | 4 - .../file-templates/templates/.editorconfig | 7 - .../templates/android-mode/__build.gradle | 49 - .../file-templates/templates/c++-mode/__cpp | 7 - .../file-templates/templates/c++-mode/__hpp | 10 - .../templates/c++-mode/__main.cpp | 13 - .../templates/c++-mode/__winmain.cpp | 12 - .../file-templates/templates/c-mode/__c | 7 - .../file-templates/templates/c-mode/__h | 10 - .../templates/direnv-envrc-mode/__envrc | 15 - .../templates/dockerfile-mode/__ | 4 - .../templates/emacs-ert-mode/__ | 3 - .../templates/emacs-lisp-mode/__doom-doctor | 3 - .../templates/emacs-lisp-mode/__doom-module | 3 - .../templates/emacs-lisp-mode/__doom-packages | 4 - .../templates/emacs-lisp-mode/__doom-test | 4 - .../templates/emacs-lisp-mode/__package | 25 - .../file-templates/templates/fish-mode/__ | 3 - .../templates/gitignore-mode/__ | 68 - .../file-templates/templates/go-mode/__.go | 7 - .../templates/go-mode/__main.go | 9 - .../templates/java-mode/__annotation-type | 9 - .../templates/java-mode/__class | 9 - .../file-templates/templates/java-mode/__enum | 9 - .../templates/java-mode/__interface | 9 - .../file-templates/templates/java-mode/__main | 11 - .../templates/java-mode/__record | 8 - .../templates/js-mode/__gulpfile.js | 4 - .../templates/js-mode/__webpack.config.js | 21 - .../file-templates/templates/json-mode/__ | 3 - .../templates/json-mode/__bower.json | 14 - .../templates/json-mode/__package.json | 13 - .../templates/love-mode/__conf.lua | 40 - .../templates/love-mode/__main.lua | 0 .../templates/makefile-gmake-mode/__ | 9 - .../templates/makefile-gmake-mode/__cpp | 46 - .../file-templates/templates/markdown-mode/__ | 6 - .../templates/markdown-mode/__jekyll-post | 7 - .../file-templates/templates/nix-mode/__ | 9 - .../templates/nix-mode/__shell.nix | 9 - .../file-templates/templates/nose-mode/__ | 0 .../file-templates/templates/nxml-mode/__ | 2 - .../file-templates/templates/org-mode/__ | 20 - .../templates/org-mode/__contact.org | 17 - .../templates/org-mode/__doom-readme | 70 - .../templates/org-mode/__invoice.org | 21 - .../templates/org-mode/__project.org | 9 - .../file-templates/templates/php-mode/__ | 3 - .../templates/php-mode/__.class.php | 7 - .../file-templates/templates/python-mode/__ | 5 - .../templates/python-mode/__setup.py | 0 .../file-templates/templates/rspec-mode/__ | 3 - .../templates/rspec-mode/__.rspec | 3 - .../templates/rspec-mode/__helper | 9 - .../file-templates/templates/ruby-mode/__ | 3 - .../templates/ruby-mode/__.gemspec | 0 .../templates/ruby-mode/__Gemfile | 3 - .../templates/ruby-mode/__Rakefile | 16 - .../templates/ruby-mode/__module | 12 - .../templates/rust-mode/__Cargo.toml | 5 - .../templates/rust-mode/__main.rs | 3 - .../file-templates/templates/scss-mode/__ | 0 .../templates/scss-mode/__master.scss | 0 .../templates/scss-mode/__normalize.scss | 0 .../file-templates/templates/sh-mode/__ | 3 - .../file-templates/templates/sh-mode/__zunit | 5 - .../file-templates/templates/slim-mode/__ | 17 - .../file-templates/templates/snippet-mode/__ | 8 - .../templates/solidity-mode/__sol | 10 - .../templates/text-mode/__license | 5 - .../templates/text-mode/__license-apache | 207 -- .../templates/text-mode/__license-apache-bp | 19 - .../templates/text-mode/__license-bsd2 | 28 - .../templates/text-mode/__license-bsd3 | 31 - .../templates/text-mode/__license-gpl3 | 680 ------- .../templates/text-mode/__license-gpl3-bp | 21 - .../templates/text-mode/__license-lgpl3 | 171 -- .../templates/text-mode/__license-mit | 28 - .../templates/text-mode/__license-mozilla | 380 ---- .../templates/text-mode/__license-mozilla-bp | 9 - .../templates/text-mode/__license-unlicense | 30 - .../file-templates/templates/web-mode/__.html | 25 - .../templates/web-mode/__jekyll-layout.html | 0 .../templates/yaml-mode/__docker-compose.yml | 15 - .config/emacs/modules/editor/fold/README.org | 44 - .../modules/editor/fold/autoload/fold.el | 158 -- .../modules/editor/fold/autoload/hideshow.el | 83 - .config/emacs/modules/editor/fold/config.el | 88 - .config/emacs/modules/editor/fold/packages.el | 8 - .../emacs/modules/editor/format/README.org | 174 -- .../modules/editor/format/autoload/evil.el | 8 - .../modules/editor/format/autoload/format.el | 293 --- .../editor/format/autoload/settings.el | 203 -- .config/emacs/modules/editor/format/config.el | 89 - .../emacs/modules/editor/format/packages.el | 4 - .../modules/editor/format/test/test-format.el | 103 - .config/emacs/modules/editor/god/autoload.el | 46 - .config/emacs/modules/editor/god/config.el | 10 - .config/emacs/modules/editor/god/doctor.el | 8 - .config/emacs/modules/editor/god/packages.el | 4 - .config/emacs/modules/editor/lispy/README.org | 53 - .config/emacs/modules/editor/lispy/config.el | 44 - .../emacs/modules/editor/lispy/packages.el | 6 - .../multiple-cursors/autoload/evil-mc.el | 131 -- .../modules/editor/multiple-cursors/config.el | 206 -- .../editor/multiple-cursors/packages.el | 9 - .config/emacs/modules/editor/objed/README.org | 23 - .config/emacs/modules/editor/objed/config.el | 27 - .../emacs/modules/editor/objed/packages.el | 4 - .../emacs/modules/editor/parinfer/README.org | 55 - .../emacs/modules/editor/parinfer/config.el | 23 - .../emacs/modules/editor/parinfer/doctor.el | 7 - .../emacs/modules/editor/parinfer/packages.el | 4 - .../modules/editor/rotate-text/README.org | 52 - .../modules/editor/rotate-text/autoload.el | 21 - .../modules/editor/rotate-text/packages.el | 7 - .../emacs/modules/editor/snippets/README.org | 46 - .../editor/snippets/autoload/settings.el | 10 - .../editor/snippets/autoload/snippets.el | 328 ---- .../emacs/modules/editor/snippets/config.el | 134 -- .../emacs/modules/editor/snippets/packages.el | 10 - .../emacs/modules/editor/word-wrap/README.org | 81 - .../modules/editor/word-wrap/autoload.el | 91 - .../emacs/modules/editor/word-wrap/config.el | 30 - .../modules/editor/word-wrap/packages.el | 4 - .config/emacs/modules/emacs/dired/README.org | 49 - .config/emacs/modules/emacs/dired/autoload.el | 15 - .config/emacs/modules/emacs/dired/config.el | 221 --- .config/emacs/modules/emacs/dired/doctor.el | 4 - .config/emacs/modules/emacs/dired/packages.el | 12 - .../emacs/modules/emacs/electric/autoload.el | 26 - .../emacs/modules/emacs/electric/config.el | 18 - .../emacs/modules/emacs/ibuffer/README.org | 36 - .config/emacs/modules/emacs/ibuffer/config.el | 85 - .../emacs/modules/emacs/ibuffer/packages.el | 5 - .config/emacs/modules/emacs/undo/README.org | 68 - .config/emacs/modules/emacs/undo/config.el | 96 - .config/emacs/modules/emacs/undo/packages.el | 7 - .config/emacs/modules/emacs/vc/README.org | 42 - .../vc/autoload/bug-reference-backport.el | 100 - .../emacs/modules/emacs/vc/autoload/hydra.el | 41 - .config/emacs/modules/emacs/vc/autoload/vc.el | 48 - .config/emacs/modules/emacs/vc/config.el | 142 -- .config/emacs/modules/emacs/vc/packages.el | 11 - .config/emacs/modules/email/mu4e/README.org | 293 --- .../modules/email/mu4e/autoload/advice.el | 132 -- .../modules/email/mu4e/autoload/email.el | 348 ---- .../emacs/modules/email/mu4e/autoload/evil.el | 21 - .../modules/email/mu4e/autoload/mu-lock.el | 93 - .config/emacs/modules/email/mu4e/config.el | 681 ------- .config/emacs/modules/email/mu4e/doctor.el | 15 - .config/emacs/modules/email/mu4e/packages.el | 7 - .../emacs/modules/email/notmuch/README.org | 194 -- .../emacs/modules/email/notmuch/autoload.el | 159 -- .config/emacs/modules/email/notmuch/config.el | 133 -- .../emacs/modules/email/notmuch/packages.el | 31 - .../modules/email/wanderlust/autoload.el | 4 - .../emacs/modules/email/wanderlust/config.el | 82 - .../modules/email/wanderlust/packages.el | 11 - .../emacs/modules/input/chinese/README.org | 51 - .config/emacs/modules/input/chinese/config.el | 48 - .../emacs/modules/input/chinese/packages.el | 7 - .../emacs/modules/input/japanese/README.org | 43 - .../emacs/modules/input/japanese/config.el | 57 - .../emacs/modules/input/japanese/doctor.el | 5 - .../emacs/modules/input/japanese/packages.el | 7 - .config/emacs/modules/input/layout/+azerty.el | 81 - .config/emacs/modules/input/layout/+bepo.el | 269 --- .config/emacs/modules/input/layout/README.org | 149 -- .../modules/input/layout/autoload/bepo.el | 326 ---- .config/emacs/modules/input/layout/config.el | 8 - .config/emacs/modules/lang/agda/README.org | 4 - .config/emacs/modules/lang/agda/config.el | 40 - .config/emacs/modules/lang/agda/packages.el | 16 - .../emacs/modules/lang/beancount/README.org | 53 - .../emacs/modules/lang/beancount/autoload.el | 127 -- .../emacs/modules/lang/beancount/config.el | 33 - .../emacs/modules/lang/beancount/packages.el | 7 - .config/emacs/modules/lang/cc/README.org | 258 --- .config/emacs/modules/lang/cc/autoload.el | 330 ---- .config/emacs/modules/lang/cc/config.el | 306 --- .config/emacs/modules/lang/cc/doctor.el | 24 - .config/emacs/modules/lang/cc/packages.el | 34 - .config/emacs/modules/lang/clojure/README.org | 115 -- .../emacs/modules/lang/clojure/autoload.el | 44 - .config/emacs/modules/lang/clojure/config.el | 246 --- .../emacs/modules/lang/clojure/packages.el | 21 - .../emacs/modules/lang/common-lisp/README.org | 71 - .../lang/common-lisp/autoload/common-lisp.el | 5 - .../emacs/modules/lang/common-lisp/config.el | 162 -- .../emacs/modules/lang/common-lisp/doctor.el | 7 - .../modules/lang/common-lisp/packages.el | 6 - .config/emacs/modules/lang/coq/README.org | 6 - .config/emacs/modules/lang/coq/config.el | 91 - .config/emacs/modules/lang/coq/packages.el | 5 - .config/emacs/modules/lang/crystal/README.org | 62 - .config/emacs/modules/lang/crystal/config.el | 30 - .config/emacs/modules/lang/crystal/doctor.el | 5 - .../emacs/modules/lang/crystal/packages.el | 8 - .config/emacs/modules/lang/csharp/README.org | 43 - .config/emacs/modules/lang/csharp/autoload.el | 15 - .config/emacs/modules/lang/csharp/config.el | 74 - .config/emacs/modules/lang/csharp/doctor.el | 7 - .config/emacs/modules/lang/csharp/packages.el | 10 - .config/emacs/modules/lang/dart/README.org | 118 -- .config/emacs/modules/lang/dart/config.el | 64 - .config/emacs/modules/lang/dart/doctor.el | 8 - .config/emacs/modules/lang/dart/packages.el | 11 - .config/emacs/modules/lang/data/config.el | 23 - .config/emacs/modules/lang/data/packages.el | 4 - .config/emacs/modules/lang/dhall/config.el | 12 - .config/emacs/modules/lang/dhall/packages.el | 4 - .config/emacs/modules/lang/elixir/README.org | 79 - .config/emacs/modules/lang/elixir/config.el | 101 - .config/emacs/modules/lang/elixir/packages.el | 9 - .config/emacs/modules/lang/elm/config.el | 23 - .config/emacs/modules/lang/elm/packages.el | 6 - .../emacs/modules/lang/emacs-lisp/README.org | 60 - .../emacs/modules/lang/emacs-lisp/autoload.el | 328 ---- .../emacs/modules/lang/emacs-lisp/config.el | 239 --- .../emacs/modules/lang/emacs-lisp/demos.org | 533 ------ .../emacs/modules/lang/emacs-lisp/packages.el | 19 - .config/emacs/modules/lang/erlang/README.org | 39 - .config/emacs/modules/lang/erlang/config.el | 9 - .config/emacs/modules/lang/erlang/doctor.el | 6 - .config/emacs/modules/lang/erlang/packages.el | 4 - .config/emacs/modules/lang/ess/README.org | 57 - .config/emacs/modules/lang/ess/autoload.el | 15 - .config/emacs/modules/lang/ess/config.el | 106 -- .config/emacs/modules/lang/ess/packages.el | 15 - .config/emacs/modules/lang/factor/README.org | 43 - .config/emacs/modules/lang/factor/config.el | 77 - .config/emacs/modules/lang/factor/packages.el | 4 - .config/emacs/modules/lang/faust/README.org | 46 - .config/emacs/modules/lang/faust/autoload.el | 13 - .config/emacs/modules/lang/faust/config.el | 25 - .config/emacs/modules/lang/faust/doctor.el | 5 - .config/emacs/modules/lang/faust/packages.el | 4 - .config/emacs/modules/lang/fortran/README.org | 76 - .../emacs/modules/lang/fortran/autoload.el | 55 - .config/emacs/modules/lang/fortran/config.el | 57 - .config/emacs/modules/lang/fortran/doctor.el | 18 - .config/emacs/modules/lang/fsharp/README.org | 58 - .config/emacs/modules/lang/fsharp/config.el | 21 - .config/emacs/modules/lang/fsharp/doctor.el | 5 - .config/emacs/modules/lang/fsharp/packages.el | 4 - .config/emacs/modules/lang/fstar/README.org | 56 - .config/emacs/modules/lang/fstar/config.el | 55 - .config/emacs/modules/lang/fstar/packages.el | 4 - .../emacs/modules/lang/gdscript/README.org | 55 - .config/emacs/modules/lang/gdscript/config.el | 42 - .../emacs/modules/lang/gdscript/packages.el | 4 - .config/emacs/modules/lang/go/README.org | 99 - .config/emacs/modules/lang/go/autoload.el | 65 - .config/emacs/modules/lang/go/config.el | 78 - .config/emacs/modules/lang/go/doctor.el | 23 - .config/emacs/modules/lang/go/packages.el | 15 - .config/emacs/modules/lang/haskell/README.org | 73 - .../emacs/modules/lang/haskell/autoload.el | 28 - .config/emacs/modules/lang/haskell/config.el | 52 - .config/emacs/modules/lang/haskell/doctor.el | 26 - .../emacs/modules/lang/haskell/packages.el | 8 - .config/emacs/modules/lang/hy/config.el | 8 - .config/emacs/modules/lang/hy/packages.el | 4 - .config/emacs/modules/lang/idris/README.org | 30 - .config/emacs/modules/lang/idris/config.el | 18 - .config/emacs/modules/lang/idris/packages.el | 4 - .config/emacs/modules/lang/java/+eclim.el | 50 - .config/emacs/modules/lang/java/+lsp.el | 26 - .config/emacs/modules/lang/java/+meghanada.el | 38 - .config/emacs/modules/lang/java/README.org | 148 -- .../emacs/modules/lang/java/autoload/java.el | 80 - .../emacs/modules/lang/java/autoload/lsp.el | 22 - .config/emacs/modules/lang/java/config.el | 51 - .config/emacs/modules/lang/java/doctor.el | 13 - .config/emacs/modules/lang/java/packages.el | 17 - .../emacs/modules/lang/javascript/README.org | 146 -- .../emacs/modules/lang/javascript/autoload.el | 120 -- .../emacs/modules/lang/javascript/config.el | 308 --- .../emacs/modules/lang/javascript/doctor.el | 6 - .../emacs/modules/lang/javascript/packages.el | 20 - .config/emacs/modules/lang/json/README.org | 40 - .config/emacs/modules/lang/json/config.el | 31 - .config/emacs/modules/lang/json/doctor.el | 5 - .config/emacs/modules/lang/json/packages.el | 7 - .config/emacs/modules/lang/julia/README.org | 109 -- .config/emacs/modules/lang/julia/autoload.el | 21 - .config/emacs/modules/lang/julia/config.el | 101 - .config/emacs/modules/lang/julia/doctor.el | 19 - .config/emacs/modules/lang/julia/packages.el | 10 - .config/emacs/modules/lang/kotlin/README.org | 36 - .config/emacs/modules/lang/kotlin/autoload.el | 15 - .config/emacs/modules/lang/kotlin/config.el | 19 - .config/emacs/modules/lang/kotlin/doctor.el | 8 - .config/emacs/modules/lang/kotlin/packages.el | 7 - .../modules/lang/latex/+fontification.el | 88 - .config/emacs/modules/lang/latex/+ref.el | 39 - .config/emacs/modules/lang/latex/+viewers.el | 67 - .config/emacs/modules/lang/latex/README.org | 131 -- .config/emacs/modules/lang/latex/autoload.el | 67 - .config/emacs/modules/lang/latex/config.el | 278 --- .config/emacs/modules/lang/latex/packages.el | 23 - .config/emacs/modules/lang/lean/config.el | 36 - .config/emacs/modules/lang/lean/packages.el | 7 - .config/emacs/modules/lang/ledger/README.org | 56 - .config/emacs/modules/lang/ledger/config.el | 88 - .config/emacs/modules/lang/ledger/doctor.el | 4 - .config/emacs/modules/lang/ledger/packages.el | 10 - .config/emacs/modules/lang/lua/README.org | 78 - .../emacs/modules/lang/lua/autoload/lua.el | 51 - .../modules/lang/lua/autoload/moonscript.el | 16 - .config/emacs/modules/lang/lua/config.el | 90 - .config/emacs/modules/lang/lua/packages.el | 17 - .../emacs/modules/lang/markdown/README.org | 159 -- .../emacs/modules/lang/markdown/autoload.el | 107 -- .config/emacs/modules/lang/markdown/config.el | 141 -- .config/emacs/modules/lang/markdown/doctor.el | 22 - .../emacs/modules/lang/markdown/packages.el | 14 - .config/emacs/modules/lang/nim/README.org | 52 - .config/emacs/modules/lang/nim/config.el | 39 - .config/emacs/modules/lang/nim/doctor.el | 9 - .config/emacs/modules/lang/nim/packages.el | 9 - .config/emacs/modules/lang/nix/README.org | 57 - .config/emacs/modules/lang/nix/autoload.el | 75 - .config/emacs/modules/lang/nix/config.el | 49 - .config/emacs/modules/lang/nix/doctor.el | 9 - .config/emacs/modules/lang/nix/packages.el | 11 - .config/emacs/modules/lang/ocaml/README.org | 93 - .config/emacs/modules/lang/ocaml/autoload.el | 11 - .config/emacs/modules/lang/ocaml/config.el | 120 -- .config/emacs/modules/lang/ocaml/doctor.el | 24 - .config/emacs/modules/lang/ocaml/packages.el | 25 - .config/emacs/modules/lang/org/README.org | 304 --- .../lang/org/autoload/contrib-ipython.el | 152 -- .../lang/org/autoload/contrib-present.el | 85 - .../lang/org/autoload/contrib-roam2.el | 58 - .../modules/lang/org/autoload/org-attach.el | 59 - .../modules/lang/org/autoload/org-avy.el | 20 - .../modules/lang/org/autoload/org-babel.el | 78 - .../modules/lang/org/autoload/org-capture.el | 161 -- .../modules/lang/org/autoload/org-export.el | 53 - .../modules/lang/org/autoload/org-link.el | 248 --- .../modules/lang/org/autoload/org-refile.el | 101 - .../modules/lang/org/autoload/org-tables.el | 96 - .../emacs/modules/lang/org/autoload/org.el | 487 ----- .config/emacs/modules/lang/org/config.el | 1332 ------------- .../emacs/modules/lang/org/contrib/brain.el | 42 - .../modules/lang/org/contrib/dragndrop.el | 68 - .../emacs/modules/lang/org/contrib/ipython.el | 41 - .../emacs/modules/lang/org/contrib/journal.el | 71 - .../emacs/modules/lang/org/contrib/jupyter.el | 40 - .../emacs/modules/lang/org/contrib/noter.el | 14 - .../modules/lang/org/contrib/pomodoro.el | 17 - .../emacs/modules/lang/org/contrib/present.el | 67 - .../emacs/modules/lang/org/contrib/pretty.el | 24 - .../emacs/modules/lang/org/contrib/roam.el | 96 - .../emacs/modules/lang/org/contrib/roam2.el | 185 -- .config/emacs/modules/lang/org/doctor.el | 30 - .config/emacs/modules/lang/org/packages.el | 127 -- .../emacs/modules/lang/org/test/test-org.el | 133 -- .config/emacs/modules/lang/php/README.org | 246 --- .config/emacs/modules/lang/php/autoload.el | 26 - .config/emacs/modules/lang/php/config.el | 178 -- .config/emacs/modules/lang/php/doctor.el | 6 - .config/emacs/modules/lang/php/packages.el | 27 - .../emacs/modules/lang/plantuml/autoload.el | 63 - .config/emacs/modules/lang/plantuml/config.el | 29 - .config/emacs/modules/lang/plantuml/doctor.el | 10 - .../emacs/modules/lang/plantuml/packages.el | 8 - .../emacs/modules/lang/purescript/config.el | 38 - .../emacs/modules/lang/purescript/packages.el | 6 - .config/emacs/modules/lang/python/README.org | 130 -- .../modules/lang/python/autoload/conda.el | 17 - .../modules/lang/python/autoload/pyenv.el | 30 - .../modules/lang/python/autoload/python.el | 73 - .config/emacs/modules/lang/python/config.el | 339 ---- .config/emacs/modules/lang/python/doctor.el | 53 - .config/emacs/modules/lang/python/packages.el | 39 - .config/emacs/modules/lang/qt/README.org | 31 - .config/emacs/modules/lang/qt/autoload.el | 4 - .config/emacs/modules/lang/qt/packages.el | 5 - .config/emacs/modules/lang/racket/README.org | 70 - .config/emacs/modules/lang/racket/autoload.el | 30 - .config/emacs/modules/lang/racket/config.el | 93 - .config/emacs/modules/lang/racket/doctor.el | 11 - .config/emacs/modules/lang/racket/packages.el | 4 - .config/emacs/modules/lang/raku/README.org | 11 - .config/emacs/modules/lang/raku/config.el | 13 - .config/emacs/modules/lang/raku/packages.el | 9 - .config/emacs/modules/lang/rest/README.org | 58 - .config/emacs/modules/lang/rest/autoload.el | 28 - .config/emacs/modules/lang/rest/config.el | 35 - .config/emacs/modules/lang/rest/packages.el | 6 - .config/emacs/modules/lang/rst/config.el | 18 - .config/emacs/modules/lang/rst/packages.el | 4 - .config/emacs/modules/lang/ruby/README.org | 91 - .config/emacs/modules/lang/ruby/autoload.el | 15 - .config/emacs/modules/lang/ruby/config.el | 197 -- .config/emacs/modules/lang/ruby/doctor.el | 16 - .config/emacs/modules/lang/ruby/packages.el | 36 - .config/emacs/modules/lang/rust/README.org | 139 -- .config/emacs/modules/lang/rust/autoload.el | 27 - .config/emacs/modules/lang/rust/config.el | 83 - .config/emacs/modules/lang/rust/doctor.el | 29 - .config/emacs/modules/lang/rust/packages.el | 6 - .config/emacs/modules/lang/scala/README.org | 94 - .config/emacs/modules/lang/scala/autoload.el | 54 - .config/emacs/modules/lang/scala/config.el | 52 - .config/emacs/modules/lang/scala/doctor.el | 9 - .config/emacs/modules/lang/scala/packages.el | 8 - .config/emacs/modules/lang/scheme/README.org | 60 - .config/emacs/modules/lang/scheme/autoload.el | 73 - .config/emacs/modules/lang/scheme/config.el | 80 - .config/emacs/modules/lang/scheme/packages.el | 27 - .config/emacs/modules/lang/sh/README.org | 47 - .config/emacs/modules/lang/sh/autoload.el | 48 - .config/emacs/modules/lang/sh/config.el | 95 - .config/emacs/modules/lang/sh/doctor.el | 5 - .config/emacs/modules/lang/sh/packages.el | 11 - .config/emacs/modules/lang/sml/README.org | 39 - .config/emacs/modules/lang/sml/config.el | 29 - .config/emacs/modules/lang/sml/packages.el | 8 - .../emacs/modules/lang/solidity/README.org | 47 - .config/emacs/modules/lang/solidity/config.el | 22 - .config/emacs/modules/lang/solidity/doctor.el | 8 - .../emacs/modules/lang/solidity/packages.el | 8 - .config/emacs/modules/lang/swift/config.el | 33 - .config/emacs/modules/lang/swift/packages.el | 11 - .config/emacs/modules/lang/terra/autoload.el | 8 - .config/emacs/modules/lang/terra/config.el | 11 - .config/emacs/modules/lang/terra/packages.el | 9 - .config/emacs/modules/lang/web/+css.el | 79 - .config/emacs/modules/lang/web/+html.el | 170 -- .../emacs/modules/lang/web/autoload/css.el | 105 -- .../emacs/modules/lang/web/autoload/evil.el | 26 - .../emacs/modules/lang/web/autoload/html.el | 135 -- .config/emacs/modules/lang/web/config.el | 57 - .config/emacs/modules/lang/web/doctor.el | 14 - .config/emacs/modules/lang/web/packages.el | 24 - .../emacs/modules/lang/web/test/test-web.el | 92 - .config/emacs/modules/lang/yaml/README.org | 38 - .config/emacs/modules/lang/yaml/config.el | 9 - .config/emacs/modules/lang/yaml/packages.el | 4 - .config/emacs/modules/lang/zig/README.org | 66 - .config/emacs/modules/lang/zig/config.el | 32 - .config/emacs/modules/lang/zig/doctor.el | 13 - .config/emacs/modules/lang/zig/packages.el | 4 - .config/emacs/modules/os/macos/README.org | 42 - .config/emacs/modules/os/macos/autoload.el | 51 - .config/emacs/modules/os/macos/config.el | 62 - .config/emacs/modules/os/macos/packages.el | 5 - .config/emacs/modules/os/tty/README.org | 66 - .config/emacs/modules/os/tty/config.el | 42 - .config/emacs/modules/os/tty/packages.el | 16 - .config/emacs/modules/source.el | 7 - .config/emacs/modules/term/eshell/README.org | 65 - .../modules/term/eshell/autoload/backport.el | 146 -- .../modules/term/eshell/autoload/commands.el | 30 - .../modules/term/eshell/autoload/company.el | 60 - .../modules/term/eshell/autoload/eshell.el | 324 ---- .../modules/term/eshell/autoload/evil.el | 34 - .../modules/term/eshell/autoload/prompts.el | 39 - .../modules/term/eshell/autoload/settings.el | 26 - .config/emacs/modules/term/eshell/config.el | 201 -- .config/emacs/modules/term/eshell/packages.el | 13 - .config/emacs/modules/term/shell/autoload.el | 105 -- .config/emacs/modules/term/shell/config.el | 5 - .config/emacs/modules/term/shell/packages.el | 4 - .config/emacs/modules/term/term/autoload.el | 47 - .config/emacs/modules/term/term/config.el | 11 - .config/emacs/modules/term/term/packages.el | 5 - .config/emacs/modules/term/vterm/README.org | 123 -- .config/emacs/modules/term/vterm/autoload.el | 88 - .config/emacs/modules/term/vterm/config.el | 31 - .config/emacs/modules/term/vterm/doctor.el | 10 - .config/emacs/modules/term/vterm/packages.el | 6 - .config/emacs/modules/tools/ansible/config.el | 35 - .config/emacs/modules/tools/ansible/doctor.el | 5 - .../emacs/modules/tools/ansible/packages.el | 10 - .config/emacs/modules/tools/biblio/README.org | 151 -- .config/emacs/modules/tools/biblio/config.el | 55 - .../emacs/modules/tools/biblio/packages.el | 13 - .../tools/debugger/autoload/debugger.el | 134 -- .../modules/tools/debugger/autoload/evil.el | 34 - .../emacs/modules/tools/debugger/config.el | 160 -- .../emacs/modules/tools/debugger/doctor.el | 4 - .../emacs/modules/tools/debugger/packages.el | 10 - .config/emacs/modules/tools/direnv/README.org | 76 - .config/emacs/modules/tools/direnv/config.el | 37 - .config/emacs/modules/tools/direnv/doctor.el | 4 - .../emacs/modules/tools/direnv/packages.el | 4 - .config/emacs/modules/tools/docker/README.org | 139 -- .config/emacs/modules/tools/docker/config.el | 7 - .../emacs/modules/tools/docker/packages.el | 6 - .../modules/tools/editorconfig/README.org | 78 - .../modules/tools/editorconfig/autoload.el | 7 - .../modules/tools/editorconfig/config.el | 53 - .../modules/tools/editorconfig/doctor.el | 5 - .../modules/tools/editorconfig/packages.el | 6 - .config/emacs/modules/tools/ein/README.org | 26 - .config/emacs/modules/tools/ein/config.el | 16 - .config/emacs/modules/tools/ein/packages.el | 4 - .../emacs/modules/tools/ein/test/test-ein.el | 23 - .config/emacs/modules/tools/eval/README.org | 125 -- .../emacs/modules/tools/eval/autoload/eval.el | 146 -- .../emacs/modules/tools/eval/autoload/evil.el | 23 - .../emacs/modules/tools/eval/autoload/repl.el | 144 -- .../modules/tools/eval/autoload/settings.el | 76 - .config/emacs/modules/tools/eval/config.el | 101 - .config/emacs/modules/tools/eval/packages.el | 6 - .../emacs/modules/tools/gist/autoload/evil.el | 19 - .config/emacs/modules/tools/gist/config.el | 31 - .config/emacs/modules/tools/gist/packages.el | 4 - .config/emacs/modules/tools/lookup/README.org | 244 --- .../modules/tools/lookup/autoload/docsets.el | 131 -- .../modules/tools/lookup/autoload/evil.el | 22 - .../modules/tools/lookup/autoload/lookup.el | 441 ----- .../modules/tools/lookup/autoload/online.el | 95 - .../modules/tools/lookup/autoload/xwidget.el | 19 - .config/emacs/modules/tools/lookup/config.el | 224 --- .config/emacs/modules/tools/lookup/doctor.el | 5 - .../emacs/modules/tools/lookup/packages.el | 34 - .config/emacs/modules/tools/lsp/+eglot.el | 57 - .config/emacs/modules/tools/lsp/+lsp.el | 200 -- .config/emacs/modules/tools/lsp/README.org | 120 -- .../modules/tools/lsp/autoload/common.el | 10 - .../emacs/modules/tools/lsp/autoload/eglot.el | 39 - .../tools/lsp/autoload/flycheck-eglot.el | 76 - .../modules/tools/lsp/autoload/lsp-mode.el | 75 - .config/emacs/modules/tools/lsp/config.el | 53 - .config/emacs/modules/tools/lsp/doctor.el | 5 - .config/emacs/modules/tools/lsp/packages.el | 16 - .config/emacs/modules/tools/magit/README.org | 78 - .config/emacs/modules/tools/magit/autoload.el | 161 -- .config/emacs/modules/tools/magit/config.el | 288 --- .config/emacs/modules/tools/magit/packages.el | 10 - .config/emacs/modules/tools/make/autoload.el | 25 - .config/emacs/modules/tools/make/packages.el | 4 - .config/emacs/modules/tools/pass/README.org | 55 - .../modules/tools/pass/autoload/consult.el | 21 - .../emacs/modules/tools/pass/autoload/ivy.el | 21 - .../emacs/modules/tools/pass/autoload/pass.el | 67 - .config/emacs/modules/tools/pass/config.el | 39 - .config/emacs/modules/tools/pass/packages.el | 11 - .../modules/tools/pass/test/test-pass.el | 41 - .config/emacs/modules/tools/pdf/README.org | 109 -- .config/emacs/modules/tools/pdf/config.el | 84 - .config/emacs/modules/tools/pdf/packages.el | 5 - .../emacs/modules/tools/prodigy/autoload.el | 34 - .config/emacs/modules/tools/prodigy/config.el | 19 - .../emacs/modules/tools/prodigy/packages.el | 4 - .config/emacs/modules/tools/rgb/README.org | 51 - .config/emacs/modules/tools/rgb/autoload.el | 14 - .config/emacs/modules/tools/rgb/packages.el | 5 - .../emacs/modules/tools/taskrunner/README.org | 38 - .../modules/tools/taskrunner/autoload.el | 9 - .../emacs/modules/tools/taskrunner/config.el | 14 - .../modules/tools/taskrunner/packages.el | 14 - .../emacs/modules/tools/terraform/README.org | 69 - .../emacs/modules/tools/terraform/config.el | 21 - .../emacs/modules/tools/terraform/doctor.el | 4 - .../emacs/modules/tools/terraform/packages.el | 6 - .../emacs/modules/tools/tmux/autoload/evil.el | 17 - .../emacs/modules/tools/tmux/autoload/tmux.el | 146 -- .config/emacs/modules/tools/upload/README.org | 64 - .config/emacs/modules/tools/upload/config.el | 52 - .../emacs/modules/tools/upload/packages.el | 4 - .config/emacs/modules/ui/deft/README.org | 51 - .config/emacs/modules/ui/deft/config.el | 46 - .config/emacs/modules/ui/deft/packages.el | 4 - .../modules/ui/doom-dashboard/README.org | 88 - .../modules/ui/doom-dashboard/autoload.el | 28 - .../emacs/modules/ui/doom-dashboard/config.el | 513 ----- .../test/test-doom-dashboard.el | 40 - .config/emacs/modules/ui/doom-quit/README.org | 39 - .config/emacs/modules/ui/doom-quit/config.el | 40 - .config/emacs/modules/ui/doom/README.org | 93 - .config/emacs/modules/ui/doom/config.el | 24 - .config/emacs/modules/ui/doom/packages.el | 5 - .config/emacs/modules/ui/emoji/README.org | 56 - .config/emacs/modules/ui/emoji/config.el | 11 - .config/emacs/modules/ui/emoji/packages.el | 4 - .config/emacs/modules/ui/hl-todo/README.org | 83 - .config/emacs/modules/ui/hl-todo/config.el | 51 - .config/emacs/modules/ui/hl-todo/packages.el | 4 - .config/emacs/modules/ui/hydra/README.org | 31 - .../modules/ui/hydra/autoload/windows.el | 47 - .config/emacs/modules/ui/hydra/config.el | 15 - .config/emacs/modules/ui/hydra/packages.el | 4 - .../emacs/modules/ui/indent-guides/config.el | 26 - .../modules/ui/indent-guides/packages.el | 4 - .config/emacs/modules/ui/ligatures/+fira.el | 123 -- .../emacs/modules/ui/ligatures/+hasklig.el | 62 - .../emacs/modules/ui/ligatures/+iosevka.el | 244 --- .../modules/ui/ligatures/+pragmata-pro.el | 259 --- .config/emacs/modules/ui/ligatures/README.org | 216 --- .../modules/ui/ligatures/autoload/install.el | 58 - .../ui/ligatures/autoload/ligatures.el | 50 - .config/emacs/modules/ui/ligatures/config.el | 220 --- .config/emacs/modules/ui/minimap/README.org | 43 - .config/emacs/modules/ui/minimap/config.el | 10 - .config/emacs/modules/ui/minimap/packages.el | 4 - .config/emacs/modules/ui/modeline/+light.el | 613 ------ .config/emacs/modules/ui/modeline/README.org | 165 -- .config/emacs/modules/ui/modeline/autoload.el | 36 - .config/emacs/modules/ui/modeline/config.el | 80 - .config/emacs/modules/ui/modeline/packages.el | 8 - .config/emacs/modules/ui/nav-flash/README.org | 37 - .../emacs/modules/ui/nav-flash/autoload.el | 48 - .config/emacs/modules/ui/nav-flash/config.el | 41 - .../emacs/modules/ui/nav-flash/packages.el | 4 - .config/emacs/modules/ui/neotree/README.org | 9 - .config/emacs/modules/ui/neotree/autoload.el | 70 - .config/emacs/modules/ui/neotree/config.el | 73 - .config/emacs/modules/ui/neotree/packages.el | 4 - .config/emacs/modules/ui/ophints/README.org | 23 - .config/emacs/modules/ui/ophints/config.el | 73 - .config/emacs/modules/ui/ophints/packages.el | 6 - .config/emacs/modules/ui/popup/+hacks.el | 411 ---- .config/emacs/modules/ui/popup/README.org | 140 -- .../emacs/modules/ui/popup/autoload/popup.el | 614 ------ .../modules/ui/popup/autoload/settings.el | 190 -- .config/emacs/modules/ui/popup/config.el | 181 -- .../emacs/modules/ui/popup/test/test-popup.el | 212 --- .config/emacs/modules/ui/tabs/README.org | 18 - .config/emacs/modules/ui/tabs/autoload.el | 18 - .config/emacs/modules/ui/tabs/config.el | 26 - .config/emacs/modules/ui/tabs/packages.el | 4 - .config/emacs/modules/ui/treemacs/README.org | 71 - .config/emacs/modules/ui/treemacs/autoload.el | 17 - .config/emacs/modules/ui/treemacs/config.el | 77 - .config/emacs/modules/ui/treemacs/doctor.el | 5 - .config/emacs/modules/ui/treemacs/packages.el | 14 - .config/emacs/modules/ui/unicode/README.org | 92 - .config/emacs/modules/ui/unicode/autoload.el | 27 - .config/emacs/modules/ui/unicode/packages.el | 4 - .../emacs/modules/ui/vc-gutter/autoload.el | 34 - .config/emacs/modules/ui/vc-gutter/config.el | 121 -- .../emacs/modules/ui/vc-gutter/packages.el | 4 - .../modules/ui/vi-tilde-fringe/README.org | 42 - .../modules/ui/vi-tilde-fringe/autoload.el | 5 - .../modules/ui/vi-tilde-fringe/packages.el | 4 - .../emacs/modules/ui/window-select/README.org | 66 - .../emacs/modules/ui/window-select/config.el | 40 - .../modules/ui/window-select/packages.el | 9 - .../emacs/modules/ui/workspaces/README.org | 104 - .../modules/ui/workspaces/autoload/evil.el | 39 - .../ui/workspaces/autoload/workspaces.el | 584 ------ .config/emacs/modules/ui/workspaces/config.el | 279 --- .../emacs/modules/ui/workspaces/packages.el | 4 - .../ui/workspaces/test/test-workspaces.el | 124 -- .config/emacs/modules/ui/zen/README.org | 78 - .config/emacs/modules/ui/zen/autoload.el | 29 - .config/emacs/modules/ui/zen/config.el | 75 - .config/emacs/modules/ui/zen/packages.el | 5 - .config/emacs/test/shell.nix | 93 - .config/gtk-4.0/settings.ini | 2 - .config/oh-my-zsh | 1 - .config/pavucontrol.ini | 8 - .config/pulse/cookie | Bin 256 -> 0 bytes .config/sway/config | 21 +- .config/user-dirs.dirs | 10 +- .config/zsh/.zshrc | 13 +- .stow-local-ignore | 3 +- desktop.org | 56 +- 856 files changed, 58 insertions(+), 71400 deletions(-) delete mode 100644 .config/emacs/.dir-locals.el delete mode 100644 .config/emacs/.github/CODEOWNERS delete mode 100644 .config/emacs/.github/ISSUE_TEMPLATE/bug_report.yml delete mode 100644 .config/emacs/.github/ISSUE_TEMPLATE/bump_request.yml delete mode 100644 .config/emacs/.github/ISSUE_TEMPLATE/config.yml delete mode 100644 .config/emacs/.github/ISSUE_TEMPLATE/feature_request.yml delete mode 100644 .config/emacs/.github/PULL_REQUEST_TEMPLATE.md delete mode 100644 .config/emacs/.github/workflows/lint.yml delete mode 100644 .config/emacs/.github/workflows/test.yml delete mode 100644 .config/emacs/.github/workflows/triage.yml delete mode 100644 .config/emacs/.gitignore delete mode 100644 .config/emacs/LICENSE delete mode 100644 .config/emacs/README.md delete mode 100755 .config/emacs/bin/doom delete mode 100644 .config/emacs/bin/doom.cmd delete mode 100755 .config/emacs/bin/org-capture delete mode 100755 .config/emacs/bin/org-tangle delete mode 100644 .config/emacs/core/autoload/buffers.el delete mode 100644 .config/emacs/core/autoload/config.el delete mode 100644 .config/emacs/core/autoload/debug.el delete mode 100644 .config/emacs/core/autoload/files.el delete mode 100644 .config/emacs/core/autoload/fonts.el delete mode 100644 .config/emacs/core/autoload/help.el delete mode 100644 .config/emacs/core/autoload/output.el delete mode 100644 .config/emacs/core/autoload/packages.el delete mode 100644 .config/emacs/core/autoload/plist.el delete mode 100644 .config/emacs/core/autoload/process.el delete mode 100644 .config/emacs/core/autoload/projects.el delete mode 100644 .config/emacs/core/autoload/sandbox.el delete mode 100644 .config/emacs/core/autoload/scratch.el delete mode 100644 .config/emacs/core/autoload/sessions.el delete mode 100644 .config/emacs/core/autoload/store.el delete mode 100644 .config/emacs/core/autoload/system.el delete mode 100644 .config/emacs/core/autoload/text.el delete mode 100644 .config/emacs/core/autoload/themes.el delete mode 100644 .config/emacs/core/autoload/ui.el delete mode 100644 .config/emacs/core/cli/autoloads.el delete mode 100644 .config/emacs/core/cli/byte-compile.el delete mode 100644 .config/emacs/core/cli/ci.el delete mode 100644 .config/emacs/core/cli/debug.el delete mode 100644 .config/emacs/core/cli/doctor.el delete mode 100644 .config/emacs/core/cli/env.el delete mode 100644 .config/emacs/core/cli/help.el delete mode 100644 .config/emacs/core/cli/install.el delete mode 100644 .config/emacs/core/cli/lib/debugger.el delete mode 100644 .config/emacs/core/cli/lib/lib.el delete mode 100644 .config/emacs/core/cli/lib/straight-hacks.el delete mode 100644 .config/emacs/core/cli/packages.el delete mode 100644 .config/emacs/core/cli/sync.el delete mode 100644 .config/emacs/core/cli/test.el delete mode 100644 .config/emacs/core/cli/upgrade.el delete mode 100644 .config/emacs/core/core-cli.el delete mode 100644 .config/emacs/core/core-editor.el delete mode 100644 .config/emacs/core/core-keybinds.el delete mode 100644 .config/emacs/core/core-lib.el delete mode 100644 .config/emacs/core/core-modules.el delete mode 100644 .config/emacs/core/core-packages.el delete mode 100644 .config/emacs/core/core-projects.el delete mode 100644 .config/emacs/core/core-ui.el delete mode 100644 .config/emacs/core/core.el delete mode 100644 .config/emacs/core/packages.el delete mode 100644 .config/emacs/core/templates/BUG_REPORT delete mode 100644 .config/emacs/core/templates/QUICKSTART_INTRO delete mode 100644 .config/emacs/core/templates/VANILLA_SANDBOX delete mode 100644 .config/emacs/core/templates/config.example.el delete mode 100644 .config/emacs/core/templates/packages.example.el delete mode 100644 .config/emacs/core/test/test-autoload-buffers.el delete mode 100644 .config/emacs/core/test/test-autoload-files.el delete mode 100644 .config/emacs/core/test/test-autoload-format.el delete mode 100644 .config/emacs/core/test/test-autoload-package.el delete mode 100644 .config/emacs/core/test/test-core-keybinds.el delete mode 100644 .config/emacs/core/test/test-core-lib.el delete mode 100644 .config/emacs/core/test/test-core-modules.el delete mode 100644 .config/emacs/core/test/test-core-packages.el delete mode 100644 .config/emacs/core/test/test-core-projects.el delete mode 100644 .config/emacs/core/test/test-core-ui.el delete mode 100644 .config/emacs/core/test/test-core.el delete mode 100644 .config/emacs/docs/contributing.org delete mode 100644 .config/emacs/docs/faq.org delete mode 100644 .config/emacs/docs/getting_started.org delete mode 100644 .config/emacs/docs/index.org delete mode 100644 .config/emacs/docs/modules.org delete mode 100644 .config/emacs/early-init.el delete mode 100644 .config/emacs/init.el delete mode 100644 .config/emacs/init.example.el delete mode 100644 .config/emacs/modules/.gitignore delete mode 100644 .config/emacs/modules/LICENSE delete mode 100644 .config/emacs/modules/app/calendar/README.org delete mode 100644 .config/emacs/modules/app/calendar/autoload.el delete mode 100644 .config/emacs/modules/app/calendar/config.el delete mode 100644 .config/emacs/modules/app/calendar/packages.el delete mode 100644 .config/emacs/modules/app/emms/README.org delete mode 100644 .config/emacs/modules/app/emms/autoload.el delete mode 100644 .config/emacs/modules/app/emms/config.el delete mode 100644 .config/emacs/modules/app/emms/packages.el delete mode 100644 .config/emacs/modules/app/everywhere/README.org delete mode 100644 .config/emacs/modules/app/everywhere/cli.el delete mode 100644 .config/emacs/modules/app/everywhere/config.el delete mode 100644 .config/emacs/modules/app/everywhere/doctor.el delete mode 100644 .config/emacs/modules/app/everywhere/packages.el delete mode 100644 .config/emacs/modules/app/irc/README.org delete mode 100644 .config/emacs/modules/app/irc/autoload/irc.el delete mode 100644 .config/emacs/modules/app/irc/autoload/ivy.el delete mode 100644 .config/emacs/modules/app/irc/autoload/settings.el delete mode 100644 .config/emacs/modules/app/irc/autoload/vertico.el delete mode 100644 .config/emacs/modules/app/irc/config.el delete mode 100644 .config/emacs/modules/app/irc/packages.el delete mode 100644 .config/emacs/modules/app/rss/README.org delete mode 100644 .config/emacs/modules/app/rss/autoload.el delete mode 100644 .config/emacs/modules/app/rss/config.el delete mode 100644 .config/emacs/modules/app/rss/packages.el delete mode 100644 .config/emacs/modules/app/twitter/README.org delete mode 100644 .config/emacs/modules/app/twitter/autoload.el delete mode 100644 .config/emacs/modules/app/twitter/config.el delete mode 100644 .config/emacs/modules/app/twitter/packages.el delete mode 100644 .config/emacs/modules/checkers/grammar/README.org delete mode 100644 .config/emacs/modules/checkers/grammar/config.el delete mode 100644 .config/emacs/modules/checkers/grammar/packages.el delete mode 100644 .config/emacs/modules/checkers/spell/README.org delete mode 100644 .config/emacs/modules/checkers/spell/autoload/+flyspell.el delete mode 100644 .config/emacs/modules/checkers/spell/autoload/+spell-fu.el delete mode 100644 .config/emacs/modules/checkers/spell/config.el delete mode 100644 .config/emacs/modules/checkers/spell/doctor.el delete mode 100644 .config/emacs/modules/checkers/spell/packages.el delete mode 100644 .config/emacs/modules/checkers/syntax/README.org delete mode 100644 .config/emacs/modules/checkers/syntax/autoload.el delete mode 100644 .config/emacs/modules/checkers/syntax/config.el delete mode 100644 .config/emacs/modules/checkers/syntax/packages.el delete mode 100644 .config/emacs/modules/completion/company/README.org delete mode 100644 .config/emacs/modules/completion/company/autoload.el delete mode 100644 .config/emacs/modules/completion/company/config.el delete mode 100644 .config/emacs/modules/completion/company/packages.el delete mode 100644 .config/emacs/modules/completion/company/test/test-company.el delete mode 100644 .config/emacs/modules/completion/helm/README.org delete mode 100644 .config/emacs/modules/completion/helm/autoload/evil.el delete mode 100644 .config/emacs/modules/completion/helm/autoload/helm.el delete mode 100644 .config/emacs/modules/completion/helm/autoload/posframe.el delete mode 100644 .config/emacs/modules/completion/helm/config.el delete mode 100644 .config/emacs/modules/completion/helm/packages.el delete mode 100644 .config/emacs/modules/completion/ido/config.el delete mode 100644 .config/emacs/modules/completion/ido/packages.el delete mode 100644 .config/emacs/modules/completion/ivy/README.org delete mode 100644 .config/emacs/modules/completion/ivy/autoload/evil.el delete mode 100644 .config/emacs/modules/completion/ivy/autoload/hydras.el delete mode 100644 .config/emacs/modules/completion/ivy/autoload/ivy.el delete mode 100644 .config/emacs/modules/completion/ivy/autoload/posframe.el delete mode 100644 .config/emacs/modules/completion/ivy/config.el delete mode 100644 .config/emacs/modules/completion/ivy/doctor.el delete mode 100644 .config/emacs/modules/completion/ivy/packages.el delete mode 100644 .config/emacs/modules/completion/vertico/README.org delete mode 100644 .config/emacs/modules/completion/vertico/autoload/evil.el delete mode 100644 .config/emacs/modules/completion/vertico/autoload/magit.el delete mode 100644 .config/emacs/modules/completion/vertico/autoload/vertico.el delete mode 100644 .config/emacs/modules/completion/vertico/autoload/workspaces.el delete mode 100644 .config/emacs/modules/completion/vertico/config.el delete mode 100644 .config/emacs/modules/completion/vertico/doctor.el delete mode 100644 .config/emacs/modules/completion/vertico/packages.el delete mode 100644 .config/emacs/modules/config/default/+emacs-bindings.el delete mode 100644 .config/emacs/modules/config/default/+emacs.el delete mode 100644 .config/emacs/modules/config/default/+evil-bindings.el delete mode 100644 .config/emacs/modules/config/default/+evil.el delete mode 100644 .config/emacs/modules/config/default/README.org delete mode 100644 .config/emacs/modules/config/default/autoload/default.el delete mode 100644 .config/emacs/modules/config/default/autoload/deferred.el delete mode 100644 .config/emacs/modules/config/default/autoload/files.el delete mode 100644 .config/emacs/modules/config/default/autoload/search.el delete mode 100644 .config/emacs/modules/config/default/autoload/text.el delete mode 100644 .config/emacs/modules/config/default/config.el delete mode 100644 .config/emacs/modules/config/default/packages.el delete mode 100644 .config/emacs/modules/config/literate/README.org delete mode 100644 .config/emacs/modules/config/literate/autoload.el delete mode 100644 .config/emacs/modules/config/literate/cli.el delete mode 100644 .config/emacs/modules/editor/evil/+commands.el delete mode 100644 .config/emacs/modules/editor/evil/README.org delete mode 100644 .config/emacs/modules/editor/evil/autoload/advice.el delete mode 100644 .config/emacs/modules/editor/evil/autoload/embrace.el delete mode 100644 .config/emacs/modules/editor/evil/autoload/evil.el delete mode 100644 .config/emacs/modules/editor/evil/autoload/ex.el delete mode 100644 .config/emacs/modules/editor/evil/autoload/files.el delete mode 100644 .config/emacs/modules/editor/evil/autoload/textobjects.el delete mode 100644 .config/emacs/modules/editor/evil/autoload/unimpaired.el delete mode 100644 .config/emacs/modules/editor/evil/config.el delete mode 100644 .config/emacs/modules/editor/evil/init.el delete mode 100644 .config/emacs/modules/editor/evil/packages.el delete mode 100644 .config/emacs/modules/editor/evil/test/test-evil.el delete mode 100644 .config/emacs/modules/editor/file-templates/README.org delete mode 100644 .config/emacs/modules/editor/file-templates/autoload.el delete mode 100644 .config/emacs/modules/editor/file-templates/config.el delete mode 100644 .config/emacs/modules/editor/file-templates/packages.el delete mode 100644 .config/emacs/modules/editor/file-templates/templates/.editorconfig delete mode 100644 .config/emacs/modules/editor/file-templates/templates/android-mode/__build.gradle delete mode 100644 .config/emacs/modules/editor/file-templates/templates/c++-mode/__cpp delete mode 100644 .config/emacs/modules/editor/file-templates/templates/c++-mode/__hpp delete mode 100644 .config/emacs/modules/editor/file-templates/templates/c++-mode/__main.cpp delete mode 100644 .config/emacs/modules/editor/file-templates/templates/c++-mode/__winmain.cpp delete mode 100644 .config/emacs/modules/editor/file-templates/templates/c-mode/__c delete mode 100644 .config/emacs/modules/editor/file-templates/templates/c-mode/__h delete mode 100644 .config/emacs/modules/editor/file-templates/templates/direnv-envrc-mode/__envrc delete mode 100644 .config/emacs/modules/editor/file-templates/templates/dockerfile-mode/__ delete mode 100644 .config/emacs/modules/editor/file-templates/templates/emacs-ert-mode/__ delete mode 100644 .config/emacs/modules/editor/file-templates/templates/emacs-lisp-mode/__doom-doctor delete mode 100644 .config/emacs/modules/editor/file-templates/templates/emacs-lisp-mode/__doom-module delete mode 100644 .config/emacs/modules/editor/file-templates/templates/emacs-lisp-mode/__doom-packages delete mode 100644 .config/emacs/modules/editor/file-templates/templates/emacs-lisp-mode/__doom-test delete mode 100644 .config/emacs/modules/editor/file-templates/templates/emacs-lisp-mode/__package delete mode 100644 .config/emacs/modules/editor/file-templates/templates/fish-mode/__ delete mode 100644 .config/emacs/modules/editor/file-templates/templates/gitignore-mode/__ delete mode 100644 .config/emacs/modules/editor/file-templates/templates/go-mode/__.go delete mode 100644 .config/emacs/modules/editor/file-templates/templates/go-mode/__main.go delete mode 100644 .config/emacs/modules/editor/file-templates/templates/java-mode/__annotation-type delete mode 100644 .config/emacs/modules/editor/file-templates/templates/java-mode/__class delete mode 100644 .config/emacs/modules/editor/file-templates/templates/java-mode/__enum delete mode 100644 .config/emacs/modules/editor/file-templates/templates/java-mode/__interface delete mode 100644 .config/emacs/modules/editor/file-templates/templates/java-mode/__main delete mode 100644 .config/emacs/modules/editor/file-templates/templates/java-mode/__record delete mode 100644 .config/emacs/modules/editor/file-templates/templates/js-mode/__gulpfile.js delete mode 100644 .config/emacs/modules/editor/file-templates/templates/js-mode/__webpack.config.js delete mode 100644 .config/emacs/modules/editor/file-templates/templates/json-mode/__ delete mode 100644 .config/emacs/modules/editor/file-templates/templates/json-mode/__bower.json delete mode 100644 .config/emacs/modules/editor/file-templates/templates/json-mode/__package.json delete mode 100644 .config/emacs/modules/editor/file-templates/templates/love-mode/__conf.lua delete mode 100644 .config/emacs/modules/editor/file-templates/templates/love-mode/__main.lua delete mode 100644 .config/emacs/modules/editor/file-templates/templates/makefile-gmake-mode/__ delete mode 100644 .config/emacs/modules/editor/file-templates/templates/makefile-gmake-mode/__cpp delete mode 100644 .config/emacs/modules/editor/file-templates/templates/markdown-mode/__ delete mode 100644 .config/emacs/modules/editor/file-templates/templates/markdown-mode/__jekyll-post delete mode 100644 .config/emacs/modules/editor/file-templates/templates/nix-mode/__ delete mode 100644 .config/emacs/modules/editor/file-templates/templates/nix-mode/__shell.nix delete mode 100644 .config/emacs/modules/editor/file-templates/templates/nose-mode/__ delete mode 100644 .config/emacs/modules/editor/file-templates/templates/nxml-mode/__ delete mode 100644 .config/emacs/modules/editor/file-templates/templates/org-mode/__ delete mode 100644 .config/emacs/modules/editor/file-templates/templates/org-mode/__contact.org delete mode 100644 .config/emacs/modules/editor/file-templates/templates/org-mode/__doom-readme delete mode 100644 .config/emacs/modules/editor/file-templates/templates/org-mode/__invoice.org delete mode 100644 .config/emacs/modules/editor/file-templates/templates/org-mode/__project.org delete mode 100644 .config/emacs/modules/editor/file-templates/templates/php-mode/__ delete mode 100644 .config/emacs/modules/editor/file-templates/templates/php-mode/__.class.php delete mode 100755 .config/emacs/modules/editor/file-templates/templates/python-mode/__ delete mode 100644 .config/emacs/modules/editor/file-templates/templates/python-mode/__setup.py delete mode 100755 .config/emacs/modules/editor/file-templates/templates/rspec-mode/__ delete mode 100755 .config/emacs/modules/editor/file-templates/templates/rspec-mode/__.rspec delete mode 100755 .config/emacs/modules/editor/file-templates/templates/rspec-mode/__helper delete mode 100644 .config/emacs/modules/editor/file-templates/templates/ruby-mode/__ delete mode 100644 .config/emacs/modules/editor/file-templates/templates/ruby-mode/__.gemspec delete mode 100644 .config/emacs/modules/editor/file-templates/templates/ruby-mode/__Gemfile delete mode 100644 .config/emacs/modules/editor/file-templates/templates/ruby-mode/__Rakefile delete mode 100644 .config/emacs/modules/editor/file-templates/templates/ruby-mode/__module delete mode 100644 .config/emacs/modules/editor/file-templates/templates/rust-mode/__Cargo.toml delete mode 100644 .config/emacs/modules/editor/file-templates/templates/rust-mode/__main.rs delete mode 100644 .config/emacs/modules/editor/file-templates/templates/scss-mode/__ delete mode 100644 .config/emacs/modules/editor/file-templates/templates/scss-mode/__master.scss delete mode 100644 .config/emacs/modules/editor/file-templates/templates/scss-mode/__normalize.scss delete mode 100644 .config/emacs/modules/editor/file-templates/templates/sh-mode/__ delete mode 100644 .config/emacs/modules/editor/file-templates/templates/sh-mode/__zunit delete mode 100644 .config/emacs/modules/editor/file-templates/templates/slim-mode/__ delete mode 100644 .config/emacs/modules/editor/file-templates/templates/snippet-mode/__ delete mode 100644 .config/emacs/modules/editor/file-templates/templates/solidity-mode/__sol delete mode 100644 .config/emacs/modules/editor/file-templates/templates/text-mode/__license delete mode 100644 .config/emacs/modules/editor/file-templates/templates/text-mode/__license-apache delete mode 100644 .config/emacs/modules/editor/file-templates/templates/text-mode/__license-apache-bp delete mode 100644 .config/emacs/modules/editor/file-templates/templates/text-mode/__license-bsd2 delete mode 100644 .config/emacs/modules/editor/file-templates/templates/text-mode/__license-bsd3 delete mode 100644 .config/emacs/modules/editor/file-templates/templates/text-mode/__license-gpl3 delete mode 100644 .config/emacs/modules/editor/file-templates/templates/text-mode/__license-gpl3-bp delete mode 100644 .config/emacs/modules/editor/file-templates/templates/text-mode/__license-lgpl3 delete mode 100644 .config/emacs/modules/editor/file-templates/templates/text-mode/__license-mit delete mode 100644 .config/emacs/modules/editor/file-templates/templates/text-mode/__license-mozilla delete mode 100644 .config/emacs/modules/editor/file-templates/templates/text-mode/__license-mozilla-bp delete mode 100644 .config/emacs/modules/editor/file-templates/templates/text-mode/__license-unlicense delete mode 100644 .config/emacs/modules/editor/file-templates/templates/web-mode/__.html delete mode 100644 .config/emacs/modules/editor/file-templates/templates/web-mode/__jekyll-layout.html delete mode 100644 .config/emacs/modules/editor/file-templates/templates/yaml-mode/__docker-compose.yml delete mode 100644 .config/emacs/modules/editor/fold/README.org delete mode 100644 .config/emacs/modules/editor/fold/autoload/fold.el delete mode 100644 .config/emacs/modules/editor/fold/autoload/hideshow.el delete mode 100644 .config/emacs/modules/editor/fold/config.el delete mode 100644 .config/emacs/modules/editor/fold/packages.el delete mode 100644 .config/emacs/modules/editor/format/README.org delete mode 100644 .config/emacs/modules/editor/format/autoload/evil.el delete mode 100644 .config/emacs/modules/editor/format/autoload/format.el delete mode 100644 .config/emacs/modules/editor/format/autoload/settings.el delete mode 100644 .config/emacs/modules/editor/format/config.el delete mode 100644 .config/emacs/modules/editor/format/packages.el delete mode 100644 .config/emacs/modules/editor/format/test/test-format.el delete mode 100644 .config/emacs/modules/editor/god/autoload.el delete mode 100644 .config/emacs/modules/editor/god/config.el delete mode 100644 .config/emacs/modules/editor/god/doctor.el delete mode 100644 .config/emacs/modules/editor/god/packages.el delete mode 100644 .config/emacs/modules/editor/lispy/README.org delete mode 100644 .config/emacs/modules/editor/lispy/config.el delete mode 100644 .config/emacs/modules/editor/lispy/packages.el delete mode 100644 .config/emacs/modules/editor/multiple-cursors/autoload/evil-mc.el delete mode 100644 .config/emacs/modules/editor/multiple-cursors/config.el delete mode 100644 .config/emacs/modules/editor/multiple-cursors/packages.el delete mode 100644 .config/emacs/modules/editor/objed/README.org delete mode 100644 .config/emacs/modules/editor/objed/config.el delete mode 100644 .config/emacs/modules/editor/objed/packages.el delete mode 100644 .config/emacs/modules/editor/parinfer/README.org delete mode 100644 .config/emacs/modules/editor/parinfer/config.el delete mode 100644 .config/emacs/modules/editor/parinfer/doctor.el delete mode 100644 .config/emacs/modules/editor/parinfer/packages.el delete mode 100644 .config/emacs/modules/editor/rotate-text/README.org delete mode 100644 .config/emacs/modules/editor/rotate-text/autoload.el delete mode 100644 .config/emacs/modules/editor/rotate-text/packages.el delete mode 100644 .config/emacs/modules/editor/snippets/README.org delete mode 100644 .config/emacs/modules/editor/snippets/autoload/settings.el delete mode 100644 .config/emacs/modules/editor/snippets/autoload/snippets.el delete mode 100644 .config/emacs/modules/editor/snippets/config.el delete mode 100644 .config/emacs/modules/editor/snippets/packages.el delete mode 100644 .config/emacs/modules/editor/word-wrap/README.org delete mode 100644 .config/emacs/modules/editor/word-wrap/autoload.el delete mode 100644 .config/emacs/modules/editor/word-wrap/config.el delete mode 100644 .config/emacs/modules/editor/word-wrap/packages.el delete mode 100644 .config/emacs/modules/emacs/dired/README.org delete mode 100644 .config/emacs/modules/emacs/dired/autoload.el delete mode 100644 .config/emacs/modules/emacs/dired/config.el delete mode 100644 .config/emacs/modules/emacs/dired/doctor.el delete mode 100644 .config/emacs/modules/emacs/dired/packages.el delete mode 100644 .config/emacs/modules/emacs/electric/autoload.el delete mode 100644 .config/emacs/modules/emacs/electric/config.el delete mode 100644 .config/emacs/modules/emacs/ibuffer/README.org delete mode 100644 .config/emacs/modules/emacs/ibuffer/config.el delete mode 100644 .config/emacs/modules/emacs/ibuffer/packages.el delete mode 100644 .config/emacs/modules/emacs/undo/README.org delete mode 100644 .config/emacs/modules/emacs/undo/config.el delete mode 100644 .config/emacs/modules/emacs/undo/packages.el delete mode 100644 .config/emacs/modules/emacs/vc/README.org delete mode 100644 .config/emacs/modules/emacs/vc/autoload/bug-reference-backport.el delete mode 100644 .config/emacs/modules/emacs/vc/autoload/hydra.el delete mode 100644 .config/emacs/modules/emacs/vc/autoload/vc.el delete mode 100644 .config/emacs/modules/emacs/vc/config.el delete mode 100644 .config/emacs/modules/emacs/vc/packages.el delete mode 100644 .config/emacs/modules/email/mu4e/README.org delete mode 100644 .config/emacs/modules/email/mu4e/autoload/advice.el delete mode 100644 .config/emacs/modules/email/mu4e/autoload/email.el delete mode 100644 .config/emacs/modules/email/mu4e/autoload/evil.el delete mode 100644 .config/emacs/modules/email/mu4e/autoload/mu-lock.el delete mode 100644 .config/emacs/modules/email/mu4e/config.el delete mode 100644 .config/emacs/modules/email/mu4e/doctor.el delete mode 100644 .config/emacs/modules/email/mu4e/packages.el delete mode 100644 .config/emacs/modules/email/notmuch/README.org delete mode 100644 .config/emacs/modules/email/notmuch/autoload.el delete mode 100644 .config/emacs/modules/email/notmuch/config.el delete mode 100644 .config/emacs/modules/email/notmuch/packages.el delete mode 100644 .config/emacs/modules/email/wanderlust/autoload.el delete mode 100644 .config/emacs/modules/email/wanderlust/config.el delete mode 100644 .config/emacs/modules/email/wanderlust/packages.el delete mode 100644 .config/emacs/modules/input/chinese/README.org delete mode 100644 .config/emacs/modules/input/chinese/config.el delete mode 100644 .config/emacs/modules/input/chinese/packages.el delete mode 100644 .config/emacs/modules/input/japanese/README.org delete mode 100644 .config/emacs/modules/input/japanese/config.el delete mode 100644 .config/emacs/modules/input/japanese/doctor.el delete mode 100644 .config/emacs/modules/input/japanese/packages.el delete mode 100644 .config/emacs/modules/input/layout/+azerty.el delete mode 100644 .config/emacs/modules/input/layout/+bepo.el delete mode 100644 .config/emacs/modules/input/layout/README.org delete mode 100644 .config/emacs/modules/input/layout/autoload/bepo.el delete mode 100644 .config/emacs/modules/input/layout/config.el delete mode 100644 .config/emacs/modules/lang/agda/README.org delete mode 100644 .config/emacs/modules/lang/agda/config.el delete mode 100644 .config/emacs/modules/lang/agda/packages.el delete mode 100644 .config/emacs/modules/lang/beancount/README.org delete mode 100644 .config/emacs/modules/lang/beancount/autoload.el delete mode 100644 .config/emacs/modules/lang/beancount/config.el delete mode 100644 .config/emacs/modules/lang/beancount/packages.el delete mode 100644 .config/emacs/modules/lang/cc/README.org delete mode 100644 .config/emacs/modules/lang/cc/autoload.el delete mode 100644 .config/emacs/modules/lang/cc/config.el delete mode 100644 .config/emacs/modules/lang/cc/doctor.el delete mode 100644 .config/emacs/modules/lang/cc/packages.el delete mode 100644 .config/emacs/modules/lang/clojure/README.org delete mode 100644 .config/emacs/modules/lang/clojure/autoload.el delete mode 100644 .config/emacs/modules/lang/clojure/config.el delete mode 100644 .config/emacs/modules/lang/clojure/packages.el delete mode 100644 .config/emacs/modules/lang/common-lisp/README.org delete mode 100644 .config/emacs/modules/lang/common-lisp/autoload/common-lisp.el delete mode 100644 .config/emacs/modules/lang/common-lisp/config.el delete mode 100644 .config/emacs/modules/lang/common-lisp/doctor.el delete mode 100644 .config/emacs/modules/lang/common-lisp/packages.el delete mode 100644 .config/emacs/modules/lang/coq/README.org delete mode 100644 .config/emacs/modules/lang/coq/config.el delete mode 100644 .config/emacs/modules/lang/coq/packages.el delete mode 100644 .config/emacs/modules/lang/crystal/README.org delete mode 100644 .config/emacs/modules/lang/crystal/config.el delete mode 100644 .config/emacs/modules/lang/crystal/doctor.el delete mode 100644 .config/emacs/modules/lang/crystal/packages.el delete mode 100644 .config/emacs/modules/lang/csharp/README.org delete mode 100644 .config/emacs/modules/lang/csharp/autoload.el delete mode 100644 .config/emacs/modules/lang/csharp/config.el delete mode 100644 .config/emacs/modules/lang/csharp/doctor.el delete mode 100644 .config/emacs/modules/lang/csharp/packages.el delete mode 100644 .config/emacs/modules/lang/dart/README.org delete mode 100644 .config/emacs/modules/lang/dart/config.el delete mode 100644 .config/emacs/modules/lang/dart/doctor.el delete mode 100644 .config/emacs/modules/lang/dart/packages.el delete mode 100644 .config/emacs/modules/lang/data/config.el delete mode 100644 .config/emacs/modules/lang/data/packages.el delete mode 100644 .config/emacs/modules/lang/dhall/config.el delete mode 100644 .config/emacs/modules/lang/dhall/packages.el delete mode 100644 .config/emacs/modules/lang/elixir/README.org delete mode 100644 .config/emacs/modules/lang/elixir/config.el delete mode 100644 .config/emacs/modules/lang/elixir/packages.el delete mode 100644 .config/emacs/modules/lang/elm/config.el delete mode 100644 .config/emacs/modules/lang/elm/packages.el delete mode 100644 .config/emacs/modules/lang/emacs-lisp/README.org delete mode 100644 .config/emacs/modules/lang/emacs-lisp/autoload.el delete mode 100644 .config/emacs/modules/lang/emacs-lisp/config.el delete mode 100644 .config/emacs/modules/lang/emacs-lisp/demos.org delete mode 100644 .config/emacs/modules/lang/emacs-lisp/packages.el delete mode 100644 .config/emacs/modules/lang/erlang/README.org delete mode 100644 .config/emacs/modules/lang/erlang/config.el delete mode 100644 .config/emacs/modules/lang/erlang/doctor.el delete mode 100644 .config/emacs/modules/lang/erlang/packages.el delete mode 100644 .config/emacs/modules/lang/ess/README.org delete mode 100644 .config/emacs/modules/lang/ess/autoload.el delete mode 100644 .config/emacs/modules/lang/ess/config.el delete mode 100644 .config/emacs/modules/lang/ess/packages.el delete mode 100644 .config/emacs/modules/lang/factor/README.org delete mode 100644 .config/emacs/modules/lang/factor/config.el delete mode 100644 .config/emacs/modules/lang/factor/packages.el delete mode 100644 .config/emacs/modules/lang/faust/README.org delete mode 100644 .config/emacs/modules/lang/faust/autoload.el delete mode 100644 .config/emacs/modules/lang/faust/config.el delete mode 100644 .config/emacs/modules/lang/faust/doctor.el delete mode 100644 .config/emacs/modules/lang/faust/packages.el delete mode 100644 .config/emacs/modules/lang/fortran/README.org delete mode 100644 .config/emacs/modules/lang/fortran/autoload.el delete mode 100644 .config/emacs/modules/lang/fortran/config.el delete mode 100644 .config/emacs/modules/lang/fortran/doctor.el delete mode 100644 .config/emacs/modules/lang/fsharp/README.org delete mode 100644 .config/emacs/modules/lang/fsharp/config.el delete mode 100644 .config/emacs/modules/lang/fsharp/doctor.el delete mode 100644 .config/emacs/modules/lang/fsharp/packages.el delete mode 100644 .config/emacs/modules/lang/fstar/README.org delete mode 100644 .config/emacs/modules/lang/fstar/config.el delete mode 100644 .config/emacs/modules/lang/fstar/packages.el delete mode 100644 .config/emacs/modules/lang/gdscript/README.org delete mode 100644 .config/emacs/modules/lang/gdscript/config.el delete mode 100644 .config/emacs/modules/lang/gdscript/packages.el delete mode 100644 .config/emacs/modules/lang/go/README.org delete mode 100644 .config/emacs/modules/lang/go/autoload.el delete mode 100644 .config/emacs/modules/lang/go/config.el delete mode 100644 .config/emacs/modules/lang/go/doctor.el delete mode 100644 .config/emacs/modules/lang/go/packages.el delete mode 100644 .config/emacs/modules/lang/haskell/README.org delete mode 100644 .config/emacs/modules/lang/haskell/autoload.el delete mode 100644 .config/emacs/modules/lang/haskell/config.el delete mode 100644 .config/emacs/modules/lang/haskell/doctor.el delete mode 100644 .config/emacs/modules/lang/haskell/packages.el delete mode 100644 .config/emacs/modules/lang/hy/config.el delete mode 100644 .config/emacs/modules/lang/hy/packages.el delete mode 100644 .config/emacs/modules/lang/idris/README.org delete mode 100644 .config/emacs/modules/lang/idris/config.el delete mode 100644 .config/emacs/modules/lang/idris/packages.el delete mode 100644 .config/emacs/modules/lang/java/+eclim.el delete mode 100644 .config/emacs/modules/lang/java/+lsp.el delete mode 100644 .config/emacs/modules/lang/java/+meghanada.el delete mode 100644 .config/emacs/modules/lang/java/README.org delete mode 100644 .config/emacs/modules/lang/java/autoload/java.el delete mode 100644 .config/emacs/modules/lang/java/autoload/lsp.el delete mode 100644 .config/emacs/modules/lang/java/config.el delete mode 100644 .config/emacs/modules/lang/java/doctor.el delete mode 100644 .config/emacs/modules/lang/java/packages.el delete mode 100644 .config/emacs/modules/lang/javascript/README.org delete mode 100644 .config/emacs/modules/lang/javascript/autoload.el delete mode 100644 .config/emacs/modules/lang/javascript/config.el delete mode 100644 .config/emacs/modules/lang/javascript/doctor.el delete mode 100644 .config/emacs/modules/lang/javascript/packages.el delete mode 100644 .config/emacs/modules/lang/json/README.org delete mode 100644 .config/emacs/modules/lang/json/config.el delete mode 100644 .config/emacs/modules/lang/json/doctor.el delete mode 100644 .config/emacs/modules/lang/json/packages.el delete mode 100644 .config/emacs/modules/lang/julia/README.org delete mode 100644 .config/emacs/modules/lang/julia/autoload.el delete mode 100644 .config/emacs/modules/lang/julia/config.el delete mode 100644 .config/emacs/modules/lang/julia/doctor.el delete mode 100644 .config/emacs/modules/lang/julia/packages.el delete mode 100644 .config/emacs/modules/lang/kotlin/README.org delete mode 100644 .config/emacs/modules/lang/kotlin/autoload.el delete mode 100644 .config/emacs/modules/lang/kotlin/config.el delete mode 100644 .config/emacs/modules/lang/kotlin/doctor.el delete mode 100644 .config/emacs/modules/lang/kotlin/packages.el delete mode 100644 .config/emacs/modules/lang/latex/+fontification.el delete mode 100644 .config/emacs/modules/lang/latex/+ref.el delete mode 100644 .config/emacs/modules/lang/latex/+viewers.el delete mode 100644 .config/emacs/modules/lang/latex/README.org delete mode 100644 .config/emacs/modules/lang/latex/autoload.el delete mode 100644 .config/emacs/modules/lang/latex/config.el delete mode 100644 .config/emacs/modules/lang/latex/packages.el delete mode 100644 .config/emacs/modules/lang/lean/config.el delete mode 100644 .config/emacs/modules/lang/lean/packages.el delete mode 100644 .config/emacs/modules/lang/ledger/README.org delete mode 100644 .config/emacs/modules/lang/ledger/config.el delete mode 100644 .config/emacs/modules/lang/ledger/doctor.el delete mode 100644 .config/emacs/modules/lang/ledger/packages.el delete mode 100644 .config/emacs/modules/lang/lua/README.org delete mode 100644 .config/emacs/modules/lang/lua/autoload/lua.el delete mode 100644 .config/emacs/modules/lang/lua/autoload/moonscript.el delete mode 100644 .config/emacs/modules/lang/lua/config.el delete mode 100644 .config/emacs/modules/lang/lua/packages.el delete mode 100644 .config/emacs/modules/lang/markdown/README.org delete mode 100644 .config/emacs/modules/lang/markdown/autoload.el delete mode 100644 .config/emacs/modules/lang/markdown/config.el delete mode 100644 .config/emacs/modules/lang/markdown/doctor.el delete mode 100644 .config/emacs/modules/lang/markdown/packages.el delete mode 100644 .config/emacs/modules/lang/nim/README.org delete mode 100644 .config/emacs/modules/lang/nim/config.el delete mode 100644 .config/emacs/modules/lang/nim/doctor.el delete mode 100644 .config/emacs/modules/lang/nim/packages.el delete mode 100644 .config/emacs/modules/lang/nix/README.org delete mode 100644 .config/emacs/modules/lang/nix/autoload.el delete mode 100644 .config/emacs/modules/lang/nix/config.el delete mode 100644 .config/emacs/modules/lang/nix/doctor.el delete mode 100644 .config/emacs/modules/lang/nix/packages.el delete mode 100644 .config/emacs/modules/lang/ocaml/README.org delete mode 100644 .config/emacs/modules/lang/ocaml/autoload.el delete mode 100644 .config/emacs/modules/lang/ocaml/config.el delete mode 100644 .config/emacs/modules/lang/ocaml/doctor.el delete mode 100644 .config/emacs/modules/lang/ocaml/packages.el delete mode 100644 .config/emacs/modules/lang/org/README.org delete mode 100644 .config/emacs/modules/lang/org/autoload/contrib-ipython.el delete mode 100644 .config/emacs/modules/lang/org/autoload/contrib-present.el delete mode 100644 .config/emacs/modules/lang/org/autoload/contrib-roam2.el delete mode 100644 .config/emacs/modules/lang/org/autoload/org-attach.el delete mode 100644 .config/emacs/modules/lang/org/autoload/org-avy.el delete mode 100644 .config/emacs/modules/lang/org/autoload/org-babel.el delete mode 100644 .config/emacs/modules/lang/org/autoload/org-capture.el delete mode 100644 .config/emacs/modules/lang/org/autoload/org-export.el delete mode 100644 .config/emacs/modules/lang/org/autoload/org-link.el delete mode 100644 .config/emacs/modules/lang/org/autoload/org-refile.el delete mode 100644 .config/emacs/modules/lang/org/autoload/org-tables.el delete mode 100644 .config/emacs/modules/lang/org/autoload/org.el delete mode 100644 .config/emacs/modules/lang/org/config.el delete mode 100644 .config/emacs/modules/lang/org/contrib/brain.el delete mode 100644 .config/emacs/modules/lang/org/contrib/dragndrop.el delete mode 100644 .config/emacs/modules/lang/org/contrib/ipython.el delete mode 100644 .config/emacs/modules/lang/org/contrib/journal.el delete mode 100644 .config/emacs/modules/lang/org/contrib/jupyter.el delete mode 100644 .config/emacs/modules/lang/org/contrib/noter.el delete mode 100644 .config/emacs/modules/lang/org/contrib/pomodoro.el delete mode 100644 .config/emacs/modules/lang/org/contrib/present.el delete mode 100644 .config/emacs/modules/lang/org/contrib/pretty.el delete mode 100644 .config/emacs/modules/lang/org/contrib/roam.el delete mode 100644 .config/emacs/modules/lang/org/contrib/roam2.el delete mode 100644 .config/emacs/modules/lang/org/doctor.el delete mode 100644 .config/emacs/modules/lang/org/packages.el delete mode 100644 .config/emacs/modules/lang/org/test/test-org.el delete mode 100644 .config/emacs/modules/lang/php/README.org delete mode 100644 .config/emacs/modules/lang/php/autoload.el delete mode 100644 .config/emacs/modules/lang/php/config.el delete mode 100644 .config/emacs/modules/lang/php/doctor.el delete mode 100644 .config/emacs/modules/lang/php/packages.el delete mode 100644 .config/emacs/modules/lang/plantuml/autoload.el delete mode 100644 .config/emacs/modules/lang/plantuml/config.el delete mode 100644 .config/emacs/modules/lang/plantuml/doctor.el delete mode 100644 .config/emacs/modules/lang/plantuml/packages.el delete mode 100644 .config/emacs/modules/lang/purescript/config.el delete mode 100644 .config/emacs/modules/lang/purescript/packages.el delete mode 100644 .config/emacs/modules/lang/python/README.org delete mode 100644 .config/emacs/modules/lang/python/autoload/conda.el delete mode 100644 .config/emacs/modules/lang/python/autoload/pyenv.el delete mode 100644 .config/emacs/modules/lang/python/autoload/python.el delete mode 100644 .config/emacs/modules/lang/python/config.el delete mode 100644 .config/emacs/modules/lang/python/doctor.el delete mode 100644 .config/emacs/modules/lang/python/packages.el delete mode 100644 .config/emacs/modules/lang/qt/README.org delete mode 100644 .config/emacs/modules/lang/qt/autoload.el delete mode 100644 .config/emacs/modules/lang/qt/packages.el delete mode 100644 .config/emacs/modules/lang/racket/README.org delete mode 100644 .config/emacs/modules/lang/racket/autoload.el delete mode 100644 .config/emacs/modules/lang/racket/config.el delete mode 100644 .config/emacs/modules/lang/racket/doctor.el delete mode 100644 .config/emacs/modules/lang/racket/packages.el delete mode 100644 .config/emacs/modules/lang/raku/README.org delete mode 100644 .config/emacs/modules/lang/raku/config.el delete mode 100644 .config/emacs/modules/lang/raku/packages.el delete mode 100644 .config/emacs/modules/lang/rest/README.org delete mode 100644 .config/emacs/modules/lang/rest/autoload.el delete mode 100644 .config/emacs/modules/lang/rest/config.el delete mode 100644 .config/emacs/modules/lang/rest/packages.el delete mode 100644 .config/emacs/modules/lang/rst/config.el delete mode 100644 .config/emacs/modules/lang/rst/packages.el delete mode 100644 .config/emacs/modules/lang/ruby/README.org delete mode 100644 .config/emacs/modules/lang/ruby/autoload.el delete mode 100644 .config/emacs/modules/lang/ruby/config.el delete mode 100644 .config/emacs/modules/lang/ruby/doctor.el delete mode 100644 .config/emacs/modules/lang/ruby/packages.el delete mode 100644 .config/emacs/modules/lang/rust/README.org delete mode 100644 .config/emacs/modules/lang/rust/autoload.el delete mode 100644 .config/emacs/modules/lang/rust/config.el delete mode 100644 .config/emacs/modules/lang/rust/doctor.el delete mode 100644 .config/emacs/modules/lang/rust/packages.el delete mode 100644 .config/emacs/modules/lang/scala/README.org delete mode 100644 .config/emacs/modules/lang/scala/autoload.el delete mode 100644 .config/emacs/modules/lang/scala/config.el delete mode 100644 .config/emacs/modules/lang/scala/doctor.el delete mode 100644 .config/emacs/modules/lang/scala/packages.el delete mode 100644 .config/emacs/modules/lang/scheme/README.org delete mode 100644 .config/emacs/modules/lang/scheme/autoload.el delete mode 100644 .config/emacs/modules/lang/scheme/config.el delete mode 100644 .config/emacs/modules/lang/scheme/packages.el delete mode 100644 .config/emacs/modules/lang/sh/README.org delete mode 100644 .config/emacs/modules/lang/sh/autoload.el delete mode 100755 .config/emacs/modules/lang/sh/config.el delete mode 100644 .config/emacs/modules/lang/sh/doctor.el delete mode 100644 .config/emacs/modules/lang/sh/packages.el delete mode 100644 .config/emacs/modules/lang/sml/README.org delete mode 100644 .config/emacs/modules/lang/sml/config.el delete mode 100644 .config/emacs/modules/lang/sml/packages.el delete mode 100644 .config/emacs/modules/lang/solidity/README.org delete mode 100644 .config/emacs/modules/lang/solidity/config.el delete mode 100644 .config/emacs/modules/lang/solidity/doctor.el delete mode 100644 .config/emacs/modules/lang/solidity/packages.el delete mode 100644 .config/emacs/modules/lang/swift/config.el delete mode 100644 .config/emacs/modules/lang/swift/packages.el delete mode 100644 .config/emacs/modules/lang/terra/autoload.el delete mode 100644 .config/emacs/modules/lang/terra/config.el delete mode 100644 .config/emacs/modules/lang/terra/packages.el delete mode 100644 .config/emacs/modules/lang/web/+css.el delete mode 100644 .config/emacs/modules/lang/web/+html.el delete mode 100644 .config/emacs/modules/lang/web/autoload/css.el delete mode 100644 .config/emacs/modules/lang/web/autoload/evil.el delete mode 100644 .config/emacs/modules/lang/web/autoload/html.el delete mode 100644 .config/emacs/modules/lang/web/config.el delete mode 100644 .config/emacs/modules/lang/web/doctor.el delete mode 100644 .config/emacs/modules/lang/web/packages.el delete mode 100644 .config/emacs/modules/lang/web/test/test-web.el delete mode 100644 .config/emacs/modules/lang/yaml/README.org delete mode 100644 .config/emacs/modules/lang/yaml/config.el delete mode 100644 .config/emacs/modules/lang/yaml/packages.el delete mode 100644 .config/emacs/modules/lang/zig/README.org delete mode 100644 .config/emacs/modules/lang/zig/config.el delete mode 100644 .config/emacs/modules/lang/zig/doctor.el delete mode 100644 .config/emacs/modules/lang/zig/packages.el delete mode 100644 .config/emacs/modules/os/macos/README.org delete mode 100644 .config/emacs/modules/os/macos/autoload.el delete mode 100644 .config/emacs/modules/os/macos/config.el delete mode 100644 .config/emacs/modules/os/macos/packages.el delete mode 100644 .config/emacs/modules/os/tty/README.org delete mode 100644 .config/emacs/modules/os/tty/config.el delete mode 100644 .config/emacs/modules/os/tty/packages.el delete mode 100644 .config/emacs/modules/source.el delete mode 100644 .config/emacs/modules/term/eshell/README.org delete mode 100644 .config/emacs/modules/term/eshell/autoload/backport.el delete mode 100644 .config/emacs/modules/term/eshell/autoload/commands.el delete mode 100644 .config/emacs/modules/term/eshell/autoload/company.el delete mode 100644 .config/emacs/modules/term/eshell/autoload/eshell.el delete mode 100644 .config/emacs/modules/term/eshell/autoload/evil.el delete mode 100644 .config/emacs/modules/term/eshell/autoload/prompts.el delete mode 100644 .config/emacs/modules/term/eshell/autoload/settings.el delete mode 100644 .config/emacs/modules/term/eshell/config.el delete mode 100644 .config/emacs/modules/term/eshell/packages.el delete mode 100644 .config/emacs/modules/term/shell/autoload.el delete mode 100644 .config/emacs/modules/term/shell/config.el delete mode 100644 .config/emacs/modules/term/shell/packages.el delete mode 100644 .config/emacs/modules/term/term/autoload.el delete mode 100644 .config/emacs/modules/term/term/config.el delete mode 100644 .config/emacs/modules/term/term/packages.el delete mode 100644 .config/emacs/modules/term/vterm/README.org delete mode 100644 .config/emacs/modules/term/vterm/autoload.el delete mode 100644 .config/emacs/modules/term/vterm/config.el delete mode 100644 .config/emacs/modules/term/vterm/doctor.el delete mode 100644 .config/emacs/modules/term/vterm/packages.el delete mode 100644 .config/emacs/modules/tools/ansible/config.el delete mode 100644 .config/emacs/modules/tools/ansible/doctor.el delete mode 100644 .config/emacs/modules/tools/ansible/packages.el delete mode 100644 .config/emacs/modules/tools/biblio/README.org delete mode 100644 .config/emacs/modules/tools/biblio/config.el delete mode 100644 .config/emacs/modules/tools/biblio/packages.el delete mode 100644 .config/emacs/modules/tools/debugger/autoload/debugger.el delete mode 100644 .config/emacs/modules/tools/debugger/autoload/evil.el delete mode 100644 .config/emacs/modules/tools/debugger/config.el delete mode 100644 .config/emacs/modules/tools/debugger/doctor.el delete mode 100644 .config/emacs/modules/tools/debugger/packages.el delete mode 100644 .config/emacs/modules/tools/direnv/README.org delete mode 100644 .config/emacs/modules/tools/direnv/config.el delete mode 100644 .config/emacs/modules/tools/direnv/doctor.el delete mode 100644 .config/emacs/modules/tools/direnv/packages.el delete mode 100644 .config/emacs/modules/tools/docker/README.org delete mode 100644 .config/emacs/modules/tools/docker/config.el delete mode 100644 .config/emacs/modules/tools/docker/packages.el delete mode 100644 .config/emacs/modules/tools/editorconfig/README.org delete mode 100644 .config/emacs/modules/tools/editorconfig/autoload.el delete mode 100644 .config/emacs/modules/tools/editorconfig/config.el delete mode 100644 .config/emacs/modules/tools/editorconfig/doctor.el delete mode 100644 .config/emacs/modules/tools/editorconfig/packages.el delete mode 100644 .config/emacs/modules/tools/ein/README.org delete mode 100644 .config/emacs/modules/tools/ein/config.el delete mode 100644 .config/emacs/modules/tools/ein/packages.el delete mode 100644 .config/emacs/modules/tools/ein/test/test-ein.el delete mode 100644 .config/emacs/modules/tools/eval/README.org delete mode 100644 .config/emacs/modules/tools/eval/autoload/eval.el delete mode 100644 .config/emacs/modules/tools/eval/autoload/evil.el delete mode 100644 .config/emacs/modules/tools/eval/autoload/repl.el delete mode 100644 .config/emacs/modules/tools/eval/autoload/settings.el delete mode 100644 .config/emacs/modules/tools/eval/config.el delete mode 100644 .config/emacs/modules/tools/eval/packages.el delete mode 100644 .config/emacs/modules/tools/gist/autoload/evil.el delete mode 100644 .config/emacs/modules/tools/gist/config.el delete mode 100644 .config/emacs/modules/tools/gist/packages.el delete mode 100644 .config/emacs/modules/tools/lookup/README.org delete mode 100644 .config/emacs/modules/tools/lookup/autoload/docsets.el delete mode 100644 .config/emacs/modules/tools/lookup/autoload/evil.el delete mode 100644 .config/emacs/modules/tools/lookup/autoload/lookup.el delete mode 100644 .config/emacs/modules/tools/lookup/autoload/online.el delete mode 100644 .config/emacs/modules/tools/lookup/autoload/xwidget.el delete mode 100644 .config/emacs/modules/tools/lookup/config.el delete mode 100644 .config/emacs/modules/tools/lookup/doctor.el delete mode 100644 .config/emacs/modules/tools/lookup/packages.el delete mode 100644 .config/emacs/modules/tools/lsp/+eglot.el delete mode 100644 .config/emacs/modules/tools/lsp/+lsp.el delete mode 100644 .config/emacs/modules/tools/lsp/README.org delete mode 100644 .config/emacs/modules/tools/lsp/autoload/common.el delete mode 100644 .config/emacs/modules/tools/lsp/autoload/eglot.el delete mode 100644 .config/emacs/modules/tools/lsp/autoload/flycheck-eglot.el delete mode 100644 .config/emacs/modules/tools/lsp/autoload/lsp-mode.el delete mode 100644 .config/emacs/modules/tools/lsp/config.el delete mode 100644 .config/emacs/modules/tools/lsp/doctor.el delete mode 100644 .config/emacs/modules/tools/lsp/packages.el delete mode 100644 .config/emacs/modules/tools/magit/README.org delete mode 100644 .config/emacs/modules/tools/magit/autoload.el delete mode 100644 .config/emacs/modules/tools/magit/config.el delete mode 100644 .config/emacs/modules/tools/magit/packages.el delete mode 100644 .config/emacs/modules/tools/make/autoload.el delete mode 100644 .config/emacs/modules/tools/make/packages.el delete mode 100644 .config/emacs/modules/tools/pass/README.org delete mode 100644 .config/emacs/modules/tools/pass/autoload/consult.el delete mode 100644 .config/emacs/modules/tools/pass/autoload/ivy.el delete mode 100644 .config/emacs/modules/tools/pass/autoload/pass.el delete mode 100644 .config/emacs/modules/tools/pass/config.el delete mode 100644 .config/emacs/modules/tools/pass/packages.el delete mode 100644 .config/emacs/modules/tools/pass/test/test-pass.el delete mode 100644 .config/emacs/modules/tools/pdf/README.org delete mode 100644 .config/emacs/modules/tools/pdf/config.el delete mode 100644 .config/emacs/modules/tools/pdf/packages.el delete mode 100644 .config/emacs/modules/tools/prodigy/autoload.el delete mode 100644 .config/emacs/modules/tools/prodigy/config.el delete mode 100644 .config/emacs/modules/tools/prodigy/packages.el delete mode 100644 .config/emacs/modules/tools/rgb/README.org delete mode 100644 .config/emacs/modules/tools/rgb/autoload.el delete mode 100644 .config/emacs/modules/tools/rgb/packages.el delete mode 100644 .config/emacs/modules/tools/taskrunner/README.org delete mode 100644 .config/emacs/modules/tools/taskrunner/autoload.el delete mode 100644 .config/emacs/modules/tools/taskrunner/config.el delete mode 100644 .config/emacs/modules/tools/taskrunner/packages.el delete mode 100644 .config/emacs/modules/tools/terraform/README.org delete mode 100644 .config/emacs/modules/tools/terraform/config.el delete mode 100644 .config/emacs/modules/tools/terraform/doctor.el delete mode 100644 .config/emacs/modules/tools/terraform/packages.el delete mode 100644 .config/emacs/modules/tools/tmux/autoload/evil.el delete mode 100644 .config/emacs/modules/tools/tmux/autoload/tmux.el delete mode 100644 .config/emacs/modules/tools/upload/README.org delete mode 100644 .config/emacs/modules/tools/upload/config.el delete mode 100644 .config/emacs/modules/tools/upload/packages.el delete mode 100644 .config/emacs/modules/ui/deft/README.org delete mode 100644 .config/emacs/modules/ui/deft/config.el delete mode 100644 .config/emacs/modules/ui/deft/packages.el delete mode 100644 .config/emacs/modules/ui/doom-dashboard/README.org delete mode 100644 .config/emacs/modules/ui/doom-dashboard/autoload.el delete mode 100644 .config/emacs/modules/ui/doom-dashboard/config.el delete mode 100644 .config/emacs/modules/ui/doom-dashboard/test/test-doom-dashboard.el delete mode 100644 .config/emacs/modules/ui/doom-quit/README.org delete mode 100644 .config/emacs/modules/ui/doom-quit/config.el delete mode 100644 .config/emacs/modules/ui/doom/README.org delete mode 100644 .config/emacs/modules/ui/doom/config.el delete mode 100644 .config/emacs/modules/ui/doom/packages.el delete mode 100644 .config/emacs/modules/ui/emoji/README.org delete mode 100644 .config/emacs/modules/ui/emoji/config.el delete mode 100644 .config/emacs/modules/ui/emoji/packages.el delete mode 100644 .config/emacs/modules/ui/hl-todo/README.org delete mode 100644 .config/emacs/modules/ui/hl-todo/config.el delete mode 100644 .config/emacs/modules/ui/hl-todo/packages.el delete mode 100644 .config/emacs/modules/ui/hydra/README.org delete mode 100644 .config/emacs/modules/ui/hydra/autoload/windows.el delete mode 100644 .config/emacs/modules/ui/hydra/config.el delete mode 100644 .config/emacs/modules/ui/hydra/packages.el delete mode 100644 .config/emacs/modules/ui/indent-guides/config.el delete mode 100644 .config/emacs/modules/ui/indent-guides/packages.el delete mode 100644 .config/emacs/modules/ui/ligatures/+fira.el delete mode 100644 .config/emacs/modules/ui/ligatures/+hasklig.el delete mode 100644 .config/emacs/modules/ui/ligatures/+iosevka.el delete mode 100644 .config/emacs/modules/ui/ligatures/+pragmata-pro.el delete mode 100644 .config/emacs/modules/ui/ligatures/README.org delete mode 100644 .config/emacs/modules/ui/ligatures/autoload/install.el delete mode 100644 .config/emacs/modules/ui/ligatures/autoload/ligatures.el delete mode 100644 .config/emacs/modules/ui/ligatures/config.el delete mode 100644 .config/emacs/modules/ui/minimap/README.org delete mode 100644 .config/emacs/modules/ui/minimap/config.el delete mode 100644 .config/emacs/modules/ui/minimap/packages.el delete mode 100644 .config/emacs/modules/ui/modeline/+light.el delete mode 100644 .config/emacs/modules/ui/modeline/README.org delete mode 100644 .config/emacs/modules/ui/modeline/autoload.el delete mode 100644 .config/emacs/modules/ui/modeline/config.el delete mode 100644 .config/emacs/modules/ui/modeline/packages.el delete mode 100644 .config/emacs/modules/ui/nav-flash/README.org delete mode 100644 .config/emacs/modules/ui/nav-flash/autoload.el delete mode 100644 .config/emacs/modules/ui/nav-flash/config.el delete mode 100644 .config/emacs/modules/ui/nav-flash/packages.el delete mode 100644 .config/emacs/modules/ui/neotree/README.org delete mode 100644 .config/emacs/modules/ui/neotree/autoload.el delete mode 100644 .config/emacs/modules/ui/neotree/config.el delete mode 100644 .config/emacs/modules/ui/neotree/packages.el delete mode 100644 .config/emacs/modules/ui/ophints/README.org delete mode 100644 .config/emacs/modules/ui/ophints/config.el delete mode 100644 .config/emacs/modules/ui/ophints/packages.el delete mode 100644 .config/emacs/modules/ui/popup/+hacks.el delete mode 100644 .config/emacs/modules/ui/popup/README.org delete mode 100644 .config/emacs/modules/ui/popup/autoload/popup.el delete mode 100644 .config/emacs/modules/ui/popup/autoload/settings.el delete mode 100644 .config/emacs/modules/ui/popup/config.el delete mode 100644 .config/emacs/modules/ui/popup/test/test-popup.el delete mode 100644 .config/emacs/modules/ui/tabs/README.org delete mode 100644 .config/emacs/modules/ui/tabs/autoload.el delete mode 100644 .config/emacs/modules/ui/tabs/config.el delete mode 100644 .config/emacs/modules/ui/tabs/packages.el delete mode 100644 .config/emacs/modules/ui/treemacs/README.org delete mode 100644 .config/emacs/modules/ui/treemacs/autoload.el delete mode 100644 .config/emacs/modules/ui/treemacs/config.el delete mode 100644 .config/emacs/modules/ui/treemacs/doctor.el delete mode 100644 .config/emacs/modules/ui/treemacs/packages.el delete mode 100644 .config/emacs/modules/ui/unicode/README.org delete mode 100644 .config/emacs/modules/ui/unicode/autoload.el delete mode 100644 .config/emacs/modules/ui/unicode/packages.el delete mode 100644 .config/emacs/modules/ui/vc-gutter/autoload.el delete mode 100644 .config/emacs/modules/ui/vc-gutter/config.el delete mode 100644 .config/emacs/modules/ui/vc-gutter/packages.el delete mode 100644 .config/emacs/modules/ui/vi-tilde-fringe/README.org delete mode 100644 .config/emacs/modules/ui/vi-tilde-fringe/autoload.el delete mode 100644 .config/emacs/modules/ui/vi-tilde-fringe/packages.el delete mode 100644 .config/emacs/modules/ui/window-select/README.org delete mode 100644 .config/emacs/modules/ui/window-select/config.el delete mode 100644 .config/emacs/modules/ui/window-select/packages.el delete mode 100644 .config/emacs/modules/ui/workspaces/README.org delete mode 100644 .config/emacs/modules/ui/workspaces/autoload/evil.el delete mode 100644 .config/emacs/modules/ui/workspaces/autoload/workspaces.el delete mode 100644 .config/emacs/modules/ui/workspaces/config.el delete mode 100644 .config/emacs/modules/ui/workspaces/packages.el delete mode 100644 .config/emacs/modules/ui/workspaces/test/test-workspaces.el delete mode 100644 .config/emacs/modules/ui/zen/README.org delete mode 100644 .config/emacs/modules/ui/zen/autoload.el delete mode 100644 .config/emacs/modules/ui/zen/config.el delete mode 100644 .config/emacs/modules/ui/zen/packages.el delete mode 100644 .config/emacs/test/shell.nix delete mode 100644 .config/gtk-4.0/settings.ini delete mode 160000 .config/oh-my-zsh delete mode 100644 .config/pavucontrol.ini delete mode 100644 .config/pulse/cookie diff --git a/.config/doom/config.el b/.config/doom/config.el index 3b8b944..9b0aece 100644 --- a/.config/doom/config.el +++ b/.config/doom/config.el @@ -3,12 +3,11 @@ (setq user-full-name "ry" user-mail-address "rpem66@pm.me") -(setq doom-theme 'doom-manegarm) +(setq doom-theme 'doom-Iosvkem) -;; Disable line mode for specific major/minor modes (dolist (mode '(org-mode-hook - vterm-mode-hook term-mode-hook + shell-mode-hook eshell-mode-hook)) (add-hook mode (lambda () (display-line-numbers-mode 0)))) diff --git a/.config/doom/custom.el b/.config/doom/custom.el index 142a6a9..269ccaf 100644 --- a/.config/doom/custom.el +++ b/.config/doom/custom.el @@ -6,7 +6,7 @@ '(ansi-color-names-vector ["#282c34" "#ff6c6b" "#98be65" "#ECBE7B" "#51afef" "#c678dd" "#46D9FF" "#bbc2cf"]) '(custom-safe-themes - '("1704976a1797342a1b4ea7a75bdbb3be1569f4619134341bd5a4c1cfb16abad4" "b5803dfb0e4b6b71f309606587dd88651efe0972a5be16ece6a958b197caeed8" default)) + '("a9a67b318b7417adbedaab02f05fa679973e9718d9d26075c6235b1f0db703c8" "1704976a1797342a1b4ea7a75bdbb3be1569f4619134341bd5a4c1cfb16abad4" "b5803dfb0e4b6b71f309606587dd88651efe0972a5be16ece6a958b197caeed8" default)) '(exwm-floating-border-color "#191b20") '(fci-rule-color "#5B6268") '(highlight-tail-colors diff --git a/.config/doom/init.el b/.config/doom/init.el index 32a6045..fd76a0d 100644 --- a/.config/doom/init.el +++ b/.config/doom/init.el @@ -123,7 +123,7 @@ ;;fsharp ; ML stands for Microsoft's Language ;;fstar ; (dependent) types and (monadic) effects and Z3 ;;gdscript ; the language you waited for - ;;(go +lsp) ; the hipster dialect + (go +lsp) ; the hipster dialect ;;(haskell +lsp) ; a language that's lazier than I am ;;hy ; readability of scheme w/ speed of python ;;idris ; a language you can depend on diff --git a/.config/emacs/.dir-locals.el b/.config/emacs/.dir-locals.el deleted file mode 100644 index f8673c5..0000000 --- a/.config/emacs/.dir-locals.el +++ /dev/null @@ -1,3 +0,0 @@ -((nil (git-commit-major-mode . git-commit-elisp-text-mode) - (fill-column . 80)) - (org-mode (buffer-read-only . t))) diff --git a/.config/emacs/.github/CODEOWNERS b/.config/emacs/.github/CODEOWNERS deleted file mode 100644 index 4bdc947..0000000 --- a/.config/emacs/.github/CODEOWNERS +++ /dev/null @@ -1,159 +0,0 @@ -# -*- mode: conf -*- -# Each line is a file pattern followed by one or more owners. - -# I will be the default owner for everything in the repo unless a later match -# takes precedence. -* @hlissner - -# Module maintainers -# Don't edit this by hand! Use 'doom make workflows' -modules/app/calendar/* @doomemacs/app-calendar -modules/app/emms/* @doomemacs/app-emms -modules/app/everywhere/* @doomemacs/app-everywhere -modules/app/irc/* @doomemacs/app-irc -modules/app/rss/* @doomemacs/app-rss -modules/app/twitter/* @doomemacs/app-twitter -modules/checkers/grammar/* @doomemacs/checkers-grammar -modules/checkers/spell/* @doomemacs/checkers-spell -modules/checkers/syntax/* @doomemacs/checkers-syntax -modules/completion/company/* @doomemacs/completion-company -modules/completion/helm/* @doomemacs/completion-helm -modules/completion/ido/* @doomemacs/completion-ido -modules/completion/ivy/* @doomemacs/completion-ivy -modules/completion/vertico/* @doomemacs/completion-vertico -modules/config/default/* @doomemacs/config-default -modules/config/literate/* @doomemacs/config-literate -modules/editor/evil/* @doomemacs/editor-evil -modules/editor/file-templates/* @doomemacs/editor-file-templates -modules/editor/fold/* @doomemacs/editor-fold -modules/editor/format/* @doomemacs/editor-format -modules/editor/god/* @doomemacs/editor-god -modules/editor/lispy/* @doomemacs/editor-lispy -modules/editor/multiple-cursors/* @doomemacs/editor-multiple-cursors -modules/editor/objed/* @doomemacs/editor-objed -modules/editor/parinfer/* @doomemacs/editor-parinfer -modules/editor/rotate-text/* @doomemacs/editor-rotate-text -modules/editor/snippets/* @doomemacs/editor-snippets -modules/editor/word-wrap/* @doomemacs/editor-word-wrap -modules/emacs/dired/* @doomemacs/emacs-dired -modules/emacs/electric/* @doomemacs/emacs-electric -modules/emacs/ibuffer/* @doomemacs/emacs-ibuffer -modules/emacs/tramp/* @doomemacs/emacs-tramp -modules/emacs/undo/* @doomemacs/emacs-undo -modules/emacs/vc/* @doomemacs/emacs-vc -modules/email/mu4e/* @doomemacs/email-mu4e -modules/email/notmuch/* @doomemacs/email-notmuch -modules/email/wanderlust/* @doomemacs/email-wanderlust -modules/input/chinese/* @doomemacs/input-chinese -modules/input/japanese/* @doomemacs/input-japanese -modules/input/layout/* @doomemacs/input-layout -modules/lang/agda/* @doomemacs/lang-agda -modules/lang/beancount/* @doomemacs/lang-beancount -modules/lang/cc/* @doomemacs/lang-cc -modules/lang/clojure/* @doomemacs/lang-clojure -modules/lang/common-lisp/* @doomemacs/lang-common-lisp -modules/lang/coq/* @doomemacs/lang-coq -modules/lang/crystal/* @doomemacs/lang-crystal -modules/lang/csharp/* @doomemacs/lang-csharp -modules/lang/dart/* @doomemacs/lang-dart -modules/lang/data/* @doomemacs/lang-data -modules/lang/dhall/* @doomemacs/lang-dhall -modules/lang/elixir/* @doomemacs/lang-elixir -modules/lang/elm/* @doomemacs/lang-elm -modules/lang/emacs-lisp/* @doomemacs/lang-emacs-lisp -modules/lang/erlang/* @doomemacs/lang-erlang -modules/lang/ess/* @doomemacs/lang-ess -modules/lang/factor/* @doomemacs/lang-factor -modules/lang/faust/* @doomemacs/lang-faust -modules/lang/fsharp/* @doomemacs/lang-fsharp -modules/lang/fstar/* @doomemacs/lang-fstar -modules/lang/gdscript/* @doomemacs/lang-gdscript -modules/lang/go/* @doomemacs/lang-go -modules/lang/haskell/* @doomemacs/lang-haskell -modules/lang/hy/* @doomemacs/lang-hy -modules/lang/idris/* @doomemacs/lang-idris -modules/lang/java/* @doomemacs/lang-java -modules/lang/javascript/* @doomemacs/lang-javascript -modules/lang/json/* @doomemacs/lang-json -modules/lang/julia/* @doomemacs/lang-julia -modules/lang/kotlin/* @doomemacs/lang-kotlin -modules/lang/latex/* @doomemacs/lang-latex -modules/lang/lean/* @doomemacs/lang-lean -modules/lang/ledger/* @doomemacs/lang-ledger -modules/lang/lua/* @doomemacs/lang-lua -modules/lang/markdown/* @doomemacs/lang-markdown -modules/lang/nim/* @doomemacs/lang-nim -modules/lang/nix/* @doomemacs/lang-nix -modules/lang/ocaml/* @doomemacs/lang-ocaml -modules/lang/org/* @doomemacs/lang-org -modules/lang/php/* @doomemacs/lang-php -modules/lang/plantuml/* @doomemacs/lang-plantuml -modules/lang/purescript/* @doomemacs/lang-purescript -modules/lang/python/* @doomemacs/lang-python -modules/lang/qt/* @doomemacs/lang-qt -modules/lang/racket/* @doomemacs/lang-racket -modules/lang/raku/* @doomemacs/lang-raku -modules/lang/rest/* @doomemacs/lang-rest -modules/lang/rst/* @doomemacs/lang-rst -modules/lang/ruby/* @doomemacs/lang-ruby -modules/lang/rust/* @doomemacs/lang-rust -modules/lang/scala/* @doomemacs/lang-scala -modules/lang/scheme/* @doomemacs/lang-scheme -modules/lang/sh/* @doomemacs/lang-sh -modules/lang/sml/* @doomemacs/lang-sml -modules/lang/solidity/* @doomemacs/lang-solidity -modules/lang/swift/* @doomemacs/lang-swift -modules/lang/terra/* @doomemacs/lang-terra -modules/lang/web/* @doomemacs/lang-web -modules/lang/yaml/* @doomemacs/lang-yaml -modules/lang/zig/* @doomemacs/lang-zig -modules/os/macos/* @doomemacs/os-macos -modules/os/tty/* @doomemacs/os-tty -modules/term/eshell/* @doomemacs/term-eshell -modules/term/shell/* @doomemacs/term-shell -modules/term/term/* @doomemacs/term-term -modules/term/vterm/* @doomemacs/term-vterm -modules/tools/ansible/* @doomemacs/tools-ansible -modules/tools/biblio/* @doomemacs/tools-biblio -modules/tools/debugger/* @doomemacs/tools-debugger -modules/tools/direnv/* @doomemacs/tools-direnv -modules/tools/docker/* @doomemacs/tools-docker -modules/tools/editorconfig/* @doomemacs/tools-editorconfig -modules/tools/ein/* @doomemacs/tools-ein -modules/tools/eval/* @doomemacs/tools-eval -modules/tools/gist/* @doomemacs/tools-gist -modules/tools/lookup/* @doomemacs/tools-lookup -modules/tools/lsp/* @doomemacs/tools-lsp -modules/tools/magit/* @doomemacs/tools-magit -modules/tools/make/* @doomemacs/tools-make -modules/tools/pass/* @doomemacs/tools-pass -modules/tools/pdf/* @doomemacs/tools-pdf -modules/tools/prodigy/* @doomemacs/tools-prodigy -modules/tools/rgb/* @doomemacs/tools-rgb -modules/tools/taskrunner/* @doomemacs/tools-taskrunner -modules/tools/terraform/* @doomemacs/tools-terraform -modules/tools/tmux/* @doomemacs/tools-tmux -modules/tools/upload/* @doomemacs/tools-upload -modules/ui/deft/* @doomemacs/ui-deft -modules/ui/doom/* @doomemacs/ui-doom -modules/ui/doom-dashboard/* @doomemacs/ui-doom-dashboard -modules/ui/doom-quit/* @doomemacs/ui-doom-quit -modules/ui/emoji/* @doomemacs/ui-emoji -modules/ui/hl-todo/* @doomemacs/ui-hl-todo -modules/ui/hydra/* @doomemacs/ui-hydra -modules/ui/indent-guides/* @doomemacs/ui-indent-guides -modules/ui/ligatures/* @doomemacs/ui-ligatures -modules/ui/minimap/* @doomemacs/ui-minimap -modules/ui/modeline/* @doomemacs/ui-modeline -modules/ui/nav-flash/* @doomemacs/ui-nav-flash -modules/ui/neotree/* @doomemacs/ui-neotree -modules/ui/ophints/* @doomemacs/ui-ophints -modules/ui/popup/* @doomemacs/ui-popup -modules/ui/tabs/* @doomemacs/ui-tabs -modules/ui/treemacs/* @doomemacs/ui-treemacs -modules/ui/unicode/* @doomemacs/ui-unicode -modules/ui/vc-gutter/* @doomemacs/ui-vc-gutter -modules/ui/vi-tilde-fringe/* @doomemacs/ui-vi-tilde-fringe -modules/ui/window-select/* @doomemacs/ui-window-select -modules/ui/workspaces/* @doomemacs/ui-workspaces -modules/ui/zen/* @doomemacs/ui-zen diff --git a/.config/emacs/.github/ISSUE_TEMPLATE/bug_report.yml b/.config/emacs/.github/ISSUE_TEMPLATE/bug_report.yml deleted file mode 100644 index d7514db..0000000 --- a/.config/emacs/.github/ISSUE_TEMPLATE/bug_report.yml +++ /dev/null @@ -1,95 +0,0 @@ ---- -name: 📝 Bug Report -description: Report a bug, error, or misbehavior -labels: ["1. bug", "needs-triage"] -body: -- type: markdown - attributes: - value: | - > :warning: **Our issue tracker is not for how-to or configuration questions.** Please post those on [our Discord](https://doomemacs.org/discord). - - **Before you proceed...** - - We depend on you to ensure your issue hasn't already been addressed, isn't covered by documentation, and isn't caused by personal configuration. To help us rule out these possibilities please follow these guidelines: - - + [ ] Search [the FAQ](https://git.doomemacs.org/docs/faq.org) and [the documentation](https://git.doomemacs.org/docs/getting_started.org) for solutions. - + [ ] Search [the issue tracker](https://github.com/hlissner/doom-emacs/issues) for similar issues (the closed issues too). - + [ ] Search [the Discourse](https://discourse.doomemacs.org) for any errors and solutions. - + [ ] Ensure the issue can be reproduced on [the latest commit](https://github.com/hlissner/doom-emacs/commit) of Doom Emacs. - + [ ] Consult [our troubleshooting](https://github.com/hlissner/doom-emacs/blob/develop/docs/getting_started.org#troubleshoot) on techniques to get more information and, possibly, solve the issue yourself. -- type: textarea - attributes: - label: What did you expect to happen? - placeholder: When I do X, it should do Y. - validations: - required: true -- type: textarea - attributes: - label: What actually happened? - description: | - + Include screenshots/casts, if possible - + List *all* error messages and **[include backtraces for each of them](https://github.com/hlissner/doom-emacs/blob/develop/docs/getting_started.org#how-to-extract-a-backtrace-from-an-error) - + Include any suspicious logs in the **[\*Messages\*](https://doomemacs.org/d/t/55) buffer. - + If you include log dumps, please use [pastebin.com](https://pastebin.com) - + **Use [code fences](https://docs.github.com/en/github/writing-on-github/creating-and-highlighting-code-blocks) for code, error messages, and backtraces.** - + Avoid phrases like "X does not work" or "X stopped working" without explaining what "working" means. - placeholder: | - When I do X, Z happened. Here is the backtrace: - - ``` - Debugger entered--Lisp error: (error "Beep Boop") - error("Beep Boop") - pp-eval-expression((error "Beep Boop")) - \#(pp-eval-expression (error "Beep Boop")) - apply(# (pp-eval-expression (error "Beep Boop"))) - funcall-interactively(pp-eval-expression (error "Beep Boop")) - ``` - - And here is the log: https://pastebin.com/fakeurl - validations: - required: true -- type: textarea - attributes: - label: Describe your attempts to resolve the issue - description: | - Describe resources you consulted or code you tried to fix your problem, and their result. - - **HINT: Remember to use [code fences](https://docs.github.com/en/github/writing-on-github/creating-and-highlighting-code-blocks) for code, log output, and backtraces.** - placeholder: | - I tried setting X to Y, then I tried Z. Here's what else I tried... - - ```elisp - (setq variable value) - ``` -- type: textarea - attributes: - label: Steps to reproduce - description: How do we reproduce your issue? Walk us through a minimal test case. - placeholder: | - 1. Open Emacs - 2. `M-x doom/info` and be prompted to visit pastebin.com - 3. Press `y` to open pastebin.com in browser - 4. Paste the contents of my clipboard into text box - 5. Click "Create New Paste" - 6. My wife leaves me - validations: - required: true -- type: input - id: doominfo - attributes: - label: System Information - description: | - Paste a link to a [pastebin](https://pastebin.com) where you've uploaded the output of `M-x doom/info` or `$ ~/.emacs.d/bin/doom info`. - - > :warning: **Do not paste your M-x doom/info directly into this box!** Use pastebin to minimize search result pollution in our issue tracker. - - > :warning: **Do not omit any part of or modify your doom/info.** - placeholder: https://pastebin.com/fakeurl - validations: - required: true -- type: markdown - attributes: - value: | - Before you go, please make sure your report's title is descriptive and specific. Avoid phrases like "X doesn't work" or "X stopped working". Error messages are best, but failing that, try to describe what "working" means to you. - - **Thank you for taking the time to fill out a bug report!** diff --git a/.config/emacs/.github/ISSUE_TEMPLATE/bump_request.yml b/.config/emacs/.github/ISSUE_TEMPLATE/bump_request.yml deleted file mode 100644 index 66d96f2..0000000 --- a/.config/emacs/.github/ISSUE_TEMPLATE/bump_request.yml +++ /dev/null @@ -1,34 +0,0 @@ ---- -name: 📦 Update Package -description: Request a pinned package be bumped -labels: ["1. update", "needs-triage"] -body: -- type: markdown - attributes: - value: | - Doom pins its packages to certain commits to avoid breaking updates and to help its maintainer keep up with changes. These pins are updated (bumped) frequently, usually every other week, but some may warrant an early bump, due to critical bug fixes or to adapt to external events. - - Use this form to let us know about these packages. - - ----- - - **Before you submit this bump request, make sure...** - - + [ ] To search for any open (or closed) [bump requests for this package](https://github.com/hlissner/doom-emacs/pulls?q=is%3Apr+is%3Aopen+label%3A%221.+update%29%22+). - + [ ] The target package(s) **are not** in [the do-not-PR list](https://gist.github.com/hlissner/bb6365626d825aeaf5e857b1c03c9837) list. - + [ ] These packages haven't already been bumped on the [latest commit of Doom](https://github.com/hlissner/doom-emacs/commit). - + [ ] The new versions of these packages work without issue. -- type: textarea - attributes: - label: What package(s) should be bumped? - placeholder: | - lsp-mode, lsp-python-ms, lsp-pyright, ... - validations: - required: true -- type: textarea - attributes: - label: Why should Doom bump these packages early? - description: | - Briefly describe what has changed, and why they warrant an early bump. Link any relevant commits or issues, if possible. Mention anything Doom may have to change to accommodate it. - placeholder: | - Recent changes to X have fixed several open issues in Y and Z, but have broken A and B in Doom. diff --git a/.config/emacs/.github/ISSUE_TEMPLATE/config.yml b/.config/emacs/.github/ISSUE_TEMPLATE/config.yml deleted file mode 100644 index d6c706e..0000000 --- a/.config/emacs/.github/ISSUE_TEMPLATE/config.yml +++ /dev/null @@ -1,14 +0,0 @@ -blank_issues_enabled: false -contact_links: - - name: Official Documentation - url: https://doomemacs.org/docs/index.org - about: "Walks you through how to use, abuse, or confuse Doom Emacs. Also available from within Doom: `M-x doom/help`" - - name: Visit our Discourse (work in progress) - url: https://discourse.doomemacs.org - about: "A repository of official learning resources and discussion forum for Emacs and Doom" - - name: Visit our Discord - url: https://doomemacs.org/discord - about: "A place to chat, get to know the community, and get help quick" - - name: See third-party resources - url: https://discourse.doomemacs.org/resources - about: "A curated collection of non-official resources to help you learn Emacs and Doom" diff --git a/.config/emacs/.github/ISSUE_TEMPLATE/feature_request.yml b/.config/emacs/.github/ISSUE_TEMPLATE/feature_request.yml deleted file mode 100644 index b4249ce..0000000 --- a/.config/emacs/.github/ISSUE_TEMPLATE/feature_request.yml +++ /dev/null @@ -1,43 +0,0 @@ ---- -name: 📝 Feature Request -description: Propose a new idea or feature -labels: ["1. request", "needs-triage"] -body: -- type: markdown - attributes: - value: | - > :warning: **Our issue tracker is not for how-to or configuration questions.** Please post those on [our Discord](https://doomemacs.org/discord) or [Discourse](https://discourse.doomemacs.org) instead. - - **Before you proceed, to rule out the possibility that your request has already been made (or fulfilled), please follow these guidelines:** - - + [ ] Read the [contributing guidelines](https://git.doomemacs.org/docs/contributing.org). - + [ ] Search [the issue tracker](https://github.com/hlissner/doom-emacs/issues?q=label%3A%221.+request%22+) for similar requests. - + [ ] Search [the module list](https://git.doomemacs.org/docs/modules.org) in case my feature was already implemented. - + [ ] The request hasn't been fulfilled on [the latest commit of Doom](https://github.com/hlissner/doom-emacs/commit). -- type: textarea - attributes: - label: Describe your request - placeholder: | - I'd like Doom to incorporate the game, Doom Eternal, into Doom Emacs, [found here](https://store.steampowered.com/app/379720/DOOM/). - - It replaces `M-x doctor` with a superior alternative: a distraction from your personal problems. - validations: - required: true -- type: textarea - attributes: - label: Briefly explain its use-case - description: | - A screencast is ideal, but a list of steps and effects showing off how it would work is acceptable. - placeholder: | - 1. Install Linux - 2. Install Emacs - 3. Install Doom - 4. Install Doom Eternal - 5. Speed run Doom Eternal - 6. Ponder why your wife left you - validations: - required: true -- type: markdown - attributes: - value: | - **Thank you for taking the time to fill out a feature request!** diff --git a/.config/emacs/.github/PULL_REQUEST_TEMPLATE.md b/.config/emacs/.github/PULL_REQUEST_TEMPLATE.md deleted file mode 100644 index 289d28b..0000000 --- a/.config/emacs/.github/PULL_REQUEST_TEMPLATE.md +++ /dev/null @@ -1,16 +0,0 @@ - - -Fixes #0000 - -{{{ Summarize what you've changed HERE and why }}} diff --git a/.config/emacs/.github/workflows/lint.yml b/.config/emacs/.github/workflows/lint.yml deleted file mode 100644 index db3bb55..0000000 --- a/.config/emacs/.github/workflows/lint.yml +++ /dev/null @@ -1,18 +0,0 @@ -name: Commit linter -on: - pull_request: -jobs: - lint-commits: - timeout-minutes: 10 - runs-on: ubuntu-latest - steps: - - uses: styfle/cancel-workflow-action@0.9.1 - with: - access_token: ${{ github.token }} - - uses: purcell/setup-emacs@master - with: - version: 27.2 - - uses: actions/checkout@v2.3.1 - with: - fetch-depth: 0 - - run: bin/doom ci lint-commits ${{ github.event.pull_request.base.sha }} ${{ github.event.pull_request.head.sha }} diff --git a/.config/emacs/.github/workflows/test.yml b/.config/emacs/.github/workflows/test.yml deleted file mode 100644 index b8c7827..0000000 --- a/.config/emacs/.github/workflows/test.yml +++ /dev/null @@ -1,68 +0,0 @@ -name: Tests - -on: - pull_request: - push: - paths-ignore: - - '**.md' - - '**.org' - - 'docs/**' - - '.dir-locals.el' - - 'LICENSE' - branches: - - main - - develop - -jobs: - unix-test: - runs-on: ${{ matrix.os }} - strategy: - matrix: - os: [ubuntu-latest, macos-latest] - emacs_version: [27.1, 27.2, snapshot] - steps: - - uses: purcell/setup-emacs@master - with: - version: ${{ matrix.emacs_version }} - - name: Check out doom-emacs - uses: actions/checkout@v2 - - name: Set up test Doom profile - run: bin/doom sync --profile test - - name: Set up test Doom profile - run: bin/doom test - - name: Cache package builds - uses: actions/cache@v2 - with: - path: .local/straight/repos - key: ${{ runner.os }}-build-doom-packages-${{ hashFiles('**/packages.el') }} - restore-keys: | - ${{ runner.os }}-build-doom-packages- - # FIXME - # name: Compile - # run: "bin/doom -y compile" - - windows-test: - runs-on: windows-latest - strategy: - matrix: - emacs-version: [27.1, 27.2, snapshot] - steps: - - uses: actions/checkout@v2 - - uses: actions/setup-python@v2 - with: - python-version: '3.6' - architecture: 'x64' - - uses: jcs090218/setup-emacs-windows@master - with: - version: ${{ matrix.emacs-version }} - - name: Set up test Doom profile - run: bin/doom sync --profile test - - name: Set up test Doom profile - run: bin/doom test - - name: Cache package builds - uses: actions/cache@v2 - with: - path: .local/straight/repos - key: ${{ runner.os }}-build-doom-packages-${{ hashFiles('**/packages.el') }} - restore-keys: | - ${{ runner.os }}-build-doom-packages- diff --git a/.config/emacs/.github/workflows/triage.yml b/.config/emacs/.github/workflows/triage.yml deleted file mode 100644 index b6ee605..0000000 --- a/.config/emacs/.github/workflows/triage.yml +++ /dev/null @@ -1,30 +0,0 @@ -name: Mark stale issues and lock closed threads -on: - schedule: - - cron: '0 */12 * * *' # twice, daily -jobs: - lock: - timeout-minutes: 10 - runs-on: ubuntu-latest - steps: - - uses: actions/stale@v3 - with: - stale-issue-message: > - :warning: **This issue has been automatically marked stale because - due to 60 days of inactivity.** If this issue is still valid, please - reply to it or it will be closed in 7 days. - stale-pr-message: >- - :warning: **This pull request has been automatically marked stale - due to 60 days of inactivity.** If this PR is still valid, please - reply to it or it will be closed in 7 days. - exempt-issue-labels: ':heart:,needs-triage,help wanted,1. announcement,2. status:confirmed,2. status:waiting,2. status:undecided' - exempt-pr-labels: ':heart:,needs-triage,2. status:confirmed,2. status:archived,2. status:resolved-temporarily,2. status:waiting,2. status:needs-work,2. status:undecided' - stale-issue-label: stale - stale-pr-label: stale - exempt-all-milestones: true - exempt-all-assignees: true - - uses: dessant/lock-threads@v2 - with: - github-token: ${{ github.token }} - issue-lock-inactive-days: '90' - pr-lock-inactive-days: '90' diff --git a/.config/emacs/.gitignore b/.config/emacs/.gitignore deleted file mode 100644 index bbcf3fd..0000000 --- a/.config/emacs/.gitignore +++ /dev/null @@ -1,38 +0,0 @@ -.DS_Store -*~ -*.*~ -\#* -.\#* -.local/ -.extension/ -*.cache* -*.log -/modules/private -test/.local*/ -test/result - -# emacs tempfiles that shouldn't be there -.dap-breakpoints -.org-id-locations -.tern-port -.yas-compiled-snippets.el -auto-save-list/ -cask/ -ede-projects.el -elpa/ -eln-cache/ -network-security.data -places -semanticdb -server/ -smex-items -tramp -transient/ -var/ - -# compiled files -*.elc -*.lib -*.fas -*.dat -*.eld diff --git a/.config/emacs/LICENSE b/.config/emacs/LICENSE deleted file mode 100644 index 5f4d5a0..0000000 --- a/.config/emacs/LICENSE +++ /dev/null @@ -1,22 +0,0 @@ -The MIT License (MIT) - -Copyright (c) 2016-2021 Henrik Lissner. - -Permission is hereby granted, free of charge, to any person obtaining -a copy of this software and associated documentation files (the -"Software"), to deal in the Software without restriction, including -without limitation the rights to use, copy, modify, merge, publish, -distribute, sublicense, and/or sell copies of the Software, and to -permit persons to whom the Software is furnished to do so, subject to -the following conditions: - -The above copyright notice and this permission notice shall be -included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY -CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, -TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/.config/emacs/README.md b/.config/emacs/README.md deleted file mode 100644 index 526bc58..0000000 --- a/.config/emacs/README.md +++ /dev/null @@ -1,247 +0,0 @@ -
- -# Doom Emacs - -[Install](#install) • [Documentation] • [FAQ] • [Screenshots] • [Contribute](#contribute) - -![Made with Doom Emacs](https://img.shields.io/github/tag/hlissner/doom-emacs.svg?style=flat-square&label=release&color=58839b) -![Minimum Emacs version supported: 27.1](https://img.shields.io/badge/Emacs-27.1+-blueviolet.svg?style=flat-square&logo=GNU%20Emacs&logoColor=white) -![Latest commit](https://img.shields.io/github/last-commit/hlissner/doom-emacs/develop?style=flat-square) -![Build status: develop](https://img.shields.io/github/workflow/status/hlissner/doom-emacs/CI/develop?style=flat-square) -[![Discord Server](https://img.shields.io/discord/406534637242810369?color=738adb&label=Discord&logo=discord&logoColor=white&style=flat-square)][Discord] -[![Discourse server](https://img.shields.io/discourse/users?server=https%3A%2F%2Fdiscourse.doomemacs.org&logo=discourse&label=Discourse&style=flat-square&color=9cf)][Discourse] - -![Doom Emacs Screenshot](https://raw.githubusercontent.com/hlissner/doom-emacs/screenshots/main.png) - -
- ---- - -### Table of Contents -- [Introduction](#introduction) -- [Features](#features) -- [Prerequisites](#prerequisites) -- [Install](#install) -- [Roadmap](#roadmap) -- [Getting help](#getting-help) -- [Contribute](#contribute) - - -# Introduction - - - - -> It is a story as old as time. A stubborn, shell-dwelling, and melodramatic -> vimmer—envious of the features of modern text editors—spirals into -> despair before he succumbs to the [dark side][evil-mode]. This is his config. - -Doom is a configuration framework for [GNU Emacs] tailored for Emacs bankruptcy -veterans who want less framework in their frameworks, a modicum of stability -(and reproducibility) from their package manager, and the performance of a hand -rolled config (or better). It can be a foundation for your own config or a -resource for Emacs enthusiasts to learn more about our favorite operating -system. - -Its design is guided by these mantras: - -+ **Gotta go fast.** Startup and run-time performance are priorities. Doom goes - beyond by modifying packages to be snappier and load lazier. -+ **Close to metal.** There's less between you and vanilla Emacs by design. - That's less to grok and less to work around when you tinker. Internals ought - to be written as if reading them were part of Doom's UX, and it is! -+ **Opinionated, but not stubborn.** Doom is about reasonable defaults and - curated opinions, but use as little or as much of it as you like. -+ **Your system, your rules.** You know better. At least, Doom hopes so! It - won't *automatically* install system dependencies (and will force plugins not - to either). Rely on `doom doctor` to tell you what's missing. -+ **Nix/Guix is a great idea!** The Emacs ecosystem is temperamental. Things - break and they break often. Disaster recovery should be a priority! Doom's - package management should be declarative and your private config reproducible, - and comes with a means to roll back releases and updates (still a WIP). - -Check out [the FAQ][FAQ] for answers to common questions about the project. - - -# Features -- Minimalistic good looks inspired by modern editors. -- Curated and sane defaults for many packages, (major) OSes, and Emacs itself. -- A modular organizational structure for separating concerns in your config. -- A standard library designed to simplify your elisp bike shedding. -- A declarative [package management system][package-management] (powered by - [straight.el]) with a command line interface. Install packages from anywhere, - not just (M)ELPA, and pin them to any commit. -- Optional vim emulation powered by [evil-mode], including ports of popular vim - plugins like [vim-sneak], [vim-easymotion], [vim-unimpaired] and - [more][ported-vim-plugins]! -- Opt-in LSP integration for many languages, using [lsp-mode] or [eglot] -- Support for *many* programming languages. Includes syntax highlighting, - linters/checker integration, inline code evaluation, code completion (where - possible), REPLs, documentation lookups, snippets, and more! -- Support for *many* tools, like docker, pass, ansible, terraform, and more. -- A Spacemacs-esque [keybinding scheme][bindings], centered around leader - and localleader prefix keys (SPC and SPCm for - evil users, C-c and C-c l for vanilla users). -- A rule-based [popup manager][popup-system] to control how temporary buffers - are displayed (and disposed of). -- Per-file indentation style detection and [editorconfig] integration. Let - someone else argue about tabs vs **_spaces_**. -- Project-management tools and framework-specific minor modes with their own - snippets libraries. -- Project search (and replace) utilities, powered by [ripgrep] and [ivy] or - [helm]. -- Isolated and persistent workspaces (also substitutes for vim tabs). -- Support for Chinese and Japanese input systems. -- Save a snapshot of your shell environment to a file for Emacs to load at - startup. No more struggling to get Emacs to inherit your `PATH`, among other - things. - - -# Prerequisites -+ Git 2.23+ -+ Emacs 27.1+ (*27.2 is recommended*, or [native-comp](https://www.emacswiki.org/emacs/GccEmacs)). -+ [ripgrep] 11.0+ -+ GNU `find` -+ *OPTIONAL:* [fd] 7.3.0+ (improves file indexing performance for some commands) - -Doom is comprised of [~150 optional modules][Modules], some of which may have -additional dependencies. [Visit their documentation][Modules] or run `bin/doom -doctor` to check for any that you may have missed. - - -# Install -``` sh -git clone --depth 1 https://github.com/hlissner/doom-emacs ~/.emacs.d -~/.emacs.d/bin/doom install -``` - -Then [read our Getting Started guide][getting-started] to be walked through -installing, configuring and maintaining Doom Emacs. - -It's a good idea to add `~/.emacs.d/bin` to your `PATH`! Other `bin/doom` -commands you should know about: - -+ `doom sync` to synchronize your private config with Doom by installing missing - packages, removing orphaned packages, and regenerating caches. Run this - whenever you modify your private `init.el` or `packages.el`, or install/remove - an Emacs package through your OS package manager (e.g. mu4e or agda). -+ `doom upgrade` to update Doom to the latest release & all installed packages. -+ `doom doctor` to diagnose common issues with your system and config. -+ `doom env` to dump a snapshot of your shell environment to a file that Doom - will load at startup. This allows Emacs to inherit your `PATH`, among other - things. -+ `doom build` to recompile all installed packages (use this if you up/downgrade - Emacs). - - -# Roadmap -Doom is an active and ongoing project. To make that development more -transparent, its roadmap (and other concerns) are published across three github -project boards and a newsletter: - -+ [Development Roadmap](https://github.com/orgs/doomemacs/projects/6): - roughly outlines our goals between release milestones and their progress. -+ [Plugins under review](https://github.com/orgs/doomemacs/projects/5): - lists plugins we are watching and considering for inclusion, and what their - status for inclusion is. Please consult this list before requesting new - packages/features. -+ [Upstream bugs](https://github.com/orgs/doomemacs/projects/7): lists - issues that originate from elsewhere, and whether or not we have local - workarounds or temporary fixes for them. -+ ~~Doom's newsletter~~ (not finished) will contain changelogs in between - releases. - - -# Getting help -Emacs is no journey of a mere thousand miles. You _will_ run into problems and -mysterious errors. When you do, here are some places you can look for help: - -+ [Our documentation][documentation] covers many use cases. - + [The Configuration section][configuration] covers how to configure Doom and - its packages. - + [The Package Management section][package-management] covers how to install - and disable packages. - + [This section][bin/doom] explains the `bin/doom` script's most important - commands. - + [This section][common-mistakes] lists some common configuration mistakes new - users make, when migrating a config from another distro or their own. - + [This answer][change-theme] shows you how to add your own themes to your - private config. - + [This answer][change-font] shows you how to change the default font. - + Your issue may be documented in the [FAQ]. -+ With Emacs built-in help system documentation is a keystroke away: - + For functions: SPC h f or C-h f - + For variables: SPC h v or C-h v - + For a keybind: SPC h k or C-h k - + To search available keybinds: SPC h b b or C-h b b -+ Run `bin/doom doctor` to detect common issues with your development - environment and private config. -+ Check out the [FAQ], in case your question has already been answered. -+ Search [Doom's issue tracker](https://github.com/hlissner/doom-emacs/issues) in case your issue was already - reported. -+ Hop on [our Discord server][discord]; it's active and friendly! Keep an eye on - the #announcements channel, where I announce breaking updates and releases. - - -# Contribute -[![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg?style=flat-square)](http://makeapullrequest.com) -[![Elisp styleguide](https://img.shields.io/badge/elisp-style%20guide-purple?style=flat-square)](https://github.com/bbatsov/emacs-lisp-style-guide) -[![Donate on liberapay](https://img.shields.io/badge/liberapay-donate-1.svg?style=flat-square&logo=liberapay&color=blue)][liberapay] -[![Donate on paypal](https://img.shields.io/badge/paypal-donate-1?style=flat-square&logo=paypal&color=blue)][paypal] - -Doom is a labor of love and incurable madness, but I'm only one guy. Doom -wouldn't be where it is today without your help. I welcome contributions of any -kind! - -+ I :heart: pull requests and bug reports (see the [Contributing - Guidelines][contribute])! -+ Don't hesitate to [tell me my Elisp-fu - sucks](https://github.com/hlissner/doom-emacs/issues/new), but please tell me - why. -+ Hop on [our Discord server][Discord] and say hi! Help others, hang out or talk - to me about Emacs, gamedev, programming, physics, pixel art, anime, gaming -- - anything you like. Nourish this lonely soul. -+ If you'd like to support my work financially, buy me a drink through - [liberapay] or [paypal]. My work contends with studies, adventures in indie - gamedev and freelance work. Donations help me allocate more time to my Emacs - and OSS capers. - - -[contribute]: docs/contributing.org -[discord]: https://discord.gg/qvGgnVx -[discourse]: https://discourse.doomemacs.org -[documentation]: docs/index.org -[faq]: https://discourse.doomemacs.org/t/doom-emacs-faq/45 -[getting-started]: docs/getting_started.org -[install]: docs/getting_started.org#install -[backtrace]: docs/getting_started.org#how-to-extract-a-backtrace-from-an-error -[configuration]: docs/getting_started.org#configuring-doom -[package-management]: docs/getting_started.org#package-management -[bin/doom]: docs/getting_started.org#the-bindoom-utility -[common-mistakes]: docs/getting_started.org#common-mistakes-when-configuring-doom-emacs -[change-theme]: docs/faq.org#how-do-i-change-the-theme -[change-font]: docs/faq.org#how-do-i-change-the-fonts -[modules]: docs/modules.org -[popup-system]: modules/ui/popup/README.org -[screenshots]: https://github.com/hlissner/doom-emacs/tree/screenshots#emacsd-screenshots - -[bindings]: modules/config/default/+evil-bindings.el -[editorconfig]: http://editorconfig.org/ -[evil-mode]: https://github.com/emacs-evil/evil -[fd]: https://github.com/sharkdp/fd -[gnu emacs]: https://www.gnu.org/software/emacs/ -[helm]: https://github.com/emacs-helm/helm -[ivy]: https://github.com/abo-abo/swiper -[lsp-mode]: https://github.com/emacs-lsp/lsp-mode -[eglot]: https://github.com/joaotavora/eglot -[nix]: https://nixos.org -[ported-vim-plugins]: modules/editor/evil/README.org#ported-vim-plugins -[ripgrep]: https://github.com/BurntSushi/ripgrep -[straight.el]: https://github.com/raxod502/straight.el -[vim-easymotion]: https://github.com/easymotion/vim-easymotion -[vim-lion]: https://github.com/tommcdo/vim-lion -[vim-sneak]: https://github.com/justinmk/vim-sneak -[vim-unimpaired]: https://github.com/tpope/vim-unimpaired - -[liberapay]: https://liberapay.com/hlissner/donate -[paypal]: https://paypal.me/henriklissner/10 diff --git a/.config/emacs/bin/doom b/.config/emacs/bin/doom deleted file mode 100755 index 9550212..0000000 --- a/.config/emacs/bin/doom +++ /dev/null @@ -1,166 +0,0 @@ -#!/usr/bin/env sh -:; set -e # -*- mode: emacs-lisp; lexical-binding: t -*- -:; case "$EMACS" in *term*) EMACS=emacs ;; *) EMACS="${EMACS:-emacs}" ;; esac -:; $EMACS --version >/dev/null 2>&1 || { >&2 echo "Can't find emacs in your PATH"; exit 1; } -:; $EMACS --no-site-file --script "$0" -- "$@" || __DOOMCODE=$? -:; [ "${__DOOMCODE:-0}" -eq 128 ] && { sh "`$EMACS -Q --batch --eval '(princ temporary-file-directory)'`/doom.sh" "$0" "$@" && true; __DOOMCODE=$?; } -:; exit $__DOOMCODE - -;; The garbage collector isn't as important during CLI ops. A higher threshold -;; makes it 15-30% faster, but set it too high and we risk runaway memory usage -;; in longer sessions. -(setq gc-cons-threshold 134217728) ; 128mb - -;; Prioritize non-byte-compiled source files in non-interactive sessions to -;; prevent loading stale byte-code. -(setq load-prefer-newer t) - -;; Ensure Doom runs out of this file's parent directory, where Doom is -;; presumably installed. Use the EMACSDIR envvar to change this. -(setq user-emacs-directory - (if (getenv-internal "EMACSDIR") - (file-name-as-directory (expand-file-name (getenv-internal "EMACSDIR"))) - (expand-file-name - "../" (file-name-directory (file-truename load-file-name))))) - - -;; -;;; Sanity checks - -(when (version< emacs-version "27.1") - (error - (concat "Detected Emacs " emacs-version " (at " (car command-line-args) ").\n\n" - "Doom only supports Emacs 27.1 and newer. A guide to install a newer version\n" - "of Emacs can be found at:\n\n " - (format "https://doomemacs.org/docs/getting_started.org#%s\n" - (cond ((eq system-type 'darwin) "on-macos") - ((memq system-type '(cygwin windows-nt ms-dos)) "on-windows") - ("on-linux"))) - "Aborting..."))) - -(unless (file-readable-p (expand-file-name "core/core.el" user-emacs-directory)) - (error - (concat - "Couldn't find or read '" - (abbreviate-file-name - (expand-file-name "core/core.el" user-emacs-directory)) - "'.\n\n" - "Are you sure Doom Emacs is correctly installed?\n\n" - (when (file-symlink-p load-file-name) - (concat "This error can occur if you've symlinked the 'doom' script, which Doom does not\n" - "support. Consider symlinking its parent directory instead or explicitly set the\n" - "EMACSDIR environment variable, e.g.\n\n " - (if (string-match-p "/fish$" (getenv "SHELL")) - "env EMACSDIR=~/.emacs.d doom" - "EMACSDIR=~/.emacs.d doom sync")) - "\n\n") - "Aborting..."))) - -(when (equal (user-real-uid) 0) - ;; If ~/.emacs.d is owned by root, assume the user genuinely wants root to be - ;; their primary user. - (unless (= 0 (file-attribute-user-id (file-attributes user-emacs-directory))) - (error - (concat - "Do not run this script as root. It will cause file permissions errors later.\n\n" - "To carry on anyway, change the owner of your Emacs config to root:\n\n" - " chown root:root -R " (abbreviate-file-name user-emacs-directory) "\n\n" - "Aborting...")))) - - -;; -;;; Let 'er rip! - -;; HACK Load `cl' and site files manually to prevent polluting logs and stdout -;; with deprecation and/or file load messages. -(let ((inhibit-message t)) - (require 'cl) - (unless site-run-file - (let ((site-run-file "site-start") - (verbose (or (getenv "DEBUG") init-file-debug)) - (tail load-path) - (lispdir (expand-file-name "../lisp" data-directory)) - dir) - (while tail - (setq dir (car tail)) - (let ((default-directory dir)) - (load (expand-file-name "subdirs.el") t (not verbose) t)) - (or (string-prefix-p lispdir dir) - (let ((default-directory dir)) - (load (expand-file-name "leim-list.el") t (not verbose) t))) - (setq tail (cdr tail))) - (load site-run-file t (not verbose))))) - -;; Load the heart of the beast and its CLI processing library -(load (expand-file-name "core/core.el" user-emacs-directory) nil t) -(require 'core-cli) - -(kill-emacs - ;; Process the arguments passed to this script. `doom-cli-execute' should - ;; return one of two things: a cons cell whose CAR is t, and CDR is the - ;; command's return value OR one of: a keyword, command string, or command - ;; list. - (pcase (apply #'doom-cli-execute :doom (cdr (member "--" argv))) - - ;; If a CLI command returns an integer, treat it as an exit code. - ((and (app car-safe `t) code) - (if (integerp (cdr code)) - (cdr code))) - - ;; CLI commands can do (throw 'exit SHELL-COMMAND) to run something after - ;; this session ends. e.g. - ;; - ;; (throw 'exit "$@") or (throw 'exit :restart) - ;; This reruns the current command with the same arguments. - ;; (throw 'exit "$@ -h -c") - ;; This reruns the current command with two new switches. - ;; (throw 'exit "emacs -nw FILE") - ;; Opens Emacs on FILE - ;; (throw 'exit t) or (throw 'exit nil) - ;; A safe way to simply abort back to the shell with exit code 0 - ;; (throw 'exit 42) - ;; Abort to shell with an explicit exit code (as a more abrupt - ;; alternative to having the CLI command return 42). - ;; - ;; How this works: the command is written to a temporary shell script which - ;; is executed after this session ends (see the shebang lines of this file). - ;; It's done this way because Emacs' batch library lacks an implementation of - ;; the exec system call. - (command - (cond - ((integerp command) - command) - ((booleanp command) - 0) - ((let ((script (expand-file-name "doom.sh" temporary-file-directory)) - (coding-system-for-write 'utf-8-unix) - (coding-system-for-read 'utf-8-unix)) - (with-temp-file script - (insert "#!/usr/bin/env sh\n" - "_postscript() {\n" - " rm -f " (shell-quote-argument script) "\n " - (cond ((eq command :restart) "$@") - ((stringp command) command) - ((listp command) - (string-join - (if (listp (car-safe command)) - (cl-loop for line in (doom-enlist command) - collect (mapconcat #'shell-quote-argument (remq nil line) " ")) - (list (mapconcat #'shell-quote-argument (remq nil command) " "))) - "\n "))) - "\n}\n" - (save-match-data - (cl-loop for env - in (cl-set-difference process-environment - (get 'process-environment 'initial-value) - :test #'equal) - if (string-match "^\\([a-zA-Z0-9_]+\\)=\\(.+\\)$" env) - concat (format "%s=%s \\\n" - (match-string 1 env) - (shell-quote-argument (match-string 2 env))))) - (format "PATH=\"%s%s$PATH\" \\\n" (concat doom-emacs-dir "bin/") path-separator) - "_postscript $@\n")) - (set-file-modes script #o600) - ;; Error code 128 is special: it means run the post-script after this - ;; session ends. - 128)))))) diff --git a/.config/emacs/bin/doom.cmd b/.config/emacs/bin/doom.cmd deleted file mode 100644 index 7cba4ca..0000000 --- a/.config/emacs/bin/doom.cmd +++ /dev/null @@ -1,25 +0,0 @@ -:: Forward the ./doom script to Emacs - -@ECHO OFF -SETLOCAL ENABLEDELAYEDEXPANSION - -PUSHD "%~dp0" >NUL - -SET args= -SET command=%1 - -:LOOP -SHIFT /1 -IF NOT [%1]==[] ( - SET args=%args% %1 - GOTO :LOOP -) - -IF [%command%]==[run] ( - start runemacs -Q %args% -l ..\init.el -f "doom-run-all-startup-hooks-h" -) ELSE ( - emacs --quick --script .\doom -- %* -) - -POPD >NUL -ECHO ON diff --git a/.config/emacs/bin/org-capture b/.config/emacs/bin/org-capture deleted file mode 100755 index 86348c2..0000000 --- a/.config/emacs/bin/org-capture +++ /dev/null @@ -1,43 +0,0 @@ -#!/usr/bin/env sh - -# Open an org-capture popup frame from the shell. This opens a temporary emacs -# daemon if emacs isn't already running. -# -# Usage: org-capture [-k KEY] [MESSAGE] -# Examples: -# org-capture -k n "To the mind that is still, the whole universe surrenders." - -set -e - -cleanup() { - emacsclient --eval '(let (kill-emacs-hook) (kill-emacs))' -} - -# If emacs isn't running, we start a temporary daemon, solely for this window. -if ! emacsclient --suppress-output --eval nil 2>/dev/null; then - echo "No Emacs daemon/server is available! Starting one..." - emacs --daemon - trap cleanup EXIT INT TERM -fi - -# org-capture key mapped to argument flags -# keys=$(emacsclient -e "(+org-capture-available-keys)" | cut -d '"' -f2) -while getopts "hk:" opt; do - key="\"$OPTARG\"" - break -done -shift $((OPTIND-1)) - -# use remaining args, else read from stdin if passed a single dash -str="$*" -case "$str" in - -) str=$(cat) ;; -esac - -# Fix incompatible terminals that cause odd 'not a valid terminal' errors -[ "$TERM" = "alacritty" ] && export TERM=xterm-256color - -# Non-daemon servers flicker a lot if frames are created from terminal, so we do -# it internally instead. -emacsclient -a "" \ - -e "(+org-capture/open-frame \"$str\" ${key:-nil})" diff --git a/.config/emacs/bin/org-tangle b/.config/emacs/bin/org-tangle deleted file mode 100755 index b662ecb..0000000 --- a/.config/emacs/bin/org-tangle +++ /dev/null @@ -1,159 +0,0 @@ -#!/usr/bin/env sh -":"; exec emacs --quick --script "$0" -- "$@" # -*- mode: emacs-lisp; lexical-binding: t; -*- -;;; bin/org-tangle - -;; Tangles source blocks from org files. Also expands #+INCLUDE directives, -;; unlike vanilla `ob-tangle'. Debug/info messages are directed to stderr and -;; can be ignored. -;; -;; -l/--lang LANG -;; Only include blocks in the specified language (e.g. emacs-lisp). -;; -a/--all -;; Tangle all blocks by default (unless it has :tangle nil set or a -;; :notangle: tag) -;; -t/--tag TAG -;; --and TAG -;; --or TAG -;; Only include blocks in trees that have these tags. Combine multiple --and -;; and --or's, or just use --tag (implicit --and). -;; -p/--print -;; Prints tangled code to stdout instead of to files -;; -;; Usage: org-tangle [[-l|--lang] LANG] some-file.org another.org -;; Examples: -;; org-tangle -l sh modules/some/module/README.org > install_module.sh -;; org-tangle -l sh modules/lang/go/README.org | sh -;; org-tangle --and tagA --and tagB my/literate/config.org - -(require 'cl-lib) -(require 'ox) -(require 'ob-tangle) - -(defun usage () - (with-temp-buffer - (insert (format "%s %s [OPTIONS] [TARGETS...]\n" - "Usage:" - (file-name-nondirectory load-file-name)) - "\n" - "A command line interface for tangling org-mode files. TARGETS can be\n" - "files or folders (which are searched for org files recursively).\n" - "\n" - "This is useful for literate configs that rely on command line\n" - "workflows to build it.\n" - "\n" - "Example:\n" - " org-tangle some-file.org\n" - " org-tangle literate/config/\n" - " org-tangle -p -l sh scripts.org > do_something.sh\n" - " org-tangle -p -l python -t tagA -t tagB file.org | python\n" - "\n" - "Options:\n" - " -a --all\t\tTangle all blocks by default\n" - " -l --lang LANG\tOnly tangle blocks written in LANG\n" - " -p --print\t\tPrint tangled output to stdout than to files\n" - " -t --tag TAG\n" - " --and TAG\n" - " --or TAG\n" - " Lets you tangle org blocks by tag. You may have more than one\n" - " of these options.\n") - (princ (buffer-string)))) - -(defun *org-babel-tangle (fn &rest args) - "Don't write tangled blocks to files, print them to stdout." - (cl-letf (((symbol-function 'write-region) - (lambda (start end filename &optional append visit lockname mustbenew) - (princ (buffer-string))))) - (apply fn args))) - -(defun *org-babel-tangle-collect-blocks (&optional language tangle-file) - "Like `org-babel-tangle-collect-blocks', but will ignore blocks that are in -trees with the :notangle: tag." - (let ((counter 0) last-heading-pos blocks) - (org-babel-map-src-blocks (buffer-file-name) - (let ((current-heading-pos - (org-with-wide-buffer - (org-with-limited-levels (outline-previous-heading))))) - (if (eq last-heading-pos current-heading-pos) (cl-incf counter) - (setq counter 1) - (setq last-heading-pos current-heading-pos))) - (unless (org-in-commented-heading-p) - (require 'org) - (let* ((tags (org-get-tags-at)) - (info (org-babel-get-src-block-info 'light)) - (src-lang (nth 0 info)) - (src-tfile (cdr (assq :tangle (nth 2 info))))) - (cond ((member "notangle" tags)) - - ((and (or or-tags and-tags) - (or (not and-tags) - (let ((a (cl-intersection and-tags tags :test #'string=)) - (b and-tags)) - (not (or (cl-set-difference a b :test #'equal) - (cl-set-difference b a :test #'equal))))) - (or (not or-tags) - (cl-intersection or-tags tags :test #'string=)) - t)) - - ((or (not (or all-blocks src-tfile)) - (string= src-tfile "no") ; tangle blocks by default - (and tangle-file (not (equal tangle-file src-tfile))) - (and language (not (string= language src-lang))))) - - ;; Add the spec for this block to blocks under its language. - ((let ((by-lang (assoc src-lang blocks)) - (block (org-babel-tangle-single-block counter))) - (if by-lang - (setcdr by-lang (cons block (cdr by-lang))) - (push (cons src-lang (list block)) blocks)))))))) - ;; Ensure blocks are in the correct order. - (mapcar (lambda (b) (cons (car b) (nreverse (cdr b)))) blocks))) -(advice-add #'org-babel-tangle-collect-blocks - :override #'*org-babel-tangle-collect-blocks) - -(defvar all-blocks nil) -(defvar and-tags nil) -(defvar or-tags nil) -(let (lang srcs and-tags or-tags) - (pop argv) - (while argv - (let ((arg (pop argv))) - (pcase arg - ((or "-h" "--help") - (usage) - (error "")) - ((or "-a" "--all") - (setq all-blocks t)) - ((or "-l" "--lang") - (setq lang (pop argv))) - ((or "-p" "--print") - (advice-add #'org-babel-tangle :around #'*org-babel-tangle)) - ((or "-t" "--tag" "--and") - (push (pop argv) and-tags)) - ("--or" - (push (pop argv) or-tags)) - ((guard (string-match-p "^--lang=" arg)) - (setq lang (cadr (split-string arg "=" t t)))) - ((guard (file-directory-p arg)) - (setq srcs - (append (directory-files-recursively arg "\\.org$") - srcs))) - ((guard (file-exists-p arg)) - (push arg srcs)) - (_ (error "Unknown option or file: %s" arg))))) - - (dolist (file srcs) - (let ((backup (make-temp-file (file-name-base file) nil ".backup.org"))) - (unwind-protect - ;; Prevent slow hooks from interfering - (let (org-mode-hook org-confirm-babel-evaluate) - ;; We do the ol' switcheroo because `org-babel-tangle' writes - ;; changes to the current file, which would be imposing on the user. - (copy-file file backup t) - (with-current-buffer (find-file-noselect file) - ;; Tangling doesn't expand #+INCLUDE directives, so we do it - ;; ourselves, since includes are so useful for literate configs! - (org-export-expand-include-keyword) - (org-babel-tangle nil nil lang))) - (ignore-errors (copy-file backup file t)) - (ignore-errors (delete-file backup))))) - (kill-emacs 0)) diff --git a/.config/emacs/core/autoload/buffers.el b/.config/emacs/core/autoload/buffers.el deleted file mode 100644 index bb71b30..0000000 --- a/.config/emacs/core/autoload/buffers.el +++ /dev/null @@ -1,393 +0,0 @@ -;;; core/autoload/buffers.el -*- lexical-binding: t; -*- - -;;;###autoload -(defvar doom-real-buffer-functions - '(doom-dired-buffer-p) - "A list of predicate functions run to determine if a buffer is real, unlike -`doom-unreal-buffer-functions'. They are passed one argument: the buffer to be -tested. - -Should any of its function returns non-nil, the rest of the functions are -ignored and the buffer is considered real. - -See `doom-real-buffer-p' for more information.") - -;;;###autoload -(defvar doom-unreal-buffer-functions - '(minibufferp doom-special-buffer-p doom-non-file-visiting-buffer-p) - "A list of predicate functions run to determine if a buffer is *not* real, -unlike `doom-real-buffer-functions'. They are passed one argument: the buffer to -be tested. - -Should any of these functions return non-nil, the rest of the functions are -ignored and the buffer is considered unreal. - -See `doom-real-buffer-p' for more information.") - -;;;###autoload -(defvar-local doom-real-buffer-p nil - "If non-nil, this buffer should be considered real no matter what. See -`doom-real-buffer-p' for more information.") - -;;;###autoload -(defvar doom-fallback-buffer-name "*scratch*" - "The name of the buffer to fall back to if no other buffers exist (will create -it if it doesn't exist).") - - -;; -;;; Functions - -;;;###autoload -(defun doom-buffer-frame-predicate (buf) - "To be used as the default frame buffer-predicate parameter. Returns nil if -BUF should be skipped over by functions like `next-buffer' and `other-buffer'." - (or (doom-real-buffer-p buf) - (eq buf (doom-fallback-buffer)))) - -;;;###autoload -(defun doom-fallback-buffer () - "Returns the fallback buffer, creating it if necessary. By default this is the -scratch buffer. See `doom-fallback-buffer-name' to change this." - (let (buffer-list-update-hook) - (get-buffer-create doom-fallback-buffer-name))) - -;;;###autoload -(defalias 'doom-buffer-list #'buffer-list) - -;;;###autoload -(defun doom-project-buffer-list (&optional project) - "Return a list of buffers belonging to the specified PROJECT. - -If PROJECT is nil, default to the current project. - -If no project is active, return all buffers." - (let ((buffers (doom-buffer-list))) - (if-let* ((project-root - (if project (expand-file-name project) - (doom-project-root)))) - (cl-loop for buf in buffers - if (projectile-project-buffer-p buf project-root) - collect buf) - buffers))) - -;;;###autoload -(defun doom-open-projects () - "Return a list of projects with open buffers." - (cl-loop with projects = (make-hash-table :test 'equal :size 8) - for buffer in (doom-buffer-list) - if (buffer-live-p buffer) - if (doom-real-buffer-p buffer) - if (with-current-buffer buffer (doom-project-root)) - do (puthash (abbreviate-file-name it) t projects) - finally return (hash-table-keys projects))) - -;;;###autoload -(defun doom-dired-buffer-p (buf) - "Returns non-nil if BUF is a dired buffer." - (provided-mode-derived-p (buffer-local-value 'major-mode buf) - 'dired-mode)) - -;;;###autoload -(defun doom-special-buffer-p (buf) - "Returns non-nil if BUF's name starts and ends with an *." - (equal (substring (buffer-name buf) 0 1) "*")) - -;;;###autoload -(defun doom-temp-buffer-p (buf) - "Returns non-nil if BUF is temporary." - (equal (substring (buffer-name buf) 0 1) " ")) - -;;;###autoload -(defun doom-visible-buffer-p (buf) - "Return non-nil if BUF is visible." - (get-buffer-window buf)) - -;;;###autoload -(defun doom-buried-buffer-p (buf) - "Return non-nil if BUF is not visible." - (not (doom-visible-buffer-p buf))) - -;;;###autoload -(defun doom-non-file-visiting-buffer-p (buf) - "Returns non-nil if BUF does not have a value for `buffer-file-name'." - (not (buffer-file-name buf))) - -;;;###autoload -(defun doom-real-buffer-list (&optional buffer-list) - "Return a list of buffers that satisfy `doom-real-buffer-p'." - (cl-remove-if-not #'doom-real-buffer-p (or buffer-list (doom-buffer-list)))) - -;;;###autoload -(defun doom-real-buffer-p (buffer-or-name) - "Returns t if BUFFER-OR-NAME is a 'real' buffer. - -A real buffer is a useful buffer; a first class citizen in Doom. Real ones -should get special treatment, because we will be spending most of our time in -them. Unreal ones should be low-profile and easy to cast aside, so we can focus -on real ones. - -The exact criteria for a real buffer is: - - 1. A non-nil value for the buffer-local value of the `doom-real-buffer-p' - variable OR - 2. Any function in `doom-real-buffer-functions' returns non-nil OR - 3. None of the functions in `doom-unreal-buffer-functions' must return - non-nil. - -If BUFFER-OR-NAME is omitted or nil, the current buffer is tested." - (or (bufferp buffer-or-name) - (stringp buffer-or-name) - (signal 'wrong-type-argument (list '(bufferp stringp) buffer-or-name))) - (when-let (buf (get-buffer buffer-or-name)) - (when-let (basebuf (buffer-base-buffer buf)) - (setq buf basebuf)) - (and (buffer-live-p buf) - (not (doom-temp-buffer-p buf)) - (or (buffer-local-value 'doom-real-buffer-p buf) - (run-hook-with-args-until-success 'doom-real-buffer-functions buf) - (not (run-hook-with-args-until-success 'doom-unreal-buffer-functions buf)))))) - -;;;###autoload -(defun doom-unreal-buffer-p (buffer-or-name) - "Return t if BUFFER-OR-NAME is an 'unreal' buffer. - -See `doom-real-buffer-p' for details on what that means." - (not (doom-real-buffer-p buffer-or-name))) - -;;;###autoload -(defun doom-buffers-in-mode (modes &optional buffer-list derived-p) - "Return a list of buffers whose `major-mode' is `eq' to MODE(S). - -If DERIVED-P, test with `derived-mode-p', otherwise use `eq'." - (let ((modes (doom-enlist modes))) - (cl-remove-if-not (if derived-p - (lambda (buf) - (apply #'provided-mode-derived-p - (buffer-local-value 'major-mode buf) - modes)) - (lambda (buf) - (memq (buffer-local-value 'major-mode buf) modes))) - (or buffer-list (doom-buffer-list))))) - -;;;###autoload -(defun doom-visible-windows (&optional window-list) - "Return a list of the visible, non-popup (dedicated) windows." - (cl-loop for window in (or window-list (window-list)) - when (or (window-parameter window 'visible) - (not (window-dedicated-p window))) - collect window)) - -;;;###autoload -(defun doom-visible-buffers (&optional buffer-list) - "Return a list of visible buffers (i.e. not buried)." - (let ((buffers (delete-dups (mapcar #'window-buffer (window-list))))) - (if buffer-list - (cl-delete-if (lambda (b) (memq b buffer-list)) - buffers) - (delete-dups buffers)))) - -;;;###autoload -(defun doom-buried-buffers (&optional buffer-list) - "Get a list of buffers that are buried." - (cl-remove-if #'get-buffer-window (or buffer-list (doom-buffer-list)))) - -;;;###autoload -(defun doom-matching-buffers (pattern &optional buffer-list) - "Get a list of all buffers that match the regex PATTERN." - (cl-loop for buf in (or buffer-list (doom-buffer-list)) - when (string-match-p pattern (buffer-name buf)) - collect buf)) - -;;;###autoload -(defun doom-set-buffer-real (buffer flag) - "Forcibly mark BUFFER as FLAG (non-nil = real). - -See `doom-real-buffer-p' for an explanation for real buffers." - (with-current-buffer buffer - (setq doom-real-buffer-p flag))) - -;;;###autoload -(defun doom-kill-buffer-and-windows (buffer) - "Kill the buffer and delete all the windows it's displayed in." - (dolist (window (get-buffer-window-list buffer)) - (unless (one-window-p t) - (delete-window window))) - (kill-buffer buffer)) - -;;;###autoload -(defun doom-fixup-windows (windows) - "Ensure that each of WINDOWS is showing a real buffer or the fallback buffer." - (dolist (window windows) - (with-selected-window window - (when (doom-unreal-buffer-p (window-buffer)) - (previous-buffer) - (when (doom-unreal-buffer-p (window-buffer)) - (switch-to-buffer (doom-fallback-buffer))))))) - -;;;###autoload -(defun doom-kill-buffer-fixup-windows (buffer) - "Kill the BUFFER and ensure all the windows it was displayed in have switched -to a real buffer or the fallback buffer." - (let ((windows (get-buffer-window-list buffer))) - (kill-buffer buffer) - (doom-fixup-windows (cl-remove-if-not #'window-live-p windows)))) - -;;;###autoload -(defun doom-kill-buffers-fixup-windows (buffers) - "Kill the BUFFERS and ensure all the windows they were displayed in have -switched to a real buffer or the fallback buffer." - (let ((seen-windows (make-hash-table :test 'eq :size 8))) - (dolist (buffer buffers) - (let ((windows (get-buffer-window-list buffer))) - (kill-buffer buffer) - (dolist (window (cl-remove-if-not #'window-live-p windows)) - (puthash window t seen-windows)))) - (doom-fixup-windows (hash-table-keys seen-windows)))) - -;;;###autoload -(defun doom-kill-matching-buffers (pattern &optional buffer-list) - "Kill all buffers (in current workspace OR in BUFFER-LIST) that match the -regex PATTERN. Returns the number of killed buffers." - (let ((buffers (doom-matching-buffers pattern buffer-list))) - (dolist (buf buffers (length buffers)) - (kill-buffer buf)))) - - -;; -;; Hooks - -;;;###autoload -(defun doom-mark-buffer-as-real-h () - "Hook function that marks the current buffer as real. - -See `doom-real-buffer-p' for an explanation for real buffers." - (doom-set-buffer-real (current-buffer) t)) - - -;; -;; Interactive commands - -;;;###autoload -(defun doom/save-and-kill-buffer () - "Save the current buffer to file, then kill it." - (interactive) - (save-buffer) - (kill-current-buffer)) - -;;;###autoload -(defun doom/kill-this-buffer-in-all-windows (buffer &optional dont-save) - "Kill BUFFER globally and ensure all windows previously showing this buffer -have switched to a real buffer or the fallback buffer. - -If DONT-SAVE, don't prompt to save modified buffers (discarding their changes)." - (interactive - (list (current-buffer) current-prefix-arg)) - (cl-assert (bufferp buffer) t) - (when (and (buffer-modified-p buffer) dont-save) - (with-current-buffer buffer - (set-buffer-modified-p nil))) - (doom-kill-buffer-fixup-windows buffer)) - - -(defun doom--message-or-count (interactive message count) - (if interactive - (message message count) - count)) - -;;;###autoload -(defun doom/kill-all-buffers (&optional buffer-list interactive) - "Kill all buffers and closes their windows. - -If the prefix arg is passed, doesn't close windows and only kill buffers that -belong to the current project." - (interactive - (list (if current-prefix-arg - (doom-project-buffer-list) - (doom-buffer-list)) - t)) - (if (null buffer-list) - (message "No buffers to kill") - (save-some-buffers) - (delete-other-windows) - (when (memq (current-buffer) buffer-list) - (switch-to-buffer (doom-fallback-buffer))) - (mapc #'kill-buffer buffer-list) - (doom--message-or-count - interactive "Killed %d buffers" - (- (length buffer-list) - (length (cl-remove-if-not #'buffer-live-p buffer-list)))))) - -;;;###autoload -(defun doom/kill-other-buffers (&optional buffer-list interactive) - "Kill all other buffers (besides the current one). - -If the prefix arg is passed, kill only buffers that belong to the current -project." - (interactive - (list (delq (current-buffer) - (if current-prefix-arg - (doom-project-buffer-list) - (doom-buffer-list))) - t)) - (mapc #'doom-kill-buffer-and-windows buffer-list) - (doom--message-or-count - interactive "Killed %d other buffers" - (- (length buffer-list) - (length (cl-remove-if-not #'buffer-live-p buffer-list))))) - -;;;###autoload -(defun doom/kill-matching-buffers (pattern &optional buffer-list interactive) - "Kill buffers that match PATTERN in BUFFER-LIST. - -If the prefix arg is passed, only kill matching buffers in the current project." - (interactive - (list (read-regexp "Buffer pattern: ") - (if current-prefix-arg - (doom-project-buffer-list) - (doom-buffer-list)) - t)) - (doom-kill-matching-buffers pattern buffer-list) - (when interactive - (message "Killed %d buffer(s)" - (- (length buffer-list) - (length (cl-remove-if-not #'buffer-live-p buffer-list)))))) - -;;;###autoload -(defun doom/kill-buried-buffers (&optional buffer-list interactive) - "Kill buffers that are buried. - -If PROJECT-P (universal argument), only kill buried buffers belonging to the -current project." - (interactive - (list (doom-buried-buffers - (if current-prefix-arg (doom-project-buffer-list))) - t)) - (mapc #'kill-buffer buffer-list) - (doom--message-or-count - interactive "Killed %d buried buffers" - (- (length buffer-list) - (length (cl-remove-if-not #'buffer-live-p buffer-list))))) - -;;;###autoload -(defun doom/kill-project-buffers (project &optional interactive) - "Kill buffers for the specified PROJECT." - (interactive - (list (if-let (open-projects (doom-open-projects)) - (completing-read - "Kill buffers for project: " open-projects - nil t nil nil - (if-let* ((project-root (doom-project-root)) - (project-root (abbreviate-file-name project-root)) - ((member project-root open-projects))) - project-root)) - (message "No projects are open!") - nil) - t)) - (when project - (let ((buffer-list (doom-project-buffer-list project))) - (doom-kill-buffers-fixup-windows buffer-list) - (doom--message-or-count - interactive "Killed %d project buffers" - (- (length buffer-list) - (length (cl-remove-if-not #'buffer-live-p buffer-list))))))) diff --git a/.config/emacs/core/autoload/config.el b/.config/emacs/core/autoload/config.el deleted file mode 100644 index de34727..0000000 --- a/.config/emacs/core/autoload/config.el +++ /dev/null @@ -1,129 +0,0 @@ -;;; core/autoload/config.el -*- lexical-binding: t; -*- - -(defvar doom-bin-dir (concat doom-emacs-dir "bin/")) -(defvar doom-bin (concat doom-bin-dir "doom")) - -;;;###autoload -(defvar doom-reloading-p nil - "TODO") - -;;;###autoload -(defun doom/open-private-config () - "Browse your `doom-private-dir'." - (interactive) - (unless (file-directory-p doom-private-dir) - (make-directory doom-private-dir t)) - (doom-project-browse doom-private-dir)) - -;;;###autoload -(defun doom/find-file-in-private-config () - "Search for a file in `doom-private-dir'." - (interactive) - (doom-project-find-file doom-private-dir)) - -;;;###autoload -(defun doom/goto-private-init-file () - "Open your private init.el file. -And jumps to your `doom!' block." - (interactive) - (find-file (expand-file-name "init.el" doom-private-dir)) - (goto-char - (or (save-excursion - (goto-char (point-min)) - (search-forward "(doom!" nil t)) - (point)))) - -;;;###autoload -(defun doom/goto-private-config-file () - "Open your private config.el file." - (interactive) - (find-file (expand-file-name "config.el" doom-private-dir))) - -;;;###autoload -(defun doom/goto-private-packages-file () - "Open your private packages.el file." - (interactive) - (find-file (expand-file-name "packages.el" doom-private-dir))) - - -;; -;;; Managements - -(defmacro doom--if-compile (command on-success &optional on-failure) - (declare (indent 2)) - `(let ((default-directory doom-emacs-dir)) - (with-current-buffer (compile ,command t) - (let ((w (get-buffer-window (current-buffer)))) - (select-window w) - (add-hook - 'compilation-finish-functions - (lambda (_buf status) - (if (equal status "finished\n") - (progn - (delete-window w) - ,on-success) - ,on-failure)) - nil 'local))))) - -;;;###autoload -(defun doom/reload () - "Reloads your private config. - -This is experimental! It will try to do as `bin/doom sync' does, but from within -this Emacs session. i.e. it reload autoloads files (if necessary), reloads your -package list, and lastly, reloads your private config.el. - -Runs `doom-after-reload-hook' afterwards." - (interactive) - (mapc #'require (cdr doom-incremental-packages)) - (doom--if-compile (format "%S sync -e" doom-bin) - (let ((doom-reloading-p t)) - (doom-run-hooks 'doom-before-reload-hook) - (doom-initialize 'force) - (with-demoted-errors "PRIVATE CONFIG ERROR: %s" - (general-auto-unbind-keys) - (unwind-protect - (doom-initialize-modules 'force) - (general-auto-unbind-keys t))) - (doom-run-hooks 'doom-after-reload-hook) - (message "Config successfully reloaded!")) - (user-error "Failed to reload your config"))) - -;;;###autoload -(defun doom/reload-autoloads () - "Reload only `doom-autoloads-file' and `doom-package-autoload-file'. - -This is much faster and safer than `doom/reload', but not as comprehensive. This -reloads your package and module visibility, but does not install new packages or -remove orphaned ones. It also doesn't reload your private config. - -It is useful to only pull in changes performed by 'doom sync' on the command -line." - (interactive) - (require 'core-cli) - (require 'core-packages) - (doom-initialize-packages) - (doom-autoloads-reload)) - -;;;###autoload -(defun doom/reload-env () - "Reloads your envvar file. - -DOES NOT REGENERATE IT. You must run 'doom env' in your shell OUTSIDE of Emacs. -Doing so from within Emacs will taint your shell environment. - -An envvar file contains a snapshot of your shell environment, which can be -imported into Emacs." - (interactive) - (let ((default-directory doom-emacs-dir)) - (with-temp-buffer - (doom-load-envvars-file doom-env-file) - (message "Reloaded %S" (abbreviate-file-name doom-env-file))))) - -;;;###autoload -(defun doom/upgrade () - "Run 'doom upgrade' then prompt to restart Emacs." - (interactive) - (doom--if-compile (format "%S -y upgrade" doom-bin) - (when (y-or-n-p "You must restart Emacs for the upgrade to take effect.\n\nRestart Emacs?") - (doom/restart-and-restore)))) diff --git a/.config/emacs/core/autoload/debug.el b/.config/emacs/core/autoload/debug.el deleted file mode 100644 index 4cddca1..0000000 --- a/.config/emacs/core/autoload/debug.el +++ /dev/null @@ -1,363 +0,0 @@ -;;; core/autoload/debug.el -*- lexical-binding: t; -*- - -;; -;;; Doom's debug mode - -;;;###autoload -(defvar doom-debug-variables - '(async-debug - debug-on-error - doom-debug-p - garbage-collection-messages - gcmh-verbose - init-file-debug - jka-compr-verbose - url-debug - use-package-verbose - (message-log-max . 16384)) - "A list of variable to toggle on `doom-debug-mode'. - -Each entry can be a variable symbol or a cons cell whose CAR is the variable -symbol and CDR is the value to set it to when `doom-debug-mode' is activated.") - -(defvar doom--debug-vars-undefined nil) - -(defun doom--watch-debug-vars-h (&rest _) - (when-let (bound-vars (cl-remove-if-not #'boundp doom--debug-vars-undefined)) - (doom-log "New variables available: %s" bound-vars) - (let ((message-log-max nil)) - (doom-debug-mode -1) - (doom-debug-mode +1)))) - -;;;###autoload -(define-minor-mode doom-debug-mode - "Toggle `debug-on-error' and `doom-debug-p' for verbose logging." - :init-value nil - :global t - (let ((enabled doom-debug-mode)) - (setq doom--debug-vars-undefined nil) - (dolist (var doom-debug-variables) - (cond ((listp var) - (cl-destructuring-bind (var . val) var - (if (boundp var) - (set-default - var (if (not enabled) - (prog1 (get var 'initial-value) - (put 'x 'initial-value nil)) - (put var 'initial-value (symbol-value var)) - val)) - (add-to-list 'doom--debug-vars-undefined var)))) - ((if (boundp var) - (set-default var enabled) - (add-to-list 'doom--debug-vars-undefined var))))) - (when (called-interactively-p 'any) - (when (fboundp 'explain-pause-mode) - (explain-pause-mode (if enabled +1 -1)))) - ;; Watch for changes in `doom-debug-variables', or when packages load (and - ;; potentially define one of `doom-debug-variables'), in case some of them - ;; aren't defined when `doom-debug-mode' is first loaded. - (cond (enabled - (add-variable-watcher 'doom-debug-variables #'doom--watch-debug-vars-h) - (add-hook 'after-load-functions #'doom--watch-debug-vars-h)) - (t - (remove-variable-watcher 'doom-debug-variables #'doom--watch-debug-vars-h) - (remove-hook 'after-load-functions #'doom--watch-debug-vars-h))) - (message "Debug mode %s" (if enabled "on" "off")))) - - -;; -;;; Hooks - -;;;###autoload -(defun doom-run-all-startup-hooks-h () - "Run all startup Emacs hooks. Meant to be executed after starting Emacs with --q or -Q, for example: - - emacs -Q -l init.el -f doom-run-all-startup-hooks-h" - (setq after-init-time (current-time)) - (let ((inhibit-startup-hooks nil)) - (doom-run-hooks 'after-init-hook - 'delayed-warnings-hook - 'emacs-startup-hook - 'tty-setup-hook - 'window-setup-hook))) - - -;; -;;; Helpers - -(defsubst doom--collect-forms-in (file form) - (when (file-readable-p file) - (let (forms) - (with-temp-buffer - (insert-file-contents file) - (let (emacs-lisp-mode-hook) (emacs-lisp-mode)) - (while (re-search-forward (format "(%s " (regexp-quote form)) nil t) - (let ((ppss (syntax-ppss))) - (unless (or (nth 4 ppss) - (nth 3 ppss)) - (save-excursion - (goto-char (match-beginning 0)) - (push (sexp-at-point) forms))))) - (nreverse forms))))) - -;;;###autoload -(defun doom-info () - "Returns diagnostic information about the current Emacs session in markdown, -ready to be pasted in a bug report on github." - (require 'vc-git) - (require 'core-packages) - (let ((default-directory doom-emacs-dir)) - (letf! ((defun sh (&rest args) (cdr (apply #'doom-call-process args))) - (defun cat (file &optional limit) - (with-temp-buffer - (insert-file-contents file nil 0 limit) - (buffer-string))) - (defun abbrev-path (path) - (replace-regexp-in-string - (regexp-opt (list (user-login-name)) 'words) "$USER" - (abbreviate-file-name path))) - (defun symlink-path (file) - (format "%s%s" (abbrev-path file) - (if (file-symlink-p file) "" - (concat " -> " (abbrev-path (file-truename file))))))) - `((generated . ,(format-time-string "%b %d, %Y %H:%M:%S")) - (system . ,(delq - nil (list (doom-system-distro-version) - (when (executable-find "uname") - (sh "uname" "-msr")) - (window-system)))) - (emacs . ,(delq - nil (list emacs-version - (bound-and-true-p emacs-repository-branch) - (and (stringp emacs-repository-version) - (substring emacs-repository-version 0 9)) - (symlink-path doom-emacs-dir)))) - (doom . ,(list doom-version - (sh "git" "log" "-1" "--format=%D %h %ci") - (symlink-path doom-private-dir))) - (shell . ,(abbrev-path shell-file-name)) - (features . ,system-configuration-features) - (traits - . ,(mapcar - #'symbol-name - (delq - nil (list (cond ((not doom-interactive-p) 'batch) - ((display-graphic-p) 'gui) - ('tty)) - (if (daemonp) 'daemon) - (if (and (require 'server) - (server-running-p)) - 'server-running) - (if (boundp 'chemacs-profiles-path) - 'chemacs) - (if (file-exists-p doom-env-file) - 'envvar-file) - (if (featurep 'exec-path-from-shell) - 'exec-path-from-shell) - (if (file-symlink-p user-emacs-directory) - 'symlinked-emacsdir) - (if (file-symlink-p doom-private-dir) - 'symlinked-doomdir) - (if (and (stringp custom-file) (file-exists-p custom-file)) - 'custom-file) - (if (doom-files-in `(,@doom-modules-dirs - ,doom-core-dir - ,doom-private-dir) - :type 'files :match "\\.elc$") - 'byte-compiled-config))))) - (custom - ,@(when (and (stringp custom-file) - (file-exists-p custom-file)) - (cl-loop for (type var _) in (get 'user 'theme-settings) - if (eq type 'theme-value) - collect var))) - (modules - ,@(or (cl-loop with cat = nil - for key being the hash-keys of doom-modules - if (or (not cat) - (not (eq cat (car key)))) - do (setq cat (car key)) - and collect cat - collect - (let* ((flags (doom-module-get cat (cdr key) :flags)) - (path (doom-module-get cat (cdr key) :path)) - (module (append (cond ((null path) - (list '&nopath)) - ((file-in-directory-p path doom-private-dir) - (list '&user))) - (if flags - `(,(cdr key) ,@flags) - (list (cdr key)))))) - (if (= (length module) 1) - (car module) - module))) - '("n/a"))) - (packages - ,@(condition-case e - (mapcar - #'cdr (doom--collect-forms-in - (doom-path doom-private-dir "packages.el") - "package!")) - (error (format "<%S>" e)))) - (unpin - ,@(condition-case e - (mapcan #'identity - (mapcar - #'cdr (doom--collect-forms-in - (doom-path doom-private-dir "packages.el") - "unpin!"))) - (error (list (format "<%S>" e))))) - (elpa - ,@(condition-case e - (progn - (package-initialize) - (cl-loop for (name . _) in package-alist - collect (format "%s" name))) - (error (format "<%S>" e)))))))) - - -;; -;;; Commands - -;;;###autoload -(defun doom/version () - "Display the current version and ocmit of Doom & Emacs." - (interactive) - (let ((default-directory doom-emacs-dir)) - (print! "Doom emacs\tv%-15s %s" - doom-version - (or (cdr (doom-call-process "git" "log" "-1" "--format=%D %h %ci")) - "n/a"))) - (let ((default-directory doom-core-dir)) - (print! "Doom core\tv%-15s %s" - doom-core-version - (or (cdr (doom-call-process "git" "log" "-1" "--format=%D %h %ci")) - "n/a")))) - -;;;###autoload -(defun doom/info (&optional raw) - "Collects some debug information about your Emacs session, formats it and -copies it to your clipboard, ready to be pasted into bug reports!" - (interactive "P") - (let ((buffer (get-buffer-create "*doom info*")) - (info (doom-info))) - (with-current-buffer buffer - (erase-buffer) - (if raw - (progn - (save-excursion - (pp info (current-buffer))) - (dolist (sym '(modules packages)) - (when (re-search-forward (format "^ *\\((%s\\)" sym) nil t) - (goto-char (match-beginning 1)) - (cl-destructuring-bind (beg . end) - (bounds-of-thing-at-point 'sexp) - (let ((sexp (prin1-to-string (sexp-at-point)))) - (delete-region beg end) - (insert sexp)))))) - (dolist (spec info) - (when (cdr spec) - (insert! "%-11s %s\n" - ((car spec) - (if (listp (cdr spec)) - (mapconcat (lambda (x) (format "%s" x)) - (cdr spec) " ") - (cdr spec))))))) - (if (not doom-interactive-p) - (print! (buffer-string)) - (with-current-buffer (pop-to-buffer buffer) - (setq buffer-read-only t) - (goto-char (point-min)) - (kill-new (buffer-string)) - (when (y-or-n-p "Your doom-info was copied to the clipboard.\n\nOpen pastebin.com?") - (browse-url "https://pastebin.com"))))))) - - -;;;###autoload -(defun doom/am-i-secure () - "Test to see if your root certificates are securely configured in emacs. -Some items are not supported by the `nsm.el' module." - (declare (interactive-only t)) - (interactive) - (unless (string-match-p "\\_" system-configuration-features) - (warn "gnutls support isn't built into Emacs, there may be problems")) - (if-let* ((bad-hosts - (cl-loop for bad - in '("https://expired.badssl.com/" - "https://wrong.host.badssl.com/" - "https://self-signed.badssl.com/" - "https://untrusted-root.badssl.com/" - ;; "https://revoked.badssl.com/" - ;; "https://pinning-test.badssl.com/" - "https://sha1-intermediate.badssl.com/" - "https://rc4-md5.badssl.com/" - "https://rc4.badssl.com/" - "https://3des.badssl.com/" - "https://null.badssl.com/" - "https://sha1-intermediate.badssl.com/" - ;; "https://client-cert-missing.badssl.com/" - "https://dh480.badssl.com/" - "https://dh512.badssl.com/" - "https://dh-small-subgroup.badssl.com/" - "https://dh-composite.badssl.com/" - "https://invalid-expected-sct.badssl.com/" - ;; "https://no-sct.badssl.com/" - ;; "https://mixed-script.badssl.com/" - ;; "https://very.badssl.com/" - "https://subdomain.preloaded-hsts.badssl.com/" - "https://superfish.badssl.com/" - "https://edellroot.badssl.com/" - "https://dsdtestprovider.badssl.com/" - "https://preact-cli.badssl.com/" - "https://webpack-dev-server.badssl.com/" - "https://captive-portal.badssl.com/" - "https://mitm-software.badssl.com/" - "https://sha1-2016.badssl.com/" - "https://sha1-2017.badssl.com/") - if (condition-case _e - (url-retrieve-synchronously bad) - (error nil)) - collect bad))) - (error "tls seems to be misconfigured (it got %s)." - bad-hosts) - (url-retrieve "https://badssl.com" - (lambda (status) - (if (or (not status) (plist-member status :error)) - (warn "Something went wrong.\n\n%s" (pp-to-string status)) - (message "Your trust roots are set up properly.\n\n%s" (pp-to-string status)) - t))))) - - -;; -;;; Reporting bugs - -;;;###autoload -(defun doom/copy-buffer-contents (buffer-name) - "Copy the contents of BUFFER-NAME to your clipboard." - (interactive - (list (if current-prefix-arg - (completing-read "Select buffer: " (mapcar #'buffer-name (buffer-list))) - (buffer-name (current-buffer))))) - (let ((buffer (get-buffer buffer-name))) - (unless (buffer-live-p buffer) - (user-error "Buffer isn't live")) - (kill-new - (with-current-buffer buffer - (substring-no-properties (buffer-string)))) - (message "Contents of %S were copied to the clipboard" buffer-name))) - - -;; -;;; Profiling - -(defvar doom--profiler nil) -;;;###autoload -(defun doom/toggle-profiler () - "Toggle the Emacs profiler. Run it again to see the profiling report." - (interactive) - (if (not doom--profiler) - (profiler-start 'cpu+mem) - (profiler-report) - (profiler-stop)) - (setq doom--profiler (not doom--profiler))) diff --git a/.config/emacs/core/autoload/files.el b/.config/emacs/core/autoload/files.el deleted file mode 100644 index 66fde92..0000000 --- a/.config/emacs/core/autoload/files.el +++ /dev/null @@ -1,347 +0,0 @@ -;;; core/autoload/files.el -*- lexical-binding: t; -*- - -(defun doom--resolve-path-forms (spec &optional directory) - "Converts a simple nested series of or/and forms into a series of -`file-exists-p' checks. - -For example - - (doom--resolve-path-forms - '(or A (and B C)) - \"~\") - -Returns (approximately): - - '(let* ((_directory \"~\") - (A (expand-file-name A _directory)) - (B (expand-file-name B _directory)) - (C (expand-file-name C _directory))) - (or (and (file-exists-p A) A) - (and (if (file-exists-p B) B) - (if (file-exists-p C) C)))) - -This is used by `file-exists-p!' and `project-file-exists-p!'." - (declare (pure t) (side-effect-free t)) - (if (and (listp spec) - (memq (car spec) '(or and))) - (cons (car spec) - (mapcar (doom-rpartial #'doom--resolve-path-forms directory) - (cdr spec))) - (let ((filevar (make-symbol "file"))) - `(let ((,filevar ,spec)) - (and (stringp ,filevar) - ,(if directory - `(let ((default-directory ,directory)) - (file-exists-p ,filevar)) - `(file-exists-p ,filevar)) - ,filevar))))) - -;;;###autoload -(defun doom-path (&rest segments) - "Constructs a file path from SEGMENTS. -Ignores `nil' elements in SEGMENTS." - (let ((segments (remq nil segments)) - file-name-handler-alist - dir) - (while segments - (setq segment (pop segments) - dir (expand-file-name - (if (listp segment) - (apply #'doom-path dir segment) - segment) - dir))) - dir)) - -;;;###autoload -(defun doom-glob (&rest segments) - "Construct a path from SEGMENTS and expand glob patterns. -Returns nil if the path doesn't exist. -Ignores `nil' elements in SEGMENTS." - (let (case-fold-search) - (file-expand-wildcards (apply #'doom-path segments) t))) - -;;;###autoload -(defun doom-dir (&rest segments) - "Constructs a path from SEGMENTS. -See `doom-path'. -Ignores `nil' elements in SEGMENTS." - (when-let (path (doom-path segments)) - (directory-file-name path))) - -;;;###autoload -(cl-defun doom-files-in - (paths &rest rest - &key - filter - map - (full t) - (follow-symlinks t) - (type 'files) - (relative-to (unless full default-directory)) - (depth 99999) - (mindepth 0) - (match "/[^._][^/]+")) - "Return a list of files/directories in PATHS (one string or a list of them). - -FILTER is a function or symbol that takes one argument (the path). If it returns -non-nil, the entry will be excluded. - -MAP is a function or symbol which will be used to transform each entry in the -results. - -TYPE determines what kind of path will be included in the results. This can be t -(files and folders), 'files or 'dirs. - -By default, this function returns paths relative to PATH-OR-PATHS if it is a -single path. If it a list of paths, this function returns absolute paths. -Otherwise, by setting RELATIVE-TO to a path, the results will be transformed to -be relative to it. - -The search recurses up to DEPTH and no further. DEPTH is an integer. - -MATCH is a string regexp. Only entries that match it will be included." - (let (result) - (dolist (file (mapcan (doom-rpartial #'doom-glob "*") (doom-enlist paths))) - (cond ((file-directory-p file) - (appendq! - result - (and (memq type '(t dirs)) - (string-match-p match file) - (not (and filter (funcall filter file))) - (not (and (file-symlink-p file) - (not follow-symlinks))) - (<= mindepth 0) - (list (cond (map (funcall map file)) - (relative-to (file-relative-name file relative-to)) - (file)))) - (and (>= depth 1) - (apply #'doom-files-in file - (append (list :mindepth (1- mindepth) - :depth (1- depth) - :relative-to relative-to) - rest))))) - ((and (memq type '(t files)) - (string-match-p match file) - (not (and filter (funcall filter file))) - (<= mindepth 0)) - (push (if relative-to - (file-relative-name file relative-to) - file) - result)))) - result)) - -;;;###autoload -(defun doom-file-cookie-p (file &optional cookie null-value) - "Returns the evaluated result of FORM in a ;;;###COOKIE FORM at the top of -FILE. - -If COOKIE doesn't exist, or cookie isn't within the first 256 bytes of FILE, -return NULL-VALUE." - (unless (file-exists-p file) - (signal 'file-missing file)) - (unless (file-readable-p file) - (error "%S is unreadable" file)) - (with-temp-buffer - (insert-file-contents file nil 0 256) - (if (re-search-forward (format "^;;;###%s " (regexp-quote (or cookie "if"))) - nil t) - (let ((load-file-name file)) - (eval (sexp-at-point) t)) - null-value))) - -;;;###autoload -(defmacro file-exists-p! (files &optional directory) - "Returns non-nil if the FILES in DIRECTORY all exist. - -DIRECTORY is a path; defaults to `default-directory'. - -Returns the last file found to meet the rules set by FILES, which can be a -single file or nested compound statement of `and' and `or' statements." - `(let ((p ,(doom--resolve-path-forms files directory))) - (and p (expand-file-name p ,directory)))) - -;;;###autoload -(defun doom-file-size (file &optional dir) - "Returns the size of FILE (in DIR) in bytes." - (let ((file (expand-file-name file dir))) - (unless (file-exists-p file) - (error "Couldn't find file %S" file)) - (unless (file-readable-p file) - (error "File %S is unreadable; can't acquire its filesize" - file)) - (nth 7 (file-attributes file)))) - -(defvar w32-get-true-file-attributes) -;;;###autoload -(defun doom-directory-size (dir) - "Returns the size of FILE (in DIR) in kilobytes." - (unless (file-directory-p dir) - (error "Directory %S does not exist" dir)) - (if (executable-find "du") - (/ (string-to-number (cdr (doom-call-process "du" "-sb" dir))) - 1024.0) - ;; REVIEW This is slow and terribly inaccurate, but it's something - (let ((w32-get-true-file-attributes t) - (file-name-handler-alist dir) - (max-lisp-eval-depth 5000) - (sum 0.0)) - (dolist (attrs (directory-files-and-attributes dir nil nil t) sum) - (unless (member (car attrs) '("." "..")) - (cl-incf - sum (if (eq (nth 1 attrs) t) ; is directory - (doom-directory-size (expand-file-name (car attrs) dir)) - (/ (nth 8 attrs) 1024.0)))))))) - - -;; -;;; Helpers - -(defun doom--update-files (&rest files) - "Ensure FILES are updated in `recentf', `magit' and `save-place'." - (let (toplevels) - (dolist (file files) - (when (featurep 'vc) - (vc-file-clearprops file) - (when-let (buffer (get-file-buffer file)) - (with-current-buffer buffer - (vc-refresh-state)))) - (when (featurep 'magit) - (when-let (default-directory (magit-toplevel (file-name-directory file))) - (cl-pushnew default-directory toplevels))) - (unless (file-readable-p file) - (when (bound-and-true-p recentf-mode) - (recentf-remove-if-non-kept file)) - (when (and (bound-and-true-p projectile-mode) - (doom-project-p) - (projectile-file-cached-p file (doom-project-root))) - (projectile-purge-file-from-cache file)))) - (dolist (default-directory toplevels) - (magit-refresh)) - (when (bound-and-true-p save-place-mode) - (save-place-forget-unreadable-files)))) - - -;; -;;; Commands - -;;;###autoload -(defun doom/delete-this-file (&optional path force-p) - "Delete PATH, kill its buffers and expunge it from vc/magit cache. - -If PATH is not specified, default to the current buffer's file. - -If FORCE-P, delete without confirmation." - (interactive - (list (buffer-file-name (buffer-base-buffer)) - current-prefix-arg)) - (let* ((path (or path (buffer-file-name (buffer-base-buffer)))) - (short-path (abbreviate-file-name path))) - (unless (and path (file-exists-p path)) - (user-error "Buffer is not visiting any file")) - (unless (file-exists-p path) - (error "File doesn't exist: %s" path)) - (unless (or force-p (y-or-n-p (format "Really delete %S?" short-path))) - (user-error "Aborted")) - (let ((buf (current-buffer))) - (unwind-protect - (progn (delete-file path t) t) - (if (file-exists-p path) - (error "Failed to delete %S" short-path) - ;; Ensures that windows displaying this buffer will be switched to - ;; real buffers (`doom-real-buffer-p') - (doom/kill-this-buffer-in-all-windows buf t) - (doom--update-files path) - (message "Deleted %S" short-path)))))) - -;;;###autoload -(defun doom/copy-this-file (new-path &optional force-p) - "Copy current buffer's file to NEW-PATH. - -If FORCE-P, overwrite the destination file if it exists, without confirmation." - (interactive - (list (read-file-name "Copy file to: ") - current-prefix-arg)) - (unless (and buffer-file-name (file-exists-p buffer-file-name)) - (user-error "Buffer is not visiting any file")) - (let ((old-path (buffer-file-name (buffer-base-buffer))) - (new-path (expand-file-name new-path))) - (make-directory (file-name-directory new-path) 't) - (copy-file old-path new-path (or force-p 1)) - (doom--update-files old-path new-path) - (message "File copied to %S" (abbreviate-file-name new-path)))) - -;;;###autoload -(defun doom/move-this-file (new-path &optional force-p) - "Move current buffer's file to NEW-PATH. - -If FORCE-P, overwrite the destination file if it exists, without confirmation." - (interactive - (list (read-file-name "Move file to: ") - current-prefix-arg)) - (unless (and buffer-file-name (file-exists-p buffer-file-name)) - (user-error "Buffer is not visiting any file")) - (let ((old-path (buffer-file-name (buffer-base-buffer))) - (new-path (expand-file-name new-path))) - (when (directory-name-p new-path) - (setq new-path (concat new-path (file-name-nondirectory old-path)))) - (make-directory (file-name-directory new-path) 't) - (rename-file old-path new-path (or force-p 1)) - (set-visited-file-name new-path t t) - (doom--update-files old-path new-path) - (message "File moved to %S" (abbreviate-file-name new-path)))) - -(defun doom--sudo-file-path (file) - (let ((host (or (file-remote-p file 'host) "localhost"))) - (concat "/" (when (file-remote-p file) - (concat (file-remote-p file 'method) ":" - (if-let (user (file-remote-p file 'user)) - (concat user "@" host) - host) - "|")) - "sudo:root@" host - ":" (or (file-remote-p file 'localname) - file)))) - -;;;###autoload -(defun doom/sudo-find-file (file) - "Open FILE as root." - (interactive "FOpen file as root: ") - (find-file (doom--sudo-file-path file))) - -;;;###autoload -(defun doom/sudo-this-file () - "Open the current file as root." - (interactive) - (find-file - (doom--sudo-file-path - (or buffer-file-name - (when (or (derived-mode-p 'dired-mode) - (derived-mode-p 'wdired-mode)) - default-directory))))) - -;;;###autoload -(defun doom/sudo-save-buffer () - "Save this file as root." - (interactive) - (let ((file (doom--sudo-file-path buffer-file-name))) - (if-let (buffer (find-file-noselect file)) - (let ((origin (current-buffer))) - (copy-to-buffer buffer (point-min) (point-max)) - (unwind-protect - (with-current-buffer buffer - (save-buffer)) - (unless (eq origin buffer) - (kill-buffer buffer)) - (with-current-buffer origin - (revert-buffer t t)))) - (user-error "Unable to open %S" file)))) - -;;;###autoload -(defun doom/remove-recent-file (file) - "Remove FILE from your recently-opened-files list." - (interactive - (list (completing-read "Remove recent file: " recentf-list - nil t))) - (setq recentf-list (delete file recentf-list)) - (recentf-save-list) - (message "Removed %S from `recentf-list'" (abbreviate-file-name file))) diff --git a/.config/emacs/core/autoload/fonts.el b/.config/emacs/core/autoload/fonts.el deleted file mode 100644 index 558c97c..0000000 --- a/.config/emacs/core/autoload/fonts.el +++ /dev/null @@ -1,180 +0,0 @@ -;;; core/autoload/fonts.el -*- lexical-binding: t; -*- - -;;;###autoload -(defvar doom-font-increment 2 - "How many steps to increase the font size each time `doom/increase-font-size' -or `doom/decrease-font-size' are invoked.") - -;;;###autoload -(defvar doom-big-font nil - "The font to use for `doom-big-font-mode'. -If nil, `doom-font' will be used, scaled up by `doom-big-font-increment'. See -`doom-font' for details on acceptable values for this variable.") - -;;;###autoload -(defvar doom-big-font-increment 4 - "How many steps to increase the font size (with `doom-font' as the base) when -`doom-big-font-mode' is enabled and `doom-big-font' is nil.") - - -;; -;;; Library - -;;;###autoload -(defun doom-normalize-font (font) - "Return FONT as a normalized font spec. - -The font will be normalized (i.e. :weight, :slant, and :width will set to -'normal if not specified) before it is converted. - -FONT can be a `font-spec', a font object, an XFT font string, or an XLFD font -string." - (cl-check-type font (or font string vector)) - (when (and (stringp font) - (string-prefix-p "-" font)) - (setq font (x-decompose-font-name font))) - (let* ((font - (cond ((stringp font) - (dolist (prop '("weight" "slant" "width") (aref (font-info font) 0)) - (unless (string-match-p (format ":%s=" prop) font) - (setq font (concat font ":" prop "=normal"))))) - ((fontp font) - (dolist (prop '(:weight :slant :width) (font-xlfd-name font)) - (unless (font-get font prop) - (font-put font prop 'normal)))) - ((vectorp font) - (dolist (i '(1 2 3) (x-compose-font-name font)) - (unless (aref font i) - (aset font i "normal")))))) - (font (x-resolve-font-name font)) - (font (font-spec :name font))) - (unless (font-get font :size) - (font-put font :size - (font-get (font-spec :name (face-font 'default)) - :size))) - font)) - -;;;###autoload -(defun doom-adjust-font-size (increment &optional fixed-size-p font-alist) - "Increase size of font in FRAME by INCREMENT. - -If FIXED-SIZE-P is non-nil, treat INCREMENT as a font size, rather than a -scaling factor. - -FONT-ALIST is an alist give temporary values to certain Doom font variables, -like `doom-font' or `doom-variable-pitch-font'. e.g. - - `((doom-font . ,(font-spec :family \"Sans Serif\" :size 12))) - -Doesn't work in terminal Emacs." - (unless (display-multi-font-p) - (user-error "Cannot resize fonts in terminal Emacs")) - (condition-case-unless-debug e - (let (changed) - (dolist (sym '((doom-font . default) - (doom-serif-font . fixed-pitch-serif) - (doom-variable-pitch-font . variable-pitch)) - (when changed - (doom-init-fonts-h 'reload) - t)) - (cl-destructuring-bind (var . face) sym - (if (null increment) - (when (get var 'initial-value) - (set var (get var 'initial-value)) - (put var 'initial-value nil) - (setq changed t)) - (let* ((original-font (or (symbol-value var) - (face-font face t) - (with-temp-buffer (face-font face)))) - (font (doom-normalize-font original-font)) - (dfont - (or (if-let* ((remap-font (alist-get var font-alist)) - (remap-xlfd (doom-normalize-font remap-font))) - remap-xlfd - (purecopy font)) - (error "Could not decompose %s font" var)))) - (let* ((step (if fixed-size-p 0 (* increment doom-font-increment))) - (orig-size (font-get font :size)) - (new-size (if fixed-size-p increment (+ orig-size step)))) - (cond ((<= new-size 0) - (error "`%s' font is too small to be resized (%d)" var new-size)) - ((= orig-size new-size) - (user-error "Could not resize `%s' for some reason" var)) - ((setq changed t) - (unless (get var 'initial-value) - (put var 'initial-value original-font)) - (font-put dfont :size new-size) - (set var dfont))))))))) - (error - (ignore-errors (doom-adjust-font-size nil)) - (signal (car e) (cdr e))))) - -;;;###autoload -(defun doom-font-exists-p (font) - "Return non-nil if FONT exists on this system." - (declare (pure t) (side-effect-free t)) - (ignore-errors (find-font (doom-normalize-font font)))) - - -;; -;;; Commands - -;;;###autoload -(defun doom/reload-font () - "Reload your fonts, if they're set. -See `doom-init-fonts-h'." - (interactive) - (doom-init-fonts-h 'reload)) - -;;;###autoload -(defun doom/increase-font-size (count &optional increment) - "Enlargens the font size across the current and child frames." - (interactive "p") - (doom-adjust-font-size (* count (or increment doom-font-increment)))) - -;;;###autoload -(defun doom/decrease-font-size (count &optional increment) - "Shrinks the font size across the current and child frames." - (interactive "p") - (doom-adjust-font-size (* (- count) (or increment doom-font-increment)))) - -;;;###autoload -(defun doom/reset-font-size () - "Reset font size and `text-scale'. - -Assuming it has been adjusted via `doom/increase-font-size' and -`doom/decrease-font-size', or `text-scale-*' commands." - (interactive) - (let (success) - (when (and (boundp 'text-scale-mode-amount) - (/= text-scale-mode-amount 0)) - (text-scale-set 0) - (setq success t)) - (cond (doom-big-font-mode - (message "Disabling `doom-big-font-mode'") - (doom-big-font-mode -1) - (setq success t)) - ((doom-adjust-font-size nil) - (setq success t))) - (unless success - (user-error "The font hasn't been resized")))) - -;;;###autoload -(define-minor-mode doom-big-font-mode - "Globally resizes your fonts for streams, screen-sharing or presentations. - -Uses `doom-big-font' if its set, otherwise uses `doom-font' (falling back to -your system font). - -Also resizees `doom-variable-pitch-font' and `doom-serif-font'." - :init-value nil - :lighter " BIG" - :global t - (if doom-big-font - ;; Use `doom-big-font' in lieu of `doom-font' - (doom-adjust-font-size - (when doom-big-font-mode - (font-get (doom-normalize-font doom-big-font) :size)) - t `((doom-font . ,doom-big-font))) - ;; Resize the current font - (doom-adjust-font-size (if doom-big-font-mode doom-big-font-increment)))) diff --git a/.config/emacs/core/autoload/help.el b/.config/emacs/core/autoload/help.el deleted file mode 100644 index ffb2bff..0000000 --- a/.config/emacs/core/autoload/help.el +++ /dev/null @@ -1,741 +0,0 @@ -;;; core/autoload/help.el -*- lexical-binding: t; -*- - -(defvar doom--help-major-mode-module-alist - '((dockerfile-mode :tools docker) - (agda2-mode :lang agda) - (c-mode :lang cc) - (c++-mode :lang cc) - (objc++-mode :lang cc) - (crystal-mode :lang crystal) - (lisp-mode :lang common-lisp) - (csharp-mode :lang csharp) - (clojure-mode :lang clojure) - (clojurescript-mode :lang clojure) - (json-mode :lang json) - (yaml-mode :lang yaml) - (csv-mode :lang data) - (erlang-mode :lang erlang) - (elixir-mode :lang elixir) - (elm-mode :lang elm) - (emacs-lisp-mode :lang emacs-lisp) - (ess-r-mode :lang ess) - (ess-julia-mode :lang ess) - (go-mode :lang go) - (haskell-mode :lang haskell) - (hy-mode :lang hy) - (idris-mode :lang idris) - (java-mode :lang java) - (js2-mode :lang javascript) - (rjsx-mode :lang javascript) - (typescript-mode :lang javascript) - (typescript-tsx-mode :lang javascript) - (coffee-mode :lang javascript) - (julia-mode :lang julia) - (kotlin-mode :lang kotlin) - (latex-mode :lang latex) - (LaTeX-mode :lang latex) - (ledger-mode :lang ledger) - (lua-mode :lang lua) - (moonscript-mode :lang lua) - (markdown-mode :lang markdown) - (gfm-mode :lang markdown) - (nim-mode :lang nim) - (nix-mode :lang nix) - (taureg-mode :lang ocaml) - (org-mode :lang org) - (raku-mode :lang raku) - (php-mode :lang php) - (hack-mode :lang php) - (plantuml-mode :lang plantuml) - (purescript-mode :lang purescript) - (python-mode :lang python) - (restclient-mode :lang rest) - (ruby-mode :lang ruby) - (rust-mode :lang rust) - (rustic-mode :lang rust) - (scala-mode :lang scala) - (scheme-mode :lang scheme) - (sh-mode :lang sh) - (swift-mode :lang swift) - (web-mode :lang web) - (css-mode :lang web) - (scss-mode :lang web) - (sass-mode :lang web) - (less-css-mode :lang web) - (stylus-mode :lang web) - (terra-mode :lang terra)) - "An alist mapping major modes to Doom modules. - -This is used by `doom/help-modules' to auto-select the module corresponding to -the current major-modea.") - - -;; -;;; Helpers - -;;;###autoload -(defun doom-active-minor-modes () - "Return a list of active minor-mode symbols." - (cl-loop for mode in minor-mode-list - if (and (boundp mode) (symbol-value mode)) - collect mode)) - - -;; -;;; Custom describe commands - -;;;###autoload (defalias 'doom/describe-autodefs #'doom/help-autodefs) -;;;###autoload (defalias 'doom/describe-module #'doom/help-modules) -;;;###autoload (defalias 'doom/describe-package #'doom/help-packages) - -;;;###autoload -(defun doom/describe-active-minor-mode (mode) - "Get information on an active minor mode. Use `describe-minor-mode' for a -selection of all minor-modes, active or not." - (interactive - (list (completing-read "Describe active mode: " (doom-active-minor-modes)))) - (let ((symbol - (cond ((stringp mode) (intern mode)) - ((symbolp mode) mode) - ((error "Expected a symbol/string, got a %s" (type-of mode)))))) - (if (fboundp symbol) - (helpful-function symbol) - (helpful-variable symbol)))) - - -;; -;;; Documentation commands - -(defvar org-agenda-files) -(defun doom--org-headings (files &optional depth include-files) - "TODO" - (require 'org) - (let* ((default-directory doom-docs-dir) - (org-agenda-files (mapcar #'expand-file-name (doom-enlist files))) - (depth (if (integerp depth) depth)) - (org-inhibit-startup t)) - (message "Loading search results...") - (unwind-protect - (delq - nil - (org-map-entries - (lambda () - (cl-destructuring-bind (level _reduced-level _todo _priority text tags) - (org-heading-components) - (when (and (or (null depth) - (<= level depth)) - (or (null tags) - (not (string-match-p ":TOC" tags)))) - (let ((path (org-get-outline-path)) - (title (org-collect-keywords '("TITLE") '("TITLE")))) - (list (string-join - (list (string-join - (append (when include-files - (list (or (cdr (assoc "TITLE" title)) - (file-relative-name (buffer-file-name))))) - path - (when text - (list (replace-regexp-in-string org-link-any-re "\\4" text)))) - " > ") - tags) - " ") - (buffer-file-name) - (point)))))) - t 'agenda)) - (mapc #'kill-buffer org-agenda-new-buffers) - (setq org-agenda-new-buffers nil)))) - -(defvar ivy-sort-functions-alist) -;;;###autoload -(defun doom-completing-read-org-headings (prompt files &optional depth include-files initial-input extra-candidates) - "TODO" - (let ((alist - (append (doom--org-headings files depth include-files) - extra-candidates)) - ivy-sort-functions-alist) - (if-let (result (completing-read prompt alist nil nil initial-input)) - (cl-destructuring-bind (file &optional location) - (cdr (assoc result alist)) - (find-file file) - (cond ((functionp location) - (funcall location)) - (location - (goto-char location))) - (ignore-errors - (when (outline-invisible-p) - (save-excursion - (outline-previous-visible-heading 1) - (org-show-subtree))))) - (user-error "Aborted")))) - -;;;###autoload -(defun doom/homepage () - "Open the doom emacs homepage in the browser." - (interactive) - (browse-url "https://doomemacs.org")) - -;;;###autoload -(defun doom/issue-tracker () - "Open Doom Emacs' issue tracker on Discourse." - (interactive) - (browse-url "https://github.com/hlissner/doom-emacs/issues")) - -;;;###autoload -(defun doom/report-bug () - "Open the browser on our Discourse. - -If called when a backtrace buffer is present, it and the output of `doom-info' -will be automatically appended to the result." - (interactive) - ;; TODO Upload doom/info to pastebin and append to querystring - (browse-url "https://github.com/hlissner/doom-emacs/issues/new?labels=1.+bug%2C2.+status%3Aunread&template=bug_report.yml")) - -;;;###autoload -(defun doom/discourse () - "Open Doom Emacs' issue tracker on Discourse." - (interactive) - (browse-url "https://discourse.doomemacs.org")) - -;;;###autoload -(defun doom/help () - "Open Doom's user manual." - (interactive) - (find-file (expand-file-name "index.org" doom-docs-dir))) - -;;;###autoload -(defun doom/help-search-headings (&optional initial-input) - "Search Doom's documentation and jump to a headline." - (interactive) - (doom-completing-read-org-headings - "Find in Doom help: " - (list "getting_started.org" - "contributing.org" - "troubleshooting.org" - "tutorials.org" - "faq.org") - 3 t initial-input - (mapcar (lambda (x) - (setcar x (concat "Doom Modules > " (car x))) - x) - (doom--help-modules-list)))) - -;;;###autoload -(defun doom/help-search (&optional initial-input) - "Perform a text search on all of Doom's documentation." - (interactive) - (funcall (cond ((fboundp '+ivy-file-search) - #'+ivy-file-search) - ((fboundp '+helm-file-search) - #'+helm-file-search) - ((fboundp '+vertico-file-search) - #'+vertico-file-search) - ((rgrep - (read-regexp - "Search for" (or initial-input 'grep-tag-default) - 'grep-regexp-history) - "*.org" doom-emacs-dir) - #'ignore)) - :query initial-input - :args '("-t" "org") - :in doom-emacs-dir - :prompt "Search documentation for: ")) - -;;;###autoload -(defun doom/help-search-news (&optional initial-input) - "Search headlines in Doom's newsletters." - (interactive) - (doom-completing-read-org-headings - "Find in News: " - (nreverse (doom-files-in (expand-file-name "news" doom-docs-dir) - :match "/[0-9]" - :relative-to doom-docs-dir)) - nil t initial-input)) - -;;;###autoload -(defun doom/help-faq (&optional initial-input) - "Search Doom's FAQ and jump to a question." - (interactive) - (doom-completing-read-org-headings - "Find in FAQ: " (list "faq.org") - 2 nil initial-input)) - -;;;###autoload -(defun doom/help-news () - "Open a Doom newsletter. -The latest newsletter will be selected by default." - (interactive) - (let* ((default-directory (expand-file-name "news/" doom-docs-dir)) - (news-files (doom-files-in default-directory))) - (find-file - (read-file-name (format "Open Doom newsletter (current: v%s): " - doom-version) - default-directory - (if (member doom-version news-files) - doom-version - (concat (mapconcat #'number-to-string - (nbutlast (version-to-list doom-version) 1) - ".") - ".x")) - t doom-version)))) - -;;;###autoload -(defun doom/help-autodefs (autodef) - "Open documentation for an autodef. - -An autodef is a Doom concept. It is a function or macro that is always defined, -whether or not its containing module is disabled (in which case it will safely -no-op without evaluating its arguments). This syntactic sugar lets you use them -without needing to check if they are available." - (interactive - (let* ((settings - (cl-loop with case-fold-search = nil - for sym being the symbols of obarray - for sym-name = (symbol-name sym) - if (and (or (functionp sym) - (macrop sym)) - (string-match-p "[a-z]!$" sym-name)) - collect sym)) - (sym (symbol-at-point)) - (autodef - (completing-read - "Describe setter: " - ;; TODO Could be cleaner (refactor me!) - (cl-loop with maxwidth = (apply #'max (mapcar #'length (mapcar #'symbol-name settings))) - for def in (sort settings #'string-lessp) - if (get def 'doom-module) - collect - (format (format "%%-%ds%%s" (+ maxwidth 4)) - def (propertize (format "%s %s" (car it) (cdr it)) - 'face 'font-lock-comment-face)) - else if (and (string-match-p "^set-.+!$" (symbol-name def)) - (symbol-file def) - (file-in-directory-p (symbol-file def) doom-core-dir)) - collect - (format (format "%%-%ds%%s" (+ maxwidth 4)) - def (propertize (format "core/%s.el" (file-name-sans-extension (file-relative-name (symbol-file def) doom-core-dir))) - 'face 'font-lock-comment-face))) - nil t - (when (and (symbolp sym) - (string-match-p "!$" (symbol-name sym))) - (symbol-name sym))))) - (list (and autodef (car (split-string autodef " ")))))) - (or (stringp autodef) - (functionp autodef) - (signal 'wrong-type-argument (list '(stringp functionp) autodef))) - (let ((fn (if (functionp autodef) - autodef - (intern-soft autodef)))) - (or (fboundp fn) - (error "'%s' is not a valid DOOM autodef" autodef)) - (if (fboundp 'helpful-callable) - (helpful-callable fn) - (describe-function fn)))) - -(defun doom--help-modules-list () - (cl-loop for path in (cdr (doom-module-load-path 'all)) - for (cat . mod) = (doom-module-from-path path) - for readme-path = (or (doom-module-locate-path cat mod "README.org") - (doom-module-locate-path cat mod)) - for format = (format "%s %s" cat mod) - if (doom-module-p cat mod) - collect (list format readme-path) - else if (and cat mod) - collect (list (propertize format 'face 'font-lock-comment-face) - readme-path))) - -(defun doom--help-current-module-str () - (cond ((save-excursion - (require 'smartparens) - (ignore-errors - (sp-beginning-of-sexp) - (unless (eq (char-after) ?\() - (backward-char)) - (let ((sexp (sexp-at-point))) - (when (memq (car-safe sexp) '(featurep! require!)) - (format "%s %s" (nth 1 sexp) (nth 2 sexp))))))) - ((when buffer-file-name - (when-let (mod (doom-module-from-path buffer-file-name)) - (unless (memq (car mod) '(:core :private)) - (format "%s %s" (car mod) (cdr mod)))))) - ((when-let (mod (cdr (assq major-mode doom--help-major-mode-module-alist))) - (format "%s %s" - (symbol-name (car mod)) - (symbol-name (cadr mod))))))) - -;;;###autoload -(defun doom/help-modules (category module &optional visit-dir) - "Open the documentation for a Doom module. - -CATEGORY is a keyword and MODULE is a symbol. e.g. :editor and 'evil. - -If VISIT-DIR is non-nil, visit the module's directory rather than its -documentation. - -Automatically selects a) the module at point (in private init files), b) the -module derived from a `featurep!' or `require!' call, c) the module that the -current file is in, or d) the module associated with the current major mode (see -`doom--help-major-mode-module-alist')." - (interactive - (nconc - (mapcar #'intern - (split-string - (completing-read "Describe module: " - (doom--help-modules-list) - nil t nil nil - (doom--help-current-module-str)) - " " t)) - (list current-prefix-arg))) - (cl-check-type category symbol) - (cl-check-type module symbol) - (cl-destructuring-bind (module-string path) - (or (assoc (format "%s %s" category module) (doom--help-modules-list)) - (user-error "'%s %s' is not a valid module" category module)) - (setq module-string (substring-no-properties module-string)) - (unless (file-readable-p path) - (error "Can't find or read %S module at %S" module-string path)) - (cond ((not (file-directory-p path)) - (if visit-dir - (doom-project-browse (file-name-directory path)) - (find-file path))) - (visit-dir - (doom-project-browse path)) - ((y-or-n-p (format "The %S module has no README file. Explore its directory?" - module-string)) - (doom-project-browse (file-name-directory path))) - ((user-error "Aborted module lookup"))))) - -;;;###autoload -(defun doom/help-custom-variable (var) - "Look up documentation for a custom variable. - -Unlike `helpful-variable', which casts a wider net that includes internal -variables, this only lists variables that exist to be customized (defined with -`defcustom')." - (interactive - (list (helpful--read-symbol - "Custom variable: " - (helpful--variable-at-point) - (lambda (sym) - (and (helpful--variable-p sym) - (custom-variable-p sym) - ;; Exclude minor mode state variables, which aren't meant to be - ;; modified directly, but through their associated function. - (not (or (and (string-suffix-p "-mode" (symbol-name sym)) - (fboundp sym)) - (eq (get sym 'custom-set) 'custom-set-minor-mode)))))))) - (helpful-variable var)) - - -;; -;;; `doom/help-packages' - -(defun doom--help-insert-button (label &optional uri line) - "Helper function to insert a button at point. - -The button will have the text LABEL. If URI is given, the button will open it, -otherwise the LABEL will be used. If the uri to open is a url it will be opened -in a browser. If LINE is given (and the uri to open is not a url), then the file -will open with point on that line." - (let ((uri (or uri label))) - (insert-text-button - label - 'face 'link - 'follow-link t - 'action - (if (string-match-p "^https?://" uri) - (lambda (_) (browse-url uri)) - (unless (file-exists-p uri) - (error "Path does not exist: %S" uri)) - (lambda (_) - (when (window-dedicated-p) - (other-window 1)) - (find-file uri) - (when line - (goto-char (point-min)) - (forward-line (1- line)) - (recenter))))))) - -(defun doom--help-package-configs (package) - (let ((default-directory doom-emacs-dir)) - ;; TODO Use ripgrep instead - (split-string - (cdr (doom-call-process - "git" "grep" "--no-break" "--no-heading" "--line-number" - (format "%s %s\\($\\| \\)" - "\\(^;;;###package\\|(after!\\|(use-package!\\)" - package) - ":(exclude)*.org")) - "\n" t))) - -(defvar doom--help-packages-list nil) -;;;###autoload -(defun doom/help-packages (package) - "Like `describe-package', but for packages installed by Doom modules. - -Only shows installed packages. Includes information about where packages are -defined and configured. - -If prefix arg is present, refresh the cache." - (interactive - (let ((guess (or (function-called-at-point) - (symbol-at-point)))) - (require 'finder-inf nil t) - (require 'package) - (require 'straight) - (let ((packages - (if (and doom--help-packages-list (null current-prefix-arg)) - doom--help-packages-list - (message "Generating packages list for the first time...") - (redisplay) - (setq doom--help-packages-list - (delete-dups - (append (mapcar #'car package-alist) - (mapcar #'car package--builtins) - (mapcar #'intern - (hash-table-keys straight--build-cache)) - (mapcar #'car (doom-package-list 'all)) - nil)))))) - (unless (memq guess packages) - (setq guess nil)) - (list - (intern - (completing-read (format "Describe Doom package (%s): " - (concat (when guess - (format "default '%s', " guess)) - (format "total %d" (length packages)))) - packages nil t nil nil - (when guess (symbol-name guess)))))))) - ;; TODO Refactor me. - (require 'core-packages) - (doom-initialize-packages) - (help-setup-xref (list #'doom/help-packages package) - (called-interactively-p 'interactive)) - (with-help-window (help-buffer) - (with-current-buffer standard-output - (when (or (package-desc-p package) - (and (symbolp package) - (or (assq package package-alist) - (assq package package--builtins)))) - (describe-package-1 package)) - (let ((indent (make-string 13 ? ))) - (goto-char (point-min)) - (if (re-search-forward " Status: .*$" nil t) - (insert "\n") - (search-forward "\n\n" nil t)) - - (package--print-help-section "Package") - (insert (symbol-name package) "\n") - - (package--print-help-section "Source") - (pcase (doom-package-backend package) - (`straight - (insert "Straight\n") - (package--print-help-section "Pinned") - (insert (if-let (pin (plist-get (cdr (assq package doom-packages)) :pin)) - pin - "unpinned") - "\n") - - (package--print-help-section "Build") - (let ((default-directory (straight--repos-dir (symbol-name package)))) - (if (file-exists-p default-directory) - (insert (cdr (doom-call-process "git" "log" "-1" "--format=%D %h %ci"))) - (insert "n/a"))) - (insert "\n" indent) - - (package--print-help-section "Build location") - (let ((build-dir (straight--build-dir (symbol-name package)))) - (if (file-exists-p build-dir) - (doom--help-insert-button (abbreviate-file-name build-dir)) - (insert "n/a"))) - (insert "\n" indent) - - (package--print-help-section "Repo location") - (let* ((local-repo (doom-package-recipe-repo package)) - (repo-dir (straight--repos-dir local-repo))) - (if (file-exists-p repo-dir) - (doom--help-insert-button (abbreviate-file-name repo-dir)) - (insert "n/a")) - (insert "\n")) - - (let ((recipe (doom-package-build-recipe package))) - (package--print-help-section "Recipe") - (insert - (replace-regexp-in-string "\n" (concat "\n" indent) - (pp-to-string recipe)))) - - (package--print-help-section "Homepage") - (doom--help-insert-button (doom-package-homepage package))) - - (`elpa (insert "[M]ELPA ") - (doom--help-insert-button (doom-package-homepage package)) - (package--print-help-section "Location") - (doom--help-insert-button - (abbreviate-file-name - (file-name-directory - (locate-library (symbol-name package)))))) - (`builtin (insert "Built-in\n") - (package--print-help-section "Location") - (doom--help-insert-button - (abbreviate-file-name - (file-name-directory - (locate-library (symbol-name package)))))) - (`other (doom--help-insert-button - (abbreviate-file-name - (or (symbol-file package) - (locate-library (symbol-name package)))))) - (_ (insert "Not installed"))) - (insert "\n") - - (when-let - (modules - (if (gethash (symbol-name package) straight--build-cache) - (doom-package-get package :modules) - (plist-get (cdr (assq package (doom-package-list 'all))) - :modules))) - (package--print-help-section "Modules") - (insert "Declared by the following Doom modules:\n") - (dolist (m modules) - (let* ((module-path (pcase (car m) - (:core doom-core-dir) - (:private doom-private-dir) - (category - (doom-module-locate-path category - (cdr m))))) - (readme-path (expand-file-name "README.org" module-path))) - (insert indent) - (doom--help-insert-button - (format "%s %s" (car m) (or (cdr m) "")) - module-path) - (insert " (") - (if (file-exists-p readme-path) - (doom--help-insert-button "readme" readme-path) - (insert "no readme")) - (insert ")\n")))) - - (package--print-help-section "Configs") - (if-let ((configs (doom--help-package-configs package))) - (progn - (insert "This package is configured in the following locations:") - (dolist (location configs) - (insert "\n" indent) - (cl-destructuring-bind (file line _match &rest) - (split-string location ":") - (doom--help-insert-button location - (expand-file-name file doom-emacs-dir) - (string-to-number line))))) - (insert "This package is not configured anywhere")) - (goto-char (point-min)))))) - -(defvar doom--package-cache nil) -(defun doom--package-list (&optional prompt) - (let* ((guess (or (function-called-at-point) - (symbol-at-point)))) - (require 'finder-inf nil t) - (unless package--initialized - (package-initialize t)) - (let ((packages (or doom--package-cache - (progn - (message "Reading packages...") - (cl-delete-duplicates - (append (mapcar 'car package-alist) - (mapcar 'car package--builtins) - (mapcar 'car package-archive-contents))))))) - (setq doom--package-cache packages) - (unless (memq guess packages) - (setq guess nil)) - (intern (completing-read (or prompt - (if guess - (format "Select package to search for (default %s): " - guess) - "Describe package: ")) - packages nil t nil nil - (if guess (symbol-name guess))))))) - -;;;###autoload -(defun doom/help-package-config (package) - "Jump to any `use-package!', `after!' or ;;;###package block for PACKAGE. - -This only searches `doom-emacs-dir' (typically ~/.emacs.d) and does not include -config blocks in your private config." - (interactive (list (doom--package-list "Find package config: "))) - (cl-destructuring-bind (file line _match) - (split-string - (completing-read - "Jump to config: " - (or (doom--help-package-configs package) - (user-error "This package isn't configured by you or Doom"))) - ":") - (find-file (expand-file-name file doom-emacs-dir)) - (goto-char (point-min)) - (forward-line (1- line)) - (recenter))) - -;;;###autoload -(defalias 'doom/help-package-homepage #'straight-visit-package-website) - -(defun doom--help-search-prompt (prompt) - (let ((query (doom-thing-at-point-or-region))) - (if (featurep 'counsel) - query - (read-string prompt query 'git-grep query)))) - -(defvar counsel-rg-base-command) -(defun doom--help-search (dirs query prompt) - ;; REVIEW Replace with deadgrep - (unless (executable-find "rg") - (user-error "Can't find ripgrep on your system")) - (cond ((fboundp 'consult--grep) - (consult--grep - prompt - (lambda (input) - (pcase-let* ((cmd (split-string-and-unquote consult-ripgrep-args)) - (type (consult--ripgrep-regexp-type (car cmd))) - (`(,arg . ,opts) (consult--command-split input)) - (`(,re . ,hl) (funcall consult--regexp-compiler arg type))) - (when re - (list :command - (append cmd - (and (eq type 'pcre) '("-P")) - (list "-e" (consult--join-regexps re type)) - opts - dirs) - :highlight hl)))) - data-directory query)) - ((fboundp 'counsel-rg) - (let ((counsel-rg-base-command - (if (stringp counsel-rg-base-command) - (format counsel-rg-base-command - (concat "%s " (mapconcat #'shell-quote-argument dirs " "))) - (append counsel-rg-base-command dirs)))) - (counsel-rg query nil "-Lz" (concat prompt ": ")))) - ;; () TODO Helm support? - ((grep-find - (string-join - (append (list "rg" "-L" "--search-zip" "--no-heading" "--color=never" - (shell-quote-argument query)) - (mapcar #'shell-quote-argument dirs)) - " "))))) - -;;;###autoload -(defun doom/help-search-load-path (query) - "Perform a text search on your `load-path'. -Uses the symbol at point or the current selection, if available." - (interactive - (list (doom--help-search-prompt "Search load-path: "))) - (doom--help-search (cl-remove-if-not #'file-directory-p load-path) - query "Search load-path: ")) - -;;;###autoload -(defun doom/help-search-loaded-files (query) - "Perform a text search on your `load-path'. -Uses the symbol at point or the current selection, if available." - (interactive - (list (doom--help-search-prompt "Search loaded files: "))) - (doom--help-search - (cl-loop for (file . _) in (cl-remove-if-not #'stringp load-history :key #'car) - for filebase = (file-name-sans-extension file) - if (file-exists-p! (or (format "%s.el.gz" filebase) - (format "%s.el" filebase))) - collect it) - query "Search loaded files: ")) diff --git a/.config/emacs/core/autoload/output.el b/.config/emacs/core/autoload/output.el deleted file mode 100644 index 8c45c49..0000000 --- a/.config/emacs/core/autoload/output.el +++ /dev/null @@ -1,278 +0,0 @@ -;;; core/autoload/output.el -*- lexical-binding: t; -*- - -(defvar doom-output-ansi-alist - '(;; fx - (bold 1 :weight bold) - (dark 2) - (italic 3 :slant italic) - (underscore 4 :underline t) - (blink 5) - (rapid 6) - (contrary 7) - (concealed 8) - (strike 9 :strike-through t) - ;; fg - (black 30 term-color-black) - (red 31 term-color-red) - (green 32 term-color-green) - (yellow 33 term-color-yellow) - (blue 34 term-color-blue) - (magenta 35 term-color-magenta) - (cyan 36 term-color-cyan) - (white 37 term-color-white) - ;; bg - (on-black 40 term-color-black) - (on-red 41 term-color-red) - (on-green 42 term-color-green) - (on-yellow 43 term-color-yellow) - (on-blue 44 term-color-blue) - (on-magenta 45 term-color-magenta) - (on-cyan 46 term-color-cyan) - (on-white 47 term-color-white)) - "An alist of fg/bg/fx names mapped to ansi codes and term-color-* variables. - -This serves as the cipher for converting (COLOR ...) function calls in `print!' -and `format!' into colored output, where COLOR is any car of this list.") - -(defvar doom-output-class-alist - `((color . doom--output-color) - (class . doom--output-class) - (indent . doom--output-indent) - (autofill . doom--output-autofill) - (success . (lambda (str &rest args) - (apply #'doom--output-color 'green (format "✓ %s" str) args))) - (warn . (lambda (str &rest args) - (apply #'doom--output-color 'yellow (format "! %s" str) args))) - (error . (lambda (str &rest args) - (apply #'doom--output-color 'red (format "x %s" str) args))) - (info . (lambda (str &rest args) - (concat "- " (if args (apply #'format str args) str)))) - (start . (lambda (str &rest args) - (concat "> " (if args (apply #'format str args) str)))) - (debug . (lambda (str &rest args) - (if doom-debug-p - (apply #'doom--output-color 'dark - (format "- %s" str) - args) - ""))) - (path . abbreviate-file-name) - (symbol . symbol-name) - (relpath . (lambda (str &optional dir) - (if (or (not str) - (not (stringp str)) - (string-empty-p str)) - str - (let ((dir (or dir (file-truename default-directory))) - (str (file-truename str))) - (if (file-in-directory-p str dir) - (file-relative-name str dir) - (abbreviate-file-name str)))))) - (filename . file-name-nondirectory) - (dirname . (lambda (path) - (unless (file-directory-p path) - (setq path (file-name-directory path))) - (directory-file-name path)))) - "An alist of text classes that map to transformation functions. - -Any of these classes can be called like functions from within `format!' and -`print!' calls, which will transform their input.") - -(defvar doom-output-indent 0 - "Level to rigidly indent text returned by `format!' and `print!'.") - -(defvar doom-output-indent-increment 2 - "Steps in which to increment `doom-output-indent' for consecutive levels.") - -(defvar doom-output-backend - (if doom-interactive-p 'text-properties 'ansi) - "Determines whether to print colors with ANSI codes or with text properties. - -Accepts 'ansi and 'text-properties. nil means don't render colors.") - - -;; -;;; Library - -;;;###autoload -(defun doom--format (output) - (if (string-empty-p (string-trim output)) - "" - (concat (make-string doom-output-indent 32) - (replace-regexp-in-string - "\n" (concat "\n" (make-string doom-output-indent 32)) - output t t)))) - -;;;###autoload -(defun doom--print (output) - (unless (string-empty-p output) - (if noninteractive - (send-string-to-terminal output) - (princ output)) - (terpri) - output)) - -;;;###autoload -(defun doom--output-indent (width text &optional prefix) - "Indent TEXT by WIDTH spaces. If ARGS, format TEXT with them." - (with-temp-buffer - (setq text (format "%s" text)) - (insert text) - (indent-rigidly (point-min) (point-max) width) - (when (stringp prefix) - (when (> width 2) - (goto-char (point-min)) - (beginning-of-line-text) - (delete-char (- (length prefix))) - (insert prefix))) - (buffer-string))) - -;;;###autoload -(defun doom--output-autofill (&rest msgs) - "Ensure MSG is split into lines no longer than `fill-column'." - (with-temp-buffer - (let ((fill-column 76)) - (dolist (line msgs) - (when line - (insert (format "%s" line)))) - (fill-region (point-min) (point-max)) - (buffer-string)))) - -;;;###autoload -(defun doom--output-color (style format &rest args) - "Apply STYLE to formatted MESSAGE with ARGS. - -STYLE is a symbol that correlates to `doom-output-ansi-alist'. - -In a noninteractive session, this wraps the result in ansi color codes. -Otherwise, it maps colors to a term-color-* face." - (let* ((code (cadr (assq style doom-output-ansi-alist))) - (format (format "%s" format)) - (message (if args (apply #'format format args) format))) - (unless code - (error "%S is an invalid color" style)) - (pcase doom-output-backend - (`ansi - (format "\e[%dm%s\e[%dm" code message 0)) - (`text-properties - (require 'term) ; piggyback on term's color faces - (propertize - message - 'face - (append (get-text-property 0 'face format) - (cond ((>= code 40) - `(:background ,(caddr (assq style doom-output-ansi-alist)))) - ((>= code 30) - `(:foreground ,(face-foreground (caddr (assq style doom-output-ansi-alist))))) - ((cddr (assq style doom-output-ansi-alist))))))) - (_ message)))) - -;;;###autoload -(defun doom--output-class (class format &rest args) - "Apply CLASS to formatted format with ARGS. - -CLASS is derived from `doom-output-class-alist', and can contain any arbitrary, -transformative logic." - (let (fn) - (cond ((setq fn (cdr (assq class doom-output-class-alist))) - (if (functionp fn) - (apply fn format args) - (error "%s does not have a function" class))) - (args (apply #'format format args)) - (format)))) - -;;;###autoload -(defun doom--output-apply (forms &optional sub) - "Replace color-name functions with calls to `doom--output-color'." - (cond ((null forms) nil) - ((listp forms) - (append (cond ((not (symbolp (car forms))) - (list (doom--output-apply (car forms)))) - (sub - (list (car forms))) - ((assq (car forms) doom-output-ansi-alist) - `(doom--output-color ',(car forms))) - ((assq (car forms) doom-output-class-alist) - `(doom--output-class ',(car forms))) - ((list (car forms)))) - (doom--output-apply (cdr forms) t) - nil)) - (forms))) - -;;;###autoload -(defmacro format! (message &rest args) - "An alternative to `format' that understands (color ...) and converts them -into faces or ANSI codes depending on the type of sesssion we're in." - `(doom--format (format ,@(doom--output-apply `(,message ,@args))))) - -;;;###autoload -(defmacro print-group! (&rest body) - "Indents any `print!' or `format!' output within BODY." - `(let ((doom-output-indent (+ doom-output-indent-increment doom-output-indent))) - ,@body)) - -;;;###autoload -(defmacro print! (message &rest args) - "Prints MESSAGE, formatted with ARGS, to stdout. - -Returns non-nil if the message is a non-empty string. - -Can be colored using (color ...) blocks: - - (print! \"Hello %s\" (bold (blue \"How are you?\"))) - (print! \"Hello %s\" (red \"World\")) - (print! (green \"Great %s!\") \"success\") - -Uses faces in interactive sessions and ANSI codes otherwise." - `(doom--print (format! ,message ,@args))) - -;;;###autoload -(defmacro insert! (message &rest args) - "Like `insert'; the last argument must be format arguments for MESSAGE. - -\(fn MESSAGE... ARGS)" - `(insert (format! (concat ,message ,@(butlast args)) - ,@(car (last args))))) - -;;;###autoload -(defmacro error! (message &rest args) - "Like `error', but with the power of `format!'." - `(error (format! ,message ,@args))) - -;;;###autoload -(defmacro user-error! (message &rest args) - "Like `user-error', but with the power of `format!'." - `(user-error (format! ,message ,@args))) - -;;;###autoload -(defmacro with-output-to! (dest &rest body) - "Send all output produced in BODY to DEST. -DEST can be one or more of `standard-output', a buffer, a file" - (declare (indent 1)) - `(let* ((log-buffer (generate-new-buffer " *doom log*")) - (standard-output - (lambda (out) - (with-current-buffer log-buffer - (insert-char out)) - (send-string-to-terminal (char-to-string out))))) - (letf! (defun message (msg &rest args) - (when msg - (print-group! - (with-current-buffer log-buffer - (insert (doom--format (apply #'format msg args)) "\n")) - (when (or doom-debug-p (not inhibit-message)) - (doom--print (doom--format (apply #'format msg args)))))) - message) - (unwind-protect - ,(macroexp-progn body) - (with-current-buffer log-buffer - (require 'ansi-color) - (ansi-color-filter-region (point-min) (point-max))) - (let ((dest ,dest)) - (cond ((bufferp dest) - (with-current-buffer dest - (insert-buffer-substring log-buffer))) - ((stringp dest) - (make-directory (file-name-directory dest) 'parents) - (with-temp-file dest - (insert-buffer-substring log-buffer)))) - (kill-buffer log-buffer)))))) diff --git a/.config/emacs/core/autoload/packages.el b/.config/emacs/core/autoload/packages.el deleted file mode 100644 index 36d53a0..0000000 --- a/.config/emacs/core/autoload/packages.el +++ /dev/null @@ -1,306 +0,0 @@ -;;; core/autoload/packages.el -*- lexical-binding: t; -*- - -;;;###autoload -(defun doom/reload-packages () - "Reload `doom-packages', `package' and `quelpa'." - (interactive) - ;; HACK straight.el must be loaded for this to work - (message "Reloading packages") - (doom-initialize-packages t) - (message "Reloading packages...DONE")) - - -;; -;;; Bump commands - -(defun doom--package-merge-recipes (package plist) - (require 'straight) - (doom-plist-merge - (plist-get plist :recipe) - (if-let (recipe (straight-recipes-retrieve package)) - (cdr (if (memq (car recipe) '(quote \`)) - (eval recipe t) - recipe)) - (let ((recipe (plist-get (cdr (assq package doom-packages)) - :recipe))) - (if (keywordp (car recipe)) - recipe - (cdr recipe)))))) - -(defun doom--package-to-bump-string (package plist) - "Return a PACKAGE and its PLIST in 'username/repo@commit' format." - (format "%s@%s" - (plist-get (doom--package-merge-recipes package plist) :repo) - (substring-no-properties (plist-get plist :pin) 0 12))) - -(defun doom--package-at-point (&optional point) - "Return the package and plist from the (package! PACKAGE PLIST...) at point." - (save-match-data - (save-excursion - (and point (goto-char point)) - (while (and (or (atom (sexp-at-point)) - (doom-point-in-string-or-comment-p)) - (search-backward "(" nil t))) - (when (eq (car-safe (sexp-at-point)) 'package!) - (cl-destructuring-bind (beg . end) - (bounds-of-thing-at-point 'sexp) - (let* ((doom-packages nil) - (buffer-file-name - (or buffer-file-name - (bound-and-true-p org-src-source-file-name))) - (package (eval (sexp-at-point) t))) - (list :beg beg - :end end - :package (car package) - :plist (cdr package)))))))) - -;;;###autoload -(defun doom/bumpify-package-at-point () - "Convert `package!' call at point to a bump string." - (interactive) - (cl-destructuring-bind (&key package plist beg end) - (doom--package-at-point) - (when-let (str (doom--package-to-bump-string package plist)) - (goto-char beg) - (delete-region beg end) - (insert str)))) - -;;;###autoload -(defun doom/bumpify-packages-in-buffer () - "Convert all `package!' calls in buffer into bump strings." - (interactive) - (save-excursion - (goto-char (point-min)) - (while (search-forward "(package!" nil t) - (unless (doom-point-in-string-or-comment-p) - (doom/bumpify-package-at-point))))) - -;;;###autoload -(defun doom/bump-package-at-point (&optional select) - "Inserts or updates a `:pin' for the `package!' statement at point. -Grabs the latest commit id of the package using 'git'." - (interactive "P") - (doom-initialize-packages) - (cl-destructuring-bind (&key package plist beg end) - (or (doom--package-at-point) - (user-error "Not on a `package!' call")) - (let* ((recipe (doom--package-merge-recipes package plist)) - (branch (plist-get recipe :branch)) - (oldid (or (plist-get plist :pin) - (doom-package-get package :pin))) - (url (straight-vc-git--destructure recipe (upstream-repo upstream-host) - (straight-vc-git--encode-url upstream-repo upstream-host))) - (id (or (when url - (cdr (doom-call-process - "git" "ls-remote" url - (unless select branch)))) - (user-error "Couldn't find a recipe for %s" package))) - (id (car (split-string - (if select - (completing-read "Commit: " (split-string id "\n" t)) - id))))) - (when (and oldid - (plist-member plist :pin) - (equal oldid id)) - (user-error "%s: no update necessary" package)) - (save-excursion - (if (re-search-forward ":pin +\"\\([^\"]+\\)\"" end t) - (replace-match id t t nil 1) - (goto-char (1- end)) - (insert " :pin " (prin1-to-string id)))) - (cond ((not oldid) - (message "%s: → %s" package (substring id 0 10))) - ((< (length oldid) (length id)) - (message "%s: extended to %s..." package id)) - ((message "%s: %s → %s" - package - (substring oldid 0 10) - (substring id 0 10))))))) - -;;;###autoload -(defun doom/bump-packages-in-buffer (&optional select) - "Inserts or updates a `:pin' to all `package!' statements in current buffer. -If SELECT (prefix arg) is non-nil, prompt you to choose a specific commit for -each package." - (interactive "P") - (save-excursion - (goto-char (point-min)) - (doom-initialize-packages) - (let (packages) - (while (search-forward "(package! " nil t) - (unless (let ((ppss (syntax-ppss))) - (or (nth 4 ppss) - (nth 3 ppss) - (save-excursion - (and (goto-char (match-beginning 0)) - (not (plist-member (sexp-at-point) :pin)))))) - (condition-case e - (push (doom/bump-package-at-point select) packages) - (user-error (message "%s" (error-message-string e)))))) - (if packages - (message "Updated %d packages\n- %s" (length packages) (string-join packages "\n- ")) - (message "No packages to update"))))) - -;;;###autoload -(defun doom/bump-module (category &optional module select) - "Bump packages in CATEGORY MODULE. -If SELECT (prefix arg) is non-nil, prompt you to choose a specific commit for -each package." - (interactive - (let* ((module (completing-read - "Bump module: " - (let ((modules (doom-module-list 'all))) - (mapcar (lambda (m) - (if (listp m) - (format "%s %s" (car m) (cdr m)) - (format "%s" m))) - (append '(:private :core) - (delete-dups (mapcar #'car modules)) - modules))) - nil t nil nil)) - (module (split-string module " " t))) - (list (intern (car module)) - (ignore-errors (intern (cadr module))) - current-prefix-arg))) - (mapc (fn! ((cat . mod)) - (if-let (packages-file - (pcase cat - (:private (car (doom-glob doom-private-dir "packages.el"))) - (:core (car (doom-glob doom-core-dir "packages.el"))) - (_ (doom-module-locate-path cat mod "packages.el")))) - (with-current-buffer - (or (get-file-buffer packages-file) - (find-file-noselect packages-file)) - (doom/bump-packages-in-buffer select) - (save-buffer)) - (message "Module %s has no packages.el file" (cons cat mod)))) - (if module - (list (cons category module)) - (cl-remove-if-not (lambda (m) (eq (car m) category)) - (append '((:core) (:private)) - (doom-module-list 'all)))))) - -;;;###autoload -(defun doom/bump-package (package) - "Bump PACKAGE in all modules that install it." - (interactive - (list (intern (completing-read "Bump package: " - (mapcar #'car (doom-package-list 'all)))))) - (let* ((packages (doom-package-list 'all)) - (modules (plist-get (alist-get package packages) :modules))) - (unless modules - (user-error "This package isn't installed by any Doom module")) - (dolist (module modules) - (when-let (packages-file (doom-module-locate-path (car module) (cdr module))) - (doom/bump-module (car module) (cdr module)))))) - - -;; -;;; Bump commits - -;;;###autoload -(defun doom/bumpify-diff (&optional interactive) - "Copy user/repo@hash -> user/repo@hash's of changed packages to clipboard. - -Must be run from a magit diff buffer." - (interactive (list 'interactive)) - (save-window-excursion - (magit-diff-staged) - (unless (eq major-mode 'magit-diff-mode) - (user-error "Not in a magit diff buffer")) - (let (targets lines) - (save-excursion - (while (re-search-forward "^modified +\\(.+\\)$" nil t) - (cl-pushnew (doom-module-from-path (match-string 1)) targets - :test #'equal))) - (while (re-search-forward "^-" nil t) - (let ((file (magit-file-at-point)) - before after) - (save-window-excursion - (call-interactively #'magit-diff-visit-file) - (or (looking-at-p "(package!") - (re-search-forward "(package! " (line-end-position) t) - (re-search-backward "(package! ")) - (let ((buffer-file-name file)) - (cl-destructuring-bind (&key package plist _beg _end) - (doom--package-at-point) - (setq before (doom--package-to-bump-string package plist))))) - (re-search-forward "^+") - (save-window-excursion - (call-interactively #'magit-diff-visit-file) - (or (looking-at-p "(package!") - (re-search-forward "(package! " (line-end-position) t) - (re-search-backward "(package! ")) - (let ((buffer-file-name file)) - (cl-destructuring-bind (&key package plist _beg _end) - (doom--package-at-point) - (setq after (doom--package-to-bump-string package plist))))) - (cl-pushnew (format "%s -> %s" before after) lines))) - (if (null lines) - (user-error "No bumps to bumpify") - (prog1 (funcall (if interactive #'kill-new #'identity) - (format "bump: %s\n\n%s" - (mapconcat (lambda (x) - (mapconcat #'symbol-name x " ")) - (cl-loop with alist = () - for (category . module) in (reverse targets) - do (setf (alist-get category alist) - (append (alist-get category alist) (list module))) - finally return alist) - " ") - (string-join (sort (reverse lines) #'string-lessp) - "\n"))) - (when interactive - (message "Copied to clipboard"))))))) - -;;;###autoload -(defun doom/commit-bumps () - "Create a pre-filled magit commit for currently bumped packages." - (interactive) - (magit-commit-create - (list "-e" "-m" (doom/bumpify-diff)))) - - -;; -;;; Package metadata - -;;;###autoload -(defun doom-package-homepage (package) - "Return the url to PACKAGE's homepage (usually a repo)." - (doom-initialize-packages) - (or (get package 'homepage) - (put package 'homepage - (cond ((when-let (location (locate-library (symbol-name package))) - (with-temp-buffer - (if (string-match-p "\\.gz$" location) - (jka-compr-insert-file-contents location) - (insert-file-contents (concat (file-name-sans-extension location) ".el") - nil 0 4096)) - (let ((case-fold-search t)) - (when (re-search-forward " \\(?:URL\\|homepage\\|Website\\): \\(http[^\n]+\\)\n" nil t) - (match-string-no-properties 1)))))) - ((when-let ((recipe (straight-recipes-retrieve package))) - (straight--with-plist (straight--convert-recipe recipe) - (host repo) - (pcase host - (`github (format "https://github.com/%s" repo)) - (`gitlab (format "https://gitlab.com/%s" repo)) - (`bitbucket (format "https://bitbucket.com/%s" (plist-get plist :repo))) - (`git repo) - (_ nil))))) - ((or package-archive-contents - (progn (package-refresh-contents) - package-archive-contents)) - (pcase (ignore-errors (package-desc-archive (cadr (assq package package-archive-contents)))) - (`nil nil) - ("org" "https://orgmode.org") - ((or "melpa" "melpa-mirror") - (format "https://melpa.org/#/%s" package)) - ("gnu" - (format "https://elpa.gnu.org/packages/%s.html" package)) - (archive - (if-let (src (cdr (assoc package package-archives))) - (format "%s" src) - (user-error "%S isn't installed through any known source (%s)" - package archive))))) - ((user-error "Can't get homepage for %S package" package)))))) diff --git a/.config/emacs/core/autoload/plist.el b/.config/emacs/core/autoload/plist.el deleted file mode 100644 index 7702d3d..0000000 --- a/.config/emacs/core/autoload/plist.el +++ /dev/null @@ -1,93 +0,0 @@ -;;; core/autoload/plist.el -*- lexical-binding: t; -*- - -;; -;;; Macros - -;;;###autoload -(cl-defmacro doplist! ((arglist plist &optional retval) &rest body) - "Loop over a PLIST's (property value) pairs then return RETVAL. - -Evaluate BODY with either ARGLIST bound to (cons PROP VAL) or, if ARGLIST is a -list, the pair is destructured into (CAR . CDR)." - (declare (indent 1)) - (let ((plist-var (make-symbol "plist"))) - `(let ((,plist-var (copy-sequence ,plist))) - (while ,plist-var - (let ,(if (listp arglist) - `((,(pop arglist) (pop ,plist-var)) - (,(pop arglist) (pop ,plist-var))) - `((,arglist (cons (pop ,plist-var) - (pop ,plist-var))))) - ,@body)) - ,retval))) - -;;;###autoload -(defmacro plist-put! (plist &rest rest) - "Set each PROP VALUE pair in REST to PLIST in-place." - `(cl-loop for (prop value) - on (list ,@rest) by #'cddr - do ,(if (symbolp plist) - `(setq ,plist (plist-put ,plist prop value)) - `(plist-put ,plist prop value)))) - -;;;###autoload -(defmacro plist-delete! (plist prop) - "Delete PROP from PLIST in-place." - `(setq ,plist (doom-plist-delete ,plist ,prop))) - - -;; -;;; Library - -;;;###autoload -(defun doom-plist-get (plist prop &optional nil-value) - "Return PROP in PLIST, if it exists. Otherwise NIL-VALUE." - (if-let (val (plist-member plist prop)) - (cadr val) - nil-value)) - -;;;###autoload -(defun doom-plist-merge (from-plist to-plist) - "Non-destructively merge FROM-PLIST onto TO-PLIST" - (let ((plist (copy-sequence from-plist))) - (while plist - (plist-put! to-plist (pop plist) (pop plist))) - to-plist)) - -;;;###autoload -(defun doom-plist-delete-nil (plist) - "Delete `nil' properties from a copy of PLIST." - (let (p) - (while plist - (if (car plist) - (plist-put! p (car plist) (nth 1 plist))) - (setq plist (cddr plist))) - p)) - -;;;###autoload -(defun doom-plist-delete (plist &rest props) - "Delete PROPS from a copy of PLIST." - (let (p) - (while plist - (if (not (memq (car plist) props)) - (plist-put! p (car plist) (nth 1 plist))) - (setq plist (cddr plist))) - p)) - -;;;###autoload -(defun doom-plist-keys (plist) - "Return the keys in PLIST." - (let (keys) - (while plist - (push (car plist) keys) - (setq plist (cddr plist))) - keys)) - -;;;###autoload -(defun doom-plist-values (plist) - "Return the values in PLIST." - (let (keys) - (while plist - (push (cadr plist) keys) - (setq plist (cddr plist))) - keys)) diff --git a/.config/emacs/core/autoload/process.el b/.config/emacs/core/autoload/process.el deleted file mode 100644 index e368be7..0000000 --- a/.config/emacs/core/autoload/process.el +++ /dev/null @@ -1,42 +0,0 @@ -;;; core/autoload/process.el -*- lexical-binding: t; -*- - -;;;###autoload -(defun doom-call-process (command &rest args) - "Execute COMMAND with ARGS synchronously. - -Returns (STATUS . OUTPUT) when it is done, where STATUS is the returned error -code of the process and OUTPUT is its stdout output." - (with-temp-buffer - (cons (or (apply #'call-process command nil t nil (remq nil args)) - -1) - (string-trim (buffer-string))))) - -;;;###autoload -(defun doom-exec-process (command &rest args) - "Execute COMMAND with ARGS synchronously. - -Unlike `doom-call-process', this pipes output to `standard-output' on the fly to -simulate 'exec' in the shell, so batch scripts could run external programs -synchronously without sacrificing their output. - -Warning: freezes indefinitely on any stdin prompt." - ;; FIXME Is there any way to handle prompts? - (with-temp-buffer - (cons (let ((process - (make-process :name "doom-sh" - :buffer (current-buffer) - :command (cons command (remq nil args)) - :connection-type 'pipe)) - done-p) - (set-process-filter - process (lambda (_process output) - (princ output (current-buffer)) - (princ (doom--format output)))) - (set-process-sentinel - process (lambda (process _event) - (when (memq (process-status process) '(exit stop)) - (setq done-p t)))) - (while (not done-p) - (sit-for 0.1)) - (process-exit-status process)) - (string-trim (buffer-string))))) diff --git a/.config/emacs/core/autoload/projects.el b/.config/emacs/core/autoload/projects.el deleted file mode 100644 index e17dcd0..0000000 --- a/.config/emacs/core/autoload/projects.el +++ /dev/null @@ -1,178 +0,0 @@ -;;; core/autoload/projects.el -*- lexical-binding: t; -*- - -;; HACK We forward declare these variables because they are let-bound in a -;; number of places with no guarantee that they've been defined yet (i.e. -;; that `projectile' is loaded). If a variable is defined with `defvar' -;; while it is lexically bound, you get "Defining as dynamic an already -;; lexical var" errors in Emacs 28+). -;;;###autoload (defvar projectile-project-root nil) -;;;###autoload (defvar projectile-enable-caching doom-interactive-p) -;;;###autoload (defvar projectile-require-project-root 'prompt) - -;;;###autodef -(cl-defun set-project-type! (name &key predicate compile run test configure dir) - "Add a project type to `projectile-project-type'." - (declare (indent 1)) - (after! projectile - (add-to-list 'projectile-project-types - (list name - 'marker-files predicate - 'compilation-dir dir - 'configure-command configure - 'compile-command compile - 'test-command test - 'run-command run)))) - - -;; -;;; Macros - -;;;###autoload -(defmacro project-file-exists-p! (files) - "Checks if the project has the specified FILES. -Paths are relative to the project root, unless they start with ./ or ../ (in -which case they're relative to `default-directory'). If they start with a slash, -they are absolute." - `(file-exists-p! ,files (doom-project-root))) - - -;; -;;; Commands - -;;;###autoload -(defun doom/find-file-in-other-project (project-root) - "Performs `projectile-find-file' in a known project of your choosing." - (interactive - (list - (completing-read "Find file in project: " (projectile-relevant-known-projects)))) - (unless (file-directory-p project-root) - (error "Project directory '%s' doesn't exist" project-root)) - (doom-project-find-file project-root)) - -;;;###autoload -(defun doom/browse-in-other-project (project-root) - "Performs `find-file' in a known project of your choosing." - (interactive - (list - (completing-read "Browse in project: " (projectile-relevant-known-projects)))) - (unless (file-directory-p project-root) - (error "Project directory '%s' doesn't exist" project-root)) - (doom-project-browse project-root)) - -;;;###autoload -(defun doom/browse-in-emacsd () - "Browse files from `doom-emacs-dir'." - (interactive) (doom-project-browse doom-emacs-dir)) - -;;;###autoload -(defun doom/find-file-in-emacsd () - "Find a file under `doom-emacs-dir', recursively." - (interactive) (doom-project-find-file doom-emacs-dir)) - -;;;###autoload -(defun doom/add-directory-as-project (dir) - "Register an arbitrary directory as a project. -If DIR is not a valid project, a .project file will be created within it. This -command will throw an error if a parent of DIR is a valid project (which would -mask DIR)." - (interactive "D") - (let ((short-dir (abbreviate-file-name dir))) - (unless (file-equal-p (doom-project-root dir) dir) - (with-temp-file (doom-path dir ".project"))) - (let ((proj-dir (doom-project-root dir))) - (unless (file-equal-p proj-dir dir) - (user-error "Can't add %S as a project, because %S is already a project" - short-dir (abbreviate-file-name proj-dir))) - (message "%S was not a project; adding .project file to it" - short-dir (abbreviate-file-name proj-dir)) - (projectile-add-known-project directory)))) - - -;; -;;; Library - -;;;###autoload -(defun doom-project-p (&optional dir) - "Return t if DIR (defaults to `default-directory') is a valid project." - (and (doom-project-root dir) - t)) - -;;;###autoload -(defun doom-project-root (&optional dir) - "Return the project root of DIR (defaults to `default-directory'). -Returns nil if not in a project." - (let ((projectile-project-root - (unless dir (bound-and-true-p projectile-project-root))) - projectile-require-project-root) - (projectile-project-root dir))) - -;;;###autoload -(defun doom-project-name (&optional dir) - "Return the name of the current project. - -Returns '-' if not in a valid project." - (if-let (project-root (or (doom-project-root dir) - (if dir (expand-file-name dir)))) - (funcall projectile-project-name-function project-root) - "-")) - -;;;###autoload -(defun doom-project-expand (name &optional dir) - "Expand NAME to project root." - (expand-file-name name (doom-project-root dir))) - -;;;###autoload -(defun doom-project-find-file (dir) - "Jump to a file in DIR (searched recursively). - -If DIR is not a project, it will be indexed (but not cached)." - (unless (file-directory-p dir) - (error "Directory %S does not exist" dir)) - (unless (file-readable-p dir) - (error "Directory %S isn't readable" dir)) - (let* ((default-directory (file-truename dir)) - (projectile-project-root (doom-project-root dir)) - (projectile-enable-caching projectile-enable-caching)) - (cond ((and projectile-project-root (file-equal-p projectile-project-root default-directory)) - (unless (doom-project-p default-directory) - ;; Disable caching if this is not a real project; caching - ;; non-projects easily has the potential to inflate the projectile - ;; cache beyond reason. - (setq projectile-enable-caching nil)) - (call-interactively - ;; Intentionally avoid `helm-projectile-find-file', because it runs - ;; asynchronously, and thus doesn't see the lexical - ;; `default-directory' - (if (doom-module-p :completion 'ivy) - #'counsel-projectile-find-file - #'projectile-find-file))) - ((and (bound-and-true-p vertico-mode) - (fboundp '+vertico/find-file-in)) - (+vertico/find-file-in default-directory)) - ((and (bound-and-true-p ivy-mode) - (fboundp 'counsel-file-jump)) - (call-interactively #'counsel-file-jump)) - ((project-current nil dir) - (project-find-file-in nil nil dir)) - ((and (bound-and-true-p helm-mode) - (fboundp 'helm-find-files)) - (call-interactively #'helm-find-files)) - ((call-interactively #'find-file))))) - -;;;###autoload -(defun doom-project-browse (dir) - "Traverse a file structure starting linearly from DIR." - (let ((default-directory (file-truename (expand-file-name dir)))) - (call-interactively - (cond ((doom-module-p :completion 'ivy) - #'counsel-find-file) - ((doom-module-p :completion 'helm) - #'helm-find-files) - (#'find-file))))) - -;;;###autoload -(defun doom-project-ignored-p (project-root) - "Return non-nil if temporary file or a straight package." - (unless (file-remote-p project-root) - (or (file-in-directory-p project-root temporary-file-directory) - (file-in-directory-p project-root doom-local-dir)))) diff --git a/.config/emacs/core/autoload/sandbox.el b/.config/emacs/core/autoload/sandbox.el deleted file mode 100644 index 1dab322..0000000 --- a/.config/emacs/core/autoload/sandbox.el +++ /dev/null @@ -1,183 +0,0 @@ -;;; core/autoload/sandbox.el -*- lexical-binding: t; -*- - -(defvar doom-sandbox-buffer-name "*doom:sandbox*" - "Name of the Doom sandbox buffer.") - -(defvar doom-sandbox-dir - (expand-file-name "doom-sandbox" (temporary-file-directory)) - "TODO") - -(defvar doom-sandbox-preamble - ";; Welcome to the sandbox! -;; -;; This is a test bed for running Emacs Lisp in another instance of Emacs that -;; has varying amounts of Doom loaded: -;; -;; - vanilla Emacs (nothing loaded) \\[doom--run-vanilla-emacs] -;; - vanilla Doom (only Doom core) \\[doom--run-vanilla-doom] -;; - Doom + modules - your private config \\[doom--run-vanilla-doom+] -;; - Doom + modules + your private config \\[doom--run-full-doom] -;; -;; This is done without sacrificing access to installed packages. Use the sandbox -;; to reproduce bugs and determine if Doom is to blame.\n\n" - "TODO") - -(defun doom--sandbox-launch (args forms) - (require 'package) - (require 'restart-emacs) - (let* ((sandbox-file (expand-file-name "init.el" doom-sandbox-dir)) - (args (append args (list "-l" sandbox-file)))) - (delete-directory doom-sandbox-dir 'recursive) - (make-directory doom-sandbox-dir 'parents) - (with-temp-file sandbox-file - (prin1 forms (current-buffer))) - (condition-case-unless-debug e - (cond ((display-graphic-p) - (if (memq system-type '(windows-nt ms-dos)) - (restart-emacs--start-gui-on-windows args) - (restart-emacs--start-gui-using-sh args))) - ((memq system-type '(windows-nt ms-dos)) - (user-error "Cannot start another Emacs from Windows shell.")) - ((suspend-emacs - (format "%s %s -nw; fg" - (shell-quote-argument (restart-emacs--get-emacs-binary)) - (mapconcat #'shell-quote-argument args " "))))) - (error - (delete-directory doom-sandbox-dir 'recursive) - (signal (car e) (cdr e)))))) - - -(defun doom--sandbox-run (&optional mode) - "TODO" - (doom--sandbox-launch - (unless (eq mode 'doom) '("-Q")) - (let ((forms - (read (format "(progn\n%s\n)" - (buffer-substring-no-properties - (point-min) - (point-max)))))) - (if (eq mode 'doom) - forms - `(progn - ;; doom variables - (setq doom-debug-p t - doom-emacs-dir ,doom-emacs-dir - doom-cache-dir ,(expand-file-name "cache/" doom-sandbox-dir) - doom-etc-dir ,(expand-file-name "etc/" doom-sandbox-dir)) - (defun doom--write-to-etc-dir-a (fn &rest args) - (let ((user-emacs-directory doom-etc-dir)) - (apply fn args))) - (advice-add #'locate-user-emacs-file :around #'doom--write-to-etc-dir-a) - ;; emacs essential variables - (setq before-init-time (current-time) - after-init-time nil - init-file-debug doom-debug-p - noninteractive nil - process-environment (get 'process-environment 'initial-value) - exec-path (get 'exec-path 'initial-value) - load-path ',load-path - user-init-file load-file-name) - ;; package.el - (setq package--init-file-ensured t - package-user-dir ,package-user-dir - package-archives ',package-archives) - ;; (add-hook 'kill-emacs-hook - ;; (lambda () - ;; (delete-file user-init-file) - ;; (when (file-equal-p user-emacs-directory ,doom-sandbox-dir) - ;; (delete-directory user-emacs-directory 'recursive)))) - (with-eval-after-load 'undo-tree - ;; HACK `undo-tree' sometimes throws errors because - ;; `buffer-undo-tree' isn't correctly initialized. - (setq-default buffer-undo-tree (make-undo-tree))) - ;; Then launch as much about Emacs as we can - (defun --run-- () ,forms) - ,(pcase mode - (`doom - '(--run--)) - (`vanilla-doom+ ; Doom core + modules - private config - `(progn - (load-file ,(expand-file-name "core.el" doom-core-dir)) - (setq doom-modules-dirs (list doom-modules-dir)) - (let ((doom-init-modules-p t)) - (doom-initialize) - (doom-initialize-core-modules)) - (setq doom-modules ',doom-modules) - (maphash (lambda (key plist) - (doom-module-put - (car key) (cdr key) - :path (doom-module-locate-path (car key) (cdr key)))) - doom-modules) - (--run--) - (maphash (doom-module-loader doom-module-init-file) doom-modules) - (maphash (doom-module-loader doom-module-config-file) doom-modules) - (doom-run-hooks 'doom-init-modules-hook))) - (`vanilla-doom ; only Doom core - `(progn - (load-file ,(expand-file-name "core.el" doom-core-dir)) - (let ((doom-init-modules-p t)) - (doom-initialize) - (doom-initialize-core-modules)) - (--run--))) - (`vanilla ; nothing loaded - `(progn - (if (boundp 'comp-deferred-compilation) - ;; REVIEW Remove me after a month - (setq comp-deferred-compilation nil - comp-deferred-compilation-deny-list ',(bound-and-true-p native-comp-async-env-modifier-form) - comp-async-env-modifier-form ',(bound-and-true-p native-comp-async-env-modifier-form) - comp-eln-load-path ',(bound-and-true-p native-comp-eln-load-path)) - (setq native-comp-deferred-compilation nil - native-comp-deferred-compilation-deny-list ',(bound-and-true-p native-comp-async-env-modifier-form) - native-comp-async-env-modifier-form ',(bound-and-true-p native-comp-async-env-modifier-form) - native-comp-eln-load-path ',(bound-and-true-p native-comp-eln-load-path))) - (package-initialize t) - (--run--)))) - ;; Then rerun Emacs' startup hooks to simulate a fresh Emacs session, - ;; because they've already fired. - (fset 'doom-run-hook #',(symbol-function #'doom-run-hook)) - (fset 'doom-run-hooks #',(symbol-function #'doom-run-hooks)) - (fset 'doom-run-all-startup-hooks-h #',(symbol-function #'doom-run-all-startup-hooks-h)) - (doom-run-all-startup-hooks-h)))))) - -(fset 'doom--run-vanilla-emacs (cmd! (doom--sandbox-run 'vanilla))) -(fset 'doom--run-vanilla-doom (cmd! (doom--sandbox-run 'vanilla-doom))) -(fset 'doom--run-vanilla-doom+ (cmd! (doom--sandbox-run 'vanilla-doom+))) -(fset 'doom--run-full-doom (cmd! (doom--sandbox-run 'doom))) - -(defvar doom-sandbox-emacs-lisp-mode-map - (let ((map (make-sparse-keymap))) - (define-key map (kbd "C-c C-c") #'doom--run-vanilla-emacs) - (define-key map (kbd "C-c C-d") #'doom--run-vanilla-doom) - (define-key map (kbd "C-c C-p") #'doom--run-vanilla-doom+) - (define-key map (kbd "C-c C-f") #'doom--run-full-doom) - (define-key map (kbd "C-c C-k") #'kill-current-buffer) - map)) - -(define-derived-mode doom-sandbox-emacs-lisp-mode emacs-lisp-mode "Sandbox Elisp" - "TODO") - -;;;###autoload -(defun doom/sandbox () - "Open the Emacs Lisp sandbox. - -This is a test bed for running Emacs Lisp in another instance of Emacs with -varying amounts of Doom loaded, including: - - a) vanilla Emacs (nothing loaded), - b) vanilla Doom (only Doom core), - c) Doom + modules - your private config or - c) Doom + modules + your private config (a complete Doom session) - -This is done without sacrificing access to installed packages. Use the sandbox -to reproduce bugs and determine if Doom is to blame." - (interactive) - (pop-to-buffer - (with-current-buffer (get-buffer-create doom-sandbox-buffer-name) - (doom-sandbox-emacs-lisp-mode) - (setq-local default-directory doom-emacs-dir) - (and (buffer-live-p (get-buffer doom-sandbox-buffer-name)) - (= (buffer-size) 0) - (insert (substitute-command-keys doom-sandbox-preamble))) - (goto-char (point-max)) - (current-buffer)))) diff --git a/.config/emacs/core/autoload/scratch.el b/.config/emacs/core/autoload/scratch.el deleted file mode 100644 index 645d26e..0000000 --- a/.config/emacs/core/autoload/scratch.el +++ /dev/null @@ -1,199 +0,0 @@ -;;; core/autoload/scratch.el -*- lexical-binding: t; -*- - -(defvar doom-scratch-default-file "__default" - "The default file name for a project-less scratch buffer. - -Will be saved in `doom-scratch-dir'.") - -(defvar doom-scratch-dir (concat doom-etc-dir "scratch") - "Where to save persistent scratch buffers.") - -(defvar doom-scratch-initial-major-mode nil - "What major mode to start fresh scratch buffers in. - -Scratch buffers preserve their last major mode, however, so this only affects -the first, fresh scratch buffer you create. This accepts: - - t Inherits the major mode of the last buffer you had selected. - nil Uses `fundamental-mode' - MAJOR-MODE Any major mode symbol") - -(defvar doom-scratch-buffers nil - "A list of active scratch buffers.") - -(defvar doom-scratch-current-project nil - "The name of the project associated with the current scratch buffer.") -(put 'doom-scratch-current-project 'permanent-local t) - -(defvar doom-scratch-buffer-hook () - "The hooks to run after a scratch buffer is created.") - - -(defun doom--load-persistent-scratch-buffer (project-name) - (setq-local doom-scratch-current-project - (or project-name - doom-scratch-default-file)) - (let ((smart-scratch-file - (expand-file-name (concat doom-scratch-current-project ".el") - doom-scratch-dir))) - (make-directory doom-scratch-dir t) - (when (file-readable-p smart-scratch-file) - (message "Reading %s" smart-scratch-file) - (cl-destructuring-bind (content point mode) - (with-temp-buffer - (save-excursion (insert-file-contents smart-scratch-file)) - (read (current-buffer))) - (erase-buffer) - (funcall mode) - (insert content) - (goto-char point) - t)))) - -;;;###autoload -(defun doom-scratch-buffer (&optional dont-restore-p mode directory project-name) - "Return a scratchpad buffer in major MODE." - (let* ((buffer-name (if project-name - (format "*doom:scratch (%s)*" project-name) - "*doom:scratch*")) - (buffer (get-buffer buffer-name))) - (with-current-buffer - (or buffer (get-buffer-create buffer-name)) - (setq default-directory directory) - (setq-local so-long--inhibited t) - (if dont-restore-p - (erase-buffer) - (unless buffer - (doom--load-persistent-scratch-buffer project-name) - (when (and (eq major-mode 'fundamental-mode) - (functionp mode)) - (funcall mode)))) - (cl-pushnew (current-buffer) doom-scratch-buffers) - (add-transient-hook! 'doom-switch-buffer-hook (doom-persist-scratch-buffers-h)) - (add-transient-hook! 'doom-switch-window-hook (doom-persist-scratch-buffers-h)) - (add-hook 'kill-buffer-hook #'doom-persist-scratch-buffer-h nil 'local) - (run-hooks 'doom-scratch-buffer-created-hook) - (current-buffer)))) - - -;; -;;; Persistent scratch buffer - -;;;###autoload -(defun doom-persist-scratch-buffer-h () - "Save the current buffer to `doom-scratch-dir'." - (let ((content (buffer-substring-no-properties (point-min) (point-max))) - (point (point)) - (mode major-mode)) - (with-temp-file - (expand-file-name (concat (or doom-scratch-current-project - doom-scratch-default-file) - ".el") - doom-scratch-dir) - (prin1 (list content - point - mode) - (current-buffer))))) - -;;;###autoload -(defun doom-persist-scratch-buffers-h () - "Save all scratch buffers to `doom-scratch-dir'." - (setq doom-scratch-buffers - (cl-delete-if-not #'buffer-live-p doom-scratch-buffers)) - (dolist (buffer doom-scratch-buffers) - (with-current-buffer buffer - (doom-persist-scratch-buffer-h)))) - -;;;###autoload -(defun doom-persist-scratch-buffers-after-switch-h () - "Kill scratch buffers when they are no longer visible, saving them to disk." - (unless (cl-some #'get-buffer-window doom-scratch-buffers) - (mapc #'kill-buffer doom-scratch-buffers) - (remove-hook 'doom-switch-buffer-hook #'doom-persist-scratch-buffers-after-switch-h))) - -;;;###autoload -(when doom-interactive-p - (add-hook 'kill-emacs-hook #'doom-persist-scratch-buffers-h)) - - -;; -;;; Commands - -(defvar projectile-enable-caching) -;;;###autoload -(defun doom/open-scratch-buffer (&optional arg project-p same-window-p) - "Pop up a persistent scratch buffer. - -If passed the prefix ARG, do not restore the last scratch buffer. -If PROJECT-P is non-nil, open a persistent scratch buffer associated with the - current project." - (interactive "P") - (let (projectile-enable-caching) - (funcall - (if same-window-p - #'switch-to-buffer - #'pop-to-buffer) - (doom-scratch-buffer - arg - (cond ((eq doom-scratch-initial-major-mode t) - (unless (or buffer-read-only - (derived-mode-p 'special-mode) - (string-match-p "^ ?\\*" (buffer-name))) - major-mode)) - ((null doom-scratch-initial-major-mode) - nil) - ((symbolp doom-scratch-initial-major-mode) - doom-scratch-initial-major-mode)) - default-directory - (when project-p - (doom-project-name)))))) - -;;;###autoload -(defun doom/switch-to-scratch-buffer (&optional arg project-p) - "Like `doom/open-scratch-buffer', but switches to it in the current window. - -If passed the prefix ARG, do not restore the last scratch buffer." - (interactive "P") - (doom/open-scratch-buffer arg project-p 'same-window)) - -;;;###autoload -(defun doom/open-project-scratch-buffer (&optional arg same-window-p) - "Opens the (persistent) project scratch buffer in a popup. - -If passed the prefix ARG, do not restore the last scratch buffer." - (interactive "P") - (doom/open-scratch-buffer arg 'project same-window-p)) - -;;;###autoload -(defun doom/switch-to-project-scratch-buffer (&optional arg) - "Like `doom/open-project-scratch-buffer', but switches to it in the current -window. - -If passed the prefix ARG, do not restore the last scratch buffer." - (interactive "P") - (doom/open-project-scratch-buffer arg 'same-window)) - -;;;###autoload -(defun doom/revert-scratch-buffer () - "Revert scratch buffer to last persistent state." - (interactive) - (unless (string-match-p "^\\*doom:scratch" (buffer-name)) - (user-error "Not in a scratch buffer")) - (when (doom--load-persistent-scratch-buffer doom-scratch-current-project) - (message "Reloaded scratch buffer"))) - -;;;###autoload -(defun doom/delete-persistent-scratch-file (&optional arg) - "Deletes a scratch buffer file in `doom-scratch-dir'. - -If prefix ARG, delete all persistent scratches." - (interactive) - (if arg - (progn - (delete-directory doom-scratch-dir t) - (message "Cleared %S" (abbreviate-file-name doom-scratch-dir))) - (make-directory doom-scratch-dir t) - (let ((file (read-file-name "Delete scratch file > " doom-scratch-dir "scratch"))) - (if (not (file-exists-p file)) - (message "%S does not exist" (abbreviate-file-name file)) - (delete-file file) - (message "Successfully deleted %S" (abbreviate-file-name file)))))) diff --git a/.config/emacs/core/autoload/sessions.el b/.config/emacs/core/autoload/sessions.el deleted file mode 100644 index 0d018df..0000000 --- a/.config/emacs/core/autoload/sessions.el +++ /dev/null @@ -1,131 +0,0 @@ -;;; core/autoload/sessions.el -*- lexical-binding: t; -*- - -(defvar desktop-base-file-name) -(defvar desktop-dirname) -(defvar desktop-restore-eager) -(defvar desktop-file-modtime) - - -;; -;;; Helpers - -;;;###autoload -(defun doom-session-file (&optional name) - "TODO" - (cond ((require 'persp-mode nil t) - (expand-file-name (or name persp-auto-save-fname) persp-save-dir)) - ((require 'desktop nil t) - (if name - (expand-file-name name (file-name-directory (desktop-full-file-name))) - (desktop-full-file-name))) - ((error "No session backend available")))) - -;;;###autoload -(defun doom-save-session (&optional file) - "TODO" - (setq file (expand-file-name (or file (doom-session-file)))) - (cond ((require 'persp-mode nil t) - (unless persp-mode (persp-mode +1)) - (setq persp-auto-save-opt 0) - (persp-save-state-to-file file)) - ((and (require 'frameset nil t) - (require 'restart-emacs nil t)) - (let ((frameset-filter-alist (append '((client . restart-emacs--record-tty-file)) - frameset-filter-alist)) - (desktop-base-file-name (file-name-nondirectory file)) - (desktop-dirname (file-name-directory file)) - (desktop-restore-eager t) - desktop-file-modtime) - (make-directory desktop-dirname t) - ;; Prevents confirmation prompts - (let ((desktop-file-modtime (nth 5 (file-attributes (desktop-full-file-name))))) - (desktop-save desktop-dirname t)))) - ((error "No session backend to save session with")))) - -;;;###autoload -(defun doom-load-session (&optional file) - "TODO" - (setq file (expand-file-name (or file (doom-session-file)))) - (message "Attempting to load %s" file) - (cond ((not (file-readable-p file)) - (message "No session file at %S to read from" file)) - ((require 'persp-mode nil t) - (unless persp-mode - (persp-mode +1)) - (let ((allowed (persp-list-persp-names-in-file file))) - (cl-loop for name being the hash-keys of *persp-hash* - unless (member name allowed) - do (persp-kill name)) - (persp-load-state-from-file file))) - ((and (require 'frameset nil t) - (require 'restart-emacs nil t)) - (restart-emacs--restore-frames-using-desktop file)) - ((error "No session backend to load session with")))) - - -;; -;;; Commands - -;;;###autoload -(defun doom/quickload-session () - "TODO" - (interactive) - (message "Restoring session...") - (doom-load-session) - (message "Session restored. Welcome back.")) - -;;;###autoload -(defun doom/quicksave-session () - "TODO" - (interactive) - (message "Saving session") - (doom-save-session) - (message "Saving session...DONE")) - -;;;###autoload -(defun doom/load-session (file) - "TODO" - (interactive - (let ((session-file (doom-session-file))) - (list (or (read-file-name "Session to restore: " - (file-name-directory session-file) - (file-name-nondirectory session-file) - t) - (user-error "No session selected. Aborting"))))) - (unless file - (error "No session file selected")) - (message "Loading '%s' session" file) - (doom-load-session file) - (message "Session restored. Welcome back.")) - -;;;###autoload -(defun doom/save-session (file) - "TODO" - (interactive - (let ((session-file (doom-session-file))) - (list (or (read-file-name "Save session to: " - (file-name-directory session-file) - (file-name-nondirectory session-file)) - (user-error "No session selected. Aborting"))))) - (unless file - (error "No session file selected")) - (message "Saving '%s' session" file) - (doom-save-session file)) - -;;;###autoload -(defalias 'doom/restart #'restart-emacs) - -;;;###autoload -(defun doom/restart-and-restore (&optional debug) - "TODO" - (interactive "P") - (setq doom-autosave-session nil) - (doom/quicksave-session) - (save-some-buffers nil t) - (letf! ((#'save-buffers-kill-emacs #'kill-emacs) - (confirm-kill-emacs)) - (restart-emacs - (append (if debug (list "--debug-init")) - (when (boundp 'chemacs-current-emacs-profile) - (list "--with-profile" chemacs-current-emacs-profile)) - (list "--eval" "(add-hook 'window-setup-hook #'doom-load-session 100)"))))) diff --git a/.config/emacs/core/autoload/store.el b/.config/emacs/core/autoload/store.el deleted file mode 100644 index 651fb17..0000000 --- a/.config/emacs/core/autoload/store.el +++ /dev/null @@ -1,155 +0,0 @@ -;;; core/autoload/cache.el -*- lexical-binding: t; -*- - -;; This little library abstracts the process of writing arbitrary elisp values -;; to a 2-tiered file store (in `doom-store-dir'/`doom-store-location'). - -(defvar doom-store-dir (concat doom-etc-dir "store/") - "Directory to look for and store data accessed through this API.") - -(defvar doom-store-persist-alist () - "An alist of alists, containing lists of variables for the doom cache library -to persist across Emacs sessions.") - -(defvar doom-store-location "default" - "The default location for cache files. This symbol is translated into a file -name under `pcache-directory' (by default a subdirectory under -`doom-store-dir'). One file may contain multiple cache entries.") - -(defvar doom--store-table (make-hash-table :test 'equal)) - -(defun doom-save-persistent-store-h () - "Hook to persist `doom-store's storage when Emacs is killed." - (let (locations) - ;; Persist `doom-store-persist-alist' - (dolist (alist (butlast doom-store-persist-alist 1)) - (cl-loop with location = (car alist) - for var in (cdr alist) - do (doom-store-put var (symbol-value var) nil location 'noflush) - and do (cl-pushnew location locations :test #'equal))) - ;; Clean up expired entries, - (dolist (location (doom-files-in doom-store-dir :relative-to doom-store-dir)) - (maphash (lambda (key val) - (when (doom--store-expired-p key val) - (cl-pushnew location locations :test #'equal) - (doom--store-rem key location 'noflush))) - (doom--store-init location))) - (mapc #'doom--store-flush locations))) -(add-hook 'kill-emacs-hook #'doom-save-persistent-store-h) - - -;; -;;; Library - -;;;###autoload -(defun doom-store-persist (location variables) - "Persist VARIABLES (list of symbols) in LOCATION (symbol). -This populates these variables with cached values, if one exists, and saves them -to file when Emacs quits. This cannot persist buffer-local variables." - (cl-check-type location string) - (dolist (var variables) - (when (doom-store-member-p var location) - (set var (doom-store-get var location)))) - (setf (alist-get location doom-store-persist-alist) - (append variables (alist-get location doom-store-persist-alist)))) - -;;;###autoload -(defun doom-store-desist (location &optional variables) - "Unregisters VARIABLES (list of symbols) in LOCATION (symbol). -Variables to persist are recorded in `doom-store-persist-alist'. Does not affect -the actual variables themselves or their values." - (cl-check-type location string) - (if variables - (setf (alist-get location doom-store-persist-alist) - (cl-set-difference (cdr (assq location doom-store-persist-alist)) - variables)) - (delq! location doom-store-persist-alist 'assoc))) - -(defun doom--store-init (&optional location) - (cl-check-type location (or null string)) - (let ((location (or location doom-store-location))) - (or (gethash location doom--store-table) - (let* ((file-name-handler-alist nil) - (location-path (expand-file-name location doom-store-dir))) - (if (file-exists-p location-path) - (puthash location - (with-temp-buffer - (set-buffer-multibyte nil) - (setq buffer-file-coding-system 'binary) - (insert-file-contents-literally location-path) - (read (current-buffer))) - doom--store-table) - (puthash location (make-hash-table :test 'equal) - doom--store-table)))))) - -(defun doom--store-expired-p (key data) - (let ((ttl (car data))) - (cond ((functionp ttl) - (not (funcall ttl key data))) - ((consp ttl) - (time-less-p ttl (current-time)))))) - -(defun doom--store-flush (location) - "Write `doom--store-table' to `doom-store-dir'." - (let ((file-name-handler-alist nil) - (coding-system-for-write 'binary) - (write-region-annotate-functions nil) - (write-region-post-annotation-function nil)) - (let* ((location (or location doom-store-location)) - (data (doom--store-init location))) - (make-directory doom-store-dir 'parents) - (with-temp-file (expand-file-name location doom-store-dir) - (prin1 data (current-buffer))) - data))) - - -;;;###autoload -(defun doom-store-get (key &optional location default-value noflush) - "Retrieve KEY from LOCATION (defaults to `doom-store-location'). -If it doesn't exist or has expired, DEFAULT_VALUE is returned." - (let ((data (gethash key (doom--store-init location) default-value))) - (if (not (or (eq data default-value) - (doom--store-expired-p key data))) - (cdr data) - (doom-store-rem key location noflush) - default-value))) - -;;;###autoload -(defun doom-store-put (key value &optional ttl location noflush) - "Set KEY to VALUE in the store at LOCATION. -KEY can be any lisp object that is comparable with `equal'. TTL is the duration -(in seconds) after which this cache entry expires; if nil, no cache expiration. -LOCATION is the super-key to store this cache item under. It defaults to -`doom-store-location'." - (cl-check-type ttl (or null integer function)) - (puthash key (cons (if (integerp ttl) - (time-add (current-time) ttl) - ttl) - value) - (doom--store-init location)) - (unless noflush - (doom--store-flush location))) - -;;;###autoload -(defun doom-store-rem (key &optional location noflush) - "Clear a cache LOCATION (defaults to `doom-store-location')." - (remhash key (doom--store-init location)) - (unless noflush - (doom--store-flush location))) - -;;;###autoload -(defun doom-store-member-p (key &optional location) - "Return t if KEY in LOCATION exists. -LOCATION defaults to `doom-store-location'." - (let ((nil-value (format "--nilvalue%s--" (current-time)))) - (not (equal (doom-store-get key location nil-value) - nil-value)))) - -;;;###autoload -(defun doom-store-clear (&optional location) - "Clear the store at LOCATION (defaults to `doom-store-location')." - (let* ((location (or location doom-store-location)) - (path (expand-file-name location doom-store-dir))) - (remhash location doom--store-table) - (when (file-exists-p path) - (delete-file path) - t))) diff --git a/.config/emacs/core/autoload/system.el b/.config/emacs/core/autoload/system.el deleted file mode 100644 index 4f98d1e..0000000 --- a/.config/emacs/core/autoload/system.el +++ /dev/null @@ -1,108 +0,0 @@ -;;; core/autoload/system.el -*- lexical-binding: t; -*- - -;;;###autoload -(defun doom-system-distro () - "Return a symbol representing the installed distro." - (cond (IS-WINDOWS 'windows) - (IS-MAC 'macos) - ((and (file-exists-p "/etc/os-release") - (with-temp-buffer - (insert-file-contents "/etc/os-release") - (when (re-search-forward "^ID=\"?\\([^\"\n]+\\)\"?" nil t) - (intern (downcase (match-string 1))))))) - ;; A few redundancies in case os-release fails us - ((file-exists-p "/etc/debian_version") - 'debian) - ((executable-find "nixos-version") - 'nixos) - ((and (or (file-exists-p "/etc/config.scm") - (file-directory-p "/run/current-system")) - (executable-find "guix")) - 'guix) - ('linux))) - -;;;###autoload -(defun doom-system-distro-version () - "Return a distro name and version string." - (letf! (defun sh (&rest args) (cdr (apply #'doom-call-process args))) - (let ((distro (doom-system-distro))) - (cond - ((eq distro 'windows) - (format "Windows %s" "Unknown")) ; TODO - ((eq distro 'macos) - (format "MacOS %s" (sh "sw_vers" "-productVersion"))) - ((executable-find "lsb_release") - (sh "lsb_release" "-s" "-d")) - ((executable-find "nixos-version") - (format "NixOS %s" (sh "nixos-version"))) - ((and (file-exists-p "/etc/os-release") - (with-temp-buffer - (insert-file-contents "/etc/os-release") - (when (re-search-forward "^PRETTY_NAME=\"?\\([^\"\n]+\\)\"?" nil t) - (match-string 1))))) - ((when-let (files (doom-glob "/etc/*-release")) - (truncate-string-to-width - (replace-regexp-in-string "\n" " " (cat (car files) 73) nil t) - 64 nil nil "..."))) - ((concat "Unknown " (sh "uname" "-v"))))))) - -;;;###autoload -(defun doom-system-distro-icon () - "Display icon for the installed distro." - (propertize - (pcase (doom-system-distro) - (`windows (all-the-icons-faicon "windows")) - (`macos (all-the-icons-faicon "apple")) - (`arch "\uF303") - (`debian "\uF306") - (`raspbian "\uF315") - (`ubuntu "\uF31b") - (`elementary "\uF309") - (`fedora "\uF30a") - (`coreos "\uF305") - (`gentoo "\uF30d") - (`mageia "\uF310") - (`centos "\uF304") - ((or `opensuse `tumbleweed) "\uF314") - (`sabayon "\uF317") - (`slackware "\uF319") - (`linuxmint "\uF30e") - (`alpine "\uF300") - (`aosc "\uF301") - (`nixos "\uF313") - (`devuan "\uF307") - (`manjaro "\uF312") - ((or `void `artix) "\uF17c") - (_ (all-the-icons-faicon "linux"))) - 'face '(:height 1) - 'display '(raise 0))) - -;;;###autoload -(defun doom-system-cpus () - "Return the max number of processing units on this system. -Tries to be portable. Returns 1 if cannot be determined." - (or (get 'doom-system-cpus 'cached-value) - (put 'doom-system-cpus 'cached-value - (let ((cpus - (cond ((fboundp 'w32-get-nproc) - (w32-get-nproc)) - ((getenv "NUMBER_OF_PROCESSORS")) - ((executable-find "nproc") - (doom-call-process "nproc")) - ((executable-find "sysctl") - (doom-call-process "sysctl" "-n" "hw.ncpu"))))) - (max - 1 (or (cl-typecase cpus - (integer cpus) - (string - (condition-case _ - (string-to-number cpus) - (wrong-type-argument - (user-error "NUMBER_OF_PROCESSORS contains an invalid value: %S" - cpus)))) - (consp - (if (zerop (car cpus)) - (string-to-number (cdr cpus)) - (user-error "Failed to look up number of processors, because:\n\n%s" - (cdr cpus))))) - 1)))))) diff --git a/.config/emacs/core/autoload/text.el b/.config/emacs/core/autoload/text.el deleted file mode 100644 index dffdff8..0000000 --- a/.config/emacs/core/autoload/text.el +++ /dev/null @@ -1,349 +0,0 @@ -;;; core/autoload/text.el -*- lexical-binding: t; -*- - -;;;###autoload -(defvar doom-point-in-comment-functions () - "List of functions to run to determine if point is in a comment. - -Each function takes one argument: the position of the point. Stops on the first -function to return non-nil. Used by `doom-point-in-comment-p'.") - -;;;###autoload -(defvar doom-point-in-string-functions () - "List of functions to run to determine if point is in a string. - -Each function takes one argument: the position of the point. Stops on the first -function to return non-nil. Used by `doom-point-in-string-p'.") - -;;;###autoload -(defun doom-surrounded-p (pair &optional inline balanced) - "Returns t if point is surrounded by a brace delimiter: {[( - -If INLINE is non-nil, only returns t if braces are on the same line, and -whitespace is balanced on either side of the cursor. - -If INLINE is nil, returns t if the opening and closing braces are on adjacent -lines, above and below, with only whitespace in between." - (when pair - (let ((beg (plist-get pair :beg)) - (end (plist-get pair :end)) - (pt (point))) - (when (and (> pt beg) (< pt end)) - (when-let* ((cl (plist-get pair :cl)) - (op (plist-get pair :op))) - (and (not (string= op "")) - (not (string= cl "")) - (let ((nbeg (+ (length op) beg)) - (nend (- end (length cl)))) - (let ((content (buffer-substring-no-properties nbeg nend))) - (and (string-match-p (format "[ %s]*" (if inline "" "\n")) content) - (or (not balanced) - (= (- pt nbeg) (- nend pt)))))))))))) - -;;;###autoload -(defun doom-point-in-comment-p (&optional pos) - "Return non-nil if POS is in a comment. -POS defaults to the current position." - (let ((pos (or pos (point)))) - (if doom-point-in-comment-functions - (run-hook-with-args-until-success 'doom-point-in-comment-functions pos) - (nth 4 (syntax-ppss pos))))) - -;;;###autoload -(defun doom-point-in-string-p (&optional pos) - "Return non-nil if POS is in a string." - ;; REVIEW Should we cache `syntax-ppss'? - (let ((pos (or pos (point)))) - (if doom-point-in-string-functions - (run-hook-with-args-until-success 'doom-point-in-string-functions pos) - (nth 3 (syntax-ppss pos))))) - -;;;###autoload -(defun doom-point-in-string-or-comment-p (&optional pos) - "Return non-nil if POS is in a string or comment." - (or (doom-point-in-string-p pos) - (doom-point-in-comment-p pos))) - -;;;###autoload -(defun doom-region-active-p () - "Return non-nil if selection is active. -Detects evil visual mode as well." - (declare (side-effect-free t)) - (or (use-region-p) - (and (bound-and-true-p evil-local-mode) - (evil-visual-state-p)))) - -;;;###autoload -(defun doom-region-beginning () - "Return beginning position of selection. -Uses `evil-visual-beginning' if available." - (declare (side-effect-free t)) - (or (and (bound-and-true-p evil-local-mode) - (markerp evil-visual-beginning) - (marker-position evil-visual-beginning)) - (region-beginning))) - -;;;###autoload -(defun doom-region-end () - "Return end position of selection. -Uses `evil-visual-end' if available." - (declare (side-effect-free t)) - (if (bound-and-true-p evil-local-mode) - evil-visual-end - (region-end))) - -;;;###autoload -(defun doom-thing-at-point-or-region (&optional thing prompt) - "Grab the current selection, THING at point, or xref identifier at point. - -Returns THING if it is a string. Otherwise, if nothing is found at point and -PROMPT is non-nil, prompt for a string (if PROMPT is a string it'll be used as -the prompting string). Returns nil if all else fails. - -NOTE: Don't use THING for grabbing symbol-at-point. The xref fallback is smarter -in some cases." - (declare (side-effect-free t)) - (cond ((stringp thing) - thing) - ((doom-region-active-p) - (buffer-substring-no-properties - (doom-region-beginning) - (doom-region-end))) - (thing - (thing-at-point thing t)) - ((require 'xref nil t) - ;; Eglot, nox (a fork of eglot), and elpy implementations for - ;; `xref-backend-identifier-at-point' betray the documented purpose of - ;; the interface. Eglot/nox return a hardcoded string and elpy prepends - ;; the line number to the symbol. - (if (memq (xref-find-backend) '(eglot elpy nox)) - (thing-at-point 'symbol t) - ;; A little smarter than using `symbol-at-point', though in most - ;; cases, xref ends up using `symbol-at-point' anyway. - (xref-backend-identifier-at-point (xref-find-backend)))) - (prompt - (read-string (if (stringp prompt) prompt ""))))) - - -;; -;;; Commands - -(defun doom--bol-bot-eot-eol (&optional pos) - (save-mark-and-excursion - (when pos - (goto-char pos)) - (let* ((bol (if visual-line-mode - (save-excursion - (beginning-of-visual-line) - (point)) - (line-beginning-position))) - (bot (save-excursion - (goto-char bol) - (skip-chars-forward " \t\r") - (point))) - (eol (if visual-line-mode - (save-excursion (end-of-visual-line) (point)) - (line-end-position))) - (eot (or (save-excursion - (if (not comment-use-syntax) - (progn - (goto-char bol) - (when (re-search-forward comment-start-skip eol t) - (or (match-end 1) (match-beginning 0)))) - (goto-char eol) - (while (and (doom-point-in-comment-p) - (> (point) bol)) - (backward-char)) - (skip-chars-backward " " bol) - (or (eq (char-after) 32) - (eolp) - (bolp) - (forward-char)) - (point))) - eol))) - (list bol bot eot eol)))) - -(defvar doom--last-backward-pt nil) -;;;###autoload -(defun doom/backward-to-bol-or-indent (&optional point) - "Jump between the indentation column (first non-whitespace character) and the -beginning of the line. The opposite of -`doom/forward-to-last-non-comment-or-eol'." - (interactive "^d") - (let ((pt (or point (point)))) - (cl-destructuring-bind (bol bot _eot _eol) - (doom--bol-bot-eot-eol pt) - (cond ((> pt bot) - (goto-char bot)) - ((= pt bol) - (or (and doom--last-backward-pt - (= (line-number-at-pos doom--last-backward-pt) - (line-number-at-pos pt))) - (setq doom--last-backward-pt nil)) - (goto-char (or doom--last-backward-pt bot)) - (setq doom--last-backward-pt nil)) - ((<= pt bot) - (setq doom--last-backward-pt pt) - (goto-char bol)))))) - -(defvar doom--last-forward-pt nil) -;;;###autoload -(defun doom/forward-to-last-non-comment-or-eol (&optional point) - "Jumps between the last non-blank, non-comment character in the line and the -true end of the line. The opposite of `doom/backward-to-bol-or-indent'." - (interactive "^d") - (let ((pt (or point (point)))) - (cl-destructuring-bind (_bol _bot eot eol) - (doom--bol-bot-eot-eol pt) - (cond ((< pt eot) - (goto-char eot)) - ((= pt eol) - (goto-char (or doom--last-forward-pt eot)) - (setq doom--last-forward-pt nil)) - ((>= pt eot) - (setq doom--last-backward-pt pt) - (goto-char eol)))))) - -;;;###autoload -(defun doom/backward-kill-to-bol-and-indent () - "Kill line to the first non-blank character. If invoked again afterwards, kill -line to beginning of line. Same as `evil-delete-back-to-indentation'." - (interactive) - (let ((empty-line-p (save-excursion (beginning-of-line) - (looking-at-p "[ \t]*$")))) - (funcall (if (fboundp 'evil-delete) - #'evil-delete - #'delete-region) - (point-at-bol) (point)) - (unless empty-line-p - (indent-according-to-mode)))) - -;;;###autoload -(defun doom/delete-backward-word (arg) - "Like `backward-kill-word', but doesn't affect the kill-ring." - (interactive "p") - (let (kill-ring) - (ignore-errors (backward-kill-word arg)))) - -;;;###autoload -(defun doom/dumb-indent () - "Inserts a tab character (or spaces x tab-width)." - (interactive) - (if indent-tabs-mode - (insert "\t") - (let* ((movement (% (current-column) tab-width)) - (spaces (if (= 0 movement) tab-width (- tab-width movement)))) - (insert (make-string spaces ? ))))) - -;;;###autoload -(defun doom/dumb-dedent () - "Dedents the current line." - (interactive) - (if indent-tabs-mode - (call-interactively #'backward-delete-char) - (unless (bolp) - (save-excursion - (when (> (current-column) (current-indentation)) - (back-to-indentation)) - (let ((movement (% (current-column) tab-width))) - (delete-char - (- (if (= 0 movement) - tab-width - (- tab-width movement))))))))) - -;;;###autoload -(defun doom/retab (arg &optional beg end) - "Converts tabs-to-spaces or spaces-to-tabs within BEG and END (defaults to -buffer start and end, to make indentation consistent. Which it does depends on -the value of `indent-tab-mode'. - -If ARG (universal argument) is non-nil, retab the current buffer using the -opposite indentation style." - (interactive "P\nr") - (unless (and beg end) - (setq beg (point-min) - end (point-max))) - (let ((indent-tabs-mode (if arg (not indent-tabs-mode) indent-tabs-mode))) - (if indent-tabs-mode - (tabify beg end) - (untabify beg end)))) - -;;;###autoload -(defun doom/delete-trailing-newlines () - "Trim trailing newlines. - -Respects `require-final-newline'." - (interactive) - (save-excursion - (goto-char (point-max)) - (delete-blank-lines))) - -;;;###autoload -(defun doom/dos2unix () - "Convert the current buffer to a Unix file encoding." - (interactive) - (set-buffer-file-coding-system 'undecided-unix nil)) - -;;;###autoload -(defun doom/unix2dos () - "Convert the current buffer to a DOS file encoding." - (interactive) - (set-buffer-file-coding-system 'undecided-dos nil)) - -;;;###autoload -(defun doom/toggle-indent-style () - "Switch between tabs and spaces indentation style in the current buffer." - (interactive) - (setq indent-tabs-mode (not indent-tabs-mode)) - (message "Indent style changed to %s" (if indent-tabs-mode "tabs" "spaces"))) - -(defvar editorconfig-lisp-use-default-indent) -;;;###autoload -(defun doom/set-indent-width (width) - "Change the indentation size to WIDTH of the current buffer. - -The effectiveness of this command is significantly improved if you have -editorconfig or dtrt-indent installed." - (interactive - (list (if (integerp current-prefix-arg) - current-prefix-arg - (read-number "New indent size: ")))) - (setq tab-width width) - (setq-local standard-indent width) - (when (boundp 'evil-shift-width) - (setq evil-shift-width width)) - (cond ((require 'editorconfig nil t) - (let (editorconfig-lisp-use-default-indent) - (editorconfig-set-indentation nil width))) - ((require 'dtrt-indent nil t) - (when-let (var (nth 2 (assq major-mode dtrt-indent-hook-mapping-list))) - (doom-log "Updated %s = %d" var width) - (set var width)))) - (message "Changed indentation to %d" width)) - - -;; -;;; Hooks - -;;;###autoload -(defun doom-enable-delete-trailing-whitespace-h () - "Enables the automatic deletion of trailing whitespaces upon file save. - -i.e. enables `ws-butler-mode' in the current buffer." - (ws-butler-mode +1)) - -;;;###autoload -(defun doom-disable-delete-trailing-whitespace-h () - "Disables the automatic deletion of trailing whitespaces upon file save. - -i.e. disables `ws-butler-mode' in the current buffer." - (ws-butler-mode -1)) - -;;;###autoload -(defun doom-enable-show-trailing-whitespace-h () - "Enable `show-trailing-whitespace' in the current buffer." - (setq-local show-trailing-whitespace t)) - -;;;###autoload -(defun doom-disable-show-trailing-whitespace-h () - "Disable `show-trailing-whitespace' in the current buffer." - (setq-local show-trailing-whitespace nil)) diff --git a/.config/emacs/core/autoload/themes.el b/.config/emacs/core/autoload/themes.el deleted file mode 100644 index c44be01..0000000 --- a/.config/emacs/core/autoload/themes.el +++ /dev/null @@ -1,73 +0,0 @@ -;;; core/autoload/themes.el -*- lexical-binding: t; -*- - -;;;###autoload -(defconst doom-customize-theme-hook nil) - -(add-hook! 'doom-load-theme-hook - (defun doom-apply-customized-faces-h () - "Run `doom-customize-theme-hook'." - (run-hooks 'doom-customize-theme-hook))) - -(defun doom--custom-theme-set-face (spec) - (cond ((listp (car spec)) - (cl-loop for face in (car spec) - collect - (car (doom--custom-theme-set-face (cons face (cdr spec)))))) - ((keywordp (cadr spec)) - `((,(car spec) ((t ,(cdr spec)))))) - (`((,(car spec) ,(cdr spec)))))) - -;;;###autoload -(defmacro custom-theme-set-faces! (theme &rest specs) - "Apply a list of face SPECS as user customizations for THEME. - -THEME can be a single symbol or list thereof. If nil, apply these settings to -all themes. It will apply to all themes once they are loaded." - (declare (indent defun)) - (let ((fn (gensym "doom--customize-themes-h-"))) - `(progn - (defun ,fn () - (let (custom--inhibit-theme-enable) - (dolist (theme (doom-enlist (or ,theme 'user))) - (when (or (eq theme 'user) - (custom-theme-enabled-p theme)) - (apply #'custom-theme-set-faces theme - (mapcan #'doom--custom-theme-set-face - (list ,@specs))))))) - ;; Apply the changes immediately if the user is using the default theme - ;; or the theme has already loaded. This allows you to evaluate these - ;; macros on the fly and customize your faces iteratively. - (when (or (get 'doom-theme 'previous-themes) - (null doom-theme)) - (funcall #',fn)) - (add-hook 'doom-customize-theme-hook #',fn 100)))) - -;;;###autoload -(defmacro custom-set-faces! (&rest specs) - "Apply a list of face SPECS as user customizations. - -This is a convenience macro alternative to `custom-set-face' which allows for a -simplified face format, and takes care of load order issues, so you can use -doom-themes' API without worry." - (declare (indent defun)) - `(custom-theme-set-faces! 'user ,@specs)) - -;;;###autoload -(defun doom/reload-theme () - "Reload the current Emacs theme." - (interactive) - (unless doom-theme - (user-error "No theme is active")) - (let ((themes (copy-sequence custom-enabled-themes))) - (mapc #'disable-theme custom-enabled-themes) - (let (doom-load-theme-hook) - (mapc #'enable-theme (reverse themes))) - (doom-run-hooks 'doom-load-theme-hook) - (doom/reload-font) - (message "%s %s" - (propertize - (format "Reloaded %d theme%s:" - (length themes) - (if (cdr themes) "s" "")) - 'face 'bold) - (mapconcat #'prin1-to-string themes ", ")))) diff --git a/.config/emacs/core/autoload/ui.el b/.config/emacs/core/autoload/ui.el deleted file mode 100644 index 9aa8e37..0000000 --- a/.config/emacs/core/autoload/ui.el +++ /dev/null @@ -1,246 +0,0 @@ -;;; core/autoload/ui.el -*- lexical-binding: t; -*- - -;; -;;; Public library - -;;;###autoload -(defun doom-resize-window (window new-size &optional horizontal force-p) - "Resize a window to NEW-SIZE. If HORIZONTAL, do it width-wise. -If FORCE-P is omitted when `window-size-fixed' is non-nil, resizing will fail." - (with-selected-window (or window (selected-window)) - (let ((window-size-fixed (unless force-p window-size-fixed))) - (enlarge-window (- new-size (if horizontal (window-width) (window-height))) - horizontal)))) - -;;;###autoload -(defun doom-quit-p (&optional prompt) - "Prompt the user for confirmation when killing Emacs. - -Returns t if it is safe to kill this session. Does not prompt if no real buffers -are open." - (or (not (ignore-errors (doom-real-buffer-list))) - (yes-or-no-p (format "%s" (or prompt "Really quit Emacs?"))) - (ignore (message "Aborted")))) - - -;; -;;; Advice - -;;;###autoload -(defun doom-recenter-a (&rest _) - "Generic advice for recentering window (typically :after other functions)." - (recenter)) - -;;;###autoload -(defun doom-preserve-window-position-a (fn &rest args) - "Generic advice for preserving cursor position on screen after scrolling." - (let ((row (cdr (posn-col-row (posn-at-point))))) - (prog1 (apply fn args) - (save-excursion - (let ((target-row (- (line-number-at-pos) row))) - (unless (< target-row 0) - (evil-scroll-line-to-top target-row))))))) - -;;;###autoload -(defun doom-shut-up-a (fn &rest args) - "Generic advisor for silencing noisy functions. - -In interactive Emacs, this just inhibits messages from appearing in the -minibuffer. They are still logged to *Messages*. - -In tty Emacs, messages are suppressed completely." - (quiet! (apply fn args))) - - -;; -;;; Hooks - -;;;###autoload -(defun doom-apply-ansi-color-to-compilation-buffer-h () - "Applies ansi codes to the compilation buffers. Meant for -`compilation-filter-hook'." - (with-silent-modifications - (ansi-color-apply-on-region compilation-filter-start (point)))) - -;;;###autoload -(defun doom-disable-show-paren-mode-h () - "Turn off `show-paren-mode' buffer-locally." - (setq-local show-paren-mode nil)) - -;;;###autoload -(defun doom-enable-line-numbers-h () - (display-line-numbers-mode +1)) - -;;;###autoload -(defun doom-disable-line-numbers-h () - (display-line-numbers-mode -1)) - - -;; -;;; Commands - -;;;###autoload -(defun doom/toggle-line-numbers () - "Toggle line numbers. - -Cycles through regular, relative and no line numbers. The order depends on what -`display-line-numbers-type' is set to. If you're using Emacs 26+, and -visual-line-mode is on, this skips relative and uses visual instead. - -See `display-line-numbers' for what these values mean." - (interactive) - (defvar doom--line-number-style display-line-numbers-type) - (let* ((styles `(t ,(if visual-line-mode 'visual 'relative) nil)) - (order (cons display-line-numbers-type (remq display-line-numbers-type styles))) - (queue (memq doom--line-number-style order)) - (next (if (= (length queue) 1) - (car order) - (car (cdr queue))))) - (setq doom--line-number-style next) - (setq display-line-numbers next) - (message "Switched to %s line numbers" - (pcase next - (`t "normal") - (`nil "disabled") - (_ (symbol-name next)))))) - -;;;###autoload -(defun doom/delete-frame-with-prompt () - "Delete the current frame, but ask for confirmation if it isn't empty." - (interactive) - (if (cdr (frame-list)) - (when (doom-quit-p "Close frame?") - (delete-frame)) - (save-buffers-kill-emacs))) - - -(defun doom--enlargened-forget-last-wconf-h () - (set-frame-parameter nil 'doom--maximize-last-wconf nil) - (set-frame-parameter nil 'doom--enlargen-last-wconf nil) - (remove-hook 'doom-switch-window-hook #'doom--enlargened-forget-last-wconf-h)) - -;;;###autoload -(defun doom/window-maximize-buffer (&optional arg) - "Close other windows to focus on this one. -Use `winner-undo' to undo this. Alternatively, use `doom/window-enlargen'." - (interactive "P") - (when (and (bound-and-true-p +popup-mode) - (+popup-window-p)) - (+popup/raise (selected-window))) - (delete-other-windows)) - -;;;###autoload -(defun doom/window-enlargen (&optional arg) - "Enlargen the current window (i.e. shrinks others) so you can focus on it. -Use `winner-undo' to undo this. Alternatively, use -`doom/window-maximize-buffer'." - (interactive "P") - (let* ((window (selected-window)) - (dedicated-p (window-dedicated-p window)) - (preserved-p (window-parameter window 'window-preserved-size)) - (ignore-window-parameters t) - (window-resize-pixelwise nil) - (frame-resize-pixelwise nil)) - (unwind-protect - (progn - (when dedicated-p - (set-window-dedicated-p window nil)) - (when preserved-p - (set-window-parameter window 'window-preserved-size nil)) - (maximize-window window)) - (set-window-dedicated-p window dedicated-p) - (when preserved-p - (set-window-parameter window 'window-preserved-size preserved-p))))) - -;;;###autoload -(defun doom/window-maximize-horizontally () - "Delete all windows to the left and right of the current window." - (interactive) - (require 'windmove) - (save-excursion - (while (ignore-errors (windmove-left)) (delete-window)) - (while (ignore-errors (windmove-right)) (delete-window)))) - -;;;###autoload -(defun doom/window-maximize-vertically () - "Delete all windows above and below the current window." - (interactive) - (require 'windmove) - (save-excursion - (while (ignore-errors (windmove-up)) (delete-window)) - (while (ignore-errors (windmove-down)) (delete-window)))) - -;;;###autoload -(defun doom/set-frame-opacity (opacity) - "Interactively change the current frame's opacity. - -OPACITY is an integer between 0 to 100, inclusive." - (interactive - (list (read-number "Opacity (0-100): " - (or (frame-parameter nil 'alpha) - 100)))) - (set-frame-parameter nil 'alpha opacity)) - -(defvar doom--narrowed-base-buffer nil) -;;;###autoload -(defun doom/narrow-buffer-indirectly (beg end) - "Restrict editing in this buffer to the current region, indirectly. - -This recursively creates indirect clones of the current buffer so that the -narrowing doesn't affect other windows displaying the same buffer. Call -`doom/widen-indirectly-narrowed-buffer' to undo it (incrementally). - -Inspired from http://demonastery.org/2013/04/emacs-evil-narrow-region/" - (interactive - (list (or (bound-and-true-p evil-visual-beginning) (region-beginning)) - (or (bound-and-true-p evil-visual-end) (region-end)))) - (unless (region-active-p) - (setq beg (line-beginning-position) - end (line-end-position))) - (deactivate-mark) - (let ((orig-buffer (current-buffer))) - (with-current-buffer (switch-to-buffer (clone-indirect-buffer nil nil)) - (narrow-to-region beg end) - (setq-local doom--narrowed-base-buffer orig-buffer)))) - -;;;###autoload -(defun doom/widen-indirectly-narrowed-buffer (&optional arg) - "Widens narrowed buffers. - -This command will incrementally kill indirect buffers (under the assumption they -were created by `doom/narrow-buffer-indirectly') and switch to their base -buffer. - -If ARG, then kill all indirect buffers, return the base buffer and widen it. - -If the current buffer is not an indirect buffer, it is `widen'ed." - (interactive "P") - (unless (buffer-narrowed-p) - (user-error "Buffer isn't narrowed")) - (let ((orig-buffer (current-buffer)) - (base-buffer doom--narrowed-base-buffer)) - (cond ((or (not base-buffer) - (not (buffer-live-p base-buffer))) - (widen)) - (arg - (let ((buffer orig-buffer) - (buffers-to-kill (list orig-buffer))) - (while (setq buffer (buffer-local-value 'doom--narrowed-base-buffer buffer)) - (push buffer buffers-to-kill)) - (switch-to-buffer (buffer-base-buffer)) - (mapc #'kill-buffer (remove (current-buffer) buffers-to-kill)))) - ((switch-to-buffer base-buffer) - (kill-buffer orig-buffer))))) - -;;;###autoload -(defun doom/toggle-narrow-buffer (beg end) - "Narrow the buffer to BEG END. If narrowed, widen it." - (interactive - (list (or (bound-and-true-p evil-visual-beginning) (region-beginning)) - (or (bound-and-true-p evil-visual-end) (region-end)))) - (if (buffer-narrowed-p) - (widen) - (unless (region-active-p) - (setq beg (line-beginning-position) - end (line-end-position))) - (narrow-to-region beg end))) diff --git a/.config/emacs/core/cli/autoloads.el b/.config/emacs/core/cli/autoloads.el deleted file mode 100644 index 8f37451..0000000 --- a/.config/emacs/core/cli/autoloads.el +++ /dev/null @@ -1,232 +0,0 @@ -;;; core/cli/autoloads.el -*- lexical-binding: t; -*- - -(defvar doom-autoloads-excluded-packages () - "What packages whose autoloads files we won't index. - -These packages have silly or destructive autoload files that try to load -everyone in the universe and their dog, causing errors that make babies cry. No -one wants that.") - -(defvar doom-autoloads-excluded-files - '("/bufler/bufler-workspaces-tabs\\.el$") - "List of regexps whose matching files won't be indexed for autoloads.") - -(defvar doom-autoloads-cached-vars - '(doom-modules - doom-disabled-packages - native-comp-deferred-compilation-deny-list - load-path - auto-mode-alist - interpreter-mode-alist - Info-directory-list) - "A list of variables to be cached in `doom-autoloads-file'.") - -(defvar doom-autoloads-files () - "A list of additional files or file globs to scan for autoloads.") - - -;; -;;; Library - -(defun doom-autoloads-reload (&optional file) - "Regenerates Doom's autoloads and writes them to FILE." - (unless file - (setq file doom-autoloads-file)) - (print! (start "(Re)generating autoloads file...")) - (print-group! - (cl-check-type file string) - (doom-initialize-packages) - (and (print! (start "Generating autoloads file...")) - (doom-autoloads--write - file - `((unless (equal doom-version ,doom-version) - (signal 'doom-error - (list "The installed version of Doom has changed since last 'doom sync' ran" - "Run 'doom sync' to bring Doom up to speed")))) - (cl-loop for var in doom-autoloads-cached-vars - when (boundp var) - collect `(set ',var ',(symbol-value var))) - (doom-autoloads--scan - (append (cl-loop for dir - in (append (list doom-core-dir) - (cdr (doom-module-load-path 'all-p)) - (list doom-private-dir)) - if (doom-glob dir "autoload.el") collect (car it) - if (doom-glob dir "autoload/*.el") append it) - (mapcan #'doom-glob doom-autoloads-files)) - nil) - (doom-autoloads--scan - (mapcar #'straight--autoloads-file - (seq-difference (hash-table-keys straight--build-cache) - doom-autoloads-excluded-packages)) - doom-autoloads-excluded-files - 'literal)) - (print! (start "Byte-compiling autoloads file...")) - (doom-autoloads--compile-file file) - (print! (success "Generated %s") - (relpath (byte-compile-dest-file file) - doom-emacs-dir))))) - -(defun doom-autoloads--write (file &rest forms) - (make-directory (file-name-directory file) 'parents) - (condition-case-unless-debug e - (with-temp-file file - (setq-local coding-system-for-write 'utf-8) - (let ((standard-output (current-buffer)) - (print-quoted t) - (print-level nil) - (print-length nil)) - (insert ";; -*- lexical-binding: t; coding: utf-8; no-native-compile: t -*-\n" - ";; This file is autogenerated by 'doom sync', DO NOT EDIT IT!!\n") - (dolist (form (delq nil forms)) - (mapc #'prin1 form)) - t)) - (error (delete-file file) - (signal 'doom-autoload-error (list file e))))) - -(defun doom-autoloads--compile-file (file) - (condition-case-unless-debug e - (let ((byte-compile-warnings (if doom-debug-p byte-compile-warnings))) - (and (byte-compile-file file) - (load (byte-compile-dest-file file) nil t))) - (error - (delete-file (byte-compile-dest-file file)) - (signal 'doom-autoload-error (list file e))))) - -(defun doom-autoloads--cleanup-form (form &optional expand) - (let ((func (car-safe form))) - (cond ((memq func '(provide custom-autoload)) - nil) - ((and (eq func 'add-to-list) - (memq (doom-unquote (cadr form)) - doom-autoloads-cached-vars)) - nil) - ((not (eq func 'autoload)) - form) - ((and expand (not (file-name-absolute-p (nth 2 form)))) - (defvar doom--autoloads-path-cache nil) - (setf (nth 2 form) - (let ((path (nth 2 form))) - (or (cdr (assoc path doom--autoloads-path-cache)) - (when-let* ((libpath (locate-library path)) - (libpath (file-name-sans-extension libpath)) - (libpath (abbreviate-file-name libpath))) - (push (cons path libpath) doom--autoloads-path-cache) - libpath) - path))) - form) - (form)))) - -(defun doom-autoloads--scan-autodefs (file buffer module &optional module-enabled-p) - (with-temp-buffer - (insert-file-contents file) - (while (re-search-forward "^;;;###autodef *\\([^\n]+\\)?\n" nil t) - (let* ((standard-output buffer) - (form (read (current-buffer))) - (altform (match-string 1)) - (definer (car-safe form)) - (symbol (doom-unquote (cadr form)))) - (cond ((and (not module-enabled-p) altform) - (print (read altform))) - ((memq definer '(defun defmacro cl-defun cl-defmacro)) - (if module-enabled-p - (print (make-autoload form file)) - (cl-destructuring-bind (_ _ arglist &rest body) form - (print - (if altform - (read altform) - (append - (list (pcase definer - (`defun 'defmacro) - (`cl-defun `cl-defmacro) - (_ type)) - symbol arglist - (format "THIS FUNCTION DOES NOTHING BECAUSE %s IS DISABLED\n\n%s" - module - (if (stringp (car body)) - (pop body) - "No documentation."))) - (cl-loop for arg in arglist - if (and (symbolp arg) - (not (keywordp arg)) - (not (memq arg cl--lambda-list-keywords))) - collect arg into syms - else if (listp arg) - collect (car arg) into syms - finally return (if syms `((ignore ,@syms))))))))) - (print `(put ',symbol 'doom-module ',module))) - ((eq definer 'defalias) - (cl-destructuring-bind (_ _ target &optional docstring) form - (unless module-enabled-p - (setq target #'ignore - docstring - (format "THIS FUNCTION DOES NOTHING BECAUSE %s IS DISABLED\n\n%s" - module docstring))) - (print `(put ',symbol 'doom-module ',module)) - (print `(defalias ',symbol #',(doom-unquote target) ,docstring)))) - (module-enabled-p (print form))))))) - -(defvar autoload-timestamps) -(defvar generated-autoload-load-name) -(defun doom-autoloads--scan-file (file) - (let* (;; Prevent `autoload-find-file' from firing file hooks, e.g. adding - ;; to recentf. - find-file-hook - write-file-functions - ;; Prevent a possible source of crashes when there's a syntax error - ;; in the autoloads file - debug-on-error - ;; The following bindings are in `package-generate-autoloads'. - ;; Presumably for a good reason, so I just copied them - (backup-inhibited t) - (version-control 'never) - case-fold-search ; reduce magic - autoload-timestamps ; reduce noise in generated files - ;; Needed for `autoload-generate-file-autoloads' - (generated-autoload-load-name (file-name-sans-extension file)) - (target-buffer (current-buffer)) - (module (doom-module-from-path file)) - (module-enabled-p (and (or (memq (car module) '(:core :private)) - (doom-module-p (car module) (cdr module))) - (doom-file-cookie-p file "if" t)))) - (save-excursion - (when module-enabled-p - (quiet! (autoload-generate-file-autoloads file target-buffer))) - (doom-autoloads--scan-autodefs - file target-buffer module module-enabled-p)))) - -(defun doom-autoloads--scan (files &optional exclude literal) - (require 'autoload) - (let (autoloads) - (dolist (file files (nreverse (delq nil autoloads))) - (when (and (or (null exclude) - (seq-remove (doom-rpartial #'string-match-p file) - exclude)) - (file-readable-p file)) - (doom-log "Scanning %s" file) - (setq file (file-truename file)) - (with-temp-buffer - (if literal - (insert-file-contents file) - (doom-autoloads--scan-file file)) - (save-excursion - (let ((filestr (prin1-to-string file))) - (while (re-search-forward "\\_" nil t) - ;; `load-file-name' is meaningless in a concatenated - ;; mega-autoloads file, so we replace references to it with the - ;; file they came from. - (let ((ppss (save-excursion (syntax-ppss)))) - (or (nth 3 ppss) - (nth 4 ppss) - (replace-match filestr t t)))))) - (let ((load-file-name file) - (load-path - (append (list doom-private-dir) - doom-modules-dirs - load-path))) - (condition-case _ - (while t - (push (doom-autoloads--cleanup-form (read (current-buffer)) - (not literal)) - autoloads)) - (end-of-file)))))))) diff --git a/.config/emacs/core/cli/byte-compile.el b/.config/emacs/core/cli/byte-compile.el deleted file mode 100644 index 6ed8084..0000000 --- a/.config/emacs/core/cli/byte-compile.el +++ /dev/null @@ -1,208 +0,0 @@ -;;; core/cli/byte-compile.el -*- lexical-binding: t; -*- - -(defcli! (compile c) - ((recompile-p ["-r" "--recompile"]) - (core-p ["-c" "--core"]) - (private-p ["-p" "--private"]) - (verbose-p ["-v" "--verbose"])) - "Byte-compiles your config or selected modules. - - compile [TARGETS...] - compile :core :private lang/python - compile feature lang - -Accepts :core and :private as special arguments, which target Doom's core files -and your private config files, respectively. To recompile your packages, use -'doom build' instead." - (doom-cli-byte-compile - (if (or core-p private-p) - (append (if core-p (doom-glob doom-emacs-dir "init.el")) - (if core-p (list doom-core-dir)) - (if private-p (list doom-private-dir))) - (or (y-or-n-p - (concat "WARNING: Changes made to your config after compiling it won't take effect until\n" - "this command is rerun or you run 'doom clean'! It will also make error backtraces\n" - "much more difficult to decipher.\n\n" - "If you intend to use it anyway, remember this or it will come back to bite you!\n\n" - "Continue anyway?")) - (user-error "Aborted")) - (append (doom-glob doom-emacs-dir "init.el") - (list doom-core-dir) - (seq-filter - ;; Only compile Doom's modules - (doom-rpartial #'file-in-directory-p doom-emacs-dir) - ;; Omit `doom-private-dir', which is always first - (cdr (doom-module-load-path))))) - recompile-p - verbose-p)) - -(defcli! clean () - "Delete all *.elc files." - :bare t - (doom-clean-byte-compiled-files)) - - -;; -;; Helpers - -(defun doom--byte-compile-ignore-file-p (path) - (let ((filename (file-name-nondirectory path))) - (or (not (equal (file-name-extension path) "el")) - (member filename (list "packages.el" "doctor.el")) - (string-prefix-p "." filename) - (string-prefix-p "test-" filename) - (string-prefix-p "flycheck_" filename) - (string-suffix-p ".example.el" filename)))) - -(cl-defun doom-cli-byte-compile (&optional targets recompile-p verbose-p) - "Byte compiles your emacs configuration. - -init.el is always byte-compiled by this. - -If TARGETS is specified, as a list of direcotries - -If MODULES is specified (a list of module strings, e.g. \"lang/php\"), those are -byte-compiled. Otherwise, all enabled modules are byte-compiled, including Doom -core. It always ignores unit tests and files with `no-byte-compile' enabled. - -WARNING: byte-compilation yields marginal gains and makes debugging new issues -difficult. It is recommended you don't use it unless you understand the -reprecussions. - -Use `doom-clean-byte-compiled-files' or `make clean' to reverse -byte-compilation. - -If RECOMPILE-P is non-nil, only recompile out-of-date files." - (let* ((default-directory doom-emacs-dir) - (targets (nreverse (delete-dups targets))) - ;; In case it is changed during compile-time - (auto-mode-alist auto-mode-alist) - kill-emacs-hook kill-buffer-query-functions) - - (let ((after-load-functions - (if (null targets) - after-load-functions - ;; Assemble el files we want to compile, and preserve in the order - ;; they are loaded in, so we don't run into any scary catch-22s - ;; while byte-compiling, like missing macros. - (cons (let ((target-dirs (cl-remove-if-not #'file-directory-p targets))) - (lambda (path) - (and (not (doom--byte-compile-ignore-file-p path)) - (cl-find-if (doom-partial #'file-in-directory-p path) - target-dirs) - (cl-pushnew path targets)))) - after-load-functions)))) - (doom-log "Reloading Doom in preparation for byte-compilation") - ;; But first we must be sure that Doom and your private config have been - ;; fully loaded. Which usually aren't so in an noninteractive session. - (let ((load-prefer-newer t) - (noninteractive t) - doom-interactive-p) - (doom-initialize 'force) - (quiet! (doom-initialize-packages)) - (quiet! (doom-initialize-modules)))) - - (if (null targets) - (print! (info "No targets to %scompile" (if recompile-p "re" ""))) - (print! (start "%scompiling your config...") - (if recompile-p "Re" "Byte-")) - - (dolist (dir - (cl-remove-if-not #'file-directory-p targets) - (setq targets (cl-remove-if #'file-directory-p targets))) - (prependq! targets - (doom-files-in - dir :match "\\.el" :filter #'doom--byte-compile-ignore-file-p))) - - (print-group! - (require 'use-package) - (condition-case-unless-debug e - (let* ((total-ok 0) - (total-fail 0) - (total-noop 0) - (byte-compile-verbose nil) - (byte-compile-warnings '(not free-vars unresolved noruntime lexical make-local)) - (byte-compile-dynamic-docstrings t) - (use-package-compute-statistics nil) - (use-package-defaults use-package-defaults) - (use-package-expand-minimally t) - (targets (delete-dups targets)) - (modules (seq-group-by #'doom-module-from-path targets)) - (total-files (length targets)) - (total-modules (length modules)) - (i 0) - last-module) - ;; Prevent packages from being loaded at compile time if they - ;; don't meet their own predicates. - (push (list :no-require t - (lambda (_name args) - (or (when-let (pred (or (plist-get args :if) - (plist-get args :when))) - (not (eval pred t))) - (when-let (pred (plist-get args :unless)) - (eval pred t))))) - use-package-defaults) - (dolist (module-files modules) - (cl-incf i) - (dolist (target (cdr module-files)) - (let ((elc-file (byte-compile-dest-file target))) - (cl-incf - (if (and recompile-p (not (file-newer-than-file-p target elc-file))) - total-noop - (pcase (if (not (doom-file-cookie-p target "if" t)) - 'no-byte-compile - (unless (equal last-module (car module-files)) - (print! (success "(% 3d/%d) Compiling %s") - i total-modules - (if-let (m (caar module-files)) - (format "%s %s module..." m (cdar module-files)) - (format "%d stand alone elisp files..." - (length (cdr module-files)))) - (caar module-files) (cdar module-files)) - (setq last-module (car module-files))) - (if verbose-p - (byte-compile-file target) - (quiet! (byte-compile-file target)))) - (`no-byte-compile - (print! (debug "(% 3d/%d) Ignored %s") - i total-modules (relpath target)) - total-noop) - (`nil - (print! (error "(% 3d/%d) Failed to compile %s") - i total-modules (relpath target)) - total-fail) - (_ total-ok))))))) - (print! (class (if (= total-fail 0) 'success 'warn) - "%s %d/%d file(s) (%d ignored)") - (if recompile-p "Recompiled" "Byte-compiled") - total-ok total-files - total-noop) - (= total-fail 0)) - ((debug error) - (print! (error "There were breaking errors.\n\n%s") - "Reverting changes...") - (signal 'doom-error (list 'byte-compile e)))))))) - -(defun doom-clean-byte-compiled-files () - "Delete all the compiled elc files in your Emacs configuration and private -module. This does not include your byte-compiled, third party packages.'" - (require 'core-modules) - (print! (start "Cleaning .elc files")) - (print-group! - (cl-loop with default-directory = doom-emacs-dir - with success = 0 - with esc = (if doom-debug-p "" "\033[1A") - for path - in (append (doom-glob doom-emacs-dir "*.elc") - (doom-files-in doom-private-dir :match "\\.elc$" :depth 1) - (doom-files-in doom-core-dir :match "\\.elc$") - (doom-files-in doom-modules-dirs :match "\\.elc$" :depth 4)) - if (file-exists-p path) - do (delete-file path) - and do (print! (success "\033[KDeleted %s%s") (relpath path) esc) - and do (cl-incf success) - finally do - (print! (if (> success 0) - (success "\033[K%d elc files deleted" success) - (info "\033[KNo elc files to clean")))) - t)) diff --git a/.config/emacs/core/cli/ci.el b/.config/emacs/core/cli/ci.el deleted file mode 100644 index 4434629..0000000 --- a/.config/emacs/core/cli/ci.el +++ /dev/null @@ -1,421 +0,0 @@ -;;; core/cli/ci.el -*- lexical-binding: t; -*- - -(defcli! ci (&optional target &rest args) - "TODO" - (unless target - (user-error "No CI target given")) - (if-let (fn (intern-soft (format "doom-cli--ci-%s" target))) - (apply fn args) - (user-error "No known CI target: %S" target))) - - -;; -;;; - - -(defun doom-cli--ci-deploy-hooks (&optional noforce) - (let* ((default-directory doom-emacs-dir) - (dir (cdr (doom-call-process "git" "rev-parse" "--git-path" "hooks")))) - (make-directory dir 'parents) - (dolist (hook '("commit-msg" "pre-push")) - (let ((file (doom-path dir hook))) - (unless (and (file-exists-p file) noforce) - (with-temp-file file - (insert "#!/usr/bin/env sh\n" - (doom-path doom-emacs-dir "bin/doom") - " --nocolor ci hook-" hook - " \"$@\"")) - (set-file-modes file #o700) - (print! (success "Created %s") (relpath file))))))) - - -;; -;;; Git hooks - -(defvar doom-cli-commit-trailer-keys - '(("Fix" ref hash url) - ("Ref" ref hash url) - ("Close" ref) - ("Revert" ref hash) - ("Amend" ref hash) - ("Co-authored-by" name) - ("Signed-off-by" name)) - "An alist of valid trailer keys and their accepted value types. - -Accapted value types can be one or more of ref, hash, url, username, or name.") - -(defvar doom-cli-commit-trailer-types - '((ref . "^\\(https?://[^ ]+\\|[^/]+/[^/]+\\)?#[0-9]+$") - (hash . "^\\(https?://[^ ]+\\|[^/]+/[^/]+@\\)?[a-z0-9]\\{12\\}$") - (url . "^https?://") - (name . "^[a-zA-Z0-9-_ \\.]+<[^@]+@[^.]+\\.[^>]+>$") - (username . "^@[^a-zA-Z0-9_-]+$")) - "An alist of valid trailer keys and their accepted value types. - -Accapted value types can be one or more of ref, hash, url, username, or name.") - -(defvar doom-cli-commit-types - '(bump dev docs feat fix merge module nit perf refactor release revert test tweak) - "A list of valid commit types.") - -(defvar doom-cli-commit-scopes - (list "cli" - "ci" - "lib" - (fn! (scope (&key type)) - (when (and (memq type '(bump merge module release revert)) - scope) - (user-error "%s commits should never have a scope" type))) - (fn! (scope _) - (seq-find (doom-rpartial - #'doom-glob (if (string-prefix-p ":" scope) - (format "%s" (substring scope 1)) - (format "*/%s" scope))) - doom-modules-dirs))) - "A list of valid commit scopes as strings or functions. - -Functions should take two arguments: a single scope (symbol) and a commit plist -representing the current commit being checked against. See -`doom-cli-commit-core-rules' for possible values.") - -(defvar doom-cli-commit-rules - (list (fn! (&key subject) - "If a fixup/squash commit, don't lint this commit" - (when (string-match "^\\(\\(?:fixup\\|squash\\)!\\|FIXUP\\|WIP\\) " subject) - (skip! (format "Found %S commit, skipping commit" (match-string 1 subject))))) - - (fn! (&key type subject) - "Test SUBJECT length" - (let ((len (length subject))) - (cond ((memq type '(bump revert))) - ((<= len 10) - (fail! "Subject is too short (<10) and should be more descriptive")) - ((<= len 20) - (warn! "Subject is short (<20); are you sure it's descriptive enough?")) - ((> len 72) - (fail! "Subject is %d characters, above the 72 maximum" - len)) - ((> len 50) - (warn! "Subject is %d characters; <=50 is ideal" - len))))) - - (fn! (&key type) - "Ensure commit has valid type" - (or (memq type doom-cli-commit-types) - (if type - (fail! "Invalid commit type: %s" type) - (fail! "Commit has no detectable type")))) - - (fn! (&key summary) - "Ensure commit has a summary" - (when (or (not (stringp summary)) - (string-blank-p summary)) - (fail! "Commit has no summary"))) - - (fn! (&key type summary subject) - "Ensure summary isn't needlessly capitalized" - (and (stringp summary) - (string-match-p "^[A-Z][^-A-Z.]" summary) - (fail! "%S in summary should not be capitalized" - (car (split-string summary " "))))) - - (fn! (&key type scopes summary) - "Complain about scoped types that are incompatible with scopes" - (and (memq type '(bump revert merge module release)) - scopes - (fail! "Scopes for %s commits should go after the colon, not before" - type))) - - (fn! (&rest plist &key type scopes) - "Ensure scopes are valid" - (dolist (scope scopes) - (condition-case e - (or (cl-loop for rule in doom-cli-commit-scopes - if (or (and (stringp rule) - (string= rule scope)) - (and (functionp rule) - (funcall rule scope plist))) - return t) - (fail! "Invalid scope: %s" scope)) - (user-error (fail! "%s" (error-message-string)))))) - - (fn! (&key scopes) - "Esnure scopes are sorted correctly" - (unless (equal scopes (sort (copy-sequence scopes) #'string-lessp)) - (fail! "Scopes are not in lexicographical order"))) - - (fn! (&key type body) - "Enforce 72 character line width for BODY" - (catch 'result - (with-temp-buffer - (save-excursion (insert body)) - (while (re-search-forward "^[^\n]\\{73,\\}" nil t) - (save-excursion - (or - ;; Long bump lines are acceptable - (let ((bump-re "\\(https?://.+\\|[^/]+\\)/[^/]+@[a-z0-9]\\{12\\}")) - (re-search-backward (format "^%s -> %s$" bump-re bump-re) nil t)) - ;; Long URLs are acceptable - (re-search-backward "https?://[^ ]+\\{73,\\}" nil t) - ;; Lines that start with # or whitespace are comment or - ;; code blocks. - (re-search-backward "^\\(?:#\\| +\\)" nil t) - (throw 'result (fail! "Line(s) in commit body exceed 72 characters")))))))) - - (fn! (&key bang body type) - "Ensure ! is accompanied by a 'BREAKING CHANGE:' in BODY" - (if bang - (cond ((not (string-match-p "^BREAKING CHANGE:" body)) - (fail! "'!' present in commit type, but missing 'BREAKING CHANGE:' in body")) - ((not (string-match-p "^BREAKING CHANGE: .+" body)) - (fail! "'BREAKING CHANGE:' present in commit body, but missing explanation"))) - (when (string-match-p "^BREAKING CHANGE:" body) - (fail! "'BREAKING CHANGE:' present in body, but missing '!' after %S" - type)))) - - (fn! (&key type body) - "Ensure bump commits have package ref lines" - (and (eq type 'bump) - (let ((bump-re "\\(?:https?://.+\\|[^/]+\\)/[^/]+@\\([a-z0-9]+\\)")) - (not (string-match-p (concat "^" bump-re " -> " bump-re "$") - body))) - (fail! "Bump commit is missing commit hash diffs"))) - - (fn! (&key body) - "Ensure commit hashes in bump lines are 12 characters long" - (with-temp-buffer - (insert body) - (let ((bump-re "\\<\\(?:https?://[^@]+\\|[^/]+\\)/[^/]+@\\([a-z0-9]+\\)") - refs) - (while (re-search-backward bump-re nil t) - (when (/= (length (match-string 1)) 12) - (push (match-string 0) refs))) - (when refs - (fail! "%d commit hash(s) not 12 characters long: %s" - (length refs) (string-join (nreverse refs) ", ")))))) - - ;; TODO Add bump validations for revert: type. - (fn! (&key body trailers) - "Validate commit trailers." - (let* ((keys (mapcar #'car doom-cli-commit-trailer-keys)) - (key-re (regexp-opt keys t)) - (lines - ;; Scan BODY because invalid trailers won't be in TRAILERS. - (save-match-data - (and (string-match "\n\\(\n[a-zA-Z][a-zA-Z-]*:? [^ ][^\n]+\\)+\n+\\'" body) - (split-string (match-string 0 body) "\n" t))))) - (dolist (line lines) - (unless (string-match-p (concat "^" key-re ":? [^ ]") line) - (fail! "Found %S, expected one of: %s" - (truncate-string-to-width (string-trim line) 16 nil nil "…") - (string-join keys ", "))) - (when (and (string-match "^[^a-zA-Z-]+:? \\(.+\\)$" line) - (string-match-p " " (match-string 1 line))) - (fail! "%S has multiple references, but should only have one per line" - (truncate-string-to-width (string-trim line) 20 nil nil "…"))) - (when (or (string-match (concat "^" key-re "\\(?:e?[sd]\\|ing\\)? [^ ]") line) - (string-match (concat "^\\([a-zA-Z-]+\\) [^ \n]+$") line)) - (fail! "%S missing colon after %S" - (truncate-string-to-width (string-trim line) 16 nil nil "…") - (match-string 1 line)))) - (pcase-dolist (`(,key . ,value) trailers) - (if (and (not (memq 'name (cdr (assoc key doom-cli-commit-trailer-keys)))) - (string-match-p " " value)) - (fail! "Found %S, but only one value allowed per trailer" - (truncate-string-to-width (concat key ": " value) 20 nil nil "…")) - (when-let (allowed-types (cdr (assoc key doom-cli-commit-trailer-keys))) - (or (cl-loop for type in allowed-types - if (cdr (assq type doom-cli-commit-trailer-types)) - if (string-match-p it value) - return t) - (fail! "%S expects one of %s, but got %S" - key allowed-types value))))))) - - ;; TODO Check that bump/revert SUBJECT list: 1) valid modules and 2) - ;; modules whose files are actually being touched. - - ;; TODO Ensure your diff corraborates your SCOPE - - ) - "A list of validator functions to run against a commit. - -Each function is N-arity and is passed a plist with the following keys: - - :bang - (Boolean) If `t', the commit is declared to contain a breaking change. - e.g. 'refactor!: this commit breaks everything' - :body - (String) Contains the whole BODY of a commit message, excluding the - TRAILERS. - :scopes - (List) Contains a list of scopes, as symbols. e.g. with - 'feat(org,lsp): so on and so forth', this contains '(org lsp). - :subject - (String) Contains the whole first line of a commit message. - :summary - (String) Contains the summary following the type and scopes. e.g. In - 'feat(org): fix X, Y, and Z' the summary is 'fix X, Y, and Z. - :trailers - (Map) Contains an alist of 'KEY: VALUE' trailers, i.e. All - Fix, Ref, Close, Revert, etc lines with a valid value. This will be empty if - the formatting of a commit's trailers is invalid. - :type - (Symbol) The type of commit this is. E.g. `feat', `fix', `bump', etc. - -Each function should call `fail!' or `warn!' one or more times, or `skip!' -(immediately returns). Each of these lexical functions take the same arguments -as `format'. - -Note: warnings are not considered failures.") - -(defun doom-cli--ci-hook-commit-msg (file) - (with-temp-buffer - (insert-file-contents file) - (doom-cli--ci--lint - (list (cons - "CURRENT" - (buffer-substring (point-min) - (if (re-search-forward "^# Please enter the commit message" nil t) - (match-beginning 0) - (point-max)))))))) - -(defun doom-cli--ci-hook-pre-push (_remote _url) - (with-temp-buffer - (let ((z40 "0000000000000000000000000000000000000000") - line error) - (while (setq line (ignore-errors (read-from-minibuffer ""))) - (catch 'continue - (cl-destructuring-bind (local-ref local-sha remote-ref remote-sha) - (split-string line " ") - (unless (or (string-match-p "^refs/heads/\\(master\\|main\\)$" remote-ref) - (equal local-sha z40)) - (throw 'continue t)) - (print-group! - (mapc (lambda (commit) - (seq-let (hash msg) (split-string commit "\t") - (setq error t) - (print! (info "%S commit in %s" - (car (split-string msg " ")) - (substring hash 0 12))))) - (split-string - (cdr (doom-call-process - "git" "rev-list" - "--grep" (concat "^" (regexp-opt '("WIP" "squash!" "fixup!" "FIXUP") t) " ") - "--format=%H\t%s" - (if (equal remote-sha z40) - local-sha - (format "%s..%s" remote-sha local-sha)))) - "\n" t)) - (when error - (print! (error "Aborting push due to unrebased WIP, squash!, or fixup! commits")) - (throw 'exit 1))))))))) - - -;; -;;; - -(defun doom-cli--parse-commit (commit-msg) - (with-temp-buffer - (save-excursion (insert commit-msg)) - (append - (let ((end - (save-excursion - (if (re-search-forward "\n\\(\n[a-zA-Z-]+: [^ ][^\n]+\\)+\n*\\'" nil t) - (1+ (match-beginning 0)) - (point-max))))) - `(:subject ,(buffer-substring (point-min) (line-end-position)) - :body ,(string-trim-right (buffer-substring (line-beginning-position 3) end)) - :trailers ,(save-match-data - (cl-loop with footer = (buffer-substring end (point-max)) - for line in (split-string footer "\n" t) - if (string-match "^\\([a-zA-Z-]+\\): \\(.+\\)$" line) - collect (cons (match-string 1 line) (match-string 2 line)))))) - (save-match-data - (when (looking-at "^\\([a-zA-Z0-9_-]+\\)\\(!?\\)\\(?:(\\([^)]+\\))\\)?: \\([^\n]+\\)") - `(:type ,(intern (match-string 1)) - :bang ,(equal (match-string 2) "!") - :summary ,(match-string 4) - :scopes ,(ignore-errors (split-string (match-string 3) ","))))) - (save-excursion - (let ((bump-re "\\(\\(?:https?://.+\\|[^/ \n]+\\)/[^/ \n]+@[a-z0-9]\\{12\\}\\)") - bumps) - (while (re-search-forward (format "^\\s-*\\<%s -> %s\\>" bump-re bump-re) nil t) - (cond ((rassoc (match-string 1) bumps) - (setcdr (rassoc (match-string 1) bumps) (match-string 2))) - ((assoc (match-string 2) bumps) - (setcar (assoc (match-string 2) bumps) (match-string 1))) - ((setf (alist-get (match-string 1) bumps nil nil #'equal) - (match-string 2))))) - `(:bumps ,(cl-sort (delete-dups bumps) #'string-lessp :key #'car))))))) - -(defun doom-cli--parse-bumps (from end) - (with-temp-buffer - (save-excursion - (insert - (cdr (doom-call-process "git" "log" "--format=full" "--grep=\\(bump\\|revert\\):" - (format "%s...%s" from end))))) - (save-match-data - (let (packages) - (while (let ((bump-re "\\(\\(?:https?://.+\\|[^/ ]+\\)/[^/ ]+@[a-z0-9]\\{12\\}\\)")) - (re-search-forward (format "^\\s-*\\<%s -> %s\\>" bump-re bump-re) nil t)) - (cond ((rassoc (match-string 1) packages) - (setcdr (rassoc (match-string 1) packages) (match-string 2))) - ((assoc (match-string 2) packages) - (setcar (assoc (match-string 2) packages) (match-string 1))) - ((setf (alist-get (match-string 1) packages nil nil #'equal) - (match-string 2))))) - (cl-sort (delete-dups packages) #'string-lessp :key #'car))))) - -(defun doom-cli--ci--lint (commits) - (let ((warnings 0) - (failures 0)) - (print! (start "Linting %d commits" (length commits))) - (print-group! - (pcase-dolist (`(,ref . ,commitmsg) commits) - (let* ((commit (doom-cli--parse-commit commitmsg)) - (shortref (substring ref 0 7)) - (subject (plist-get commit :subject))) - (cl-block 'linter - (letf! ((defun skip! (reason &rest args) - (print! (warn "Skipped because: %s") (apply #'format reason args)) - (cl-return-from 'linter)) - (defun warn! (reason &rest args) - (cl-incf warnings) - (print! (warn "%s") (apply #'format reason args))) - (defun fail! (reason &rest args) - (cl-incf failures) - (print! (error "%s") (apply #'format reason args)))) - (print! (start "%s %s") shortref subject) - (print-group! - (mapc (doom-rpartial #'apply commit) - doom-cli-commit-rules))))))) - (let ((issues (+ warnings failures))) - (if (= issues 0) - (print! (success "There were no issues!")) - (if (> warnings 0) (print! (warn "Warnings: %d" warnings))) - (if (> failures 0) (print! (warn "Failures: %d" failures))) - (print! "\nSee https://docs.doomemacs.org/-/conventions/git-commits") - (unless (zerop failures) - (throw 'exit 1))) - t))) - -(defun doom-cli--ci-lint-commits (from &optional to) - (with-temp-buffer - (insert - (cdr (doom-call-process - "git" "log" - (format "%s...%s" from (or to (concat from "~1")))))) - (doom-cli--ci--lint - (let (commits) - (while (re-search-backward "^commit \\([a-z0-9]\\{40\\}\\)" nil t) - (push (cons (match-string 1) - (replace-regexp-in-string - "^ " "" - (save-excursion - (buffer-substring-no-properties - (search-forward "\n\n") - (if (re-search-forward "\ncommit \\([a-z0-9]\\{40\\}\\)" nil t) - (match-beginning 0) - (point-max)))))) - commits)) - commits)))) diff --git a/.config/emacs/core/cli/debug.el b/.config/emacs/core/cli/debug.el deleted file mode 100644 index 294abcc..0000000 --- a/.config/emacs/core/cli/debug.el +++ /dev/null @@ -1,30 +0,0 @@ -;;; core/cli/debug.el -*- lexical-binding: t; -*- - -(load! "autoload/debug" doom-core-dir) - -;; -;;; Commands - -(defcli! info - ((format ["--json" "--md" "--lisp"] "What format to dump info into")) - "Output system info in markdown for bug reports." - (pcase format - ("--json" - (require 'json) - (with-temp-buffer - (insert (json-encode (doom-info))) - (json-pretty-print-buffer) - (print! (buffer-string)))) - ("--lisp" - (doom/info 'raw)) - (`nil - (doom/info)) - (_ - (user-error "I don't understand %S. Did you mean --json, --md/--markdown or --lisp?" - format))) - nil) - -(defcli! (version v) () - "Show version information for Doom & Emacs." - (doom/version) - nil) diff --git a/.config/emacs/core/cli/doctor.el b/.config/emacs/core/cli/doctor.el deleted file mode 100644 index 4c5b837..0000000 --- a/.config/emacs/core/cli/doctor.el +++ /dev/null @@ -1,276 +0,0 @@ -;;; core/cli/doctor.el -*- lexical-binding: t; -*- - -(defvar doom-warnings ()) -(defvar doom-errors ()) - -;;; Helpers -(defun elc-check-dir (dir) - (dolist (file (directory-files-recursively dir "\\.elc$")) - (when (file-newer-than-file-p (concat (file-name-sans-extension file) ".el") - file) - (warn! "%s is out-of-date" (abbreviate-file-name file))))) - -(defmacro assert! (condition message &rest args) - `(unless ,condition - (error! ,message ,@args))) - - -;;; Logging -(defmacro error! (&rest args) - `(progn (unless inhibit-message (print! (error ,@args))) - (push (format! (error ,@args)) doom-errors))) -(defmacro warn! (&rest args) - `(progn (unless inhibit-message (print! (warn ,@args))) - (push (format! (warn ,@args)) doom-warnings))) -(defmacro success! (&rest args) - `(print! (green ,@args))) -(defmacro section! (&rest args) - `(print! (bold (blue ,@args)))) - -(defmacro explain! (&rest args) - `(print-group! (print! (autofill ,@args)))) - - -;; -;;; CLI commands - -(defcli! (doctor doc) () - "Diagnoses common issues on your system. - -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 modules may optionally have a doctor.el file to run their own heuristics -in." - :bare t - (print! "The doctor will see you now...\n") - - ;; REVIEW Refactor me - (print! (start "Checking your Emacs version...")) - (print-group! - (cond - ((string= ".50" (substring emacs-version -3)) - (error! "Emacs development version detected (%s)" emacs-version) - ;; There are 2 newlines between each item to fight against - ;; the (fill-region) call in `doom--output-autofill' - (explain! "Doom supports this version, but you are using a development version of Emacs! " - "Be prepared for possibly weekly breakages that\n\n" - "\t- you will have to investigate yourself,\n\n" - "\t- might appear, or be solved, on any Emacs update,\n\n" - "\t- might depend subtly on upstream packages updates\n\n" - "You might need to unpin packages to get a fix for a specific commit of Emacs, " - "and you should be ready to downgrade Emacs if something is just not fixable.")) - (EMACS28+ - (warn! "Emacs %s detected" emacs-version) - (explain! "Doom supports this version, but you are living on the edge! " - "Be prepared for breakages in future versions of Emacs.")) - ((< emacs-major-version 27) - (error! "Emacs %s detected, Doom only supports 27.1 and newer" - emacs-version)))) - - (print! (start "Checking for Doom's prerequisites...")) - (print-group! - (if (not (executable-find "git")) - (error! "Couldn't find git on your machine! Doom's package manager won't work.") - (save-match-data - (let* ((version - (cdr (doom-call-process "git" "version"))) - (version - (and (string-match "git version \\([0-9]+\\(?:\\.[0-9]+\\)\\{2\\}\\)" version) - (match-string 1 version)))) - (if version - (when (version< version "2.23") - (error! "Git %s detected! Doom requires git 2.23 or newer!" - version)) - (warn! "Cannot determine Git version. Doom requires git 2.23 or newer!"))))) - - (unless (executable-find "rg") - (error! "Couldn't find the `rg' binary; this a hard dependecy for Doom, file searches may not work at all"))) - - (print! (start "Checking for Emacs config conflicts...")) - (when (file-exists-p "~/.emacs") - (warn! "Detected an ~/.emacs file, which may prevent Doom from loading") - (explain! "If Emacs finds an ~/.emacs file, it will ignore ~/.emacs.d, where Doom is " - "typically installed. If you're seeing a vanilla Emacs splash screen, this " - "may explain why. If you use Chemacs, you may ignore this warning.")) - - (print! (start "Checking for great Emacs features...")) - (unless (functionp 'json-serialize) - (warn! "Emacs was not built with native JSON support") - (explain! "Users will see a substantial performance gain by building Emacs with " - "jansson support (i.e. a native JSON library), particularly LSP users. " - "You must install a prebuilt Emacs binary with this included, or compile " - "Emacs with the --with-json option.")) - - (print! (start "Checking for private config conflicts...")) - (let* ((xdg-dir (concat (or (getenv "XDG_CONFIG_HOME") - "~/.config") - "/doom/")) - (doom-dir (or (getenv "DOOMDIR") - "~/.doom.d/")) - (dir (if (file-directory-p xdg-dir) - xdg-dir - doom-dir))) - (when (file-equal-p dir user-emacs-directory) - (print! (error "Doom was cloned to %S, not ~/.emacs.d or ~/.config/emacs" - (path dir))) - (explain! "Doom's source and your private Doom config have to live in separate directories. " - "Putting them in the same directory (without changing the DOOMDIR environment " - "variable) will cause errors on startup.")) - (when (and (not (file-equal-p xdg-dir doom-dir)) - (file-directory-p xdg-dir) - (file-directory-p doom-dir)) - (print! (warn "Detected two private configs, in %s and %s") - (abbreviate-file-name xdg-dir) - doom-dir) - (explain! "The second directory will be ignored, as it has lower precedence."))) - - (print! (start "Checking for stale elc files...")) - (elc-check-dir user-emacs-directory) - - (print! (start "Checking for problematic git global settings...")) - (if (executable-find "git") - (when (zerop (car (doom-call-process "git" "config" "--global" "--get-regexp" "^url\\.git://github\\.com"))) - (warn! "Detected insteadOf rules in your global gitconfig.") - (explain! "Doom's package manager heavily relies on git. In particular, many of its packages " - "are hosted on github. Rewrite rules like these will break it:\n\n" - " [url \"git://github.com\"]\n" - " insteadOf = https://github.com\n\n" - "Please remove them from your gitconfig or use a conditional includeIf rule to " - "only apply your rewrites to specific repositories. See " - "'https://git-scm.com/docs/git-config#_includes' for more information.")) - (error! "Couldn't find the `git' binary; this a hard dependecy for Doom!")) - - (print! (start "Checking Doom Emacs...")) - (condition-case-unless-debug ex - (print-group! - (let ((doom-interactive-p 'doctor)) - (doom-initialize 'force) - (doom-initialize-modules)) - - (print! (success "Initialized Doom Emacs %s") doom-version) - (print! - (if (hash-table-p doom-modules) - (success "Detected %d modules" (hash-table-count doom-modules)) - (warn "Failed to load any modules. Do you have an private init.el?"))) - - (print! (success "Detected %d packages") (length doom-packages)) - - (print! (start "Checking Doom core for irregularities...")) - (print-group! - ;; 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")) - (when-let (size (ignore-errors (doom-file-size file doom-cache-dir))) - (when (> size 1048576) ; larger than 1mb - (warn! "%s is too large (%.02fmb). This may cause freezes or odd startup delays" - file (/ size 1024 1024.0)) - (explain! "Consider deleting it from your system (manually)")))) - - (unless (ignore-errors (executable-find doom-projectile-fd-binary)) - (warn! "Couldn't find the `fd' binary; project file searches will be slightly slower")) - - (require 'projectile) - (when (projectile-project-root "~") - (warn! "Your $HOME is recognized as a project root") - (explain! "Emacs will assume $HOME is the root of any project living under $HOME. If this isn't\n" - "desired, you will need to remove \".git\" from `projectile-project-root-files-bottom-up'\n" - "(a variable), e.g.\n\n" - " (after! projectile\n" - " (setq projectile-project-root-files-bottom-up\n" - " (remove \".git\" projectile-project-root-files-bottom-up)))")) - - ;; There should only be one - (when (and (file-equal-p doom-private-dir "~/.config/doom") - (file-directory-p "~/.doom.d")) - (print! (warn "Both %S and '~/.doom.d' exist on your system") - (path doom-private-dir)) - (explain! "Doom will only load one of these (~/.config/doom takes precedence). Possessing\n" - "both is rarely intentional; you should one or the other.")) - - ;; Check for fonts - (if (not (executable-find "fc-list")) - (warn! "Warning: unable to detect fonts because fontconfig isn't installed") - ;; all-the-icons fonts - (when (and (pcase system-type - (`gnu/linux (concat (or (getenv "XDG_DATA_HOME") - "~/.local/share") - "/fonts/")) - (`darwin "~/Library/Fonts/")) - (require 'all-the-icons nil t)) - (with-temp-buffer - (let ((errors 0)) - (cl-destructuring-bind (status . output) - (doom-call-process "fc-list" "" "file") - (if (not (zerop status)) - (print! (error "There was an error running `fc-list'. Is fontconfig installed correctly?")) - (insert (cdr (doom-call-process "fc-list" "" "file"))) - (dolist (font all-the-icons-font-names) - (if (save-excursion (re-search-backward font nil t)) - (success! "Found font %s" font) - (print! (warn "Warning: couldn't find %S font") font))) - (when (> errors 0) - (explain! "Some all-the-icons fonts were missing.\n\n" - "You can install them by running `M-x all-the-icons-install-fonts' within Emacs.\n" - "This could also mean you've installed them in non-standard locations, in which " - "case feel free to ignore this warning."))))))))) - - (print! (start "Checking for stale elc files in your DOOMDIR...")) - (when (file-directory-p doom-private-dir) - (print-group! - (elc-check-dir doom-private-dir))) - - (when doom-modules - (print! (start "Checking your enabled modules...")) - (advice-add #'require :around #'doom-shut-up-a) - (maphash (lambda (key plist) - (let (doom-local-errors - doom-local-warnings) - (let (doom-errors - doom-warnings) - (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"))) - (cl-loop with doom-output-indent = 6 - for name in (let (doom-packages - doom-disabled-packages) - (load packages-file 'noerror 'nomessage) - (mapcar #'car doom-packages)) - unless (or (doom-package-get name :disable) - (eval (doom-package-get name :ignore)) - (plist-member (doom-package-get name :recipe) :local-repo) - (doom-package-built-in-p name) - (doom-package-installed-p name)) - do (print! (error "Missing emacs package: %S") name)) - (let ((inhibit-message t)) - (load doctor-file 'noerror 'nomessage))) - (file-missing (error! "%s" (error-message-string ex))) - (error (error! "Syntax error: %s" ex))) - (when (or doom-errors doom-warnings) - (print-group! - (print! (start (bold "%s %s")) (car key) (cdr key)) - (print! "%s" (string-join (append doom-errors doom-warnings) "\n"))) - (setq doom-local-errors doom-errors - doom-local-warnings doom-warnings))) - (appendq! doom-errors doom-local-errors) - (appendq! doom-warnings doom-local-warnings))) - doom-modules))) - (error - (warn! "Attempt to load DOOM failed\n %s\n" - (or (cdr-safe ex) (car ex))) - (setq doom-modules nil))) - - ;; Final report - (message "") - (dolist (msg (list (list doom-errors "error" 'red) - (list doom-warnings "warning" 'yellow))) - (when (car msg) - (print! (color (nth 2 msg) - (if (cdr msg) - "There are %d %ss!" - "There is %d %s!") - (length (car msg)) (nth 1 msg))))) - (unless (or doom-errors doom-warnings) - (success! "Everything seems fine, happy Emacs'ing!")) - t) diff --git a/.config/emacs/core/cli/env.el b/.config/emacs/core/cli/env.el deleted file mode 100644 index 4451f39..0000000 --- a/.config/emacs/core/cli/env.el +++ /dev/null @@ -1,141 +0,0 @@ -;;; core/cli/env.el -*- lexical-binding: t; -*- - -(defcli! env - ((allow ["-a" "--allow" regexp] "An additive envvar whitelist regexp") - (reject ["-r" "--reject" regexp] "An additive envvar blacklist regexp") - (allow-only ["-A" regexp] "Blacklist everything but REGEXP") - (reject-only ["-R" regexp] "Whitelist everything but REGEXP") - (clear-p ["-c" "--clear"] "Clear and delete your envvar file") - (outputfile ["-o" path] - "Generate the envvar file at PATH. Envvar files that aren't in -`doom-env-file' won't be loaded automatically at startup. You will need to load -them manually from your private config with the `doom-load-envvars-file' -function.")) - "Creates or regenerates your envvars file. - -The envvars file is created by scraping the current shell environment into -newline-delimited KEY=VALUE pairs. Typically by running '$SHELL -ic env' (or -'$SHELL -c set' on windows). Doom loads this file at startup (if it exists) to -ensure Emacs mirrors your shell environment (particularly to ensure PATH and -SHELL are correctly set). - -This is useful in cases where you cannot guarantee that Emacs (or the daemon) -will be launched from the correct environment (e.g. on MacOS or through certain -app launchers on Linux). - -This file is automatically regenerated when you run this command or 'doom sync'. -However, 'doom sync' will only regenerate this file if it exists. - -Why this over exec-path-from-shell? - - 1. `exec-path-from-shell' spawns (at least) one process at startup to scrape - your shell environment. This can be arbitrarily slow depending on the - user's shell configuration. A single program (like pyenv or nvm) or config - framework (like oh-my-zsh) could undo all of Doom's startup optimizations - in one fell swoop. - - 2. `exec-path-from-shell' only scrapes some state from your shell. You have to - be proactive in order to get it to capture all the envvars relevant to your - development environment. - - I'd rather it inherit your shell environment /correctly/ (and /completely/) - or not at all. It frontloads the debugging process rather than hiding it - until you least want to deal with it." - (let ((env-file (expand-file-name (or outputfile doom-env-file)))) - (if (null clear-p) - (doom-cli-reload-env-file - 'force env-file - (append (if reject-only (list ".")) (list allow allow-only)) - (append (if allow-only (list ".")) (list reject reject-only))) - (unless (file-exists-p env-file) - (user-error! "%S does not exist to be cleared" (path env-file))) - (delete-file env-file) - (print! (success "Successfully deleted %S") (path env-file))))) - - -;; -;; Helpers - -(defvar doom-env-blacklist - '(;; State that may be problematic if overwritten - "^HOME$" "^\\(OLD\\)?PWD$" "^SHLVL$" "^PS1$" "^R?PROMPT$" "^TERM\\(CAP\\)?$" - "^USER$" - ;; X server or services' variables that shouldn't be persisted - "^DISPLAY$" "^DBUS_SESSION_BUS_ADDRESS$" "^XAUTHORITY$" "^XDG_SESSION_TYPE$" - ;; Windows+WSL envvars that shouldn't be persisted - "^WSL_INTEROP$" - ;; ssh and gpg variables (likely to become stale) - "^SSH_\\(AUTH_SOCK\\|AGENT_PID\\)$" "^\\(SSH\\|GPG\\)_TTY$" - "^GPG_AGENT_INFO$" - ;; Internal Doom envvars - "^DEBUG$" "^INSECURE$" "^YES$" "^__") - "Environment variables to not save in `doom-env-file'. - -Each string is a regexp, matched against variable names to omit from -`doom-env-file'.") - -(defvar doom-env-whitelist '() - "A whitelist for envvars to save in `doom-env-file'. - -This overrules `doom-env-ignored-vars'. Each string is a regexp, matched against -variable names to omit from `doom-env-file'.") - -(defun doom-cli-reload-env-file (&optional force-p env-file whitelist blacklist) - "Generates `doom-env-file', if it doesn't exist (or if FORCE-P). - -This scrapes the variables from your shell environment by running -`doom-env-executable' through `shell-file-name' with `doom-env-switches'. By -default, on Linux, this is '$SHELL -ic /usr/bin/env'. Variables in -`doom-env-ignored-vars' are removed." - (let ((env-file (expand-file-name (or env-file doom-env-file)))) - (when (or force-p (not (file-exists-p env-file))) - (with-temp-file env-file - (setq-local coding-system-for-write 'utf-8-unix) - (print! (start "%s envvars file at %S") - (if (file-exists-p env-file) - "Regenerating" - "Generating") - (path env-file)) - (print-group! - (when doom-interactive-p - (user-error "'doom env' must be run on the command line, not an interactive session")) - (goto-char (point-min)) - (insert - (concat - ";; -*- mode: lisp-interaction; coding: utf-8-unix; -*-\n" - ";; ---------------------------------------------------------------------------\n" - ";; This file was auto-generated by `doom env'. It contains a list of environment\n" - ";; variables scraped from your default shell (excluding variables blacklisted\n" - ";; in doom-env-ignored-vars).\n" - ";;\n" - (if (file-equal-p env-file doom-env-file) - (concat ";; It is NOT safe to edit this file. Changes will be overwritten next time you\n" - ";; run 'doom sync'. To create a safe-to-edit envvar file use:\n;;\n" - ";; doom env -o ~/.doom.d/myenv\n;;\n" - ";; And load it with (doom-load-envvars-file \"~/.doom.d/myenv\").\n") - (concat ";; This file is safe to edit by hand, but needs to be loaded manually with:\n;;\n" - ";; (doom-load-envvars-file \"path/to/this/file\")\n;;\n" - ";; Use 'doom env -o path/to/this/file' to regenerate it.")) - "\n")) - ;; We assume that this noninteractive session was spawned from the - ;; user's interactive shell, therefore simply dump - ;; `process-environment' to a file. - ;; - ;; This file should be somewhat formatted, so humans could hand-modify - ;; it if they please. - (let ((blacklist (remq nil (append blacklist doom-env-blacklist))) - (whitelist (remq nil (append whitelist doom-env-whitelist)))) - (insert "(") - (dolist (env (get 'process-environment 'initial-value)) - (catch 'skip - (let* ((var (car (split-string env "="))) - (pred (doom-rpartial #'string-match-p var))) - (when (seq-find pred blacklist) - (if (seq-find pred whitelist) - (doom-log "Whitelisted %s" var) - (doom-log "Ignored %s" var) - (throw 'skip t))) - (insert (prin1-to-string env) "\n ")))) - (insert ")")) - (print! (success "Successfully generated %S") (path env-file)) - t))))) diff --git a/.config/emacs/core/cli/help.el b/.config/emacs/core/cli/help.el deleted file mode 100644 index 11bc2e7..0000000 --- a/.config/emacs/core/cli/help.el +++ /dev/null @@ -1,102 +0,0 @@ -;;; core/cli/help.el -*- lexical-binding: t; -*- - -(defun doom--cli-print-signature (cli) - (print! (bold "Usage: doom %s%s%s") - (if (doom-cli-internal-p cli) - "" - (concat (doom-cli-name cli) " ")) - (if-let* ((optlist (doom-cli-optlist cli)) - (flags (cl-loop for opt in optlist - append (doom-cli-option-flags opt))) - (fn (doom-partial #'string-prefix-p "--"))) - (concat (when-let (short-flags (cl-remove-if fn flags)) - ;; TODO Show arguments of short flags - (format "[-%s]" - (string-join (mapcar (doom-rpartial #'substring 1 nil) short-flags) - ""))) - ;; TODO Show long flags - ;; (when-let (long-flags (cl-remove-if-not fn flags)) - ;; (concat " " (string-join long-flags " "))) - " ") - "") - (if-let (arglist (doom-cli-arglist cli)) - (string-join (append (cl-loop for arg in arglist - until (memq arg cl--lambda-list-keywords) - collect (upcase (symbol-name arg))) - (cl-loop for arg in (cdr (memq '&optional arglist)) - until (memq arg cl--lambda-list-keywords) - collect (format "[%s]" (upcase (symbol-name arg))))) - " ") - "")) - (when-let (aliases (doom-cli-aliases cli)) - (print! "Aliases: %s" (string-join aliases ", ")))) - -(defun doom--cli-print-desc (cli &optional short) - (print! "%s" - (if short - (car (split-string (doom-cli-desc cli) "\n")) - (doom-cli-desc cli)))) - -(defun doom--cli-print-short-desc (cli) - (doom--cli-print-desc cli 'short)) - -(defun doom--cli-print-options (cli) - (when-let (optlist (doom-cli-optlist cli)) - (print! (bold "Options:")) - (print-group! - (cl-loop for opt in optlist - for desc = (doom-cli-option-desc opt) - for args = (doom-cli-option-args opt) - for flagstr = (string-join (doom-cli-option-flags opt) ", ") - do - ;; TODO Adjust columns dynamically - (print! "%-18s" - (concat flagstr - (when-let (arg (car args)) - (concat " " (upcase (symbol-name arg)))))) - (print-group! - (print! (autofill "%s") desc)))))) - - -(defun doom--cli-print (cli) - (doom--cli-print-signature cli) - (terpri) - (doom--cli-print-desc cli) - (terpri) - (doom--cli-print-options cli)) - - -;; -;;; Commands - -(defcli! (help h) (&optional command) - "Describe a command or list them all." - :bare t - (if command - (doom--cli-print (doom-cli-get (intern command))) - (doom--cli-print (doom-cli-get :doom)) - (terpri) - (print! (bold "Commands:")) - (print-group! - (dolist (group (seq-group-by (lambda (cli) - (plist-get (doom-cli-plist cli) :group)) - (cl-loop for name being the hash-keys of doom--cli-commands - for cli = (gethash name doom--cli-commands) - if (and (doom-cli-p cli) - (not (doom-cli-internal-p cli)) - (not (plist-get (doom-cli-plist cli) :hidden))) - collect cli))) - (if (null (car group)) - (dolist (cli (cdr group)) - (print! "%-16s %s" - (doom-cli-name cli) - (car (split-string (doom-cli-desc cli) "\n")))) - (print! "%-26s %s" - (bold (concat (car group) ":")) - (gethash (car group) doom--cli-groups)) - (print-group! - (dolist (cli (cdr group)) - (print! "%-16s %s" - (doom-cli-name cli) - (car (split-string (doom-cli-desc cli) "\n")))))) - (terpri))))) diff --git a/.config/emacs/core/cli/install.el b/.config/emacs/core/cli/install.el deleted file mode 100644 index ac77879..0000000 --- a/.config/emacs/core/cli/install.el +++ /dev/null @@ -1,102 +0,0 @@ -;;; core/cli/install.el -*- lexical-binding: t; -*- - -(defcli! (install i) - ((noconfig-p ["--no-config"] "Don't create DOOMDIR or dummy files therein") - (noenv-p ["--no-env"] "Don't generate an envvars file (see 'doom help env')") - (noinstall-p ["--no-install"] "Don't auto-install packages") - (nofonts-p ["--no-fonts"] "Don't install (or prompt to install) all-the-icons fonts")) - "Installs and sets up Doom Emacs for the first time. - -This command does the following: - - 1. Creates DOOMDIR at ~/.doom.d, - 2. Copies ~/.emacs.d/init.example.el to $DOOMDIR/init.el (if it doesn't exist), - 3. Creates dummy files for $DOOMDIR/{config,packages}.el, - 4. Prompts you to generate an envvar file (same as 'doom env'), - 5. Installs any dependencies of enabled modules (specified by $DOOMDIR/init.el), - 6. And prompts to install all-the-icons' fonts - -This command is idempotent and safe to reuse. - -The location of DOOMDIR can be changed with the environment variable of the same -name. e.g. - - DOOMDIR=~/.config/doom doom install" - (print! (green "Installing Doom Emacs!\n")) - (let ((default-directory (doom-path "~"))) - ;; Create `doom-private-dir' - (if noconfig-p - (print! (warn "Not copying private config template, as requested")) - ;; Create DOOMDIR in ~/.config/doom if ~/.config/emacs exists. - (when (and (not (file-directory-p doom-private-dir)) - (not (getenv "DOOMDIR"))) - (let ((xdg-config-dir (or (getenv "XDG_CONFIG_HOME") "~/.config"))) - (when (file-in-directory-p doom-emacs-dir xdg-config-dir) - (setq doom-private-dir (expand-file-name "doom/" xdg-config-dir))))) - (print! (start "Creating %s") (relpath doom-private-dir)) - (make-directory doom-private-dir 'parents) - (print-group! - (print! (success "Created %s") (relpath doom-private-dir))) - - ;; Create init.el, config.el & packages.el - (mapc (lambda (file) - (cl-destructuring-bind (filename . template) file - (if (file-exists-p! filename doom-private-dir) - (print! (warn "%s already exists, skipping") filename) - (print! (info "Creating %s%s") (relpath doom-private-dir) filename) - (with-temp-file (doom-path doom-private-dir filename) - (insert-file-contents template)) - (print! (success "Done!"))))) - `(("init.el" . ,(doom-path doom-emacs-dir "init.example.el")) - ("config.el" . ,(doom-path doom-core-dir "templates/config.example.el")) - ("packages.el" . ,(doom-path doom-core-dir "templates/packages.example.el"))))) - - ;; In case no init.el was present the first time `doom-initialize-modules' was - ;; called in core.el (e.g. on first install) - (doom-initialize-modules 'force 'no-config) - - ;; Ask if user would like an envvar file generated - (if noenv-p - (print! (warn "Not generating envvars file, as requested")) - (if (file-exists-p doom-env-file) - (print! (info "Envvar file already exists, skipping")) - (when (or doom-auto-accept - (y-or-n-p "Generate an envvar file? (see `doom help env` for details)")) - (doom-cli-reload-env-file 'force-p)))) - - ;; Install Doom packages - (if noinstall-p - (print! (warn "Not installing plugins, as requested")) - (print! "Installing plugins") - (doom-cli-packages-install)) - - (print! "Regenerating autoloads files") - (doom-autoloads-reload) - - (print! "Deploying commit-msg and pre-push git hooks") - (doom-cli--ci-deploy-hooks) - - (cond (nofonts-p) - (IS-WINDOWS - (print! (warn "Doom cannot install all-the-icons' fonts on Windows!\n")) - (print-group! - (print! - (concat "You'll have to do so manually:\n\n" - " 1. Launch Doom Emacs\n" - " 2. Execute 'M-x all-the-icons-install-fonts' to download the fonts\n" - " 3. Open the download location in windows explorer\n" - " 4. Open each font file to install them")))) - ((or doom-auto-accept - (y-or-n-p "Download and install all-the-icon's fonts?")) - (require 'all-the-icons) - (let ((window-system (cond (IS-MAC 'ns) - (IS-LINUX 'x)))) - (all-the-icons-install-fonts 'yes)))) - - (when (file-exists-p "~/.emacs") - (print! (warn "A ~/.emacs file was detected. This conflicts with Doom and should be deleted!"))) - - (print! (success "\nFinished! Doom is ready to go!\n")) - (with-temp-buffer - (insert-file-contents (doom-path doom-core-dir "templates/QUICKSTART_INTRO")) - (print! "%s" (buffer-string))))) diff --git a/.config/emacs/core/cli/lib/debugger.el b/.config/emacs/core/cli/lib/debugger.el deleted file mode 100644 index 3b47709..0000000 --- a/.config/emacs/core/cli/lib/debugger.el +++ /dev/null @@ -1,71 +0,0 @@ -;;; core/cli/debugger.el -*- lexical-binding: t; -*- - -(cl-defun doom-cli--debugger (error data) - (cl-incf num-nonmacro-input-events) - (cl-destructuring-bind (backtrace &optional type data . rest) - (cons (doom-cli--backtrace) data) - (with-output-to! doom--cli-log-buffer - (let ((straight-error - (and (bound-and-true-p straight-process-buffer) - (stringp data) - (string-match-p (regexp-quote straight-process-buffer) - data) - (with-current-buffer (straight--process-buffer) - (split-string (buffer-string) "\n" t))))) - (cond (straight-error - (print! (error "The package manager threw an error")) - (print! (error "Last 25 lines of straight's error log:")) - (print-group! - (print! - "%s" (string-join - (seq-subseq straight-error - (max 0 (- (length straight-error) 25)) - (length straight-error)) - "\n")))) - ((print! (error "There was an unexpected error")) - (print-group! - (print! "%s %s" (bold "Message:") (get type 'error-message)) - (print! "%s %S" (bold "Error:") (append (list type data) rest)) - (when backtrace - (print! (bold "Backtrace:")) - (print-group! - (dolist (frame (seq-take backtrace 10)) - (let* ((frame (replace-regexp-in-string - "[\n\r]" "\\\\n" (prin1-to-string frame))) - (frame (if (> (length frame) 74) - (concat (substring frame 0 74) "...") - frame))) - (print! "%s" frame)))))))) - (when backtrace - (with-temp-file doom-cli-log-error-file - (insert "# -*- lisp-interaction -*-\n") - (insert "# vim: set ft=lisp:\n") - (let ((standard-output (current-buffer)) - (print-quoted t) - (print-escape-newlines t) - (print-escape-control-characters t) - (print-level nil) - (print-circle nil)) - (when straight-error - (print (string-join straight-error "\n"))) - (mapc #'print (cons (list type data) backtrace))) - (print! (warn "Extended backtrace logged to %s") - (relpath doom-cli-log-error-file))))))) - (throw 'exit 255)) - -(defun doom-cli--backtrace () - (let* ((n 0) - (frame (backtrace-frame n)) - (frame-list nil) - (in-program-stack nil)) - (while frame - (when in-program-stack - (push (cdr frame) frame-list)) - (when (eq (elt frame 1) 'doom-cli--debugger) - (setq in-program-stack t)) - (when (and (eq (elt frame 1) 'doom-cli-execute) - (eq (elt frame 2) :doom)) - (setq in-program-stack nil)) - (setq n (1+ n) - frame (backtrace-frame n))) - (reverse frame-list))) diff --git a/.config/emacs/core/cli/lib/lib.el b/.config/emacs/core/cli/lib/lib.el deleted file mode 100644 index b84b157..0000000 --- a/.config/emacs/core/cli/lib/lib.el +++ /dev/null @@ -1,185 +0,0 @@ -;;; core/cli/lib.el --- -*- lexical-binding: t; no-byte-compile: t; -*- - -(cl-defstruct - (doom-cli - (:constructor nil) - (:constructor - make-doom-cli - (name &key desc aliases optlist arglist plist fn - &aux - (optlist - (cl-loop for (symbol options desc) in optlist - for ((_ . options) (_ . params)) - = (seq-group-by #'stringp options) - collect - (make-doom-cli-option :symbol symbol - :flags options - :args params - :desc desc)))))) - (name nil :read-only t) - (desc "TODO") - aliases - optlist - arglist - plist - (fn (lambda (_) (print! "But nobody came!")))) - -(cl-defstruct doom-cli-option - (symbol) - (flags ()) - (args ()) - (desc "TODO")) - -(defun doom--cli-get-option (cli flag) - (cl-find-if (doom-partial #'member flag) - (doom-cli-optlist cli) - :key #'doom-cli-option-flags)) - -(defun doom--cli-process (cli args) - (let* ((args (copy-sequence args)) - (arglist (copy-sequence (doom-cli-arglist cli))) - (expected - (or (cl-position-if (doom-rpartial #'memq cl--lambda-list-keywords) - arglist) - (length arglist))) - (got 0) - restvar - rest - alist) - (catch 'done - (while args - (let ((arg (pop args))) - (cond ((eq (car arglist) '&rest) - (setq restvar (cadr arglist) - rest (cons arg args)) - (throw 'done t)) - - ((string-match "^\\(--\\([a-zA-Z0-9][a-zA-Z0-9-_]*\\)\\)\\(?:=\\(.+\\)\\)?$" arg) - (let* ((fullflag (match-string 1 arg)) - (opt (doom--cli-get-option cli fullflag))) - (unless opt - (user-error "Unrecognized switch %S" (concat "--" (match-string 2 arg)))) - (setf (alist-get (doom-cli-option-symbol opt) alist) - (or (if (doom-cli-option-args opt) - (or (match-string 3 arg) - (pop args) - (user-error "%S expected an argument, but got none" - fullflag)) - (if (match-string 3 arg) - (user-error "%S was not expecting an argument, but got %S" - fullflag (match-string 3 arg)) - fullflag)))))) - - ((string-match "^\\(-\\([a-zA-Z0-9]+\\)\\)$" arg) - (let ((fullflag (match-string 1 arg)) - (flag (match-string 2 arg))) - (dolist (switch (split-string flag "" t)) - (if-let (opt (doom--cli-get-option cli (concat "-" switch))) - (setf (alist-get (doom-cli-option-symbol opt) alist) - (if (doom-cli-option-args opt) - (or (pop args) - (user-error "%S expected an argument, but got none" - fullflag)) - fullflag)) - (user-error "Unrecognized switch %S" (concat "-" switch)))))) - - (arglist - (cl-incf got) - (let ((spec (pop arglist))) - (when (eq spec '&optional) - (setq spec (pop arglist))) - (setf (alist-get spec alist) arg)) - (when (null arglist) - (throw 'done t))) - - (t - (push arg args) - (throw 'done t)))))) - (when (< got expected) - (error "Expected %d arguments, got %d" expected got)) - (when rest - (setf (alist-get restvar alist) rest)) - alist)) - -(defun doom-cli-get (command) - "Return a CLI object associated by COMMAND name (string)." - (cond ((null command) nil) - ((doom-cli-p command) command) - ((doom-cli-get - (gethash (cond ((symbolp command) command) - ((stringp command) (intern command)) - (command)) - doom--cli-commands))))) - -(defun doom-cli-internal-p (cli) - "Return non-nil if CLI is an internal (non-public) command." - (string-prefix-p ":" (doom-cli-name cli))) - -(defun doom-cli-execute (command &rest args) - "Execute COMMAND (string) with ARGS (list of strings). - -Executes a cli defined with `defcli!' with the name or alias specified by -COMMAND, and passes ARGS to it." - (if-let (cli (doom-cli-get command)) - (funcall (doom-cli-fn cli) - (doom--cli-process cli (remq nil args))) - (user-error "Couldn't find any %S command" command))) - -(defmacro defcli! (name speclist &optional docstring &rest body) - "Defines a CLI command. - -COMMAND is a symbol or a list of symbols representing the aliases for this -command. DOCSTRING is a string description; its first line should be short -(under 60 characters), as it will be used as a summary for 'doom help'. - -SPECLIST is a specification for options and arguments, which can be a list -specification for an option/switch in the following format: - - (VAR [FLAGS... ARGS...] DESCRIPTION) - -Otherwise, SPECLIST accepts the same argument specifiers as `defun'. - -BODY will be run when this dispatcher is called." - (declare (indent 2) (doc-string 3)) - (unless (stringp docstring) - (push docstring body) - (setq docstring "TODO")) - (let ((names (doom-enlist name)) - (optlist (cl-remove-if-not #'listp speclist)) - (arglist (cl-remove-if #'listp speclist)) - (plist (cl-loop for (key val) on body by #'cddr - if (keywordp key) - nconc (list key val) into plist - else return plist))) - `(let ((name ',(car names)) - (aliases ',(cdr names)) - (plist ',plist)) - (when doom--cli-group - (setq plist (plist-put plist :group doom--cli-group))) - (puthash - name - (make-doom-cli (symbol-name name) - :desc ,docstring - :aliases (mapcar #'symbol-name aliases) - :arglist ',arglist - :optlist ',optlist - :plist plist - :fn - (lambda (--alist--) - (ignore --alist--) - (let ,(cl-loop for opt in speclist - for optsym = (if (listp opt) (car opt) opt) - unless (memq optsym cl--lambda-list-keywords) - collect (list optsym `(cdr (assq ',optsym --alist--)))) - ,@body))) - doom--cli-commands) - (when aliases - (mapc (doom-rpartial #'puthash name doom--cli-commands) - aliases))))) - -(defmacro defcligroup! (name docstring &rest body) - "Declare all enclosed cli commands are part of the NAME group." - (declare (indent defun) (doc-string 2)) - `(let ((doom--cli-group ,name)) - (puthash doom--cli-group ,docstring doom--cli-groups) - ,@body)) diff --git a/.config/emacs/core/cli/lib/straight-hacks.el b/.config/emacs/core/cli/lib/straight-hacks.el deleted file mode 100644 index 685556d..0000000 --- a/.config/emacs/core/cli/lib/straight-hacks.el +++ /dev/null @@ -1,120 +0,0 @@ -;;; core/cli/straight-hacks.el --- -*- lexical-binding: t; no-byte-compile: t; -*- - -;; Straight was designed primarily for interactive use, in an interactive Emacs -;; session, but Doom does its package management in the terminal. Some things -;; must be modified get straight to behave and improve its UX for our users. - -(defvar doom--straight-auto-options - '(("has diverged from" - . "^Reset [^ ]+ to branch") - ("but recipe specifies a URL of" - . "Delete remote \"[^\"]+\", re-create it with correct URL") - ("has a merge conflict:" - . "^Abort merge$") - ("has a dirty worktree:" - . "^Discard changes$") - ("^In repository \"[^\"]+\", [^ ]+ (on branch \"main\") is ahead of default branch \"master\"" - . "^Checkout branch \"master\"") - ("^In repository \"[^\"]+\", [^ ]+ (on branch \"[^\"]+\") is ahead of default branch \"[^\"]+\"" - . "^Checkout branch \"") - ("^In repository " - . "^Reset branch \\|^Delete remote [^,]+, re-create it with correct URL")) - "A list of regexps, mapped to regexps. - -Their CAR is tested against the prompt, and CDR is tested against the presented -option, and is used by `straight-vc-git--popup-raw' to select which option to -recommend. - -It may not be obvious to users what they should do for some straight prompts, -so Doom will recommend the one that reverts a package back to its (or target) -original state.") - - -;; HACK Remove dired & magit options from prompt, since they're inaccessible in -;; noninteractive sessions. -(advice-add #'straight-vc-git--popup-raw :override #'straight--popup-raw) - -;; HACK Replace GUI popup prompts (which hang indefinitely in tty Emacs) with -;; simple prompts. -(defadvice! doom--straight-fallback-to-y-or-n-prompt-a (fn &optional prompt) - :around #'straight-are-you-sure - (or doom-auto-accept - (if doom-interactive-p - (funcall fn prompt) - (y-or-n-p (format! "%s" (or prompt "")))))) - -(defun doom--straight-recommended-option-p (prompt option) - (cl-loop for (prompt-re . opt-re) in doom--straight-auto-options - if (string-match-p prompt-re prompt) - return (string-match-p opt-re option))) - -(defadvice! doom--straight-fallback-to-tty-prompt-a (fn prompt actions) - "Modifies straight to prompt on the terminal when in noninteractive sessions." - :around #'straight--popup-raw - (if doom-interactive-p - (funcall fn prompt actions) - (let ((doom--straight-auto-options doom--straight-auto-options)) - ;; We can't intercept C-g, so no point displaying any options for this key - ;; when C-c is the proper way to abort batch Emacs. - (delq! "C-g" actions 'assoc) - ;; HACK These are associated with opening dired or magit, which isn't - ;; possible in tty Emacs, so... - (delq! "e" actions 'assoc) - (delq! "g" actions 'assoc) - (if doom-auto-discard - (cl-loop with doom-auto-accept = t - for (_key desc func) in actions - when desc - when (doom--straight-recommended-option-p prompt desc) - return (funcall func)) - (print! (start "%s") (red prompt)) - (print-group! - (terpri) - (let (recommended options) - (print-group! - (print! " 1) Abort") - (cl-loop for (_key desc func) in actions - when desc - do (push func options) - and do - (print! "%2s) %s" (1+ (length options)) - (if (doom--straight-recommended-option-p prompt desc) - (progn - (setq doom--straight-auto-options nil - recommended (length options)) - (green (concat desc " (Choose this if unsure)"))) - desc)))) - (terpri) - (let* ((options - (cons (lambda () - (let ((doom-output-indent 0)) - (terpri) - (print! (warn "Aborted"))) - (kill-emacs 1)) - (nreverse options))) - (prompt - (format! "How to proceed? (%s%s) " - (mapconcat #'number-to-string - (number-sequence 1 (length options)) - ", ") - (if (not recommended) "" - (format "; don't know? Pick %d" (1+ recommended))))) - answer fn) - (while (null (nth (setq answer (1- (read-number prompt))) - options)) - (print! (warn "%s is not a valid answer, try again.") - answer)) - (funcall (nth answer options))))))))) - -(setq straight-arrow " > ") -(defadvice! doom--straight-respect-print-indent-a (string &rest objects) - "Same as `message' (which see for STRING and OBJECTS) normally. -However, in batch mode, print to stdout instead of stderr." - :override #'straight--output - (let ((msg (apply #'format string objects))) - (save-match-data - (when (string-match (format "^%s\\(.+\\)$" (regexp-quote straight-arrow)) msg) - (setq msg (match-string 1 msg)))) - (and (string-match-p "^\\(Cloning\\|\\(Reb\\|B\\)uilding\\) " msg) - (not (string-suffix-p "...done" msg)) - (doom--print (doom--format (concat "> " msg)))))) diff --git a/.config/emacs/core/cli/packages.el b/.config/emacs/core/cli/packages.el deleted file mode 100644 index 32dbaa3..0000000 --- a/.config/emacs/core/cli/packages.el +++ /dev/null @@ -1,649 +0,0 @@ -;; -*- no-byte-compile: t; -*- -;;; core/cli/packages.el - -(require 'comp nil t) - - -;; -;;; Commands - -(defcli! (update u) (&rest _) - "This command was removed." - :hidden t - (print! (error "This command has been removed.\n")) - (print-group! - (print! "To update Doom run 'doom upgrade'. To only update packages run 'doom sync -u'.")) - nil) - -(defcli! (build b) - ((rebuild-p ["-r"] "Only rebuild packages that need rebuilding")) - "Byte-compiles & symlinks installed packages. - -This ensures that all needed files are symlinked from their package repo and -their elisp files are byte-compiled. This is especially necessary if you upgrade -Emacs (as byte-code is generally not forward-compatible)." - (when (doom-cli-packages-build (not rebuild-p)) - (doom-autoloads-reload)) - t) - -(defcli! (purge p) - ((nobuilds-p ["-b" "--no-builds"] "Don't purge unneeded (built) packages") - (noelpa-p ["-p" "--no-elpa"] "Don't purge ELPA packages") - (norepos-p ["-r" "--no-repos"] "Don't purge unused straight repos") - (noeln-p ["-e" "--no-eln"] "Don't purge old ELN bytecode") - (noregraft-p ["-g" "--no-regraft"] "Regraft git repos (ie. compact them)")) - "Deletes orphaned packages & repos, and compacts them. - -Purges all installed ELPA packages (as they are considered temporary). Purges -all orphaned package repos and builds. If -g/--regraft is supplied, the git -repos among them will be regrafted and compacted to ensure they are as small as -possible. - -It is a good idea to occasionally run this doom purge -g to ensure your package -list remains lean." - (straight-check-all) - (when (doom-cli-packages-purge - (not noelpa-p) - (not norepos-p) - (not nobuilds-p) - (not noregraft-p) - (not noeln-p)) - (doom-autoloads-reload)) - t) - -;; (defcli! rollback () ; TODO doom rollback -;; "" -;; (user-error "Not implemented yet, sorry!")) - - -;; -;;; Library - -(defun doom--same-commit-p (abbrev-ref ref) - (and (stringp abbrev-ref) - (stringp ref) - (string-match-p (concat "^" (regexp-quote abbrev-ref)) - ref))) - -(defun doom--abbrev-commit (commit &optional full) - (if full commit (substring commit 0 7))) - -(defun doom--commit-log-between (start-ref end-ref) - (straight--process-with-result - (straight--process-run - "git" "log" "--oneline" "--no-merges" - end-ref (concat "^" (regexp-quote start-ref))) - (if success - (string-trim-right (or stdout "")) - (format "ERROR: Couldn't collect commit list because: %s" stderr)))) - -(defmacro doom--straight-with (form &rest body) - (declare (indent 1)) - `(let-alist - (let* ((buffer (straight--process-buffer)) - (start (with-current-buffer buffer (point-max))) - (retval ,form) - (output (with-current-buffer buffer (buffer-substring start (point-max))))) - (save-match-data - (list (cons 'it retval) - (cons 'stdout (substring-no-properties output)) - (cons 'success (if (string-match "\n+\\[Return code: \\([0-9-]+\\)\\]\n+" output) - (string-to-number (match-string 1 output)))) - (cons 'output (string-trim output - "^\\(\\$ [^\n]+\n\\)*\n+" - "\n+\\[Return code: [0-9-]+\\]\n+"))))) - ,@body)) - -(defun doom--barf-if-incomplete-packages () - (let ((straight-safe-mode t)) - (condition-case _ (straight-check-all) - (error (user-error "Package state is incomplete. Run 'doom sync' first"))))) - -(defmacro doom--with-package-recipes (recipes binds &rest body) - (declare (indent 2)) - (let ((recipe-var (make-symbol "recipe")) - (recipes-var (make-symbol "recipes"))) - `(let* ((,recipes-var ,recipes) - (built ()) - (straight-use-package-pre-build-functions - (cons (lambda (pkg &rest _) (cl-pushnew pkg built :test #'equal)) - straight-use-package-pre-build-functions))) - (dolist (,recipe-var ,recipes-var (nreverse built)) - (cl-block nil - (straight--with-plist (append (list :recipe ,recipe-var) ,recipe-var) - ,(doom-enlist binds) - ,@body)))))) - -(defvar doom--cli-updated-recipes nil) -(defun doom--cli-recipes-update () - "Updates straight and recipe repos." - (unless doom--cli-updated-recipes - (straight--make-build-cache-available) - (print! (start "Updating recipe repos...")) - (print-group! - (doom--with-package-recipes - (delq - nil (mapcar (doom-rpartial #'gethash straight--repo-cache) - (mapcar #'symbol-name straight-recipe-repositories))) - (recipe package type local-repo) - (let ((esc (unless doom-debug-p "\033[1A")) - (ref (straight-vc-get-commit type local-repo)) - newref output) - (print! (start "\033[KUpdating recipes for %s...%s") package esc) - (doom--straight-with (straight-vc-fetch-from-remote recipe) - (when .it - (setq output .output) - (straight-merge-package package) - (unless (equal ref (setq newref (straight-vc-get-commit type local-repo))) - (print! (success "\033[K%s updated (%s -> %s)") - package - (doom--abbrev-commit ref) - (doom--abbrev-commit newref)) - (unless (string-empty-p output) - (print-group! (print! (info "%s" output)))))))))) - (setq straight--recipe-lookup-cache (make-hash-table :test #'eq) - doom--cli-updated-recipes t))) - -(defvar doom--eln-output-expected nil) - -(defvar doom--eln-output-path (car (bound-and-true-p native-comp-eln-load-path))) - -(defun doom--eln-file-name (file) - "Return the short .eln file name corresponding to `file'." - (concat comp-native-version-dir "/" - (file-name-nondirectory - (comp-el-to-eln-filename file)))) - -(defun doom--eln-output-file (eln-name) - "Return the expected .eln file corresponding to `eln-name'." - (concat doom--eln-output-path eln-name)) - -(defun doom--eln-error-file (eln-name) - "Return the expected .error file corresponding to `eln-name'." - (concat doom--eln-output-path eln-name ".error")) - -(defun doom--find-eln-file (eln-name) - "Find `eln-name' on the `native-comp-eln-load-path'." - (cl-some (lambda (eln-path) - (let ((file (concat eln-path eln-name))) - (when (file-exists-p file) - file))) - native-comp-eln-load-path)) - -(defun doom--elc-file-outdated-p (file) - "Check whether the corresponding .elc for `file' is outdated." - (let ((elc-file (byte-compile-dest-file file))) - ;; NOTE Ignore missing elc files, they could be missing due to - ;; `no-byte-compile'. Rebuilding unnecessarily is expensive. - (when (and (file-exists-p elc-file) - (file-newer-than-file-p file elc-file)) - (doom-log "%s is newer than %s" file elc-file) - t))) - -(defun doom--eln-file-outdated-p (file) - "Check whether the corresponding .eln for `file' is outdated." - (let* ((eln-name (doom--eln-file-name file)) - (eln-file (doom--find-eln-file eln-name)) - (error-file (doom--eln-error-file eln-name))) - (cond (eln-file - (when (file-newer-than-file-p file eln-file) - (doom-log "%s is newer than %s" file eln-file) - t)) - ((file-exists-p error-file) - (when (file-newer-than-file-p file error-file) - (doom-log "%s is newer than %s" file error-file) - t)) - (t - (doom-log "%s doesn't exist" eln-name) - t)))) - -(defun doom--native-compile-done-h (file) - "Callback fired when an item has finished async compilation." - (when file - (let* ((eln-name (doom--eln-file-name file)) - (eln-file (doom--eln-output-file eln-name)) - (error-file (doom--eln-error-file eln-name))) - (if (file-exists-p eln-file) - (doom-log "Compiled %s" eln-file) - (make-directory (file-name-directory error-file) 'parents) - (write-region "" nil error-file) - (doom-log "Wrote %s" error-file))))) - -(defun doom--native-compile-jobs () - "How many async native compilation jobs are queued or in-progress." - (if (featurep 'comp) - (+ (length comp-files-queue) - (comp-async-runnings)) - 0)) - -(defun doom--wait-for-native-compile-jobs () - "Wait for all pending async native compilation jobs." - (cl-loop for pending = (doom--native-compile-jobs) - with previous = 0 - while (not (zerop pending)) - if (/= previous pending) do - (print! (start "\033[KNatively compiling %d files...\033[1A" pending)) - (setq previous pending) - else do - (let ((inhibit-message t)) - (sleep-for 0.1)))) - -(defun doom--write-missing-eln-errors () - "Write .error files for any expected .eln files that are missing." - (when NATIVECOMP - (cl-loop for file in doom--eln-output-expected - for eln-name = (doom--eln-file-name file) - for eln-file = (doom--eln-output-file eln-name) - for error-file = (doom--eln-error-file eln-name) - unless (or (file-exists-p eln-file) - (file-newer-than-file-p error-file file)) - do (make-directory (file-name-directory error-file) 'parents) - (write-region "" nil error-file) - (doom-log "Wrote %s" error-file)) - (setq doom--eln-output-expected nil))) - -(defun doom--compile-site-packages () - "Queue async compilation for all non-doom Elisp files." - (when NATIVECOMP - (cl-loop with paths = (cl-loop for path in load-path - unless (string-prefix-p doom-local-dir path) - collect path) - for file in (doom-files-in paths :match "\\.el\\(?:\\.gz\\)?$") - if (and (file-exists-p (byte-compile-dest-file file)) - (not (doom--find-eln-file (doom--eln-file-name file))) - (not (cl-some (lambda (re) - (string-match-p re file)) - native-comp-deferred-compilation-deny-list))) do - (doom-log "Compiling %s" file) - (native-compile-async file)))) - -(defun doom-cli-packages-install () - "Installs missing packages. - -This function will install any primary package (i.e. a package with a `package!' -declaration) or dependency thereof that hasn't already been." - (doom-initialize-packages) - (print! (start "Installing packages...")) - (let ((pinned (doom-package-pinned-list))) - (print-group! - (add-hook 'native-comp-async-cu-done-functions #'doom--native-compile-done-h) - (if-let (built - (doom--with-package-recipes (doom-package-recipe-list) - (recipe package type local-repo) - (unless (file-directory-p (straight--repos-dir local-repo)) - (doom--cli-recipes-update)) - (condition-case-unless-debug e - (let ((straight-use-package-pre-build-functions - (cons (lambda (pkg &rest _) - (when-let (commit (cdr (assoc pkg pinned))) - (print! (info "Checked out %s: %s") pkg commit))) - straight-use-package-pre-build-functions))) - (straight-use-package (intern package)) - ;; HACK Line encoding issues can plague repos with dirty - ;; worktree prompts when updating packages or "Local - ;; variables entry is missing the suffix" errors when - ;; installing them (see hlissner/doom-emacs#2637), so - ;; have git handle conversion by force. - (when (and IS-WINDOWS (stringp local-repo)) - (let ((default-directory (straight--repos-dir local-repo))) - (when (file-in-directory-p default-directory straight-base-dir) - (straight--process-run "git" "config" "core.autocrlf" "true"))))) - (error - (signal 'doom-package-error (list package e)))))) - (progn - (doom--compile-site-packages) - (when NATIVECOMP - (doom--wait-for-native-compile-jobs) - (doom--write-missing-eln-errors)) - (print! (success "\033[KInstalled %d packages") (length built))) - (print! (info "No packages need to be installed")) - nil)))) - - -(defun doom-cli-packages-build (&optional force-p) - "(Re)build all packages." - (doom-initialize-packages) - (print! (start "(Re)building %spackages...") (if force-p "all " "")) - (print-group! - (let ((straight-check-for-modifications - (when (file-directory-p (straight--modified-dir)) - '(find-when-checking))) - (straight--allow-find - (and straight-check-for-modifications - (executable-find straight-find-executable) - t)) - (straight--packages-not-to-rebuild - (or straight--packages-not-to-rebuild (make-hash-table :test #'equal))) - (straight--packages-to-rebuild - (or (if force-p :all straight--packages-to-rebuild) - (make-hash-table :test #'equal))) - (recipes (doom-package-recipe-list))) - (add-hook 'native-comp-async-cu-done-functions #'doom--native-compile-done-h) - (unless force-p - (straight--make-build-cache-available)) - (if-let (built - (doom--with-package-recipes recipes (package local-repo recipe) - (unless force-p - ;; Ensure packages with outdated files/bytecode are rebuilt - (let* ((build-dir (straight--build-dir package)) - (repo-dir (straight--repos-dir local-repo)) - (build (if (plist-member recipe :build) - (plist-get recipe :build) - t)) - (want-byte-compile - (or (eq build t) - (memq 'compile build))) - (want-native-compile - (or (eq build t) - (memq 'native-compile build)))) - (and (eq (car-safe build) :not) - (setq want-byte-compile (not want-byte-compile) - want-native-compile (not want-native-compile))) - (unless NATIVECOMP - (setq want-native-compile nil)) - (and (or want-byte-compile want-native-compile) - (or (file-newer-than-file-p repo-dir build-dir) - (file-exists-p (straight--modified-dir (or local-repo package))) - (cl-loop with outdated = nil - for file in (doom-files-in build-dir :match "\\.el$" :full t) - if (or (if want-byte-compile (doom--elc-file-outdated-p file)) - (if want-native-compile (doom--eln-file-outdated-p file))) - do (setq outdated t) - (when want-native-compile - (push file doom--eln-output-expected)) - finally return outdated)) - (puthash package t straight--packages-to-rebuild)))) - (straight-use-package (intern package)))) - (progn - (doom--compile-site-packages) - (when NATIVECOMP - (doom--wait-for-native-compile-jobs) - (doom--write-missing-eln-errors)) - ;; HACK Every time you save a file in a package that straight tracks, - ;; it is recorded in ~/.emacs.d/.local/straight/modified/. - ;; Typically, straight will clean these up after rebuilding, but - ;; Doom's use-case circumnavigates that, leaving these files - ;; there and causing a rebuild of those packages each time `doom - ;; sync' or similar is run, so we clean it up ourselves: - (delete-directory (straight--modified-dir) 'recursive) - (print! (success "\033[KRebuilt %d package(s)") (length built))) - (print! (info "No packages need rebuilding")) - nil)))) - - - -(defun doom-cli-packages-update () - "Updates packages." - (doom-initialize-packages) - (doom--barf-if-incomplete-packages) - (doom--cli-recipes-update) - (let* ((repo-dir (straight--repos-dir)) - (pinned (doom-package-pinned-list)) - (recipes (doom-package-recipe-list)) - (packages-to-rebuild (make-hash-table :test 'equal)) - (repos-to-rebuild (make-hash-table :test 'equal)) - (total (length recipes)) - (esc (unless doom-debug-p "\033[1A")) - (i 0) - errors) - (print! (start "Updating packages (this may take a while)...")) - (doom--with-package-recipes recipes (recipe package type local-repo) - (cl-incf i) - (print-group! - (unless (straight--repository-is-available-p recipe) - (print! (error "(%d/%d) Couldn't find local repo for %s") i total package) - (cl-return)) - (when (gethash local-repo repos-to-rebuild) - (puthash package t packages-to-rebuild) - (print! (success "(%d/%d) %s was updated indirectly (with %s)") i total package local-repo) - (cl-return)) - (let ((default-directory (straight--repos-dir local-repo))) - (unless (file-in-directory-p default-directory repo-dir) - (print! (warn "(%d/%d) Skipping %s because it is local") i total package) - (cl-return)) - (when (eq type 'git) - (unless (file-exists-p ".git") - (error "%S is not a valid repository" package))) - (condition-case-unless-debug e - (let ((ref (straight-vc-get-commit type local-repo)) - (target-ref - (cdr (or (assoc local-repo pinned) - (assoc package pinned)))) - commits - output) - (or (cond - ((not (stringp target-ref)) - (print! (start "\033[K(%d/%d) Fetching %s...%s") i total package esc) - (doom--straight-with (straight-vc-fetch-from-remote recipe) - (when .it - (straight-merge-package package) - (setq target-ref (straight-vc-get-commit type local-repo)) - (setq output (doom--commit-log-between ref target-ref) - commits (length (split-string output "\n" t))) - (or (not (doom--same-commit-p target-ref ref)) - (cl-return))))) - - ((doom--same-commit-p target-ref ref) - (print! (info "\033[K(%d/%d) %s is up-to-date...%s") i total package esc) - (cl-return)) - - ((if (straight-vc-commit-present-p recipe target-ref) - (print! (start "\033[K(%d/%d) Checking out %s (%s)...%s") - i total package (doom--abbrev-commit target-ref) esc) - (print! (start "\033[K(%d/%d) Fetching %s...%s") i total package esc) - (and (straight-vc-fetch-from-remote recipe) - (straight-vc-commit-present-p recipe target-ref))) - (straight-vc-check-out-commit recipe target-ref) - (or (not (eq type 'git)) - (setq output (doom--commit-log-between ref target-ref) - commits (length (split-string output "\n" t)))) - (doom--same-commit-p target-ref (straight-vc-get-commit type local-repo))) - - ((print! (start "\033[K(%d/%d) Re-cloning %s...") i total local-repo esc) - (let ((repo (straight--repos-dir local-repo)) - (straight-vc-git-default-clone-depth 'full)) - (delete-directory repo 'recursive) - (print-group! - (straight-use-package (intern package) nil 'no-build)) - (prog1 (file-directory-p repo) - (or (not (eq type 'git)) - (setq output (doom--commit-log-between ref target-ref) - commits (length (split-string output "\n" t)))))))) - (progn - (print! (warn "\033[K(%d/%d) Failed to fetch %s") - i total local-repo) - (unless (string-empty-p output) - (print-group! (print! (info "%s" output)))) - (cl-return))) - (puthash local-repo t repos-to-rebuild) - (puthash package t packages-to-rebuild) - (print! (success "\033[K(%d/%d) %s: %s -> %s%s") - i total local-repo - (doom--abbrev-commit ref) - (doom--abbrev-commit target-ref) - (if (and (integerp commits) (> commits 0)) - (format " [%d commit(s)]" commits) - "")) - (unless (string-empty-p output) - (let ((lines (split-string output "\n"))) - (setq output - (if (> (length lines) 20) - (concat (string-join (cl-subseq (butlast lines 1) 0 20) "\n") - "\n[...]") - output))) - (print-group! (print! "%s" (indent 2 output))))) - (user-error - (signal 'user-error (error-message-string e))) - (error - (signal 'doom-package-error (list package e))))))) - (print-group! - (princ "\033[K") - (if (hash-table-empty-p packages-to-rebuild) - (ignore (print! (success "All %d packages are up-to-date") total)) - (straight--transaction-finalize) - (let ((default-directory (straight--build-dir))) - (mapc (doom-rpartial #'delete-directory 'recursive) - (hash-table-keys packages-to-rebuild))) - (print! (success "Updated %d package(s)") - (hash-table-count packages-to-rebuild)) - (doom-cli-packages-build) - t)))) - - -;;; PURGE (for the emperor) -(defun doom--cli-packages-purge-build (build) - (let ((build-dir (straight--build-dir build))) - (delete-directory build-dir 'recursive) - (if (file-directory-p build-dir) - (ignore (print! (error "Failed to purg build/%s" build))) - (print! (success "Purged build/%s" build)) - t))) - -(defun doom--cli-packages-purge-builds (builds) - (if (not builds) - (prog1 0 - (print! (info "No builds to purge"))) - (print! (start "Purging straight builds..." (length builds))) - (print-group! - (length - (delq nil (mapcar #'doom--cli-packages-purge-build builds)))))) - -(cl-defun doom--cli-packages-regraft-repo (repo) - (unless repo - (error "No repo specified for regrafting")) - (let ((default-directory (straight--repos-dir repo))) - (unless (file-directory-p ".git") - (print! (warn "\033[Krepos/%s is not a git repo, skipping" repo)) - (cl-return)) - (unless (file-in-directory-p default-directory straight-base-dir) - (print! (warn "\033[KSkipping repos/%s because it is local" repo)) - (cl-return)) - (let ((before-size (doom-directory-size default-directory))) - (doom-call-process "git" "reset" "--hard") - (doom-call-process "git" "clean" "-ffd") - (if (not (zerop (car (doom-call-process "git" "replace" "--graft" "HEAD")))) - (print! (info "\033[Krepos/%s is already compact\033[1A" repo)) - (doom-call-process "git" "reflog" "expire" "--expire=all" "--all") - (doom-call-process "git" "gc" "--prune=now") - (let ((after-size (doom-directory-size default-directory))) - (if (equal after-size before-size) - (print! (success "\033[Krepos/%s cannot be compacted further" repo)) - (print! (success "\033[KRegrafted repos/%s (from %0.1fKB to %0.1fKB)") - repo before-size after-size))))) - t)) - -(defun doom--cli-packages-regraft-repos (repos) - (if (not repos) - (prog1 0 - (print! (info "No repos to regraft"))) - (print! (start "Regrafting %d repos..." (length repos))) - (let ((before-size (doom-directory-size (straight--repos-dir)))) - (print-group! - (prog1 (delq nil (mapcar #'doom--cli-packages-regraft-repo repos)) - (princ "\033[K") - (let ((after-size (doom-directory-size (straight--repos-dir)))) - (print! (success "Finished regrafting. Size before: %0.1fKB and after: %0.1fKB (%0.1fKB)") - before-size after-size - (- after-size before-size)))))))) - -(defun doom--cli-packages-purge-repo (repo) - (let ((repo-dir (straight--repos-dir repo))) - (when (file-directory-p repo-dir) - (delete-directory repo-dir 'recursive) - (delete-file (straight--modified-file repo)) - (if (file-directory-p repo-dir) - (ignore (print! (error "Failed to purge repos/%s" repo))) - (print! (success "Purged repos/%s" repo)) - t)))) - -(defun doom--cli-packages-purge-repos (repos) - (if (not repos) - (prog1 0 - (print! (info "No repos to purge"))) - (print! (start "Purging straight repositories...")) - (print-group! - (length - (delq nil (mapcar #'doom--cli-packages-purge-repo repos)))))) - -(defun doom--cli-packages-purge-elpa () - (require 'core-packages) - (let ((dirs (doom-files-in package-user-dir :type t :depth 0))) - (if (not dirs) - (prog1 0 - (print! (info "No ELPA packages to purge"))) - (print! (start "Purging ELPA packages...")) - (dolist (path dirs (length dirs)) - (condition-case e - (print-group! - (if (file-directory-p path) - (delete-directory path 'recursive) - (delete-file path)) - (print! (success "Deleted %s") (filename path))) - (error - (print! (error "Failed to delete %s because: %s") - (filename path) - e))))))) - -(defun doom--cli-packages-purge-eln () - (if-let (dirs - (cl-delete (expand-file-name comp-native-version-dir doom--eln-output-path) - (directory-files doom--eln-output-path t "^[^.]" t) - :test #'file-equal-p)) - (progn - (print! (start "Purging old native bytecode...")) - (print-group! - (dolist (dir dirs) - (print! (info "Deleting %S") (relpath dir doom--eln-output-path)) - (delete-directory dir 'recursive)) - (print! (success "Purged %d directory(ies)" (length dirs)))) - (length dirs)) - (print! (info "No ELN directories to purge")) - 0)) - -(defun doom-cli-packages-purge (&optional elpa-p builds-p repos-p regraft-repos-p eln-p) - "Auto-removes orphaned packages and repos. - -An orphaned package is a package that isn't a primary package (i.e. doesn't have -a `package!' declaration) or isn't depended on by another primary package. - -If BUILDS-P, include straight package builds. -If REPOS-P, include straight repos. -If ELPA-P, include packages installed with package.el (M-x package-install)." - (doom-initialize-packages) - (doom--barf-if-incomplete-packages) - (print! (start "Purging orphaned packages (for the emperor)...")) - (cl-destructuring-bind (&optional builds-to-purge repos-to-purge repos-to-regraft) - (let ((rdirs - (and (or repos-p regraft-repos-p) - (straight--directory-files (straight--repos-dir) nil nil 'sort)))) - (list (when builds-p - (let ((default-directory (straight--build-dir))) - (seq-filter #'file-directory-p - (seq-remove (doom-rpartial #'gethash straight--profile-cache) - (straight--directory-files default-directory nil nil 'sort))))) - (when repos-p - (seq-remove (doom-rpartial #'straight--checkhash straight--repo-cache) - rdirs)) - (when regraft-repos-p - (seq-filter (doom-rpartial #'straight--checkhash straight--repo-cache) - rdirs)))) - (print-group! - (delq - nil (list - (if (not builds-p) - (ignore (print! (info "Skipping builds"))) - (and (/= 0 (doom--cli-packages-purge-builds builds-to-purge)) - (straight-prune-build-cache))) - (if (not elpa-p) - (ignore (print! (info "Skipping elpa packages"))) - (/= 0 (doom--cli-packages-purge-elpa))) - (if (not repos-p) - (ignore (print! (info "Skipping repos"))) - (/= 0 (doom--cli-packages-purge-repos repos-to-purge))) - (if (not regraft-repos-p) - (ignore (print! (info "Skipping regrafting"))) - (doom--cli-packages-regraft-repos repos-to-regraft)) - (when NATIVECOMP - (if (not eln-p) - (ignore (print! (info "Skipping native bytecode"))) - (doom--cli-packages-purge-eln)))))))) diff --git a/.config/emacs/core/cli/sync.el b/.config/emacs/core/cli/sync.el deleted file mode 100644 index 8af3ca4..0000000 --- a/.config/emacs/core/cli/sync.el +++ /dev/null @@ -1,56 +0,0 @@ -;;; core/cli/sync.el -*- lexical-binding: t; -*- - -(defcli! (sync s) - ((no-envvar-p ["-e"] "Don't regenerate the envvar file") - (no-elc-p ["-c"] "Don't recompile config") - (update-p ["-u"] "Update installed packages after syncing") - (purge-p ["-p" "--prune"] "Purge orphaned package repos & regraft them")) - "Synchronize your config with Doom Emacs. - -This is the equivalent of running autoremove, install, autoloads, then -recompile. Run this whenever you: - - 1. Modify your `doom!' block, - 2. Add or remove `package!' blocks to your config, - 3. Add or remove autoloaded functions in module autoloaded files. - 4. Update Doom outside of Doom (e.g. with git) - -It will ensure that unneeded packages are removed, all needed packages are -installed, autoloads files are up-to-date and no byte-compiled files have gone -stale." - (run-hooks 'doom-sync-pre-hook) - (add-hook 'kill-emacs-hook #'doom--cli-abort-warning-h) - (print! (start "Synchronizing your config with Doom Emacs...")) - (unwind-protect - (print-group! - (delete-file doom-autoloads-file) - (when (and (not no-envvar-p) - (file-exists-p doom-env-file)) - (doom-cli-reload-env-file 'force)) - (doom-cli-packages-install) - (doom-cli-packages-build) - (when update-p - (doom-cli-packages-update)) - (doom-cli-packages-purge purge-p 'builds-p purge-p purge-p purge-p) - (run-hooks 'doom-sync-post-hook) - (when (doom-autoloads-reload) - (print! (info "Restart Emacs or use 'M-x doom/reload' for changes to take effect"))) - t) - (remove-hook 'kill-emacs-hook #'doom--cli-abort-warning-h))) - - -;; -;;; DEPRECATED Commands - -(defcli! (refresh re) () - "Deprecated for 'doom sync'" - :hidden t - (user-error "'doom refresh' has been replaced with 'doom sync'. Use that instead")) - - -;; -;;; Helpers - -(defun doom--cli-abort-warning-h () - (terpri) - (print! (warn "Script was abruptly aborted! Run 'doom sync' to repair inconsistencies"))) diff --git a/.config/emacs/core/cli/test.el b/.config/emacs/core/cli/test.el deleted file mode 100644 index 1defcf0..0000000 --- a/.config/emacs/core/cli/test.el +++ /dev/null @@ -1,104 +0,0 @@ -;;; core/cli/test.el -*- lexical-binding: t; -*- - -(defun doom--emacs-binary () - (let ((emacs-binary-path (doom-path invocation-directory invocation-name)) - (runemacs-binary-path (if IS-WINDOWS (doom-path invocation-directory "runemacs.exe")))) - (if (and runemacs-binary-path (file-exists-p runemacs-binary-path)) - runemacs-binary-path - emacs-binary-path))) - - -(defcli! test (&rest targets) - "Run Doom unit tests." - :bare t - (doom-initialize 'force 'noerror) - (require 'ansi-color) - (let (files read-files) - (unless targets - (setq targets - (cons doom-core-dir - (cl-remove-if-not - (doom-rpartial #'file-in-directory-p doom-emacs-dir) - ;; Omit `doom-private-dir', which is always first - (let (doom-modules) - (load (expand-file-name "test/init" doom-core-dir) nil t) - (cdr (doom-module-load-path))))))) - (while targets - (let ((target (pop targets))) - ;; FIXME Module targets don't work - (cond ((equal target ":core") - (appendq! files (nreverse (doom-glob doom-core-dir "test/test-*.el")))) - ((file-directory-p target) - (setq target (expand-file-name target)) - (appendq! files (nreverse (doom-glob target "test/test-*.el")))) - ((file-exists-p target) - (push target files))))) - (setenv "DOOMLOCALDIR" (concat doom-local-dir "test/")) - (setenv "DOOMDIR" (concat doom-core-dir "test/")) - (with-temp-buffer - (print! (start "Bootstrapping test environment, if necessary...")) - (cl-destructuring-bind (status . output) - (doom-exec-process - (doom--emacs-binary) - "--batch" - "--eval" - (prin1-to-string - `(progn - (setq user-emacs-directory ,doom-emacs-dir - doom-auto-accept t) - (require 'core ,(locate-library "core")) - (require 'core-cli) - (doom-initialize 'force 'noerror) - (doom-initialize-modules) - (doom-cli-reload-core-autoloads) - (when (doom-cli-packages-install) - (doom-cli-reload-package-autoloads))))) - (unless (zerop status) - (error "Failed to bootstrap unit tests")))) - (with-temp-buffer - (dolist (file files) - (if (doom-file-cookie-p file "if" t) - (cl-destructuring-bind (_status . output) - (apply #'doom-exec-process - (doom--emacs-binary) - "--batch" - "-l" (concat doom-core-dir "core.el") - "-l" (concat doom-core-dir "test/helpers.el") - (append (when (file-in-directory-p file doom-modules-dir) - (list "-f" "doom-initialize-core")) - (list "-l" file - "-f" "buttercup-run"))) - (insert (replace-regexp-in-string ansi-color-control-seq-regexp "" output)) - (push file read-files)) - (print! (info "Ignoring %s" (relpath file))))) - (let ((total 0) - (total-failed 0) - (i 0)) - (print! "\n----------------------------------------\nTests finished") - (print-group! - (goto-char (point-min)) - (while (re-search-forward "^Ran \\([0-9]+\\) specs, \\([0-9]+\\) failed," nil t) - (let ((ran (string-to-number (match-string 1))) - (failed (string-to-number (match-string 2)))) - (when (> failed 0) - (terpri) - (print! (warn "(%s) Failed %d/%d tests") - (path (nth i read-files)) - failed ran) - (save-excursion - (print-group! - (print! - "%s" (string-trim - (buffer-substring - (match-beginning 0) - (dotimes (_ failed (point)) - (search-backward "========================================")))))))) - (cl-incf total ran) - (cl-incf total-failed failed) - (cl-incf i)))) - (terpri) - (if (= total-failed 0) - (print! (success "Ran %d tests successfully." total total-failed)) - (print! (error "Ran %d tests, %d failed") total total-failed) - (kill-emacs 1))) - t))) diff --git a/.config/emacs/core/cli/upgrade.el b/.config/emacs/core/cli/upgrade.el deleted file mode 100644 index deab424..0000000 --- a/.config/emacs/core/cli/upgrade.el +++ /dev/null @@ -1,149 +0,0 @@ -;;; core/cli/upgrade.el -*- lexical-binding: t; -*- - -(defcli! (upgrade up) - ((force-p ["-f" "--force"] "Discard local changes to Doom and packages, and upgrade anyway") - (packages-only-p ["-p" "--packages"] "Only upgrade packages, not Doom")) - "Updates Doom and packages. - -This requires that ~/.emacs.d is a git repo, and is the equivalent of the -following shell commands: - - cd ~/.emacs.d - git pull --rebase - bin/doom clean - bin/doom sync -u" - :bare t - (let ((doom-auto-discard force-p)) - (cond - (packages-only-p - (doom-cli-execute "sync" "-u") - (print! (success "Finished upgrading Doom Emacs"))) - - ((doom-cli-upgrade doom-auto-accept doom-auto-discard) - ;; Reload Doom's CLI & libraries, in case there were any upstream changes. - ;; Major changes will still break, however - (print! (info "Reloading Doom Emacs")) - (throw 'exit (list "doom" "upgrade" "-p" (if force-p "-f")))) - - ((print! "Doom is up-to-date!") - (doom-cli-execute "sync" "-u"))))) - - -;; -;;; library - -(defvar doom-repo-url "https://github.com/hlissner/doom-emacs" - "The git repo url for Doom Emacs.") -(defvar doom-repo-remote "_upgrade" - "The name to use as our staging remote.") - -(defun doom--working-tree-dirty-p (dir) - (cl-destructuring-bind (success . stdout) - (doom-call-process "git" "status" "--porcelain" "-uno") - (if (= 0 success) - (split-string stdout "\n" t) - (error "Failed to check working tree in %s" dir)))) - -(defun doom--get-straight-recipe () - (with-temp-buffer - (insert-file-contents (doom-path doom-core-dir "packages.el")) - (when (re-search-forward "(package! straight" nil t) - (goto-char (match-beginning 0)) - (let ((sexp (sexp-at-point))) - (plist-put sexp :recipe - (eval (plist-get sexp :recipe) - t)))))) - - -(defun doom-cli-upgrade (&optional auto-accept-p force-p) - "Upgrade Doom to the latest version non-destructively." - (let ((default-directory doom-emacs-dir) - process-file-side-effects) - (print! (start "Preparing to upgrade Doom Emacs and its packages...")) - - (let* (;; git name-rev may return BRANCH~X for detached HEADs and fully - ;; qualified refs in some other cases, so an effort to strip out all - ;; but the branch name is necessary. git symbolic-ref (or - ;; `vc-git--symbolic-ref') won't work; it can't deal with submodules. - (branch (replace-regexp-in-string - "^\\(?:[^/]+/[^/]+/\\)?\\(.+\\)\\(?:~[0-9]+\\)?$" "\\1" - (cdr (doom-call-process "git" "name-rev" "--name-only" "HEAD")))) - (target-remote (format "%s_%s" doom-repo-remote branch))) - (unless branch - (error! (if (file-exists-p! ".git" doom-emacs-dir) - "Couldn't find Doom's .git directory. Was Doom cloned properly?" - "Couldn't detect what branch you're on. Is Doom detached?"))) - - ;; We assume that a dirty .emacs.d is intentional and abort - (when-let (dirty (doom--working-tree-dirty-p default-directory)) - (if (not force-p) - (user-error! "%s\n\n%s\n\n %s" - (format "Refusing to upgrade because %S has been modified." (path doom-emacs-dir)) - "Either stash/undo your changes or run 'doom upgrade -f' to discard local changes." - (string-join dirty "\n")) - (print! (info "You have local modifications in Doom's source. Discarding them...")) - (doom-call-process "git" "reset" "--hard" (format "origin/%s" branch)) - (doom-call-process "git" "clean" "-ffd"))) - - (doom-call-process "git" "remote" "remove" doom-repo-remote) - (unwind-protect - (let (result) - (or (zerop (car (doom-call-process "git" "remote" "add" doom-repo-remote doom-repo-url))) - (error "Failed to add %s to remotes" doom-repo-remote)) - (or (zerop (car (setq result (doom-call-process "git" "fetch" "--force" "--tags" doom-repo-remote (format "%s:%s" branch target-remote))))) - (error "Failed to fetch from upstream")) - - (let ((this-rev (cdr (doom-call-process "git" "rev-parse" "HEAD"))) - (new-rev (cdr (doom-call-process "git" "rev-parse" target-remote)))) - (cond - ((and (null this-rev) - (null new-rev)) - (error "Failed to get revisions for %s" target-remote)) - - ((equal this-rev new-rev) - (print! (success "Doom is already up-to-date!")) - nil) - - ((print! (info "A new version of Doom Emacs is available!\n\n Old revision: %s (%s)\n New revision: %s (%s)\n" - (substring this-rev 0 10) - (cdr (doom-call-process "git" "log" "-1" "--format=%cr" "HEAD")) - (substring new-rev 0 10) - (cdr (doom-call-process "git" "log" "-1" "--format=%cr" target-remote)))) - (let ((diff-url - (format "%s/compare/%s...%s" - doom-repo-url - this-rev - new-rev))) - (print! "Link to diff: %s" diff-url) - (when (and (not auto-accept-p) - (y-or-n-p "View the comparison diff in your browser?")) - (print! (info "Opened github in your browser.")) - (browse-url diff-url))) - - (if (not (or auto-accept-p - (y-or-n-p "Proceed with upgrade?"))) - (ignore (print! (error "Aborted"))) - (print! (start "Upgrading Doom Emacs...")) - (print-group! - (doom-clean-byte-compiled-files) - (let ((straight-recipe (doom--get-straight-recipe))) - (or (and (zerop (car (doom-call-process "git" "reset" "--hard" target-remote))) - (equal (cdr (doom-call-process "git" "rev-parse" "HEAD")) new-rev)) - (error "Failed to check out %s" (substring new-rev 0 10))) - ;; HACK It's messy to use straight to upgrade straight, due - ;; to the potential for backwards incompatibility, so - ;; we staticly check if Doom's `package!' declaration - ;; for straight has changed. If it has, delete - ;; straight so 'doom upgrade's second stage will - ;; install the new version for us. - ;; - ;; Clumsy, but a better solution is in the works. - (unless (equal straight-recipe (doom--get-straight-recipe)) - (print! (info "Preparing straight for an update")) - (delete-directory (doom-path straight-base-dir "straight/repos/straight.el") - 'recursive))) - (print! (info "%s") (cdr result)) - t)))))) - (ignore-errors - (doom-call-process "git" "branch" "-D" target-remote) - (doom-call-process "git" "remote" "remove" doom-repo-remote)))))) diff --git a/.config/emacs/core/core-cli.el b/.config/emacs/core/core-cli.el deleted file mode 100644 index 2ebd05e..0000000 --- a/.config/emacs/core/core-cli.el +++ /dev/null @@ -1,256 +0,0 @@ -;;; core/core-cli.el --- -*- lexical-binding: t; no-byte-compile: t; -*- - -(defvar doom-auto-accept (getenv "YES") - "If non-nil, Doom will auto-accept any confirmation prompts during batch -commands like `doom-cli-packages-install', `doom-cli-packages-update' and -`doom-packages-autoremove'.") - -(defvar doom-auto-discard (getenv "FORCE") - "If non-nil, discard all local changes while updating.") - -(defvar doom-cli-file "cli" - "The basename of CLI config files for modules. - -These are loaded when a Doom's CLI starts up. There users and modules can define -additional CLI commands, or reconfigure existing ones to better suit their -purpose.") - -(defvar doom-cli-log-file (concat doom-local-dir "doom.log") - "Where to write the extended output to.") - -(defvar doom-cli-log-error-file (concat doom-local-dir "doom.error.log") - "Where to write the last backtrace to.") - -(defvar doom--cli-log-buffer (generate-new-buffer " *doom log*")) -(defvar doom--cli-commands (make-hash-table :test 'equal)) -(defvar doom--cli-groups (make-hash-table :test 'equal)) -(defvar doom--cli-group nil) - -(define-error 'doom-cli-error "There was an unexpected error" 'doom-error) -(define-error 'doom-cli-command-not-found-error "Could not find that command" 'doom-cli-error) -(define-error 'doom-cli-wrong-number-of-arguments-error "Wrong number of CLI arguments" 'doom-cli-error) -(define-error 'doom-cli-unrecognized-option-error "Not a recognized option" 'doom-cli-error) -(define-error 'doom-cli-deprecated-error "Command is deprecated" 'doom-cli-error) - - -;; -;;; Bootstrap - -(require 'seq) -(load! "autoload/process") -(load! "autoload/system") -(load! "autoload/plist") -(load! "autoload/files") -(load! "autoload/output") - -(load! "cli/lib/debugger") -(load! "cli/lib/lib") -(load! "cli/lib/straight-hacks") - -;; Use our own home-grown debugger so we can capture and store backtraces, make -;; them more presentable, and make it easier for users to produce better bug -;; reports! -(setq debugger #'doom-cli--debugger - debug-on-error t - debug-ignored-errors '(user-error)) - -;; Create all our core directories to quell file errors. -(mapc (doom-rpartial #'make-directory 'parents) - (list doom-local-dir - doom-etc-dir - doom-cache-dir)) - -;; Ensure straight and core packages are ready to go for CLI commands. -(require 'core-modules) -(require 'core-packages) -(doom-initialize-core-packages) - -;; Default to using all cores, rather than half of them, since we compile things -;; ahead-of-time in a non-interactive session. -(defadvice! doom--comp-use-all-cores-a (&rest _) - :before #'comp-effective-async-max-jobs - (setq comp-num-cpus (doom-system-cpus))) - - -;; -;;; Entry point - -(defcli! :doom - ((help-p ["-h" "--help"] "Same as help command") - (auto-accept-p ["-y" "--yes"] "Auto-accept all confirmation prompts") - (debug-p ["-d" "--debug"] "Enables on verbose output") - (loadfile ["-l" "--load" file] "Load an elisp FILE before executing any commands") - (doomdir ["--doomdir" dir] "Use the private module at DIR (e.g. ~/.doom.d)") - (localdir ["--localdir" dir] "Use DIR as your local storage directory") - (nocolor ["-C" "--nocolor"] "Disable colored output") - &optional command - &rest args) - "A command line interface for managing Doom Emacs. - -Includes package management, diagnostics, unit tests, and byte-compilation. - -This tool also makes it trivial to launch Emacs out of a different folder or -with a different private module. - -Environment variables: - EMACSDIR Where to find the Doom Emacs repo (normally ~/.emacs.d) - DOOMDIR Where to find your private Doom config (normally ~/.doom.d) - DOOMLOCALDIR Where to store local files (normally ~/.emacs.d/.local)" - (condition-case e - (with-output-to! doom--cli-log-buffer - (when nocolor - (setq doom-output-backend nil)) - (catch 'exit - (when (and (not (getenv "__DOOMRESTART")) - (or doomdir - localdir - debug-p - auto-accept-p)) - (when doomdir - (setenv "DOOMDIR" (file-name-as-directory doomdir)) - (print! (info "DOOMDIR=%s") doomdir)) - (when localdir - (setenv "DOOMLOCALDIR" (file-name-as-directory localdir)) - (print! (info "DOOMLOCALDIR=%s") localdir)) - (when debug-p - (setenv "DEBUG" "1") - (print! (info "DEBUG=1"))) - (when auto-accept-p - (setenv "YES" auto-accept-p) - (print! (info "Confirmations auto-accept enabled"))) - (throw 'exit "__DOOMRESTART=1 $@")) - (when loadfile - (load (doom-path loadfile) nil t t)) - (when help-p - (when command - (push command args)) - (setq command "help")) - (cons - t (if (null command) - (doom-cli-execute "help") - (let ((start-time (current-time))) - (run-hooks 'doom-cli-pre-hook) - (unless (getenv "__DOOMRESTART") - (print! (start "Executing 'doom %s' with Emacs %s at %s") - (string-join - (cons (or (ignore-errors - (doom-cli-name (doom-cli-get command))) - command) - args) - " ") - emacs-version - (format-time-string "%Y-%m-%d %H:%M:%S"))) - (print-group! - (when-let (result (apply #'doom-cli-execute command args)) - (run-hooks 'doom-cli-post-hook) - (print! (success "Finished in %s") - (let* ((duration (float-time (time-subtract (current-time) before-init-time))) - (hours (/ (truncate duration) 60 60)) - (minutes (- (/ (truncate duration) 60) (* hours 60))) - (seconds (- duration (* hours 60 60) (* minutes 60)))) - (string-join - (delq - nil (list (unless (zerop hours) (format "%dh" hours)) - (unless (zerop minutes) (format "%dm" minutes)) - (format (if (> duration 60) "%ds" "%.4fs") - seconds)))))) - result))))))) - ;; TODO Not implemented yet - (doom-cli-command-not-found-error - (print! (error "Command 'doom %s' not recognized") (string-join (cdr e) " ")) - (print! "\nDid you mean one of these commands?") - (apply #'doom-cli-execute "help" "--similar" (string-join (cdr e) " ")) - 5) - ;; TODO Not implemented yet - (doom-cli-wrong-number-of-arguments-error - (cl-destructuring-bind (route opt arg n d) (cdr e) - (print! (error "doom %s: %S requires %d arguments, but %d given\n") - (mapconcat #'symbol-name route " ") arg n d) - (print-group! - (apply #'doom-cli-execute "help" (mapcar #'symbol-name route)))) - 6) - ;; TODO Not implemented yet - (doom-cli-unrecognized-option-error - (let ((option (cadr e))) - (print! (error "Unrecognized option: %S") option) - (when (string-match "^--[^=]+=\\(.+\\)$" option) - (print! "The %S syntax isn't supported. Use '%s %s' instead." - option (car (split-string option "=")) - (match-string 1 option)))) - 7) - ;; TODO Not implemented yet - (doom-cli-deprecated-error - (cl-destructuring-bind (route . commands) (cdr e) - (print! (warn "The 'doom %s' command was removed and replaced with:\n") - (mapconcat #'symbol-name route " ")) - (print-group! - (dolist (command commands) - (print! (info "%s") command)))) - 8) - (user-error - (print! (warn "%s") (cadr e)) - 9))) - - -;; -;;; CLI Commands - -(load! "cli/help") -(load! "cli/install") -(load! "cli/sync") -(load! "cli/env") -(load! "cli/upgrade") -(load! "cli/packages") -(load! "cli/autoloads") -(load! "cli/ci") - -(defcligroup! "Diagnostics" - "For troubleshooting and diagnostics" - (load! "cli/doctor") - (load! "cli/debug") - - ;; Our tests are broken at the moment. Working on fixing them, but for now we - ;; disable them: - ;; (load! "cli/test") - ) - -(defcligroup! "Compilation" - "For compiling Doom and your config" - (load! "cli/byte-compile")) - -(defcligroup! "Utilities" - "Conveniences for interacting with Doom externally" - (defcli! run (&rest args) - "Run Doom Emacs from bin/doom's parent directory. - -All arguments are passed on to Emacs. - - doom run - doom run -nw init.el - -WARNING: this command exists for convenience and testing. Doom will suffer -additional overhead by being started this way. For the best performance, it is -best to run Doom out of ~/.emacs.d and ~/.doom.d." - (throw 'exit (cons invocation-name args)))) - - -;; -;;; Bootstrap - -(doom-log "Initializing Doom CLI") -(load! doom-module-init-file doom-private-dir t) -(maphash (doom-module-loader doom-cli-file) doom-modules) -(load! doom-cli-file doom-private-dir t) - - -;; Don't generate superfluous files when writing temp buffers -(setq make-backup-files nil) -;; Stop user configuration from interfering with package management -(setq enable-dir-local-variables nil) -;; Reduce ambiguity, embrace specificity. It's more predictable. -(setq-default case-fold-search nil) -;; Don't clog the user's trash with anything we clean up in this session. -(setq delete-by-moving-to-trash nil) - -(provide 'core-cli) -;;; core-cli.el ends here diff --git a/.config/emacs/core/core-editor.el b/.config/emacs/core/core-editor.el deleted file mode 100644 index 170ce1b..0000000 --- a/.config/emacs/core/core-editor.el +++ /dev/null @@ -1,685 +0,0 @@ -;;; core-editor.el -*- lexical-binding: t; -*- - -(defvar doom-detect-indentation-excluded-modes - '(fundamental-mode pascal-mode so-long-mode) - "A list of major modes in which indentation should be automatically -detected.") - -(defvar-local doom-inhibit-indent-detection nil - "A buffer-local flag that indicates whether `dtrt-indent' should try to detect -indentation settings or not. This should be set by editorconfig if it -successfully sets indent_style/indent_size.") - -(defvar doom-inhibit-large-file-detection nil - "If non-nil, inhibit large/long file detection when opening files.") - -(defvar doom-large-file-p nil) -(put 'doom-large-file-p 'permanent-local t) - -(defvar doom-large-file-size-alist '(("." . 1.0)) - "An alist mapping regexps (like `auto-mode-alist') to filesize thresholds. - -If a file is opened and discovered to be larger than the threshold, Doom -performs emergency optimizations to prevent Emacs from hanging, crashing or -becoming unusably slow. - -These thresholds are in MB, and is used by `doom--optimize-for-large-files-a'.") - -(defvar doom-large-file-excluded-modes - '(so-long-mode special-mode archive-mode tar-mode jka-compr - git-commit-mode image-mode doc-view-mode doc-view-mode-maybe - ebrowse-tree-mode pdf-view-mode tags-table-mode) - "Major modes that `doom-check-large-file-h' will ignore.") - - -;; -;;; File handling - -(defadvice! doom--prepare-for-large-files-a (size _ filename &rest _) - "Sets `doom-large-file-p' if the file is considered large. - -Uses `doom-large-file-size-alist' to determine when a file is too large. When -`doom-large-file-p' is set, other plugins can detect this and reduce their -runtime costs (or disable themselves) to ensure the buffer is as fast as -possible." - :before #'abort-if-file-too-large - (and (numberp size) - (null doom-inhibit-large-file-detection) - (ignore-errors - (> size - (* 1024 1024 - (assoc-default filename doom-large-file-size-alist - #'string-match-p)))) - (setq-local doom-large-file-p size))) - -(add-hook! 'find-file-hook - (defun doom-optimize-for-large-files-h () - "Trigger `so-long-minor-mode' if the file is large." - (when (and doom-large-file-p buffer-file-name) - (if (or doom-inhibit-large-file-detection - (memq major-mode doom-large-file-excluded-modes)) - (kill-local-variable 'doom-large-file-p) - (when (fboundp 'so-long-minor-mode) ; in case the user disabled it - (so-long-minor-mode +1)) - (message "Large file detected! Cutting a few corners to improve performance..."))))) - - -;; Resolve symlinks when opening files, so that any operations are conducted -;; from the file's true directory (like `find-file'). -(setq find-file-visit-truename t - vc-follow-symlinks t) - -;; Disable the warning "X and Y are the same file". It's fine to ignore this -;; warning as it will redirect you to the existing buffer anyway. -(setq find-file-suppress-same-file-warnings t) - -;; Create missing directories when we open a file that doesn't exist under a -;; directory tree that may not exist. -(add-hook! 'find-file-not-found-functions - (defun doom-create-missing-directories-h () - "Automatically create missing directories when creating new files." - (unless (file-remote-p buffer-file-name) - (let ((parent-directory (file-name-directory buffer-file-name))) - (and (not (file-directory-p parent-directory)) - (y-or-n-p (format "Directory `%s' does not exist! Create it?" - parent-directory)) - (progn (make-directory parent-directory 'parents) - t)))))) - -;; Don't generate backups or lockfiles. While auto-save maintains a copy so long -;; as a buffer is unsaved, backups create copies once, when the file is first -;; written, and never again until it is killed and reopened. This is better -;; suited to version control, and I don't want world-readable copies of -;; potentially sensitive material floating around our filesystem. -(setq create-lockfiles nil - make-backup-files nil - ;; But in case the user does enable it, some sensible defaults: - version-control t ; number each backup file - backup-by-copying t ; instead of renaming current file (clobbers links) - delete-old-versions t ; clean up after itself - kept-old-versions 5 - kept-new-versions 5 - backup-directory-alist (list (cons "." (concat doom-cache-dir "backup/"))) - tramp-backup-directory-alist backup-directory-alist) - -;; But turn on auto-save, so we have a fallback in case of crashes or lost data. -;; Use `recover-file' or `recover-session' to recover them. -(setq auto-save-default t - ;; Don't auto-disable auto-save after deleting big chunks. This defeats - ;; the purpose of a failsafe. This adds the risk of losing the data we - ;; just deleted, but I believe that's VCS's jurisdiction, not ours. - auto-save-include-big-deletions t - ;; Keep it out of `doom-emacs-dir' or the local directory. - auto-save-list-file-prefix (concat doom-cache-dir "autosave/") - tramp-auto-save-directory (concat doom-cache-dir "tramp-autosave/") - auto-save-file-name-transforms - (list (list "\\`/[^/]*:\\([^/]*/\\)*\\([^/]*\\)\\'" - ;; Prefix tramp autosaves to prevent conflicts with local ones - (concat auto-save-list-file-prefix "tramp-\\2") t) - (list ".*" auto-save-list-file-prefix t))) - -(add-hook! 'after-save-hook - (defun doom-guess-mode-h () - "Guess major mode when saving a file in `fundamental-mode'. - -Likely, something has changed since the buffer was opened. e.g. A shebang line -or file path may exist now." - (when (eq major-mode 'fundamental-mode) - (let ((buffer (or (buffer-base-buffer) (current-buffer)))) - (and (buffer-file-name buffer) - (eq buffer (window-buffer (selected-window))) ; only visible buffers - (set-auto-mode)))))) - -(defadvice! doom--shut-up-autosave-a (fn &rest args) - "If a file has autosaved data, `after-find-file' will pause for 1 second to -tell you about it. Very annoying. This prevents that." - :around #'after-find-file - (letf! ((#'sit-for #'ignore)) - (apply fn args))) - -;; HACK Emacs generates long file paths for its auto-save files; long = -;; `auto-save-list-file-prefix' + `buffer-file-name'. If too long, the -;; filesystem will murder your family. To appease it, I compress -;; `buffer-file-name' to a stable 40 characters. -;; TODO PR this upstream; should be a universal issue! -(defadvice! doom-make-hashed-auto-save-file-name-a (fn) - "Compress the auto-save file name so paths don't get too long." - :around #'make-auto-save-file-name - (let ((buffer-file-name - (if (or - ;; Don't do anything for non-file-visiting buffers. Names - ;; generated for those are short enough already. - (null buffer-file-name) - ;; If an alternate handler exists for this path, bow out. Most of - ;; them end up calling `make-auto-save-file-name' again anyway, so - ;; we still achieve this advice's ultimate goal. - (find-file-name-handler buffer-file-name - 'make-auto-save-file-name)) - buffer-file-name - (sha1 buffer-file-name)))) - (funcall fn))) - -;; HACK ...does the same for Emacs backup files, but also packages that use -;; `make-backup-file-name-1' directly (like undo-tree). -(defadvice! doom-make-hashed-backup-file-name-a (fn file) - "A few places use the backup file name so paths don't get too long." - :around #'make-backup-file-name-1 - (let ((alist backup-directory-alist) - backup-directory) - (while alist - (let ((elt (car alist))) - (if (string-match (car elt) file) - (setq backup-directory (cdr elt) - alist nil) - (setq alist (cdr alist))))) - (let ((file (funcall fn file))) - (if (or (null backup-directory) - (not (file-name-absolute-p backup-directory))) - file - (expand-file-name (sha1 (file-name-nondirectory file)) - (file-name-directory file)))))) - - -;; -;;; Formatting - -;; Favor spaces over tabs. Pls dun h8, but I think spaces (and 4 of them) is a -;; more consistent default than 8-space tabs. It can be changed on a per-mode -;; basis anyway (and is, where tabs are the canonical style, like go-mode). -(setq-default indent-tabs-mode nil - tab-width 4) - -;; Only indent the line when at BOL or in a line's indentation. Anywhere else, -;; insert literal indentation. -(setq-default tab-always-indent nil) - -;; Make `tabify' and `untabify' only affect indentation. Not tabs/spaces in the -;; middle of a line. -(setq tabify-regexp "^\t* [ \t]+") - -;; An archaic default in the age of widescreen 4k displays? I disagree. We still -;; frequently split our terminals and editor frames, or have them side-by-side, -;; using up more of that newly available horizontal real-estate. -(setq-default fill-column 80) - -;; Continue wrapped words at whitespace, rather than in the middle of a word. -(setq-default word-wrap t) -;; ...but don't do any wrapping by default. It's expensive. Enable -;; `visual-line-mode' if you want soft line-wrapping. `auto-fill-mode' for hard -;; line-wrapping. -(setq-default truncate-lines t) -;; If enabled (and `truncate-lines' was disabled), soft wrapping no longer -;; occurs when that window is less than `truncate-partial-width-windows' -;; characters wide. We don't need this, and it's extra work for Emacs otherwise, -;; so off it goes. -(setq truncate-partial-width-windows nil) - -;; This was a widespread practice in the days of typewriters. I actually prefer -;; it when writing prose with monospace fonts, but it is obsolete otherwise. -(setq sentence-end-double-space nil) - -;; The POSIX standard defines a line is "a sequence of zero or more non-newline -;; characters followed by a terminating newline", so files should end in a -;; newline. Windows doesn't respect this (because it's Windows), but we should, -;; since programmers' tools tend to be POSIX compliant (and no big deal if not). -(setq require-final-newline t) - -;; Default to soft line-wrapping in text modes. It is more sensibile for text -;; modes, even if hard wrapping is more performant. -(add-hook 'text-mode-hook #'visual-line-mode) - - -;; -;;; Clipboard / kill-ring - -;; Cull duplicates in the kill ring to reduce bloat and make the kill ring -;; easier to peruse (with `counsel-yank-pop' or `helm-show-kill-ring'. -(setq kill-do-not-save-duplicates t) - - -;; -;;; Extra file extensions to support - -(nconc - auto-mode-alist - '(("/LICENSE\\'" . text-mode) - ("\\.log\\'" . text-mode) - ("rc\\'" . conf-mode) - ("\\.\\(?:hex\\|nes\\)\\'" . hexl-mode))) - - -;; -;;; Built-in plugins - -(use-package! autorevert - ;; revert buffers when their files/state have changed - :hook (focus-in . doom-auto-revert-buffers-h) - :hook (after-save . doom-auto-revert-buffers-h) - :hook (doom-switch-buffer . doom-auto-revert-buffer-h) - :hook (doom-switch-window . doom-auto-revert-buffer-h) - :config - (setq auto-revert-verbose t ; let us know when it happens - auto-revert-use-notify nil - auto-revert-stop-on-user-input nil - ;; Only prompts for confirmation when buffer is unsaved. - revert-without-query (list ".")) - - ;; `auto-revert-mode' and `global-auto-revert-mode' would, normally, abuse the - ;; heck out of file watchers _or_ aggressively poll your buffer list every X - ;; seconds. Too many watchers can grind Emacs to a halt if you preform - ;; expensive or batch processes on files outside of Emacs (e.g. their mtime - ;; changes), and polling your buffer list is terribly inefficient as your - ;; buffer list grows into the hundreds. - ;; - ;; Doom does this lazily instead. i.e. All visible buffers are reverted - ;; immediately when a) a file is saved or b) Emacs is refocused (after using - ;; another app). Meanwhile, buried buffers are reverted only when they are - ;; switched to. This way, Emacs only ever has to operate on, at minimum, a - ;; single buffer and, at maximum, ~10 buffers (after all, when do you ever - ;; have more than 10 windows in any single frame?). - (defun doom-auto-revert-buffer-h () - "Auto revert current buffer, if necessary." - (unless (or auto-revert-mode (active-minibuffer-window)) - (let ((auto-revert-mode t)) - (auto-revert-handler)))) - - (defun doom-auto-revert-buffers-h () - "Auto revert stale buffers in visible windows, if necessary." - (dolist (buf (doom-visible-buffers)) - (with-current-buffer buf - (doom-auto-revert-buffer-h))))) - - -(use-package! recentf - ;; Keep track of recently opened files - :defer-incrementally easymenu tree-widget timer - :hook (doom-first-file . recentf-mode) - :commands recentf-open-files - :custom (recentf-save-file (concat doom-cache-dir "recentf")) - :config - (setq recentf-auto-cleanup nil ; Don't. We'll auto-cleanup on shutdown - recentf-max-saved-items 200) ; default is 20 - - (defun doom--recentf-file-truename-fn (file) - (if (or (not (file-remote-p file)) - (equal "sudo" (file-remote-p file 'method))) - (abbreviate-file-name (file-truename (tramp-file-name-localname tfile))) - file)) - - ;; Resolve symlinks, strip out the /sudo:X@ prefix in local tramp paths, and - ;; abbreviate $HOME -> ~ in filepaths (more portable, more readable, & saves - ;; space) - (add-to-list 'recentf-filename-handlers #'doom--recentf-file-truename-fn) - - ;; Text properties inflate the size of recentf's files, and there is - ;; no purpose in persisting them (Must be first in the list!) - (add-to-list 'recentf-filename-handlers #'substring-no-properties) - - (add-hook! '(doom-switch-window-hook write-file-functions) - (defun doom--recentf-touch-buffer-h () - "Bump file in recent file list when it is switched or written to." - (when buffer-file-name - (recentf-add-file buffer-file-name)) - ;; Return nil for `write-file-functions' - nil)) - - (add-hook! 'dired-mode-hook - (defun doom--recentf-add-dired-directory-h () - "Add dired directories to recentf file list." - (recentf-add-file default-directory))) - - ;; The most sensible time to clean up your recent files list is when you quit - ;; Emacs (unless this is a long-running daemon session). - (setq recentf-auto-cleanup (if (daemonp) 300)) - (add-hook 'kill-emacs-hook #'recentf-cleanup) - - ;; Otherwise `load-file' calls in `recentf-load-list' pollute *Messages* - (advice-add #'recentf-load-list :around #'doom-shut-up-a)) - - -(use-package! savehist - ;; persist variables across sessions - :defer-incrementally custom - :hook (doom-first-input . savehist-mode) - :custom (savehist-file (concat doom-cache-dir "savehist")) - :config - (setq savehist-save-minibuffer-history t - savehist-autosave-interval nil ; save on kill only - savehist-additional-variables - '(kill-ring ; persist clipboard - register-alist ; persist macros - mark-ring global-mark-ring ; persist marks - search-ring regexp-search-ring)) ; persist searches - (add-hook! 'savehist-save-hook - (defun doom-savehist-unpropertize-variables-h () - "Remove text properties from `kill-ring' to reduce savehist cache size." - (setq kill-ring - (mapcar #'substring-no-properties - (cl-remove-if-not #'stringp kill-ring)) - register-alist - (cl-loop for (reg . item) in register-alist - if (stringp item) - collect (cons reg (substring-no-properties item)) - else collect (cons reg item)))) - (defun doom-savehist-remove-unprintable-registers-h () - "Remove unwriteable registers (e.g. containing window configurations). -Otherwise, `savehist' would discard `register-alist' entirely if we don't omit -the unwritable tidbits." - ;; Save new value in the temp buffer savehist is running - ;; `savehist-save-hook' in. We don't want to actually remove the - ;; unserializable registers in the current session! - (setq-local register-alist - (cl-remove-if-not #'savehist-printable register-alist))))) - - -(use-package! saveplace - ;; persistent point location in buffers - :hook (doom-first-file . save-place-mode) - :custom (save-place-file (concat doom-cache-dir "saveplace")) - :config - (defadvice! doom--recenter-on-load-saveplace-a (&rest _) - "Recenter on cursor when loading a saved place." - :after-while #'save-place-find-file-hook - (if buffer-file-name (ignore-errors (recenter)))) - - (defadvice! doom--inhibit-saveplace-in-long-files-a (fn &rest args) - :around #'save-place-to-alist - (unless doom-large-file-p - (apply fn args))) - - (defadvice! doom--dont-prettify-saveplace-cache-a (fn) - "`save-place-alist-to-file' uses `pp' to prettify the contents of its cache. -`pp' can be expensive for longer lists, and there's no reason to prettify cache -files, so this replace calls to `pp' with the much faster `prin1'." - :around #'save-place-alist-to-file - (letf! ((#'pp #'prin1)) (funcall fn)))) - - -(use-package! server - :when (display-graphic-p) - :after-call doom-first-input-hook doom-first-file-hook focus-out-hook - :custom (server-auth-dir (concat doom-emacs-dir "server/")) - :defer 1 - :init - (when-let (name (getenv "EMACS_SERVER_NAME")) - (setq server-name name)) - :config - (unless (server-running-p) - (server-start))) - - -(after! tramp - (setq remote-file-name-inhibit-cache 60 - tramp-completion-reread-directory-timeout 60 - tramp-verbose 1 - vc-ignore-dir-regexp (format "%s\\|%s\\|%s" - vc-ignore-dir-regexp - tramp-file-name-regexp - "[/\\\\]node_modules"))) - - -;; -;;; Packages - -(use-package! better-jumper - :hook (doom-first-input . better-jumper-mode) - :commands doom-set-jump-a doom-set-jump-maybe-a doom-set-jump-h - :preface - ;; REVIEW Suppress byte-compiler warning spawning a *Compile-Log* buffer at - ;; startup. This can be removed once gilbertw1/better-jumper#2 is merged. - (defvar better-jumper-local-mode nil) - :init - (global-set-key [remap evil-jump-forward] #'better-jumper-jump-forward) - (global-set-key [remap evil-jump-backward] #'better-jumper-jump-backward) - (global-set-key [remap xref-pop-marker-stack] #'better-jumper-jump-backward) - (global-set-key [remap xref-go-back] #'better-jumper-jump-backward) - (global-set-key [remap xref-go-forward] #'better-jumper-jump-forward) - :config - (defun doom-set-jump-a (fn &rest args) - "Set a jump point and ensure fn doesn't set any new jump points." - (better-jumper-set-jump (if (markerp (car args)) (car args))) - (let ((evil--jumps-jumping t) - (better-jumper--jumping t)) - (apply fn args))) - - (defun doom-set-jump-maybe-a (fn &rest args) - "Set a jump point if fn returns non-nil." - (let ((origin (point-marker)) - (result - (let* ((evil--jumps-jumping t) - (better-jumper--jumping t)) - (apply fn args)))) - (unless result - (with-current-buffer (marker-buffer origin) - (better-jumper-set-jump - (if (markerp (car args)) - (car args) - origin)))) - result)) - - (defun doom-set-jump-h () - "Run `better-jumper-set-jump' but return nil, for short-circuiting hooks." - (better-jumper-set-jump) - nil) - - ;; Creates a jump point before killing a buffer. This allows you to undo - ;; killing a buffer easily (only works with file buffers though; it's not - ;; possible to resurrect special buffers). - ;; - ;; I'm not advising `kill-buffer' because I only want this to affect - ;; interactively killed buffers. - (advice-add #'kill-current-buffer :around #'doom-set-jump-a) - - ;; Create a jump point before jumping with imenu. - (advice-add #'imenu :around #'doom-set-jump-a)) - - -(use-package! dtrt-indent - ;; Automatic detection of indent settings - :when doom-interactive-p - ;; I'm not using `global-dtrt-indent-mode' because it has hard-coded and rigid - ;; major mode checks, so I implement it in `doom-detect-indentation-h'. - :hook ((change-major-mode-after-body read-only-mode) . doom-detect-indentation-h) - :config - (defun doom-detect-indentation-h () - (unless (or (not after-init-time) - doom-inhibit-indent-detection - doom-large-file-p - (memq major-mode doom-detect-indentation-excluded-modes) - (member (substring (buffer-name) 0 1) '(" " "*"))) - ;; Don't display messages in the echo area, but still log them - (let ((inhibit-message (not doom-debug-p))) - (dtrt-indent-mode +1)))) - - ;; Enable dtrt-indent even in smie modes so that it can update `tab-width', - ;; `standard-indent' and `evil-shift-width' there as well. - (setq dtrt-indent-run-after-smie t) - ;; Reduced from the default of 5000 for slightly faster analysis - (setq dtrt-indent-max-lines 2000) - - ;; always keep tab-width up-to-date - (push '(t tab-width) dtrt-indent-hook-generic-mapping-list) - - (defvar dtrt-indent-run-after-smie) - (defadvice! doom--fix-broken-smie-modes-a (fn &optional arg) - "Some smie modes throw errors when trying to guess their indentation, like -`nim-mode'. This prevents them from leaving Emacs in a broken state." - :around #'dtrt-indent-mode - (let ((dtrt-indent-run-after-smie dtrt-indent-run-after-smie)) - (letf! ((defun symbol-config--guess (beg end) - (funcall symbol-config--guess beg (min end 10000))) - (defun smie-config-guess () - (condition-case e (funcall smie-config-guess) - (error (setq dtrt-indent-run-after-smie t) - (message "[WARNING] Indent detection: %s" - (error-message-string e)) - (message ""))))) ; warn silently - (funcall fn arg))))) - -(use-package! helpful - ;; a better *help* buffer - :commands helpful--read-symbol - :hook (helpful-mode . visual-line-mode) - :init - ;; Make `apropos' et co search more extensively. They're more useful this way. - (setq apropos-do-all t) - - (global-set-key [remap describe-function] #'helpful-callable) - (global-set-key [remap describe-command] #'helpful-command) - (global-set-key [remap describe-variable] #'helpful-variable) - (global-set-key [remap describe-key] #'helpful-key) - (global-set-key [remap describe-symbol] #'helpful-symbol) - - (defun doom-use-helpful-a (fn &rest args) - "Force FN to use helpful instead of the old describe-* commands." - (letf! ((#'describe-function #'helpful-function) - (#'describe-variable #'helpful-variable)) - (apply fn args))) - - (after! apropos - ;; patch apropos buttons to call helpful instead of help - (dolist (fun-bt '(apropos-function apropos-macro apropos-command)) - (button-type-put - fun-bt 'action - (lambda (button) - (helpful-callable (button-get button 'apropos-symbol))))) - (dolist (var-bt '(apropos-variable apropos-user-option)) - (button-type-put - var-bt 'action - (lambda (button) - (helpful-variable (button-get button 'apropos-symbol))))))) - - -;;;###package imenu -(add-hook 'imenu-after-jump-hook #'recenter) - - -(use-package! smartparens - ;; Auto-close delimiters and blocks as you type. It's more powerful than that, - ;; but that is all Doom uses it for. - :hook (doom-first-buffer . smartparens-global-mode) - :commands sp-pair sp-local-pair sp-with-modes sp-point-in-comment sp-point-in-string - :config - (add-to-list 'doom-point-in-string-functions 'sp-point-in-string) - (add-to-list 'doom-point-in-comment-functions 'sp-point-in-comment) - ;; smartparens recognizes `slime-mrepl-mode', but not `sly-mrepl-mode', so... - (add-to-list 'sp-lisp-modes 'sly-mrepl-mode) - ;; Load default smartparens rules for various languages - (require 'smartparens-config) - ;; Overlays are too distracting and not terribly helpful. show-parens does - ;; this for us already (and is faster), so... - (setq sp-highlight-pair-overlay nil - sp-highlight-wrap-overlay nil - sp-highlight-wrap-tag-overlay nil) - (with-eval-after-load 'evil - ;; But if someone does want overlays enabled, evil users will be stricken - ;; with an off-by-one issue where smartparens assumes you're outside the - ;; pair when you're really at the last character in insert mode. We must - ;; correct this vile injustice. - (setq sp-show-pair-from-inside t) - ;; ...and stay highlighted until we've truly escaped the pair! - (setq sp-cancel-autoskip-on-backward-movement nil) - ;; Smartparens conditional binds a key to C-g when sp overlays are active - ;; (even if they're invisible). This disruptively changes the behavior of - ;; C-g in insert mode, requiring two presses of the key to exit insert mode. - ;; I don't see the point of this keybind, so... - (setq sp-pair-overlay-keymap (make-sparse-keymap))) - - ;; The default is 100, because smartparen's scans are relatively expensive - ;; (especially with large pair lists for some modes), we reduce it, as a - ;; better compromise between performance and accuracy. - (setq sp-max-prefix-length 25) - ;; No pair has any business being longer than 4 characters; if they must, set - ;; it buffer-locally. It's less work for smartparens. - (setq sp-max-pair-length 4) - - ;; Silence some harmless but annoying echo-area spam - (dolist (key '(:unmatched-expression :no-matching-tag)) - (setf (alist-get key sp-message-alist) nil)) - - (add-hook! 'eval-expression-minibuffer-setup-hook - (defun doom-init-smartparens-in-eval-expression-h () - "Enable `smartparens-mode' in the minibuffer for `eval-expression'. -This includes everything that calls `read--expression', e.g. -`edebug-eval-expression' Only enable it if -`smartparens-global-mode' is on." - (when smartparens-global-mode (smartparens-mode +1)))) - (add-hook! 'minibuffer-setup-hook - (defun doom-init-smartparens-in-minibuffer-maybe-h () - "Enable `smartparens' for non-`eval-expression' commands. -Only enable `smartparens-mode' if `smartparens-global-mode' is -on." - (when (and smartparens-global-mode (memq this-command '(evil-ex))) - (smartparens-mode +1)))) - - ;; You're likely writing lisp in the minibuffer, therefore, disable these - ;; quote pairs, which lisps doesn't use for strings: - (sp-local-pair '(minibuffer-mode minibuffer-inactive-mode) "'" nil :actions nil) - (sp-local-pair '(minibuffer-mode minibuffer-inactive-mode) "`" nil :actions nil) - - ;; Smartparens breaks evil-mode's replace state - (defvar doom-buffer-smartparens-mode nil) - (add-hook! 'evil-replace-state-exit-hook - (defun doom-enable-smartparens-mode-maybe-h () - (when doom-buffer-smartparens-mode - (turn-on-smartparens-mode) - (kill-local-variable 'doom-buffer-smartparens-mode)))) - (add-hook! 'evil-replace-state-entry-hook - (defun doom-disable-smartparens-mode-maybe-h () - (when smartparens-mode - (setq-local doom-buffer-smartparens-mode t) - (turn-off-smartparens-mode))))) - - -(use-package! so-long - :hook (doom-first-file . global-so-long-mode) - :config - (setq so-long-threshold 400) ; reduce false positives w/ larger threshold - ;; Don't disable syntax highlighting and line numbers, or make the buffer - ;; read-only, in `so-long-minor-mode', so we can have a basic editing - ;; experience in them, at least. It will remain off in `so-long-mode', - ;; however, because long files have a far bigger impact on Emacs performance. - (delq! 'font-lock-mode so-long-minor-modes) - (delq! 'display-line-numbers-mode so-long-minor-modes) - (delq! 'buffer-read-only so-long-variable-overrides 'assq) - ;; ...but at least reduce the level of syntax highlighting - (add-to-list 'so-long-variable-overrides '(font-lock-maximum-decoration . 1)) - ;; ...and insist that save-place not operate in large/long files - (add-to-list 'so-long-variable-overrides '(save-place-alist . nil)) - ;; But disable everything else that may be unnecessary/expensive for large or - ;; wide buffers. - (appendq! so-long-minor-modes - '(flycheck-mode - spell-fu-mode - eldoc-mode - smartparens-mode - highlight-numbers-mode - better-jumper-local-mode - ws-butler-mode - auto-composition-mode - undo-tree-mode - highlight-indent-guides-mode - hl-fill-column-mode)) - (defun doom-buffer-has-long-lines-p () - (unless (bound-and-true-p visual-line-mode) - (let ((so-long-skip-leading-comments - ;; HACK Fix #2183: `so-long-detected-long-line-p' tries to parse - ;; comment syntax, but comment state may not be initialized, - ;; leading to a wrong-type-argument: stringp error. - (bound-and-true-p comment-use-syntax))) - (so-long-detected-long-line-p)))) - (setq so-long-predicate #'doom-buffer-has-long-lines-p)) - - -(use-package! ws-butler - ;; a less intrusive `delete-trailing-whitespaces' on save - :hook (doom-first-buffer . ws-butler-global-mode) - :config - ;; ws-butler normally preserves whitespace in the buffer (but strips it from - ;; the written file). While sometimes convenient, this behavior is not - ;; intuitive. To the average user it looks like whitespace cleanup is failing, - ;; which causes folks to redundantly install their own. - (setq ws-butler-keep-whitespace-before-point nil)) - -(provide 'core-editor) -;;; core-editor.el ends here diff --git a/.config/emacs/core/core-keybinds.el b/.config/emacs/core/core-keybinds.el deleted file mode 100644 index d1f5aff..0000000 --- a/.config/emacs/core/core-keybinds.el +++ /dev/null @@ -1,462 +0,0 @@ -;;; core-keybinds.el -*- lexical-binding: t; -*- - -;; A centralized keybinds system, integrated with `which-key' to preview -;; available keybindings. All built into one powerful macro: `map!'. If evil is -;; never loaded, then evil bindings set with `map!' are ignored (i.e. omitted -;; entirely for performance reasons). - -(defvar doom-leader-key "SPC" - "The leader prefix key for Evil users.") - -(defvar doom-leader-alt-key "M-SPC" - "An alternative leader prefix key, used for Insert and Emacs states, and for -non-evil users.") - -(defvar doom-localleader-key "SPC m" - "The localleader prefix key, for major-mode specific commands.") - -(defvar doom-localleader-alt-key "M-SPC m" - "The localleader prefix key, for major-mode specific commands. Used for Insert -and Emacs states, and for non-evil users.") - -(defvar doom-leader-map (make-sparse-keymap) - "An overriding keymap for keys.") - - -;; -;;; Keybind settings - -(cond - (IS-MAC - ;; mac-* variables are used by the special emacs-mac build of Emacs by - ;; Yamamoto Mitsuharu, while other builds use ns-*. - (setq mac-command-modifier 'super - ns-command-modifier 'super - mac-option-modifier 'meta - ns-option-modifier 'meta - ;; Free up the right option for character composition - mac-right-option-modifier 'none - ns-right-option-modifier 'none)) - (IS-WINDOWS - (setq w32-lwindow-modifier 'super - w32-rwindow-modifier 'super))) - -;; HACK Fixes Emacs' disturbing inability to distinguish C-i from TAB. -(define-key key-translation-map [?\C-i] - (cmd! (if (let ((keys (this-single-command-raw-keys))) - (and keys - (not (cl-position 'tab keys)) - (not (cl-position 'kp-tab keys)) - (display-graphic-p) - ;; Fall back if no keybind can be found, otherwise - ;; we've broken all pre-existing C-i keybinds. - (let ((key - (doom-lookup-key - (vconcat (cl-subseq keys 0 -1) [C-i])))) - (not (or (numberp key) (null key)))))) - [C-i] [?\C-i]))) - - -;; -;;; Universal, non-nuclear escape - -;; `keyboard-quit' is too much of a nuclear option. I wanted an ESC/C-g to -;; do-what-I-mean. It serves four purposes (in order): -;; -;; 1. Quit active states; e.g. highlights, searches, snippets, iedit, -;; multiple-cursors, recording macros, etc. -;; 2. Close popup windows remotely (if it is allowed to) -;; 3. Refresh buffer indicators, like git-gutter and flycheck -;; 4. Or fall back to `keyboard-quit' -;; -;; And it should do these things incrementally, rather than all at once. And it -;; shouldn't interfere with recording macros or the minibuffer. This may require -;; you press ESC/C-g two or three times on some occasions to reach -;; `keyboard-quit', but this is much more intuitive. - -(defvar doom-escape-hook nil - "A hook run when C-g is pressed (or ESC in normal mode, for evil users). - -More specifically, when `doom/escape' is pressed. If any hook returns non-nil, -all hooks after it are ignored.") - -(defun doom/escape (&optional interactive) - "Run `doom-escape-hook'." - (interactive (list 'interactive)) - (cond ((minibuffer-window-active-p (minibuffer-window)) - ;; quit the minibuffer if open. - (when interactive - (setq this-command 'abort-recursive-edit)) - (abort-recursive-edit)) - ;; Run all escape hooks. If any returns non-nil, then stop there. - ((run-hook-with-args-until-success 'doom-escape-hook)) - ;; don't abort macros - ((or defining-kbd-macro executing-kbd-macro) nil) - ;; Back to the default - ((unwind-protect (keyboard-quit) - (when interactive - (setq this-command 'keyboard-quit)))))) - -(global-set-key [remap keyboard-quit] #'doom/escape) - -(with-eval-after-load 'eldoc - (eldoc-add-command 'doom/escape)) - - -;; -;;; General + leader/localleader keys - -(use-package general - :init - ;; Convenience aliases - (defalias 'define-key! #'general-def) - (defalias 'undefine-key! #'general-unbind) - :config - ;; Prevent "X starts with non-prefix key Y" errors except at startup. - (add-hook 'doom-after-init-modules-hook #'general-auto-unbind-keys)) - - -;; HACK `map!' uses this instead of `define-leader-key!' because it consumes -;; 20-30% more startup time, so we reimplement it ourselves. -(defmacro doom--define-leader-key (&rest keys) - (let (prefix forms wkforms) - (while keys - (let ((key (pop keys)) - (def (pop keys))) - (if (keywordp key) - (when (memq key '(:prefix :infix)) - (setq prefix def)) - (when prefix - (setq key `(general--concat t ,prefix ,key))) - (let* ((udef (cdr-safe (doom-unquote def))) - (bdef (if (general--extended-def-p udef) - (general--extract-def (general--normalize-extended-def udef)) - def))) - (unless (eq bdef :ignore) - (push `(define-key doom-leader-map (general--kbd ,key) - ,bdef) - forms)) - (when-let (desc (cadr (memq :which-key udef))) - (prependq! - wkforms `((which-key-add-key-based-replacements - (general--concat t doom-leader-alt-key ,key) - ,desc) - (which-key-add-key-based-replacements - (general--concat t doom-leader-key ,key) - ,desc)))))))) - (macroexp-progn - (append (and wkforms `((after! which-key ,@(nreverse wkforms)))) - (nreverse forms))))) - -(defmacro define-leader-key! (&rest args) - "Define keys. - -Uses `general-define-key' under the hood, but does not support :states, -:wk-full-keys or :keymaps. Use `map!' for a more convenient interface. - -See `doom-leader-key' and `doom-leader-alt-key' to change the leader prefix." - `(general-define-key - :states nil - :wk-full-keys nil - :keymaps 'doom-leader-map - ,@args)) - -(defmacro define-localleader-key! (&rest args) - "Define key. - -Uses `general-define-key' under the hood, but does not support :major-modes, -:states, :prefix or :non-normal-prefix. Use `map!' for a more convenient -interface. - -See `doom-localleader-key' and `doom-localleader-alt-key' to change the -localleader prefix." - (if (featurep! :editor evil) - ;; :non-normal-prefix doesn't apply to non-evil sessions (only evil's - ;; emacs state) - `(general-define-key - :states '(normal visual motion emacs insert) - :major-modes t - :prefix doom-localleader-key - :non-normal-prefix doom-localleader-alt-key - ,@args) - `(general-define-key - :major-modes t - :prefix doom-localleader-alt-key - ,@args))) - -;; We use a prefix commands instead of general's :prefix/:non-normal-prefix -;; properties because general is incredibly slow binding keys en mass with them -;; in conjunction with :states -- an effective doubling of Doom's startup time! -(define-prefix-command 'doom/leader 'doom-leader-map) -(define-key doom-leader-map [override-state] 'all) - -;; Bind `doom-leader-key' and `doom-leader-alt-key' as late as possible to give -;; the user a chance to modify them. -(add-hook! 'doom-after-init-modules-hook - (defun doom-init-leader-keys-h () - "Bind `doom-leader-key' and `doom-leader-alt-key'." - (let ((map general-override-mode-map)) - (if (not (featurep 'evil)) - (progn - (cond ((equal doom-leader-alt-key "C-c") - (set-keymap-parent doom-leader-map mode-specific-map)) - ((equal doom-leader-alt-key "C-x") - (set-keymap-parent doom-leader-map ctl-x-map))) - (define-key map (kbd doom-leader-alt-key) 'doom/leader)) - (evil-define-key* '(normal visual motion) map (kbd doom-leader-key) 'doom/leader) - (evil-define-key* '(emacs insert) map (kbd doom-leader-alt-key) 'doom/leader)) - (general-override-mode +1)))) - - -;; -;;; Packages - -(use-package! which-key - :hook (doom-first-input . which-key-mode) - :init - (setq which-key-sort-order #'which-key-key-order-alpha - which-key-sort-uppercase-first nil - which-key-add-column-padding 1 - which-key-max-display-columns nil - which-key-min-display-lines 6 - which-key-side-window-slot -10) - :config - (put 'which-key-replacement-alist 'initial-value which-key-replacement-alist) - (add-hook! 'doom-before-reload-hook - (defun doom-reset-which-key-replacements-h () - (setq which-key-replacement-alist (get 'which-key-replacement-alist 'initial-value)))) - ;; general improvements to which-key readability - (which-key-setup-side-window-bottom) - (setq-hook! 'which-key-init-buffer-hook line-spacing 3) - - (which-key-add-key-based-replacements doom-leader-key "") - (which-key-add-key-based-replacements doom-localleader-key "")) - - -;; -;;; `map!' macro - -(defvar doom-evil-state-alist - '((?n . normal) - (?v . visual) - (?i . insert) - (?e . emacs) - (?o . operator) - (?m . motion) - (?r . replace) - (?g . global)) - "A list of cons cells that map a letter to a evil state symbol.") - -(defun doom--map-keyword-to-states (keyword) - "Convert a KEYWORD into a list of evil state symbols. - -For example, :nvi will map to (list 'normal 'visual 'insert). See -`doom-evil-state-alist' to customize this." - (cl-loop for l across (doom-keyword-name keyword) - if (assq l doom-evil-state-alist) collect (cdr it) - else do (error "not a valid state: %s" l))) - - -;; specials -(defvar doom--map-forms nil) -(defvar doom--map-fn nil) -(defvar doom--map-batch-forms nil) -(defvar doom--map-state '(:dummy t)) -(defvar doom--map-parent-state nil) -(defvar doom--map-evil-p nil) -(after! evil (setq doom--map-evil-p t)) - -(defun doom--map-process (rest) - (let ((doom--map-fn doom--map-fn) - doom--map-state - doom--map-forms - desc) - (while rest - (let ((key (pop rest))) - (cond ((listp key) - (doom--map-nested nil key)) - - ((keywordp key) - (pcase key - (:leader - (doom--map-commit) - (setq doom--map-fn 'doom--define-leader-key)) - (:localleader - (doom--map-commit) - (setq doom--map-fn 'define-localleader-key!)) - (:after - (doom--map-nested (list 'after! (pop rest)) rest) - (setq rest nil)) - (:desc - (setq desc (pop rest))) - (:map - (doom--map-set :keymaps `(quote ,(doom-enlist (pop rest))))) - (:mode - (push (cl-loop for m in (doom-enlist (pop rest)) - collect (intern (concat (symbol-name m) "-map"))) - rest) - (push :map rest)) - ((or :when :unless) - (doom--map-nested (list (intern (doom-keyword-name key)) (pop rest)) rest) - (setq rest nil)) - (:prefix-map - (cl-destructuring-bind (prefix . desc) - (let ((arg (pop rest))) - (if (consp arg) arg (list arg))) - (let ((keymap (intern (format "doom-leader-%s-map" desc)))) - (setq rest - (append (list :desc desc prefix keymap - :prefix prefix) - rest)) - (push `(defvar ,keymap (make-sparse-keymap)) - doom--map-forms)))) - (:prefix - (cl-destructuring-bind (prefix . desc) - (let ((arg (pop rest))) - (if (consp arg) arg (list arg))) - (doom--map-set (if doom--map-fn :infix :prefix) - prefix) - (when (stringp desc) - (setq rest (append (list :desc desc "" nil) rest))))) - (:textobj - (let* ((key (pop rest)) - (inner (pop rest)) - (outer (pop rest))) - (push `(map! (:map evil-inner-text-objects-map ,key ,inner) - (:map evil-outer-text-objects-map ,key ,outer)) - doom--map-forms))) - (_ - (condition-case _ - (doom--map-def (pop rest) (pop rest) - (doom--map-keyword-to-states key) - desc) - (error - (error "Not a valid `map!' property: %s" key))) - (setq desc nil)))) - - ((doom--map-def key (pop rest) nil desc) - (setq desc nil))))) - - (doom--map-commit) - (macroexp-progn (nreverse (delq nil doom--map-forms))))) - -(defun doom--map-append-keys (prop) - (let ((a (plist-get doom--map-parent-state prop)) - (b (plist-get doom--map-state prop))) - (if (and a b) - `(general--concat t ,a ,b) - (or a b)))) - -(defun doom--map-nested (wrapper rest) - (doom--map-commit) - (let ((doom--map-parent-state (doom--map-state))) - (push (if wrapper - (append wrapper (list (doom--map-process rest))) - (doom--map-process rest)) - doom--map-forms))) - -(defun doom--map-set (prop &optional value) - (unless (equal (plist-get doom--map-state prop) value) - (doom--map-commit)) - (setq doom--map-state (plist-put doom--map-state prop value))) - -(defun doom--map-def (key def &optional states desc) - (when (or (memq 'global states) - (null states)) - (setq states (cons 'nil (delq 'global states)))) - (when desc - (let (unquoted) - (cond ((and (listp def) - (keywordp (car-safe (setq unquoted (doom-unquote def))))) - (setq def (list 'quote (plist-put unquoted :which-key desc)))) - ((setq def (cons 'list - (if (and (equal key "") - (null def)) - `(:ignore t :which-key ,desc) - (plist-put (general--normalize-extended-def def) - :which-key desc)))))))) - (dolist (state states) - (push (list key def) - (alist-get state doom--map-batch-forms))) - t) - -(defun doom--map-commit () - (when doom--map-batch-forms - (cl-loop with attrs = (doom--map-state) - for (state . defs) in doom--map-batch-forms - if (or doom--map-evil-p (not state)) - collect `(,(or doom--map-fn 'general-define-key) - ,@(if state `(:states ',state)) ,@attrs - ,@(mapcan #'identity (nreverse defs))) - into forms - finally do (push (macroexp-progn forms) doom--map-forms)) - (setq doom--map-batch-forms nil))) - -(defun doom--map-state () - (let ((plist - (append (list :prefix (doom--map-append-keys :prefix) - :infix (doom--map-append-keys :infix) - :keymaps - (append (plist-get doom--map-parent-state :keymaps) - (plist-get doom--map-state :keymaps))) - doom--map-state - nil)) - newplist) - (while plist - (let ((key (pop plist)) - (val (pop plist))) - (when (and val (not (plist-member newplist key))) - (push val newplist) - (push key newplist)))) - newplist)) - -;; -(defmacro map! (&rest rest) - "A convenience macro for defining keybinds, powered by `general'. - -If evil isn't loaded, evil-specific bindings are ignored. - -Properties - :leader [...] an alias for (:prefix doom-leader-key ...) - :localleader [...] bind to localleader; requires a keymap - :mode [MODE(s)] [...] inner keybinds are applied to major MODE(s) - :map [KEYMAP(s)] [...] inner keybinds are applied to KEYMAP(S) - :prefix [PREFIX] [...] set keybind prefix for following keys. PREFIX - can be a cons cell: (PREFIX . DESCRIPTION) - :prefix-map [PREFIX] [...] same as :prefix, but defines a prefix keymap - where the following keys will be bound. DO NOT - USE THIS IN YOUR PRIVATE CONFIG. - :after [FEATURE] [...] apply keybinds when [FEATURE] loads - :textobj KEY INNER-FN OUTER-FN define a text object keybind pair - :when [CONDITION] [...] - :unless [CONDITION] [...] - - Any of the above properties may be nested, so that they only apply to a - certain group of keybinds. - -States - :n normal - :v visual - :i insert - :e emacs - :o operator - :m motion - :r replace - :g global (binds the key without evil `current-global-map') - - These can be combined in any order, e.g. :nvi will apply to normal, visual and - insert mode. The state resets after the following key=>def pair. If states are - omitted the keybind will be global (no emacs state; this is different from - evil's Emacs state and will work in the absence of `evil-mode'). - - These must be placed right before the key string. - - Do - (map! :leader :desc \"Description\" :n \"C-c\" #'dosomething) - Don't - (map! :n :leader :desc \"Description\" \"C-c\" #'dosomething) - (map! :leader :n :desc \"Description\" \"C-c\" #'dosomething)" - (doom--map-process rest)) - -(provide 'core-keybinds) -;;; core-keybinds.el ends here diff --git a/.config/emacs/core/core-lib.el b/.config/emacs/core/core-lib.el deleted file mode 100644 index e925762..0000000 --- a/.config/emacs/core/core-lib.el +++ /dev/null @@ -1,750 +0,0 @@ -;;; core-lib.el -*- lexical-binding: t; -*- - -(require 'cl-lib) - - -;; -;;; Helpers - -(defun doom--resolve-hook-forms (hooks) - "Converts a list of modes into a list of hook symbols. - -If a mode is quoted, it is left as is. If the entire HOOKS list is quoted, the -list is returned as-is." - (declare (pure t) (side-effect-free t)) - (let ((hook-list (doom-enlist (doom-unquote hooks)))) - (if (eq (car-safe hooks) 'quote) - hook-list - (cl-loop for hook in hook-list - if (eq (car-safe hook) 'quote) - collect (cadr hook) - else collect (intern (format "%s-hook" (symbol-name hook))))))) - -(defun doom--setq-hook-fns (hooks rest &optional singles) - (unless (or singles (= 0 (% (length rest) 2))) - (signal 'wrong-number-of-arguments (list #'evenp (length rest)))) - (cl-loop with vars = (let ((args rest) - vars) - (while args - (push (if singles - (list (pop args)) - (cons (pop args) (pop args))) - vars)) - (nreverse vars)) - for hook in (doom--resolve-hook-forms hooks) - for mode = (string-remove-suffix "-hook" (symbol-name hook)) - append - (cl-loop for (var . val) in vars - collect - (list var val hook - (intern (format "doom--setq-%s-for-%s-h" - var mode)))))) - - -;; -;;; Public library - -(defun doom-unquote (exp) - "Return EXP unquoted." - (declare (pure t) (side-effect-free t)) - (while (memq (car-safe exp) '(quote function)) - (setq exp (cadr exp))) - exp) - -(defun doom-enlist (exp) - "Return EXP wrapped in a list, or as-is if already a list." - (declare (pure t) (side-effect-free t)) - (if (proper-list-p exp) exp (list exp))) - -(defun doom-keyword-intern (str) - "Converts STR (a string) into a keyword (`keywordp')." - (declare (pure t) (side-effect-free t)) - (cl-check-type str string) - (intern (concat ":" str))) - -(defun doom-keyword-name (keyword) - "Returns the string name of KEYWORD (`keywordp') minus the leading colon." - (declare (pure t) (side-effect-free t)) - (cl-check-type keyword keyword) - (substring (symbol-name keyword) 1)) - -(defmacro doom-log (format-string &rest args) - "Log to *Messages* if `doom-debug-p' is on. -Does not display text in echo area, but still logs to *Messages*. Accepts the -same arguments as `message'." - `(when doom-debug-p - (let ((inhibit-message (active-minibuffer-window))) - (message - ,(concat (propertize "DOOM " 'face 'font-lock-comment-face) - (when (bound-and-true-p doom--current-module) - (propertize - (format "[%s/%s] " - (doom-keyword-name (car doom--current-module)) - (cdr doom--current-module)) - 'face 'warning)) - format-string) - ,@args)))) - -(defalias 'doom-partial #'apply-partially) - -(defun doom-rpartial (fn &rest args) - "Return a partial application of FUN to right-hand ARGS. - -ARGS is a list of the last N arguments to pass to FUN. The result is a new -function which does the same as FUN, except that the last N arguments are fixed -at the values with which this function was called." - (declare (side-effect-free t)) - (lambda (&rest pre-args) - (apply fn (append pre-args args)))) - -(defun doom-lookup-key (keys &rest keymaps) - "Like `lookup-key', but search active keymaps if KEYMAP is omitted." - (if keymaps - (cl-some (doom-rpartial #'lookup-key keys) keymaps) - (cl-loop for keymap - in (append (cl-loop for alist in emulation-mode-map-alists - append (mapcar #'cdr - (if (symbolp alist) - (if (boundp alist) (symbol-value alist)) - alist))) - (list (current-local-map)) - (mapcar #'cdr minor-mode-overriding-map-alist) - (mapcar #'cdr minor-mode-map-alist) - (list (current-global-map))) - if (keymapp keymap) - if (lookup-key keymap keys) - return it))) - -(defun doom-load-envvars-file (file &optional noerror) - "Read and set envvars from FILE. -If NOERROR is non-nil, don't throw an error if the file doesn't exist or is -unreadable. Returns the names of envvars that were changed." - (if (null (file-exists-p file)) - (unless noerror - (signal 'file-error (list "No envvar file exists" file))) - (with-temp-buffer - (insert-file-contents file) - (when-let (env (read (current-buffer))) - (let ((tz (getenv-internal "TZ"))) - (setq-default - process-environment - (append env (default-value 'process-environment)) - exec-path - (append (split-string (getenv "PATH") path-separator t) - (list exec-directory)) - shell-file-name - (or (getenv "SHELL") - (default-value 'shell-file-name))) - (when-let (newtz (getenv-internal "TZ")) - (unless (equal tz newtz) - (set-time-zone-rule newtz)))) - env)))) - -(defun doom-run-hook (hook) - "Run HOOK (a hook function) with better error handling. -Meant to be used with `run-hook-wrapped'." - (condition-case-unless-debug e - (funcall hook) - (error - (signal 'doom-hook-error (list hook e)))) - ;; return nil so `run-hook-wrapped' won't short circuit - nil) - -(defun doom-run-hooks (&rest hooks) - "Run HOOKS (a list of hook variable symbols) with better error handling. -Is used as advice to replace `run-hooks'." - (dolist (hook hooks) - (condition-case-unless-debug e - (run-hook-wrapped hook #'doom-run-hook) - (doom-hook-error - (unless debug-on-error - (lwarn hook :error "Error running hook %S because: %s" - (if (symbolp (cadr e)) - (symbol-name (cadr e)) - (cadr e)) - (caddr e))) - (signal 'doom-hook-error (cons hook (cdr e))))))) - -(defun doom-run-hook-on (hook-var trigger-hooks) - "Configure HOOK-VAR to be invoked exactly once when any of the TRIGGER-HOOKS -are invoked *after* Emacs has initialized (to reduce false positives). Once -HOOK-VAR is triggered, it is reset to nil. - -HOOK-VAR is a quoted hook. -TRIGGER-HOOK is a list of quoted hooks and/or sharp-quoted functions." - (dolist (hook trigger-hooks) - (let ((fn (intern (format "%s-init-on-%s-h" hook-var hook)))) - (fset - fn (lambda (&rest _) - ;; Only trigger this after Emacs has initialized. - (when (and after-init-time - (or (daemonp) - ;; In some cases, hooks may be lexically unset to - ;; inhibit them during expensive batch operations on - ;; buffers (such as when processing buffers - ;; internally). In these cases we should assume this - ;; hook wasn't invoked interactively. - (and (boundp hook) - (symbol-value hook)))) - (doom-run-hooks hook-var) - (set hook-var nil)))) - (cond ((daemonp) - ;; In a daemon session we don't need all these lazy loading - ;; shenanigans. Just load everything immediately. - (add-hook 'after-init-hook fn 'append)) - ((eq hook 'find-file-hook) - ;; Advise `after-find-file' instead of using `find-file-hook' - ;; because the latter is triggered too late (after the file has - ;; opened and modes are all set up). - (advice-add 'after-find-file :before fn '((depth . -101)))) - ((add-hook hook fn -101))) - fn))) - - -;; -;;; Sugars - -(defun dir! () - "Returns the directory of the emacs lisp file this function is called from." - (when-let (path (file!)) - (directory-file-name (file-name-directory path)))) - -(defun file! () - "Return the emacs lisp file this function is called from." - (cond ((bound-and-true-p byte-compile-current-file)) - (load-file-name) - ((stringp (car-safe current-load-list)) - (car current-load-list)) - (buffer-file-name) - ((error "Cannot get this file-path")))) - -(defmacro letenv! (envvars &rest body) - "Lexically bind ENVVARS in BODY, like `let' but for `process-environment'." - (declare (indent 1)) - `(let ((process-environment (copy-sequence process-environment))) - (dolist (var (list ,@(cl-loop for (var val) in envvars - collect `(cons ,var ,val)))) - (setenv (car var) (cdr var))) - ,@body)) - -(defmacro letf! (bindings &rest body) - "Temporarily rebind function, macros, and advice in BODY. - -Intended as syntax sugar for `cl-letf', `cl-labels', `cl-macrolet', and -temporary advice. - -BINDINGS is either: - - A list of, or a single, `defun', `defun*', `defmacro', or `defadvice' forms. - A list of (PLACE VALUE) bindings as `cl-letf*' would accept. - -TYPE is one of: - - `defun' (uses `cl-letf') - `defun*' (uses `cl-labels'; allows recursive references), - `defmacro' (uses `cl-macrolet') - `defadvice' (uses `defadvice!' before BODY, then `undefadvice!' after) - -NAME, ARGLIST, and BODY are the same as `defun', `defun*', `defmacro', and -`defadvice!', respectively. - -\(fn ((TYPE NAME ARGLIST &rest BODY) ...) BODY...)" - (declare (indent defun)) - (setq body (macroexp-progn body)) - (when (memq (car bindings) '(defun defun* defmacro defadvice)) - (setq bindings (list bindings))) - (dolist (binding (reverse bindings) body) - (let ((type (car binding)) - (rest (cdr binding))) - (setq - body (pcase type - (`defmacro `(cl-macrolet ((,@rest)) ,body)) - (`defadvice `(progn (defadvice! ,@rest) - (unwind-protect ,body (undefadvice! ,@rest)))) - ((or `defun `defun*) - `(cl-letf ((,(car rest) (symbol-function #',(car rest)))) - (ignore ,(car rest)) - ,(if (eq type 'defun*) - `(cl-labels ((,@rest)) ,body) - `(cl-letf (((symbol-function #',(car rest)) - (fn! ,(cadr rest) ,@(cddr rest)))) - ,body)))) - (_ - (when (eq (car-safe type) 'function) - (setq type (list 'symbol-function type))) - (list 'cl-letf (list (cons type rest)) body))))))) - -(defmacro quiet! (&rest forms) - "Run FORMS without generating any output. - -This silences calls to `message', `load', `write-region' and anything that -writes to `standard-output'. In interactive sessions this won't suppress writing -to *Messages*, only inhibit output in the echo area." - `(if doom-debug-p - (progn ,@forms) - ,(if doom-interactive-p - `(let ((inhibit-message t) - (save-silently t)) - (prog1 ,@forms (message ""))) - `(letf! ((standard-output (lambda (&rest _))) - (defun message (&rest _)) - (defun load (file &optional noerror nomessage nosuffix must-suffix) - (funcall load file noerror t nosuffix must-suffix)) - (defun write-region (start end filename &optional append visit lockname mustbenew) - (unless visit (setq visit 'no-message)) - (funcall write-region start end filename append visit lockname mustbenew))) - ,@forms)))) - -(defmacro eval-if! (cond then &rest body) - "Expands to THEN if COND is non-nil, to BODY otherwise. -COND is checked at compile/expansion time, allowing BODY to be omitted entirely -when the elisp is byte-compiled. Use this for forms that contain expensive -macros that could safely be removed at compile time." - (declare (indent 2)) - (if (eval cond) - then - (macroexp-progn body))) - -(defmacro eval-when! (cond &rest body) - "Expands to BODY if CONDITION is non-nil at compile/expansion time. -See `eval-if!' for details on this macro's purpose." - (declare (indent 1)) - (when (eval cond) - (macroexp-progn body))) - - -;;; Closure factories -(defmacro fn! (arglist &rest body) - "Returns (cl-function (lambda ARGLIST BODY...)) -The closure is wrapped in `cl-function', meaning ARGLIST will accept anything -`cl-defun' will. Implicitly adds `&allow-other-keys' if `&key' is present in -ARGLIST." - (declare (indent defun) (doc-string 1) (pure t) (side-effect-free t)) - `(cl-function - (lambda - ,(letf! (defun* allow-other-keys (args) - (mapcar - (lambda (arg) - (cond ((nlistp (cdr-safe arg)) arg) - ((listp arg) (allow-other-keys arg)) - (arg))) - (if (and (memq '&key args) - (not (memq '&allow-other-keys args))) - (if (memq '&aux args) - (let (newargs arg) - (while args - (setq arg (pop args)) - (when (eq arg '&aux) - (push '&allow-other-keys newargs)) - (push arg newargs)) - (nreverse newargs)) - (append args (list '&allow-other-keys))) - args))) - (allow-other-keys arglist)) - ,@body))) - -(defmacro cmd! (&rest body) - "Returns (lambda () (interactive) ,@body) -A factory for quickly producing interaction commands, particularly for keybinds -or aliases." - (declare (doc-string 1) (pure t) (side-effect-free t)) - `(lambda (&rest _) (interactive) ,@body)) - -(defmacro cmd!! (command &optional prefix-arg &rest args) - "Returns a closure that interactively calls COMMAND with ARGS and PREFIX-ARG. -Like `cmd!', but allows you to change `current-prefix-arg' or pass arguments to -COMMAND. This macro is meant to be used as a target for keybinds (e.g. with -`define-key' or `map!')." - (declare (doc-string 1) (pure t) (side-effect-free t)) - `(lambda (arg &rest _) (interactive "P") - (let ((current-prefix-arg (or ,prefix-arg arg))) - (,(if args - 'funcall-interactively - 'call-interactively) - ,command ,@args)))) - -(defmacro cmds! (&rest branches) - "Returns a dispatcher that runs the a command in BRANCHES. -Meant to be used as a target for keybinds (e.g. with `define-key' or `map!'). - -BRANCHES is a flat list of CONDITION COMMAND pairs. CONDITION is a lisp form -that is evaluated when (and each time) the dispatcher is invoked. If it returns -non-nil, COMMAND is invoked, otherwise it falls through to the next pair. - -The last element of BRANCHES can be a COMMANd with no CONDITION. This acts as -the fallback if all other conditions fail. - -Otherwise, Emacs will fall through the keybind and search the next keymap for a -keybind (as if this keybind never existed). - -See `general-key-dispatch' for what other arguments it accepts in BRANCHES." - (declare (doc-string 1)) - (let ((docstring (if (stringp (car branches)) (pop branches) "")) - fallback) - (when (cl-oddp (length branches)) - (setq fallback (car (last branches)) - branches (butlast branches))) - (let ((defs (cl-loop for (key value) on branches by 'cddr - unless (keywordp key) - collect (list key value)))) - `'(menu-item - ,(or docstring "") nil - :filter (lambda (&optional _) - (let (it) - (cond ,@(mapcar (lambda (pred-def) - `((setq it ,(car pred-def)) - ,(cadr pred-def))) - defs) - (t ,fallback)))))))) - -(defalias 'kbd! 'general-simulate-key) - -;; For backwards compatibility -(defalias 'λ! 'cmd!) -(defalias 'λ!! 'cmd!!) -;; DEPRECATED These have been superseded by `cmd!' and `cmd!!' -(define-obsolete-function-alias 'lambda! 'cmd! "3.0.0") -(define-obsolete-function-alias 'lambda!! 'cmd!! "3.0.0") - - -;;; Mutation -(defmacro appendq! (sym &rest lists) - "Append LISTS to SYM in place." - `(setq ,sym (append ,sym ,@lists))) - -(defmacro setq! (&rest settings) - "A stripped-down `customize-set-variable' with the syntax of `setq'. - -This can be used as a drop-in replacement for `setq'. Particularly when you know -a variable has a custom setter (a :set property in its `defcustom' declaration). -This triggers setters. `setq' does not." - (macroexp-progn - (cl-loop for (var val) on settings by 'cddr - collect `(funcall (or (get ',var 'custom-set) #'set) - ',var ,val)))) - -(defmacro delq! (elt list &optional fetcher) - "`delq' ELT from LIST in-place. - -If FETCHER is a function, ELT is used as the key in LIST (an alist)." - `(setq ,list - (delq ,(if fetcher - `(funcall ,fetcher ,elt ,list) - elt) - ,list))) - -(defmacro pushnew! (place &rest values) - "Push VALUES sequentially into PLACE, if they aren't already present. -This is a variadic `cl-pushnew'." - (let ((var (make-symbol "result"))) - `(dolist (,var (list ,@values) (with-no-warnings ,place)) - (cl-pushnew ,var ,place :test #'equal)))) - -(defmacro prependq! (sym &rest lists) - "Prepend LISTS to SYM in place." - `(setq ,sym (append ,@lists ,sym))) - - -;;; Loading -(defmacro add-load-path! (&rest dirs) - "Add DIRS to `load-path', relative to the current file. -The current file is the file from which `add-to-load-path!' is used." - `(let ((default-directory ,(dir!)) - file-name-handler-alist) - (dolist (dir (list ,@dirs)) - (cl-pushnew (expand-file-name dir) load-path :test #'string=)))) - -(defmacro after! (package &rest body) - "Evaluate BODY after PACKAGE have loaded. - -PACKAGE is a symbol or list of them. These are package names, not modes, -functions or variables. It can be: - -- An unquoted package symbol (the name of a package) - (after! helm BODY...) -- An unquoted list of package symbols (i.e. BODY is evaluated once both magit - and git-gutter have loaded) - (after! (magit git-gutter) BODY...) -- An unquoted, nested list of compound package lists, using any combination of - :or/:any and :and/:all - (after! (:or package-a package-b ...) BODY...) - (after! (:and package-a package-b ...) BODY...) - (after! (:and package-a (:or package-b package-c) ...) BODY...) - Without :or/:any/:and/:all, :and/:all are implied. - -This is a wrapper around `eval-after-load' that: - -1. Suppresses warnings for disabled packages at compile-time -2. No-ops for package that are disabled by the user (via `package!') -3. Supports compound package statements (see below) -4. Prevents eager expansion pulling in autoloaded macros all at once" - (declare (indent defun) (debug t)) - (if (symbolp package) - (unless (memq package (bound-and-true-p doom-disabled-packages)) - (list (if (or (not (bound-and-true-p byte-compile-current-file)) - (require package nil 'noerror)) - #'progn - #'with-no-warnings) - ;; We intentionally avoid `with-eval-after-load' to prevent eager - ;; macro expansion from pulling (or failing to pull) in autoloaded - ;; macros/packages. - `(eval-after-load ',package ',(macroexp-progn body)))) - (let ((p (car package))) - (cond ((memq p '(:or :any)) - (macroexp-progn - (cl-loop for next in (cdr package) - collect `(after! ,next ,@body)))) - ((memq p '(:and :all)) - (dolist (next (reverse (cdr package)) (car body)) - (setq body `((after! ,next ,@body))))) - (`(after! (:and ,@package) ,@body)))))) - -(defun doom--handle-load-error (e target path) - (let* ((source (file-name-sans-extension target)) - (err (cond ((not (featurep 'core)) - (cons 'error (file-name-directory path))) - ((file-in-directory-p source doom-core-dir) - (cons 'doom-error doom-core-dir)) - ((file-in-directory-p source doom-private-dir) - (cons 'doom-private-error doom-private-dir)) - ((cons 'doom-module-error doom-emacs-dir))))) - (signal (car err) - (list (file-relative-name - (concat source ".el") - (cdr err)) - e)))) - -(defmacro load! (filename &optional path noerror) - "Load a file relative to the current executing file (`load-file-name'). - -FILENAME is either a file path string or a form that should evaluate to such a -string at run time. PATH is where to look for the file (a string representing a -directory path). If omitted, the lookup is relative to either `load-file-name', -`byte-compile-current-file' or `buffer-file-name' (checked in that order). - -If NOERROR is non-nil, don't throw an error if the file doesn't exist." - (let* ((path (or path - (dir!) - (error "Could not detect path to look for '%s' in" - filename))) - (file (if path - `(expand-file-name ,filename ,path) - filename))) - `(condition-case-unless-debug e - (let (file-name-handler-alist) - (load ,file ,noerror 'nomessage)) - (doom-error (signal (car e) (cdr e))) - (error (doom--handle-load-error e ,file ,path))))) - -(defmacro defer-until! (condition &rest body) - "Run BODY when CONDITION is true (checks on `after-load-functions'). Meant to -serve as a predicated alternative to `after!'." - (declare (indent defun) (debug t)) - `(if ,condition - (progn ,@body) - ,(let ((fn (intern (format "doom--delay-form-%s-h" (sxhash (cons condition body)))))) - `(progn - (fset ',fn (lambda (&rest args) - (when ,(or condition t) - (remove-hook 'after-load-functions #',fn) - (unintern ',fn nil) - (ignore args) - ,@body))) - (put ',fn 'permanent-local-hook t) - (add-hook 'after-load-functions #',fn))))) - -(defmacro defer-feature! (feature &rest fns) - "Pretend FEATURE hasn't been loaded yet, until FEATURE-hook or FN runs. - -Some packages (like `elisp-mode' and `lisp-mode') are loaded immediately at -startup, which will prematurely trigger `after!' (and `with-eval-after-load') -blocks. To get around this we make Emacs believe FEATURE hasn't been loaded yet, -then wait until FEATURE-hook (or MODE-hook, if FN is provided) is triggered to -reverse this and trigger `after!' blocks at a more reasonable time." - (let ((advice-fn (intern (format "doom--defer-feature-%s-a" feature)))) - `(progn - (delq! ',feature features) - (defadvice! ,advice-fn (&rest _) - :before ',fns - ;; Some plugins (like yasnippet) will invoke a fn early to parse - ;; code, which would prematurely trigger this. In those cases, well - ;; behaved plugins will use `delay-mode-hooks', which we can check for: - (unless delay-mode-hooks - ;; ...Otherwise, announce to the world this package has been loaded, - ;; so `after!' handlers can react. - (provide ',feature) - (dolist (fn ',fns) - (advice-remove fn #',advice-fn))))))) - - -;;; Hooks -(defmacro add-transient-hook! (hook-or-function &rest forms) - "Attaches a self-removing function to HOOK-OR-FUNCTION. - -FORMS are evaluated once, when that function/hook is first invoked, then never -again. - -HOOK-OR-FUNCTION can be a quoted hook or a sharp-quoted function (which will be -advised)." - (declare (indent 1)) - (let ((append (if (eq (car forms) :after) (pop forms))) - ;; Avoid `make-symbol' and `gensym' here because an interned symbol is - ;; easier to debug in backtraces (and is visible to `describe-function') - (fn (intern (format "doom--transient-%d-h" - (put 'add-transient-hook! 'counter - (1+ (or (get 'add-transient-hook! 'counter) - 0))))))) - `(let ((sym ,hook-or-function)) - (defun ,fn (&rest _) - ,(format "Transient hook for %S" (doom-unquote hook-or-function)) - ,@forms - (let ((sym ,hook-or-function)) - (cond ((functionp sym) (advice-remove sym #',fn)) - ((symbolp sym) (remove-hook sym #',fn)))) - (unintern ',fn nil)) - (cond ((functionp sym) - (advice-add ,hook-or-function ,(if append :after :before) #',fn)) - ((symbolp sym) - (put ',fn 'permanent-local-hook t) - (add-hook sym #',fn ,append)))))) - -(defmacro add-hook! (hooks &rest rest) - "A convenience macro for adding N functions to M hooks. - -This macro accepts, in order: - - 1. The mode(s) or hook(s) to add to. This is either an unquoted mode, an - unquoted list of modes, a quoted hook variable or a quoted list of hook - variables. - 2. Optional properties :local, :append, and/or :depth [N], which will make the - hook buffer-local or append to the list of hooks (respectively), - 3. The function(s) to be added: this can be a quoted function, a quoted list - thereof, a list of `defun' or `cl-defun' forms, or arbitrary forms (will - implicitly be wrapped in a lambda). - -\(fn HOOKS [:append :local [:depth N]] FUNCTIONS-OR-FORMS...)" - (declare (indent (lambda (indent-point state) - (goto-char indent-point) - (when (looking-at-p "\\s-*(") - (lisp-indent-defform state indent-point)))) - (debug t)) - (let* ((hook-forms (doom--resolve-hook-forms hooks)) - (func-forms ()) - (defn-forms ()) - append-p local-p remove-p depth) - (while (keywordp (car rest)) - (pcase (pop rest) - (:append (setq append-p t)) - (:depth (setq depth (pop rest))) - (:local (setq local-p t)) - (:remove (setq remove-p t)))) - (while rest - (let* ((next (pop rest)) - (first (car-safe next))) - (push (cond ((memq first '(function nil)) - next) - ((eq first 'quote) - (let ((quoted (cadr next))) - (if (atom quoted) - next - (when (cdr quoted) - (setq rest (cons (list first (cdr quoted)) rest))) - (list first (car quoted))))) - ((memq first '(defun cl-defun)) - (push next defn-forms) - (list 'function (cadr next))) - ((prog1 `(lambda (&rest _) ,@(cons next rest)) - (setq rest nil)))) - func-forms))) - `(progn - ,@defn-forms - (dolist (hook (nreverse ',hook-forms)) - (dolist (func (list ,@func-forms)) - ,(if remove-p - `(remove-hook hook func ,local-p) - `(add-hook hook func ,(or depth append-p) ,local-p))))))) - -(defmacro remove-hook! (hooks &rest rest) - "A convenience macro for removing N functions from M hooks. - -Takes the same arguments as `add-hook!'. - -If N and M = 1, there's no benefit to using this macro over `remove-hook'. - -\(fn HOOKS [:append :local] FUNCTIONS)" - (declare (indent defun) (debug t)) - `(add-hook! ,hooks :remove ,@rest)) - -(defmacro setq-hook! (hooks &rest var-vals) - "Sets buffer-local variables on HOOKS. - -\(fn HOOKS &rest [SYM VAL]...)" - (declare (indent 1)) - (macroexp-progn - (cl-loop for (var val hook fn) in (doom--setq-hook-fns hooks var-vals) - collect `(defun ,fn (&rest _) - ,(format "%s = %s" var (pp-to-string val)) - (setq-local ,var ,val)) - collect `(remove-hook ',hook #',fn) ; ensure set order - collect `(add-hook ',hook #',fn)))) - -(defmacro unsetq-hook! (hooks &rest vars) - "Unbind setq hooks on HOOKS for VARS. - -\(fn HOOKS &rest [SYM VAL]...)" - (declare (indent 1)) - (macroexp-progn - (cl-loop for (_var _val hook fn) - in (doom--setq-hook-fns hooks vars 'singles) - collect `(remove-hook ',hook #',fn)))) - - -;;; Definers -(defmacro defadvice! (symbol arglist &optional docstring &rest body) - "Define an advice called SYMBOL and add it to PLACES. - -ARGLIST is as in `defun'. WHERE is a keyword as passed to `advice-add', and -PLACE is the function to which to add the advice, like in `advice-add'. -DOCSTRING and BODY are as in `defun'. - -\(fn SYMBOL ARGLIST &optional DOCSTRING &rest [WHERE PLACES...] BODY\)" - (declare (doc-string 3) (indent defun)) - (unless (stringp docstring) - (push docstring body) - (setq docstring nil)) - (let (where-alist) - (while (keywordp (car body)) - (push `(cons ,(pop body) (doom-enlist ,(pop body))) - where-alist)) - `(progn - (defun ,symbol ,arglist ,docstring ,@body) - (dolist (targets (list ,@(nreverse where-alist))) - (dolist (target (cdr targets)) - (advice-add target (car targets) #',symbol)))))) - -(defmacro undefadvice! (symbol _arglist &optional docstring &rest body) - "Undefine an advice called SYMBOL. - -This has the same signature as `defadvice!' an exists as an easy undefiner when -testing advice (when combined with `rotate-text'). - -\(fn SYMBOL ARGLIST &optional DOCSTRING &rest [WHERE PLACES...] BODY\)" - (declare (doc-string 3) (indent defun)) - (let (where-alist) - (unless (stringp docstring) - (push docstring body)) - (while (keywordp (car body)) - (push `(cons ,(pop body) (doom-enlist ,(pop body))) - where-alist)) - `(dolist (targets (list ,@(nreverse where-alist))) - (dolist (target (cdr targets)) - (advice-remove target #',symbol))))) - - -;; -;;; Backports - -;; None at the moment! - -(provide 'core-lib) -;;; core-lib.el ends here diff --git a/.config/emacs/core/core-modules.el b/.config/emacs/core/core-modules.el deleted file mode 100644 index fc66263..0000000 --- a/.config/emacs/core/core-modules.el +++ /dev/null @@ -1,572 +0,0 @@ -;;; core-modules.el --- module & package management system -*- lexical-binding: t; -*- - -(defvar doom-init-modules-p nil - "Non-nil if `doom-initialize-modules' has run.") - -(defvar doom-modules (make-hash-table :test 'equal) - "A hash table of enabled modules. Set by `doom-initialize-modules'.") - -(defvar doom-modules-dirs - (list (expand-file-name "modules/" doom-private-dir) - doom-modules-dir) - "A list of module root directories. Order determines priority.") - -(defvar doom-module-init-file "init" - "The basename of init files for modules. - -Init files are loaded early, just after Doom core, and before modules' config -files. They are always loaded, even in non-interactive sessions, and before -`doom-before-init-modules-hook'. Related to `doom-module-config-file'.") - -(defvar doom-module-config-file "config" - "The basename of config files for modules. - -Config files are loaded later, and almost always in interactive sessions. These -run before `doom-init-modules-hook'. Relevant to `doom-module-init-file'.") - -(defconst doom-obsolete-modules - '((:feature (version-control (:emacs vc) (:ui vc-gutter)) - (spellcheck (:checkers spell)) - (syntax-checker (:checkers syntax)) - (evil (:editor evil)) - (snippets (:editor snippets)) - (file-templates (:editor file-templates)) - (workspaces (:ui workspaces)) - (eval (:tools eval)) - (lookup (:tools lookup)) - (debugger (:tools debugger))) - (:tools (rotate-text (:editor rotate-text)) - (vterm (:term vterm)) - (password-store (:tools pass)) - (flycheck (:checkers syntax)) - (flyspell (:checkers spell)) - (macos (:os macos))) - (:emacs (electric-indent (:emacs electric)) - (hideshow (:editor fold)) - (eshell (:term eshell)) - (term (:term term))) - (:ui (doom-modeline (:ui modeline)) - (fci (:ui fill-column)) - (evil-goggles (:ui ophints)) - (tabbar (:ui tabs)) - (pretty-code (:ui ligatures))) - (:app (email (:email mu4e)) - (notmuch (:email notmuch))) - (:lang (perl (:lang raku)))) - "A tree alist that maps deprecated modules to their replacement(s). - -Each entry is a three-level tree. For example: - - (:feature (version-control (:emacs vc) (:ui vc-gutter)) - (spellcheck (:checkers spell)) - (syntax-checker (:tools flycheck))) - -This marks :feature version-control, :feature spellcheck and :feature -syntax-checker modules obsolete. e.g. If :feature version-control is found in -your `doom!' block, a warning is emitted before replacing it with :emacs vc and -:ui vc-gutter.") - -(defvar doom-inhibit-module-warnings doom-interactive-p - "If non-nil, don't emit deprecated or missing module warnings at startup.") - -;;; Custom hooks -(defvar doom-before-init-modules-hook nil - "A list of hooks to run before Doom's modules' config.el files are loaded, but -after their init.el files are loaded.") - -(defvar doom-init-modules-hook nil - "A list of hooks to run after Doom's modules' config.el files have loaded, but -before the user's private module.") - -(defvaralias 'doom-after-init-modules-hook 'after-init-hook) - -(defvar doom--current-module nil) -(defvar doom--current-flags nil) - - -;; -;;; Bootstrap API - -(defun doom-initialize-core-modules () - "Load Doom's core files for an interactive session." - (require 'core-keybinds) - (require 'core-ui) - (require 'core-projects) - (require 'core-editor)) - -(defun doom-module-loader (file) - "Return a closure that loads FILE from a module. - -This closure takes two arguments: a cons cell containing (CATEGORY . MODULE) -symbols, and that module's plist." - (declare (pure t) (side-effect-free t)) - (lambda (module plist) - (let ((doom--current-module module) - (doom--current-flags (plist-get plist :flags)) - (inhibit-redisplay t)) - (load! file (plist-get plist :path) t)))) - -(defun doom-initialize-modules (&optional force-p no-config-p) - "Loads the init.el in `doom-private-dir' and sets up hooks for a healthy -session of Dooming. Will noop if used more than once, unless FORCE-P is -non-nil." - (when (or force-p (not doom-init-modules-p)) - (setq doom-init-modules-p t) - (unless no-config-p - (doom-log "Initializing core modules") - (doom-initialize-core-modules)) - (when-let (init-p (load! doom-module-init-file doom-private-dir t)) - (doom-log "Initializing user config") - (maphash (doom-module-loader doom-module-init-file) doom-modules) - (doom-run-hooks 'doom-before-init-modules-hook) - (unless no-config-p - (maphash (doom-module-loader doom-module-config-file) doom-modules) - (doom-run-hooks 'doom-init-modules-hook) - (load! "config" doom-private-dir t) - (when custom-file - (load custom-file 'noerror (not doom-debug-mode))))))) - - -;; -;;; Module API - -(defun doom-module-p (category module &optional flag) - "Returns t if CATEGORY MODULE is enabled (ie. present in `doom-modules')." - (declare (pure t) (side-effect-free t)) - (when-let (plist (gethash (cons category module) doom-modules)) - (or (null flag) - (and (memq flag (plist-get plist :flags)) - t)))) - -(defun doom-module-get (category module &optional property) - "Returns the plist for CATEGORY MODULE. Gets PROPERTY, specifically, if set." - (declare (pure t) (side-effect-free t)) - (when-let (plist (gethash (cons category module) doom-modules)) - (if property - (plist-get plist property) - plist))) - -(defun doom-module-put (category module &rest plist) - "Set a PROPERTY for CATEGORY MODULE to VALUE. PLIST should be additional pairs -of PROPERTY and VALUEs. - -\(fn CATEGORY MODULE PROPERTY VALUE &rest [PROPERTY VALUE [...]])" - (puthash (cons category module) - (if-let (old-plist (doom-module-get category module)) - (if (null plist) - old-plist - (when (cl-oddp (length plist)) - (signal 'wrong-number-of-arguments (list (length plist)))) - (while plist - (plist-put old-plist (pop plist) (pop plist))) - old-plist) - plist) - doom-modules)) - -(defun doom-module-set (category module &rest plist) - "Enables a module by adding it to `doom-modules'. - -CATEGORY is a keyword, module is a symbol, PLIST is a plist that accepts the -following properties: - - :flags [SYMBOL LIST] list of enabled category flags - :path [STRING] path to category root directory - -Example: - (doom-module-set :lang 'haskell :flags '(+lsp))" - (puthash (cons category module) plist doom-modules)) - -(defun doom-module-path (category module &optional file) - "Like `expand-file-name', but expands FILE relative to CATEGORY (keywordp) and -MODULE (symbol). - -If the category isn't enabled this will always return nil. For finding disabled -modules use `doom-module-locate-path'." - (let ((path (doom-module-get category module :path))) - (if file - (let (file-name-handler-alist) - (expand-file-name file path)) - path))) - -(defun doom-module-locate-path (category &optional module file) - "Searches `doom-modules-dirs' to find the path to a module. - -CATEGORY is a keyword (e.g. :lang) and MODULE is a symbol (e.g. 'python). FILE -is a string that will be appended to the resulting path. If no path exists, this -returns nil, otherwise an absolute path. - -This doesn't require modules to be enabled. For enabled modules us -`doom-module-path'." - (when (keywordp category) - (setq category (doom-keyword-name category))) - (when (and module (symbolp module)) - (setq module (symbol-name module))) - (cl-loop with file-name-handler-alist = nil - for default-directory in doom-modules-dirs - for path = (concat category "/" module "/" file) - if (file-exists-p path) - return (expand-file-name path))) - -(defun doom-module-from-path (&optional path enabled-only) - "Returns a cons cell (CATEGORY . MODULE) derived from PATH (a file path). -If ENABLED-ONLY, return nil if the containing module isn't enabled." - (if (null path) - (if doom--current-module - (if enabled-only - (and (doom-module-p (car doom--current-module) - (cdr doom--current-module)) - doom--current-module) - doom--current-module) - (ignore-errors - (doom-module-from-path (file!)))) - (let* ((file-name-handler-alist nil) - (path (expand-file-name (or path (file!))))) - (save-match-data - (cond ((string-match "/modules/\\([^/]+\\)/\\([^/]+\\)\\(?:/.*\\)?$" path) - (when-let* ((category (doom-keyword-intern (match-string 1 path))) - (module (intern (match-string 2 path)))) - (and (or (null enabled-only) - (doom-module-p category module)) - (cons category module)))) - ((or (string-match-p (concat "^" (regexp-quote doom-core-dir)) path) - (file-in-directory-p path doom-core-dir)) - (cons :core (intern (file-name-base path)))) - ((or (string-match-p (concat "^" (regexp-quote doom-private-dir)) path) - (file-in-directory-p path doom-private-dir)) - (cons :private (intern (file-name-base path))))))))) - -(defun doom-module-load-path (&optional module-dirs) - "Return a list of file paths to activated modules. - -The list is in no particular order and its file paths are absolute. If -MODULE-DIRS is non-nil, include all modules (even disabled ones) available in -those directories. The first returned path is always `doom-private-dir'." - (declare (pure t) (side-effect-free t)) - (append (list doom-private-dir) - (if module-dirs - (mapcar (lambda (m) (doom-module-locate-path (car m) (cdr m))) - (delete-dups - (doom-files-in (if (listp module-dirs) - module-dirs - doom-modules-dirs) - :map #'doom-module-from-path - :type 'dirs - :mindepth 1 - :depth 1))) - (delq - nil (cl-loop for plist being the hash-values of doom-modules - collect (plist-get plist :path)) )) - nil)) - -(defun doom-module-mplist-map (fn mplist) - "Apply FN to each module in MPLIST." - (let ((mplist (copy-sequence mplist)) - (inhibit-message doom-inhibit-module-warnings) - obsolete - results - category m) - (while mplist - (setq m (pop mplist)) - (cond ((keywordp m) - (setq category m - obsolete (assq m doom-obsolete-modules))) - ((null category) - (error "No module category specified for %s" m)) - ((and (listp m) (keywordp (car m))) - (pcase (car m) - (:cond - (cl-loop for (cond . mods) in (cdr m) - if (eval cond t) - return (prependq! mplist mods))) - (:if (if (eval (cadr m) t) - (push (caddr m) mplist) - (prependq! mplist (cdddr m)))) - (test (if (xor (eval (cadr m) t) - (eq test :unless)) - (prependq! mplist (cddr m)))))) - ((catch 'doom-modules - (let* ((module (if (listp m) (car m) m)) - (flags (if (listp m) (cdr m)))) - (when-let (new (assq module obsolete)) - (let ((newkeys (cdr new))) - (if (null newkeys) - (message "WARNING %s module was removed" (list category module)) - (if (cdr newkeys) - (message "WARNING %s module was removed and split into the %s modules" - (list category module) (mapconcat #'prin1-to-string newkeys ", ")) - (message "WARNING %s module was moved to %s" - (list category module) (car newkeys))) - (push category mplist) - (dolist (key newkeys) - (push (if flags - (nconc (cdr key) flags) - (cdr key)) - mplist) - (push (car key) mplist)) - (throw 'doom-modules t)))) - (let ((path (doom-module-locate-path category module))) - (push (funcall fn category module - :flags (if (listp m) (cdr m)) - :path (if (stringp path) (file-truename path))) - results))))))) - (unless doom-interactive-p - (setq doom-inhibit-module-warnings t)) - (nreverse results))) - -(defun doom-module-list (&optional all-p) - "Minimally initialize `doom-modules' (a hash table) and return it. -This value is cached. If REFRESH-P, then don't use the cached value." - (if all-p - (mapcar #'doom-module-from-path (cdr (doom-module-load-path 'all))) - doom-modules)) - - -;; -;;; Use-package modifications - -(defvar doom--deferred-packages-alist '(t)) - -(autoload 'use-package "use-package-core" nil nil t) - -(setq use-package-compute-statistics doom-debug-p - use-package-verbose doom-debug-p - use-package-minimum-reported-time (if doom-debug-p 0 0.1) - use-package-expand-minimally doom-interactive-p) - -;; A common mistake for new users is that they inadvertently install their -;; packages with package.el, by copying over old `use-package' declarations with -;; an :ensure t property. Doom doesn't use package.el, so this will throw an -;; error that will confuse beginners, so we disable `:ensure'. -(setq use-package-ensure-function - (lambda (name &rest _) - (message "Ignoring ':ensure t' in '%s' config" name))) -;; ...On the other hand, if the user has loaded `package', then we should assume -;; they know what they're doing and restore the old behavior: -(add-transient-hook! 'package-initialize - (when (eq use-package-ensure-function #'ignore) - (setq use-package-ensure-function #'use-package-ensure-elpa))) - -(with-eval-after-load 'use-package-core - ;; `use-package' adds syntax highlighting for the `use-package' macro, but - ;; Emacs 26+ already highlights macros, so it's redundant. - (font-lock-remove-keywords 'emacs-lisp-mode use-package-font-lock-keywords) - - ;; We define :minor and :magic-minor from the `auto-minor-mode' package here - ;; so we don't have to load `auto-minor-mode' so early. - (dolist (keyword '(:minor :magic-minor)) - (setq use-package-keywords - (use-package-list-insert keyword use-package-keywords :commands))) - - (defalias 'use-package-normalize/:minor #'use-package-normalize-mode) - (defun use-package-handler/:minor (name _ arg rest state) - (use-package-handle-mode name 'auto-minor-mode-alist arg rest state)) - - (defalias 'use-package-normalize/:magic-minor #'use-package-normalize-mode) - (defun use-package-handler/:magic-minor (name _ arg rest state) - (use-package-handle-mode name 'auto-minor-mode-magic-alist arg rest state)) - - ;; HACK Fix `:load-path' so it resolves relative paths to the containing file, - ;; rather than `user-emacs-directory'. This is a done as a convenience - ;; for users, wanting to specify a local directory. - (defadvice! doom--resolve-load-path-from-containg-file-a (fn label arg &optional recursed) - "Resolve :load-path from the current directory." - :around #'use-package-normalize-paths - ;; `use-package-normalize-paths' resolves paths relative to - ;; `user-emacs-directory', so we change that. - (let ((user-emacs-directory (if (stringp arg) (dir!)))) - (funcall fn label arg recursed))) - - ;; Adds two keywords to `use-package' to expand its lazy-loading capabilities: - ;; - ;; :after-call SYMBOL|LIST - ;; :defer-incrementally SYMBOL|LIST|t - ;; - ;; Check out `use-package!'s documentation for more about these two. - (dolist (keyword '(:defer-incrementally :after-call)) - (push keyword use-package-deferring-keywords) - (setq use-package-keywords - (use-package-list-insert keyword use-package-keywords :after))) - - (defalias 'use-package-normalize/:defer-incrementally #'use-package-normalize-symlist) - (defun use-package-handler/:defer-incrementally (name _keyword targets rest state) - (use-package-concat - `((doom-load-packages-incrementally - ',(if (equal targets '(t)) - (list name) - (append targets (list name))))) - (use-package-process-keywords name rest state))) - - (defalias 'use-package-normalize/:after-call #'use-package-normalize-symlist) - (defun use-package-handler/:after-call (name _keyword hooks rest state) - (if (plist-get state :demand) - (use-package-process-keywords name rest state) - (let ((fn (make-symbol (format "doom--after-call-%s-h" name)))) - (use-package-concat - `((fset ',fn - (lambda (&rest _) - (doom-log "Loading deferred package %s from %s" ',name ',fn) - (condition-case e - ;; If `default-directory' is a directory that doesn't - ;; exist or is unreadable, Emacs throws up file-missing - ;; errors, so we set it to a directory we know exists and - ;; is readable. - (let ((default-directory doom-emacs-dir)) - (require ',name)) - ((debug error) - (message "Failed to load deferred package %s: %s" ',name e))) - (when-let (deferral-list (assq ',name doom--deferred-packages-alist)) - (dolist (hook (cdr deferral-list)) - (advice-remove hook #',fn) - (remove-hook hook #',fn)) - (delq! deferral-list doom--deferred-packages-alist) - (unintern ',fn nil))))) - (let (forms) - (dolist (hook hooks forms) - (push (if (string-match-p "-\\(?:functions\\|hook\\)$" (symbol-name hook)) - `(add-hook ',hook #',fn) - `(advice-add #',hook :before #',fn)) - forms))) - `((unless (assq ',name doom--deferred-packages-alist) - (push '(,name) doom--deferred-packages-alist)) - (nconc (assq ',name doom--deferred-packages-alist) - '(,@hooks))) - (use-package-process-keywords name rest state)))))) - - -;; -;;; Module config macros - -(put :if 'lisp-indent-function 2) -(put :when 'lisp-indent-function 'defun) -(put :unless 'lisp-indent-function 'defun) - -(defmacro doom! (&rest modules) - "Bootstraps DOOM Emacs and its modules. - -If the first item in MODULES doesn't satisfy `keywordp', MODULES is evaluated, -otherwise, MODULES is a multiple-property list (a plist where each key can have -multiple, linear values). - -The bootstrap process involves making sure the essential directories exist, core -packages are installed, `doom-autoloads-file' is loaded, `doom-packages-file' -cache exists (and is loaded) and, finally, loads your private init.el (which -should contain your `doom!' block). - -The overall load order of Doom is as follows: - - ~/.emacs.d/init.el - ~/.emacs.d/core/core.el - $DOOMDIR/init.el - {$DOOMDIR,~/.emacs.d}/modules/*/*/init.el - `doom-before-init-modules-hook' - {$DOOMDIR,~/.emacs.d}/modules/*/*/config.el - `doom-init-modules-hook' - $DOOMDIR/config.el - `doom-after-init-modules-hook' - `after-init-hook' - `emacs-startup-hook' - `window-setup-hook' - -Module load order is determined by your `doom!' block. See `doom-modules-dirs' -for a list of all recognized module trees. Order defines precedence (from most -to least)." - `(unless doom-interactive-p - (doom-module-mplist-map - (lambda (category module &rest plist) - (if (plist-member plist :path) - (apply #'doom-module-set category module plist) - (message "WARNING Couldn't find the %s %s module" category module))) - ,@(if (keywordp (car modules)) - (list (list 'quote modules)) - modules)) - doom-modules)) - -(defvar doom-disabled-packages) -(defmacro use-package! (name &rest plist) - "Declares and configures a package. - -This is a thin wrapper around `use-package', and is ignored if the NAME package -is disabled by the user (with `package!'). - -See `use-package' to see what properties can be provided. Doom adds support for -two extra properties: - -:after-call SYMBOL|LIST - Takes a symbol or list of symbols representing functions or hook variables. - The first time any of these functions or hooks are executed, the package is - loaded. - -:defer-incrementally SYMBOL|LIST|t - Takes a symbol or list of symbols representing packages that will be loaded - incrementally at startup before this one. This is helpful for large packages - like magit or org, which load a lot of dependencies on first load. This lets - you load them piece-meal during idle periods, so that when you finally do need - the package, it'll load quicker. - - NAME is implicitly added if this property is present and non-nil. No need to - specify it. A value of `t' implies NAME." - (declare (indent 1)) - (unless (or (memq name doom-disabled-packages) - ;; At compile-time, use-package will forcibly load packages to - ;; prevent compile-time errors. However, if a Doom user has - ;; disabled packages you get file-missing package errors, so it's - ;; necessary to check for packages at compile time: - (and (bound-and-true-p byte-compile-current-file) - (not (locate-library (symbol-name name))))) - `(use-package ,name ,@plist))) - -(defmacro use-package-hook! (package when &rest body) - "Reconfigures a package's `use-package!' block. - -This macro must be used *before* PACKAGE's `use-package!' block. Often, this -means using it from your DOOMDIR/init.el. - -Under the hood, this uses use-package's `use-package-inject-hooks'. - -PACKAGE is a symbol; the package's name. -WHEN should be one of the following: - :pre-init :post-init :pre-config :post-config - -WARNINGS: -- The use of this macro is more often than not a code smell. Use it as last - resort. There is almost always a better alternative. -- If you are using this solely for :post-config, stop! `after!' is much better. -- If :pre-init or :pre-config hooks return nil, the original `use-package!''s - :init/:config block (respectively) is overwritten, so remember to have them - return non-nil (or exploit that to overwrite Doom's config)." - (declare (indent defun)) - (unless (memq when '(:pre-init :post-init :pre-config :post-config)) - (error "'%s' isn't a valid hook for use-package-hook!" when)) - `(progn - (setq use-package-inject-hooks t) - (add-hook ',(intern (format "use-package--%s--%s-hook" - package - (substring (symbol-name when) 1))) - (lambda () ,@body) - 'append))) - -(defmacro featurep! (category &optional module flag) - "Returns t if CATEGORY MODULE is enabled. - -If FLAG is provided, returns t if CATEGORY MODULE has FLAG enabled. - - (featurep! :config default) - -Module FLAGs are set in your config's `doom!' block, typically in -~/.doom.d/init.el. Like so: - - :config (default +flag1 -flag2) - -CATEGORY and MODULE can be omitted When this macro is used from inside a module -(except your DOOMDIR, which is a special module). e.g. (featurep! +flag)" - (and (cond (flag (memq flag (doom-module-get category module :flags))) - (module (doom-module-p category module)) - (doom--current-flags (memq category doom--current-flags)) - ((if-let (module (doom-module-from-path)) - (memq category (doom-module-get (car module) (cdr module) :flags)) - (error "(featurep! %s %s %s) couldn't figure out what module it was called from (in %s)" - category module flag (file!))))) - t)) - -(provide 'core-modules) -;;; core-modules.el ends here diff --git a/.config/emacs/core/core-packages.el b/.config/emacs/core/core-packages.el deleted file mode 100644 index f1eac4f..0000000 --- a/.config/emacs/core/core-packages.el +++ /dev/null @@ -1,600 +0,0 @@ -;;; core/core-packages.el -*- lexical-binding: t; -*- - -;; Emacs package management is opinionated, and so is Doom. Doom uses `straight' -;; to create a declarative, lazy-loaded and (nominally) reproducible package -;; management system. We use `straight' over `package' because the latter is -;; tempermental. ELPA sources suffer downtime occasionally and often fail to -;; build packages when GNU Tar is unavailable (e.g. MacOS users start with BSD -;; tar). Known gnutls errors plague the current stable release of Emacs (26.x) -;; which bork TLS handshakes with ELPA repos (mainly gnu.elpa.org). See -;; https://debbugs.gnu.org/cgi/bugreport.cgi?bug=3434. -;; -;; What's worse, you can only get the latest version of packages through ELPA. -;; In an ecosystem that is constantly changing, this is more frustrating than -;; convenient. Straight (and Doom) can do rolling release, but it is opt-in. -;; -;; Interacting with this package management system is done through Doom's -;; bin/doom script. Find out more about it by running 'doom help' (I highly -;; recommend you add the script to your PATH). Here are some highlights: -;; -;; + `bin/doom install`: a wizard that guides you through setting up Doom and -;; your private config for the first time. -;; + `bin/doom sync`: your go-to command for making sure Doom is in optimal -;; condition. It ensures all unneeded packages are removed, all needed ones -;; are installed, and all metadata associated with them is generated. -;; + `bin/doom upgrade`: upgrades Doom Emacs and your packages to the latest -;; versions. There's also 'bin/doom sync -u' for updating only your packages. -;; -;; How this works is: the system reads packages.el files located in each -;; activated module, your private directory (`doom-private-dir'), and one in -;; `doom-core-dir'. These contain `package!' declarations that tell DOOM what -;; plugins to install and where from. -;; -;; All that said, you can still use package.el's commands, but 'bin/doom sync' -;; will purge ELPA packages. - -(defvar doom-packages () - "A list of enabled packages. Each element is a sublist, whose CAR is the -package's name as a symbol, and whose CDR is the plist supplied to its -`package!' declaration. Set by `doom-initialize-packages'.") - -(defvar doom-disabled-packages () - "A list of packages that should be ignored by `use-package!' and `after!'.") - -(defvar doom-packages-file "packages" - "The basename of packages file for modules. - -Package files are read whenever Doom's package manager wants a manifest of all -desired packages. They are rarely read in interactive sessions (unless the user -uses a straight or package.el command directly).") - - -;; -;;; package.el - -;; Ensure that, if we do need package.el, it is configured correctly. You really -;; shouldn't be using it, but it may be convenient for quickly testing packages. -(setq package-enable-at-startup nil - package-user-dir (concat doom-local-dir "elpa/") - package-gnupghome-dir (expand-file-name "gpg" package-user-dir)) - -(after! package - (let ((s (if gnutls-verify-error "s" ""))) - (prependq! package-archives - ;; I omit Marmalade because its packages are manually submitted - ;; rather than pulled, and so often out of date. - `(("melpa" . ,(format "http%s://melpa.org/packages/" s)) - ("org" . ,(format "http%s://orgmode.org/elpa/" s)))))) - -;; Refresh package.el the first time you call `package-install', so it can still -;; be used (e.g. to temporarily test packages). Remember to run 'doom sync' to -;; purge them; they can conflict with packages installed via straight! -(add-transient-hook! 'package-install (package-refresh-contents)) - - -;; -;;; Straight - -(setq straight-base-dir (file-truename doom-local-dir) - straight-repository-branch "develop" - ;; Since byte-code is rarely compatible across different versions of - ;; Emacs, it's best we build them in separate directories, per emacs - ;; version. - straight-build-dir (format "build-%s" emacs-version) - straight-cache-autoloads nil ; we already do this, and better. - ;; Doom doesn't encourage you to modify packages in place. Disabling this - ;; makes 'doom sync' instant (once everything set up), which is much nicer - ;; UX than the several seconds modification checks. - straight-check-for-modifications nil - ;; We handle package.el ourselves (and a little more comprehensively) - straight-enable-package-integration nil - ;; Before switching to straight, `doom-local-dir' would average out at - ;; around 100mb with half Doom's modules at ~230 packages. Afterwards, at - ;; around 1gb. With shallow cloning, that is reduced to ~400mb. This has - ;; no affect on packages that are pinned, however (run 'doom purge' to - ;; compact those after-the-fact). Some packages break when shallow cloned - ;; (like magit and org), but we'll deal with that elsewhere. - straight-vc-git-default-clone-depth '(1 single-branch)) - -(with-eval-after-load 'straight - ;; `let-alist' is built into Emacs 26 and onwards - (add-to-list 'straight-built-in-pseudo-packages 'let-alist)) - -(defadvice! doom--read-pinned-packages-a (fn &rest args) - "Read `:pin's in `doom-packages' on top of straight's lockfiles." - :around #'straight--lockfile-read-all - (append (apply fn args) ; lockfiles still take priority - (doom-package-pinned-list))) - - -;; -;;; Bootstrappers - -(defun doom--ensure-straight (recipe pin) - (let ((repo-dir (doom-path straight-base-dir "straight/repos/straight.el")) - (repo-url (concat "http" (if gnutls-verify-error "s") - "://github.com/" - (or (plist-get recipe :repo) "raxod502/straight.el"))) - (branch (or (plist-get recipe :branch) straight-repository-branch)) - (call (if doom-debug-p - (lambda (&rest args) - (print! "%s" (cdr (apply #'doom-call-process args)))) - (lambda (&rest args) - (apply #'doom-call-process args))))) - (unless (file-directory-p repo-dir) - (save-match-data - (unless (executable-find "git") - (user-error "Git isn't present on your system. Cannot proceed.")) - (let* ((version (cdr (doom-call-process "git" "version"))) - (version - (and (string-match "\\_<[0-9]+\\.[0-9]+\\(\\.[0-9]+\\)\\_>" version) - (match-string 0 version)))) - (if version - (when (version< version "2.23") - (user-error "Git %s detected! Doom requires git 2.23 or newer!" - version))))) - (print! (start "Installing straight...")) - (print-group! - (cl-destructuring-bind (depth . options) - (doom-enlist straight-vc-git-default-clone-depth) - (let ((branch-switch (if (memq 'single-branch options) - "--single-branch" - "--no-single-branch"))) - (cond - ((eq 'full depth) - (funcall call "git" "clone" "--origin" "origin" - branch-switch repo-url repo-dir)) - ((integerp depth) - (if (null pin) - (progn - (when (file-directory-p repo-dir) - (delete-directory repo-dir 'recursive)) - (funcall call "git" "clone" "--origin" "origin" repo-url - "--no-checkout" repo-dir - "--depth" (number-to-string depth) - branch-switch - "--no-tags" - "--branch" straight-repository-branch)) - (make-directory repo-dir 'recursive) - (let ((default-directory repo-dir)) - (funcall call "git" "init") - (funcall call "git" "branch" "-m" straight-repository-branch) - (funcall call "git" "remote" "add" "origin" repo-url - "--master" straight-repository-branch) - (funcall call "git" "fetch" "origin" pin - "--depth" (number-to-string depth) - "--no-tags") - (funcall call "git" "reset" "--hard" pin))))))))) - (require 'straight (concat repo-dir "/straight.el")) - (doom-log "Initializing recipes") - (mapc #'straight-use-recipes - '((org-elpa :local-repo nil) - (melpa :type git :host github - :repo "melpa/melpa" - :build nil) - (gnu-elpa-mirror :type git :host github - :repo "emacs-straight/gnu-elpa-mirror" - :build nil) - (el-get :type git :host github - :repo "dimitri/el-get" - :build nil) - (emacsmirror-mirror :type git :host github - :repo "emacs-straight/emacsmirror-mirror" - :build nil))))) - -(defun doom--ensure-core-packages (packages) - (doom-log "Installing core packages") - (dolist (package packages) - (let* ((name (car package)) - (repo (symbol-name name))) - (when-let (recipe (plist-get (cdr package) :recipe)) - (straight-override-recipe (cons name recipe)) - (when-let (local-repo (plist-get recipe :local-repo)) - (setq repo local-repo))) - (print-group! - ;; Only clone the package, don't build them. Straight hasn't been fully - ;; configured by this point. - (straight-use-package name nil t)) - ;; In case the package hasn't been built yet. - (or (member (directory-file-name (straight--build-dir (symbol-name name))) - load-path) - (add-to-list 'load-path (directory-file-name (straight--repos-dir repo))))))) - -(defun doom-initialize-core-packages (&optional force-p) - "Ensure `straight' is installed and was compiled with this version of Emacs." - (when (or force-p (null (bound-and-true-p straight-recipe-repositories))) - (doom-log "Initializing straight") - (let ((packages (doom-package-list nil 'core))) - (cl-destructuring-bind (&key recipe pin &allow-other-keys) - (alist-get 'straight packages) - (doom--ensure-straight recipe pin)) - (doom--ensure-core-packages packages)))) - -(defun doom-initialize-packages (&optional force-p) - "Process all packages, essential and otherwise, if they haven't already been. - -If FORCE-P is non-nil, do it anyway. - -This ensures `doom-packages' is populated and `straight' recipes are properly -processed." - (doom-initialize-core-packages force-p) - (when (or force-p (not (bound-and-true-p package--initialized))) - (doom-log "Initializing package.el") - (require 'package) - (package-initialize) - (unless package--initialized - (error "Failed to initialize package.el"))) - (when (or force-p (null doom-packages)) - (doom-log "Initializing straight.el") - (setq doom-disabled-packages nil - doom-packages (doom-package-list)) - (let (packages) - (dolist (package doom-packages) - (cl-destructuring-bind - (name &key recipe disable ignore &allow-other-keys) package - (if ignore - (straight-override-recipe (cons name '(:type built-in))) - (if disable - (cl-pushnew name doom-disabled-packages) - (when recipe - (straight-override-recipe (cons name recipe))) - (appendq! packages (cons name (straight--get-dependencies name))))))) - (dolist (package (cl-delete-duplicates packages :test #'equal)) - (straight-register-package package) - (let ((name (symbol-name package))) - (add-to-list 'load-path (directory-file-name (straight--build-dir name))) - (straight--load-package-autoloads name)))))) - - -;; -;;; Package management API - -(defun doom-package-get (package &optional prop nil-value) - "Returns PACKAGE's `package!' recipe from `doom-packages'." - (let ((plist (cdr (assq package doom-packages)))) - (if prop - (if (plist-member plist prop) - (plist-get plist prop) - nil-value) - plist))) - -(defun doom-package-set (package prop value) - "Set PROPERTY in PACKAGE's recipe to VALUE." - (setf (alist-get package doom-packages) - (plist-put (alist-get package doom-packages) - prop value))) - -(defun doom-package-recipe (package &optional prop nil-value) - "Returns the `straight' recipe PACKAGE was registered with." - (let* ((recipe (straight-recipes-retrieve package)) - (plist (doom-plist-merge - (plist-get (alist-get package doom-packages) :recipe) - (cdr (if (memq (car recipe) '(quote \`)) - (eval recipe t) - recipe))))) - (if prop - (if (plist-member plist prop) - (plist-get plist prop) - nil-value) - plist))) - -(defun doom-package-recipe-repo (package) - "Resolve and return PACKAGE's (symbol) local-repo property." - (if-let* ((recipe (copy-sequence (doom-package-recipe package))) - (recipe (if (and (not (plist-member recipe :type)) - (memq (plist-get recipe :host) '(github gitlab bitbucket))) - (plist-put recipe :type 'git) - recipe)) - (repo (if-let (local-repo (plist-get recipe :local-repo)) - (directory-file-name local-repo) - (ignore-errors (straight-vc-local-repo-name recipe))))) - repo - (symbol-name package))) - -(defun doom-package-build-recipe (package &optional prop nil-value) - "Returns the `straight' recipe PACKAGE was installed with." - (let ((plist (nth 2 (gethash (symbol-name package) straight--build-cache)))) - (if prop - (if (plist-member plist prop) - (plist-get plist prop) - nil-value) - plist))) - -(defun doom-package-dependencies (package &optional recursive noerror) - "Return a list of dependencies for a package. - -If RECURSIVE is `tree', return a tree of dependencies. -If RECURSIVE is nil, only return PACKAGE's immediate dependencies. -If NOERROR, return nil in case of error." - (cl-check-type package symbol) - (let ((deps (straight-dependencies (symbol-name package)))) - (pcase recursive - (`tree deps) - (`t (flatten-list deps)) - (`nil (cl-remove-if #'listp deps))))) - -(defun doom-package-depending-on (package &optional noerror) - "Return a list of packages that depend on PACKAGE. - -If PACKAGE (a symbol) isn't installed, throw an error, unless NOERROR is -non-nil." - (cl-check-type package symbol) - ;; can't get dependencies for built-in packages - (unless (or (doom-package-build-recipe package) - noerror) - (error "Couldn't find %s, is it installed?" package)) - (straight-dependents (symbol-name package))) - -;;; Predicate functions -(defun doom-package-built-in-p (package) - "Return non-nil if PACKAGE (a symbol) is built-in." - (eq (doom-package-build-recipe package :type) - 'built-in)) - -(defun doom-package-installed-p (package) - "Return non-nil if PACKAGE (a symbol) is installed." - (file-directory-p (straight--build-dir (symbol-name package)))) - -(defun doom-package-is-type-p (package type) - "TODO" - (memq type (doom-enlist (doom-package-get package :type)))) - -(defun doom-package-in-module-p (package category &optional module) - "Return non-nil if PACKAGE was installed by the user's private config." - (when-let (modules (doom-package-get package :modules)) - (or (and (not module) (assq :private modules)) - (member (cons category module) modules)))) - -(defun doom-package-backend (package) - "Return 'straight, 'builtin, 'elpa or 'other, depending on how PACKAGE is -installed." - (cond ((gethash (symbol-name package) straight--build-cache) - 'straight) - ((or (doom-package-built-in-p package) - (assq package package--builtins)) - 'builtin) - ((assq package package-alist) - 'elpa) - ((locate-library (symbol-name package)) - 'other))) - - -;;; Package getters -(defun doom--read-packages (file &optional noeval noerror) - (condition-case-unless-debug e - (with-temp-buffer ; prevent buffer-local state from propagating - (if (not noeval) - (load file noerror 'nomessage 'nosuffix) - (when (file-exists-p file) - (insert-file-contents file) - (let (emacs-lisp-mode) (emacs-lisp-mode)) - ;; Scrape `package!' blocks from FILE for a comprehensive listing of - ;; packages used by this module. - (while (search-forward "(package!" nil t) - (let ((ppss (save-excursion (syntax-ppss)))) - ;; Don't collect packages in comments or strings - (unless (or (nth 3 ppss) - (nth 4 ppss)) - (goto-char (match-beginning 0)) - (cl-destructuring-bind (_ name . plist) - (read (current-buffer)) - (push (cons - name (plist-put - plist :modules - (list (doom-module-from-path file)))) - doom-packages)))))))) - (user-error - (user-error (error-message-string e))) - (error - (signal 'doom-package-error - (list (doom-module-from-path file) - file e))))) - -(defun doom-package-list (&optional all-p core-only-p) - "Retrieve a list of explicitly declared packages from enabled modules. - -If ALL-P, gather packages unconditionally across all modules, including disabled -ones." - (let ((packages-file (concat doom-packages-file ".el")) - doom-disabled-packages - doom-packages) - (doom--read-packages - (doom-path doom-core-dir packages-file) all-p 'noerror) - (unless core-only-p - (let ((private-packages (doom-path doom-private-dir packages-file)) - (doom-modules (doom-module-list))) - (if all-p - (mapc #'doom--read-packages - (doom-files-in doom-modules-dir - :depth 2 - :match "/packages\\.el$")) - ;; We load the private packages file twice to populate - ;; `doom-disabled-packages' disabled packages are seen ASAP, and a - ;; second time to ensure privately overridden packages are properly - ;; overwritten. - (let (doom-packages) - (doom--read-packages private-packages nil 'noerror)) - (cl-loop for key being the hash-keys of doom-modules - for path = (doom-module-path (car key) (cdr key) packages-file) - for doom--current-module = key - do (doom--read-packages path nil 'noerror))) - (doom--read-packages private-packages all-p 'noerror))) - (cl-remove-if-not - (if core-only-p - (lambda (pkg) (eq (plist-get (cdr pkg) :type) 'core)) - #'identity) - (nreverse doom-packages)))) - -(defun doom-package-pinned-list () - "Return an alist mapping package names (strings) to pinned commits (strings)." - (let (alist) - (dolist (package doom-packages alist) - (cl-destructuring-bind (name &key disable ignore pin unpin &allow-other-keys) - package - (when (and (not ignore) - (not disable) - (or pin unpin)) - (setf (alist-get (file-name-nondirectory (doom-package-recipe-repo name)) - alist nil 'remove #'equal) - (unless unpin pin))))))) - -(defun doom-package-recipe-list () - "Return straight recipes for non-builtin packages with a local-repo." - (let (recipes) - (dolist (recipe (hash-table-values straight--recipe-cache)) - (cl-destructuring-bind (&key local-repo type &allow-other-keys) - recipe - (unless (or (null local-repo) - (eq type 'built-in)) - (push recipe recipes)))) - (nreverse recipes))) - - -;; -;;; Module package macros - -(cl-defmacro package! - (name &rest plist &key built-in recipe ignore _type _pin _disable) - "Declares a package and how to install it (if applicable). - -This macro is declarative and does not load nor install packages. It is used to -populate `doom-packages' with metadata about the packages Doom needs to keep -track of. - -Only use this macro in a module's packages.el file. - -Accepts the following properties: - - :type core|local|built-in|virtual - Specifies what kind of package this is. Can be a symbol or a list thereof. - `core' = this is a protected package and cannot be disabled! - `local' = this package is being modified in-place. This package's repo is - unshallowed and will be skipped when you update packages. - `built-in' = this package is already built-in (otherwise, will be - installed) - `virtual' = this package is not tracked by Doom's package manager. It won't - be installed or uninstalled. Use this to pin 2nd order dependencies. - :recipe RECIPE - Specifies a straight.el recipe to allow you to acquire packages from external - sources. See https://github.com/raxod502/straight.el#the-recipe-format for - details on this recipe. - :disable BOOL - Do not install or update this package AND disable all of its `use-package!' - and `after!' blocks. - :ignore FORM - Do not install this package. - :pin STR|nil - Pin this package to commit hash STR. Setting this to nil will unpin this - package if previously pinned. - :built-in BOOL|'prefer - Same as :ignore if the package is a built-in Emacs package. This is more to - inform help commands like `doom/help-packages' that this is a built-in - package. If set to 'prefer, the package will not be installed if it is - already provided by Emacs. - -Returns t if package is successfully registered, and nil if it was disabled -elsewhere." - (declare (indent defun)) - (when (and recipe (keywordp (car-safe recipe))) - (plist-put! plist :recipe `(quote ,recipe))) - ;; :built-in t is basically an alias for :ignore (locate-library NAME) - (when built-in - (when (and (not ignore) - (equal built-in '(quote prefer))) - (setq built-in `(locate-library ,(symbol-name name) nil (get 'load-path 'initial-value)))) - (plist-delete! plist :built-in) - (plist-put! plist :ignore built-in)) - `(let* ((name ',name) - (plist (cdr (assq name doom-packages)))) - ;; Record what module this declaration was found in - (let ((module-list (plist-get plist :modules)) - (module ',(doom-module-from-path))) - (unless (member module module-list) - (plist-put! plist :modules - (append module-list - (list module) - (when (file-in-directory-p ,(dir!) doom-private-dir) - '((:private . modules))) - nil)))) - ;; Merge given plist with pre-existing one - (doplist! ((prop val) (list ,@plist) plist) - (unless (null val) - (plist-put! plist prop val))) - ;; Some basic key validation; throws an error on invalid properties - (condition-case e - (when-let (recipe (plist-get plist :recipe)) - (cl-destructuring-bind - (&key local-repo _files _flavor - _build _pre-build _post-build _includes - _type _repo _host _branch - _remote _nonrecursive _fork _depth) - recipe - ;; Expand :local-repo from current directory - (when local-repo - (plist-put! - plist :recipe - (plist-put recipe :local-repo - (let ((local-path (expand-file-name local-repo ,(dir!)))) - (if (file-directory-p local-path) - local-path - local-repo))))))) - (error - (signal 'doom-package-error - (cons ,(symbol-name name) - (error-message-string e))))) - ;; These are the only side-effects of this macro! - (setf (alist-get name doom-packages) plist) - (if (plist-get plist :disable) - (add-to-list 'doom-disabled-packages name) - (with-no-warnings - (cons name plist))))) - -(defmacro disable-packages! (&rest packages) - "A convenience macro for disabling packages in bulk. -Only use this macro in a module's (or your private) packages.el file." - (macroexp-progn - (mapcar (lambda (p) `(package! ,p :disable t)) - packages))) - -(defmacro unpin! (&rest targets) - "Unpin packages in TARGETS. - -This unpins packages, so that 'doom upgrade' downloads their latest version. It -can be used one of five ways: - -- To disable pinning wholesale: (unpin! t) -- To unpin individual packages: (unpin! packageA packageB ...) -- To unpin all packages in a group of modules: (unpin! :lang :tools ...) -- To unpin packages in individual modules: - (unpin! (:lang python javascript) (:tools docker)) - -Or any combination of the above. - -This macro should only be used from the user's private packages.el. No module -should use it!" - (if (memq t targets) - `(mapc (doom-rpartial #'doom-package-set :unpin t) - (mapcar #'car doom-packages)) - (macroexp-progn - (mapcar - (lambda (target) - (when target - `(doom-package-set ',target :unpin t))) - (cl-loop for target in targets - if (or (keywordp target) (listp target)) - append - (cl-loop with (category . modules) = (doom-enlist target) - for (name . plist) in doom-packages - for pkg-modules = (plist-get plist :modules) - if (and (assq category pkg-modules) - (or (null modules) - (cl-loop for module in modules - if (member (cons category module) pkg-modules) - return t)) - name) - collect it) - else if (symbolp target) - collect target))))) - -(provide 'core-packages) -;;; core-packages.el ends here diff --git a/.config/emacs/core/core-projects.el b/.config/emacs/core/core-projects.el deleted file mode 100644 index 6109291..0000000 --- a/.config/emacs/core/core-projects.el +++ /dev/null @@ -1,307 +0,0 @@ -;;; core-projects.el -*- lexical-binding: t; -*- - -(defvar doom-projectile-cache-limit 10000 - "If any project cache surpasses this many files it is purged when quitting -Emacs.") - -(defvar doom-projectile-cache-blacklist '("~" "/tmp" "/") - "Directories that should never be cached.") - -(defvar doom-projectile-cache-purge-non-projects nil - "If non-nil, non-projects are purged from the cache on `kill-emacs-hook'.") - -(defvar doom-projectile-fd-binary - (cl-find-if #'executable-find (list "fdfind" "fd")) - "The filename of the `fd' executable. On some distros it's 'fdfind' (ubuntu, -debian, and derivatives). On most it's 'fd'.") - - -;; -;;; Packages - -(use-package! projectile - :commands (projectile-project-root - projectile-project-name - projectile-project-p - projectile-locate-dominating-file - projectile-relevant-known-projects) - :init - (setq projectile-cache-file (concat doom-cache-dir "projectile.cache") - ;; Auto-discovery is slow to do by default. Better to update the list - ;; when you need to (`projectile-discover-projects-in-search-path'). - projectile-auto-discover nil - projectile-enable-caching doom-interactive-p - projectile-globally-ignored-files '(".DS_Store" "TAGS") - projectile-globally-ignored-file-suffixes '(".elc" ".pyc" ".o") - projectile-kill-buffers-filter 'kill-only-files - projectile-known-projects-file (concat doom-cache-dir "projectile.projects") - projectile-ignored-projects '("~/") - projectile-ignored-project-function #'doom-project-ignored-p - - ;; The original `projectile-default-mode-line' can be expensive over - ;; TRAMP, so we gimp it in remote buffers. - projectile-mode-line-function - (lambda () - (if (file-remote-p default-directory) "" - (projectile-default-mode-line)))) - - (global-set-key [remap evil-jump-to-tag] #'projectile-find-tag) - (global-set-key [remap find-tag] #'projectile-find-tag) - - :config - (projectile-mode +1) - - ;; Auto-discovery on `projectile-mode' is slow and premature. Let's defer it - ;; until it's actually needed. Also clean up non-existing projects too! - (add-transient-hook! 'projectile-relevant-known-projects - (projectile-cleanup-known-projects) - (projectile-discover-projects-in-search-path)) - - ;; Projectile runs four functions to determine the root (in this order): - ;; - ;; + `projectile-root-local' -> checks the `projectile-project-root' variable - ;; for an explicit path. - ;; + `projectile-root-bottom-up' -> searches from / to your current directory - ;; for the paths listed in `projectile-project-root-files-bottom-up'. This - ;; includes .git and .project - ;; + `projectile-root-top-down' -> searches from the current directory down to - ;; / the paths listed in `projectile-root-files', like package.json, - ;; setup.py, or Cargo.toml - ;; + `projectile-root-top-down-recurring' -> searches from the current - ;; directory down to / for a directory that has one of - ;; `projectile-project-root-files-top-down-recurring' but doesn't have a - ;; parent directory with the same file. - ;; - ;; In the interest of performance, we reduce the number of project root marker - ;; files/directories projectile searches for when resolving the project root. - (setq projectile-project-root-files-bottom-up - (append '(".projectile" ; projectile's root marker - ".project" ; doom project marker - ".git") ; Git VCS root dir - (when (executable-find "hg") - '(".hg")) ; Mercurial VCS root dir - (when (executable-find "bzr") - '(".bzr"))) ; Bazaar VCS root dir - ;; This will be filled by other modules. We build this list manually so - ;; projectile doesn't perform so many file checks every time it resolves - ;; a project's root -- particularly when a file has no project. - projectile-project-root-files '() - projectile-project-root-files-top-down-recurring '("Makefile")) - - (push (abbreviate-file-name doom-local-dir) projectile-globally-ignored-directories) - - ;; Per-project compilation buffers - (setq compilation-buffer-name-function #'projectile-compilation-buffer-name - compilation-save-buffers-predicate #'projectile-current-project-buffer-p) - - ;; Support the more generic .project files as an alternative to .projectile - (defadvice! doom--projectile-dirconfig-file-a () - :override #'projectile-dirconfig-file - (cond ((file-exists-p! (or ".projectile" ".project") (projectile-project-root))) - ((expand-file-name ".project" (projectile-project-root))))) - - ;; Disable commands that won't work, as is, and that Doom already provides a - ;; better alternative for. - (put 'projectile-ag 'disabled "Use +default/search-project instead") - (put 'projectile-ripgrep 'disabled "Use +default/search-project instead") - (put 'projectile-grep 'disabled "Use +default/search-project instead") - - ;; Treat current directory in dired as a "file in a project" and track it - (add-hook 'dired-before-readin-hook #'projectile-track-known-projects-find-file-hook) - - ;; Accidentally indexing big directories like $HOME or / will massively bloat - ;; projectile's cache (into the hundreds of MBs). This purges those entries - ;; when exiting Emacs to prevent slowdowns/freezing when cache files are - ;; loaded or written to. - (add-hook! 'kill-emacs-hook - (defun doom-cleanup-project-cache-h () - "Purge projectile cache entries that: - -a) have too many files (see `doom-projectile-cache-limit'), -b) represent blacklisted directories that are too big, change too often or are - private. (see `doom-projectile-cache-blacklist'), -c) are not valid projectile projects." - (when (and (bound-and-true-p projectile-projects-cache) - projectile-enable-caching - doom-interactive-p) - (setq projectile-known-projects - (cl-remove-if #'projectile-ignored-project-p - projectile-known-projects)) - (projectile-cleanup-known-projects) - (cl-loop with blacklist = (mapcar #'file-truename doom-projectile-cache-blacklist) - for proot in (hash-table-keys projectile-projects-cache) - if (or (not (stringp proot)) - (string-empty-p proot) - (>= (length (gethash proot projectile-projects-cache)) - doom-projectile-cache-limit) - (member (substring proot 0 -1) blacklist) - (and doom-projectile-cache-purge-non-projects - (not (doom-project-p proot))) - (projectile-ignored-project-p proot)) - do (doom-log "Removed %S from projectile cache" proot) - and do (remhash proot projectile-projects-cache) - and do (remhash proot projectile-projects-cache-time) - and do (remhash proot projectile-project-type-cache)) - (projectile-serialize-cache)))) - - ;; Some MSYS utilities auto expanded the `/' path separator, so we need to prevent it. - (when IS-WINDOWS - (setenv "MSYS_NO_PATHCONV" "1") ; Fix path in Git Bash - (setenv "MSYS2_ARG_CONV_EXCL" "--path-separator")) ; Fix path in MSYS2 - - ;; HACK Don't rely on VCS-specific commands to generate our file lists. That's - ;; 7 commands to maintain, versus the more generic, reliable and - ;; performant `fd' or `ripgrep'. - (defadvice! doom--only-use-generic-command-a (fn vcs) - "Only use `projectile-generic-command' for indexing project files. -And if it's a function, evaluate it." - :around #'projectile-get-ext-command - (if (and (functionp projectile-generic-command) - (not (file-remote-p default-directory))) - (funcall projectile-generic-command vcs) - (let ((projectile-git-submodule-command - (get 'projectile-git-submodule-command 'initial-value))) - (funcall fn vcs)))) - - ;; `projectile-generic-command' doesn't typically support a function, but my - ;; `doom--only-use-generic-command-a' advice allows this. I do it this way so - ;; that projectile can adapt to remote systems (over TRAMP), rather then look - ;; for fd/ripgrep on the remote system simply because it exists on the host. - ;; It's faster too. - (put 'projectile-git-submodule-command 'initial-value projectile-git-submodule-command) - (setq projectile-git-submodule-command nil - projectile-indexing-method 'hybrid - projectile-generic-command - (lambda (_) - ;; If fd exists, use it for git and generic projects. fd is a rust - ;; program that is significantly faster than git ls-files or find, and - ;; it respects .gitignore. This is recommended in the projectile docs. - (cond - ((when-let - (bin (if (ignore-errors (file-remote-p default-directory nil t)) - (cl-find-if (doom-rpartial #'executable-find t) - (list "fdfind" "fd")) - doom-projectile-fd-binary)) - (concat (format "%s . -0 -H --color=never --type file --type symlink --follow --exclude .git" - bin) - (if IS-WINDOWS " --path-separator=/")))) - ;; Otherwise, resort to ripgrep, which is also faster than find - ((executable-find "rg" t) - (concat "rg -0 --files --follow --color=never --hidden -g!.git" - (if IS-WINDOWS " --path-separator=/"))) - ("find . -type f -print0")))) - - (defadvice! doom--projectile-default-generic-command-a (fn &rest args) - "If projectile can't tell what kind of project you're in, it issues an error -when using many of projectile's command, e.g. `projectile-compile-command', -`projectile-run-project', `projectile-test-project', and -`projectile-configure-project', for instance. - -This suppresses the error so these commands will still run, but prompt you for -the command instead." - :around #'projectile-default-generic-command - (ignore-errors (apply fn args)))) - - -;; -;;; Project-based minor modes - -(defvar doom-project-hook nil - "Hook run when a project is enabled. The name of the project's mode and its -state are passed in.") - -(cl-defmacro def-project-mode! (name &key - modes - files - when - match - add-hooks - on-load - on-enter - on-exit) - "Define a project minor mode named NAME and where/how it is activated. - -Project modes allow you to configure 'sub-modes' for major-modes that are -specific to a folder, project structure, framework or whatever arbitrary context -you define. These project modes can have their own settings, keymaps, hooks, -snippets, etc. - -This creates NAME-hook and NAME-map as well. - -PLIST may contain any of these properties, which are all checked to see if NAME -should be activated. If they are *all* true, NAME is activated. - - :modes MODES -- if buffers are derived from MODES (one or a list of symbols). - - :files FILES -- if project contains FILES; takes a string or a form comprised - of nested (and ...) and/or (or ...) forms. Each path is relative to the - project root, however, if prefixed with a '.' or '..', it is relative to the - current buffer. - - :match REGEXP -- if file name matches REGEXP - - :when PREDICATE -- if PREDICATE returns true (can be a form or the symbol of a - function) - - :add-hooks HOOKS -- HOOKS is a list of hooks to add this mode's hook. - - :on-load FORM -- FORM to run the first time this project mode is enabled. - - :on-enter FORM -- FORM is run each time the mode is activated. - - :on-exit FORM -- FORM is run each time the mode is disabled. - -Relevant: `doom-project-hook'." - (declare (indent 1)) - (let ((init-var (intern (format "%s-init" name)))) - (macroexp-progn - (append - (when on-load - `((defvar ,init-var nil))) - `((define-minor-mode ,name - "A project minor mode generated by `def-project-mode!'." - :init-value nil - :lighter "" - :keymap (make-sparse-keymap) - (if (not ,name) - ,on-exit - (run-hook-with-args 'doom-project-hook ',name ,name) - ,(when on-load - `(unless ,init-var - ,on-load - (setq ,init-var t))) - ,on-enter)) - (dolist (hook ,add-hooks) - (add-hook ',(intern (format "%s-hook" name)) hook))) - (cond ((or files modes when) - (cl-check-type files (or null list string)) - (let ((fn - `(lambda () - (and (not (bound-and-true-p ,name)) - (and buffer-file-name (not (file-remote-p buffer-file-name nil t))) - ,(or (null match) - `(if buffer-file-name (string-match-p ,match buffer-file-name))) - ,(or (null files) - ;; Wrap this in `eval' to prevent eager expansion - ;; of `project-file-exists-p!' from pulling in - ;; autoloaded files prematurely. - `(eval - '(project-file-exists-p! - ,(if (stringp (car files)) (cons 'and files) files)))) - ,(or when t) - (,name 1))))) - (if modes - `((dolist (mode ,modes) - (let ((hook-name - (intern (format "doom--enable-%s%s-h" ',name - (if (eq mode t) "" (format "-in-%s" mode)))))) - (fset hook-name #',fn) - (if (eq mode t) - (add-to-list 'auto-minor-mode-magic-alist (cons hook-name #',name)) - (add-hook (intern (format "%s-hook" mode)) hook-name))))) - `((add-hook 'change-major-mode-after-body-hook #',fn))))) - (match - `((add-to-list 'auto-minor-mode-alist (cons ,match #',name))))))))) - -(provide 'core-projects) -;;; core-projects.el ends here diff --git a/.config/emacs/core/core-ui.el b/.config/emacs/core/core-ui.el deleted file mode 100644 index 8e7e6c1..0000000 --- a/.config/emacs/core/core-ui.el +++ /dev/null @@ -1,655 +0,0 @@ -;;; core-ui.el -*- lexical-binding: t; -*- - -;; -;;; Variables - -(defvar doom-theme nil - "A symbol representing the Emacs theme to load at startup. - -Set to `nil' to load no theme at all. This variable is changed by -`load-theme'.") - -(defvar doom-font nil - "The default font to use. -Must be a `font-spec', a font object, an XFT font string, or an XLFD string. - -This affects the `default' and `fixed-pitch' faces. - -Examples: - (setq doom-font (font-spec :family \"Fira Mono\" :size 12)) - (setq doom-font \"Terminus (TTF):pixelsize=12:antialias=off\")") - -(defvar doom-variable-pitch-font nil - "The default font to use for variable-pitch text. -Must be a `font-spec', a font object, an XFT font string, or an XLFD string. See -`doom-font' for examples. - -An omitted font size means to inherit `doom-font''s size.") - -(defvar doom-serif-font nil - "The default font to use for the `fixed-pitch-serif' face. -Must be a `font-spec', a font object, an XFT font string, or an XLFD string. See -`doom-font' for examples. - -An omitted font size means to inherit `doom-font''s size.") - -(defvar doom-unicode-font nil - "Fallback font for Unicode glyphs. -Must be a `font-spec', a font object, an XFT font string, or an XLFD string. See -`doom-font' for examples. - -The defaults on macOS and Linux are Apple Color Emoji and Symbola, respectively. - -WARNING: if you specify a size for this font it will hard-lock any usage of this -font to that size. It's rarely a good idea to do so!") - -(defvar doom-emoji-fallback-font-families - '("Apple Color Emoji" - "Segoe UI Emoji" - "Noto Color Emoji" - "Noto Emoji") - "A list of fallback font families to use for emojis.") - -(defvar doom-symbol-fallback-font-families - '("Segoe UI Symbol" - "Apple Symbols") - "A list of fallback font families for general symbol glyphs.") - - -;; -;;; Custom hooks - -(defvar doom-init-ui-hook nil - "List of hooks to run when the UI has been initialized.") - -(defvar doom-load-theme-hook nil - "Hook run after the theme is loaded with `load-theme' or reloaded with -`doom/reload-theme'.") - -(defvar doom-switch-buffer-hook nil - "A list of hooks run after changing the current buffer.") - -(defvar doom-switch-window-hook nil - "A list of hooks run after changing the focused windows.") - -(defvar doom-switch-frame-hook nil - "A list of hooks run after changing the focused frame.") - -(defun doom-run-switch-buffer-hooks-h (&optional _) - (let ((gc-cons-threshold most-positive-fixnum) - (inhibit-redisplay t)) - (run-hooks 'doom-switch-buffer-hook))) - -(defvar doom--last-frame nil) -(defun doom-run-switch-window-or-frame-hooks-h (&optional _) - (let ((gc-cons-threshold most-positive-fixnum) - (inhibit-redisplay t)) - (unless (equal (old-selected-frame) (selected-frame)) - (run-hooks 'doom-switch-frame-hook)) - (unless (or (minibufferp) - (equal (old-selected-window) (minibuffer-window))) - (run-hooks 'doom-switch-window-hook)))) - -(defun doom-protect-fallback-buffer-h () - "Don't kill the scratch buffer. Meant for `kill-buffer-query-functions'." - (not (eq (current-buffer) (doom-fallback-buffer)))) - -(defun doom-highlight-non-default-indentation-h () - "Highlight whitespace at odds with `indent-tabs-mode'. -That is, highlight tabs if `indent-tabs-mode' is `nil', and highlight spaces at -the beginnings of lines if `indent-tabs-mode' is `t'. The purpose is to make -incorrect indentation in the current buffer obvious to you. - -Does nothing if `whitespace-mode' or `global-whitespace-mode' is already active -or if the current buffer is read-only or not file-visiting." - (unless (or (eq major-mode 'fundamental-mode) - (bound-and-true-p global-whitespace-mode) - (null buffer-file-name)) - (require 'whitespace) - (set (make-local-variable 'whitespace-style) - (cl-union (if indent-tabs-mode - '(indentation) - '(tabs tab-mark)) - (when whitespace-mode - (remq 'face whitespace-active-style)))) - (cl-pushnew 'face whitespace-style) ; must be first - (whitespace-mode +1))) - - -;; -;;; General UX - -;; A simple confirmation prompt when killing Emacs. But only prompt when there -;; are real buffers open. -(setq confirm-kill-emacs #'doom-quit-p) -;; Prompt for confirmation when deleting a non-empty frame; a last line of -;; defense against accidental loss of work. -(global-set-key [remap delete-frame] #'doom/delete-frame-with-prompt) - -;; Don't prompt for confirmation when we create a new file or buffer (assume the -;; user knows what they're doing). -(setq confirm-nonexistent-file-or-buffer nil) - -(setq uniquify-buffer-name-style 'forward - ;; no beeping or blinking please - ring-bell-function #'ignore - visible-bell nil) - -;; middle-click paste at point, not at click -(setq mouse-yank-at-point t) - -;; Larger column width for function name in profiler reports -(after! profiler - (setf (caar profiler-report-cpu-line-format) 80 - (caar profiler-report-memory-line-format) 80)) - - -;; -;;; Scrolling - -(setq hscroll-margin 2 - hscroll-step 1 - ;; Emacs spends too much effort recentering the screen if you scroll the - ;; cursor more than N lines past window edges (where N is the settings of - ;; `scroll-conservatively'). This is especially slow in larger files - ;; during large-scale scrolling commands. If kept over 100, the window is - ;; never automatically recentered. - scroll-conservatively 101 - scroll-margin 0 - scroll-preserve-screen-position t - ;; Reduce cursor lag by a tiny bit by not auto-adjusting `window-vscroll' - ;; for tall lines. - auto-window-vscroll nil - ;; mouse - mouse-wheel-scroll-amount '(2 ((shift) . hscroll)) - mouse-wheel-scroll-amount-horizontal 2) - -;; Remove hscroll-margin in shells, otherwise it causes jumpiness -(setq-hook! '(eshell-mode-hook term-mode-hook) hscroll-margin 0) - - -;; -;;; Cursor - -;; The blinking cursor is distracting, but also interferes with cursor settings -;; in some minor modes that try to change it buffer-locally (like treemacs) and -;; can cause freezing for folks (esp on macOS) with customized & color cursors. -(blink-cursor-mode -1) - -;; Don't blink the paren matching the one at point, it's too distracting. -(setq blink-matching-paren nil) - -;; Don't stretch the cursor to fit wide characters, it is disorienting, -;; especially for tabs. -(setq x-stretch-cursor nil) - - -;; -;;; Buffers - -;; Make `next-buffer', `other-buffer', etc. ignore unreal buffers. -(push '(buffer-predicate . doom-buffer-frame-predicate) default-frame-alist) - -(defadvice! doom--switch-to-fallback-buffer-maybe-a (&rest _) - "Switch to `doom-fallback-buffer' if on last real buffer. - -Advice for `kill-current-buffer'. If in a dedicated window, delete it. If there -are no real buffers left OR if all remaining buffers are visible in other -windows, switch to `doom-fallback-buffer'. Otherwise, delegate to original -`kill-current-buffer'." - :before-until #'kill-current-buffer - (let ((buf (current-buffer))) - (cond ((window-dedicated-p) - (delete-window) - t) - ((eq buf (doom-fallback-buffer)) - (message "Can't kill the fallback buffer.") - t) - ((doom-real-buffer-p buf) - (let ((visible-p (delq (selected-window) (get-buffer-window-list buf nil t)))) - (unless visible-p - (when (and (buffer-modified-p buf) - (not (y-or-n-p - (format "Buffer %s is modified; kill anyway?" - buf)))) - (user-error "Aborted"))) - (let ((inhibit-redisplay t) - buffer-list-update-hook) - (when (or ;; if there aren't more real buffers than visible buffers, - ;; then there are no real, non-visible buffers left. - (not (cl-set-difference (doom-real-buffer-list) - (doom-visible-buffers))) - ;; if we end up back where we start (or previous-buffer - ;; returns nil), we have nowhere left to go - (memq (switch-to-prev-buffer nil t) (list buf 'nil))) - (switch-to-buffer (doom-fallback-buffer))) - (unless visible-p - (with-current-buffer buf - (restore-buffer-modified-p nil)) - (kill-buffer buf))) - (run-hooks 'buffer-list-update-hook) - t))))) - - -;; -;;; Fringes - -;; Reduce the clutter in the fringes; we'd like to reserve that space for more -;; useful information, like git-gutter and flycheck. -(setq indicate-buffer-boundaries nil - indicate-empty-lines nil) - - -;; -;;; Windows/frames - -;; A simple frame title -(setq frame-title-format '("%b – Doom Emacs") - icon-title-format frame-title-format) - -;; Don't resize the frames in steps; it looks weird, especially in tiling window -;; managers, where it can leave unseemly gaps. -(setq frame-resize-pixelwise t) - -;; But do not resize windows pixelwise, this can cause crashes in some cases -;; when resizing too many windows at once or rapidly. -(setq window-resize-pixelwise nil) - -;; Disable tool, menu, and scrollbars. Doom is designed to be keyboard-centric, -;; so these are just clutter (the scrollbar also impacts performance). Whats -;; more, the menu bar exposes functionality that Doom doesn't endorse. -;; -;; I am intentionally not calling `menu-bar-mode', `tool-bar-mode', and -;; `scroll-bar-mode' because they do extra and unnecessary work that can be more -;; concisely and efficiently expressed with these six lines: -(push '(menu-bar-lines . 0) default-frame-alist) -(push '(tool-bar-lines . 0) default-frame-alist) -(push '(vertical-scroll-bars) default-frame-alist) -;; And set these to nil so users don't have to toggle the modes twice to -;; reactivate them. -(setq menu-bar-mode nil - tool-bar-mode nil - scroll-bar-mode nil) - -;; The native border "consumes" a pixel of the fringe on righter-most splits, -;; `window-divider' does not. Available since Emacs 25.1. -(setq window-divider-default-places t - window-divider-default-bottom-width 1 - window-divider-default-right-width 1) -(add-hook 'doom-init-ui-hook #'window-divider-mode) - -;; GUIs are inconsistent across systems and themes (and will rarely match our -;; active Emacs theme). They impose inconsistent shortcut key paradigms too. -;; It's best to avoid them altogether and have Emacs handle the prompting. -(setq use-dialog-box nil) -(when (bound-and-true-p tooltip-mode) - (tooltip-mode -1)) -(when IS-LINUX - (setq x-gtk-use-system-tooltips nil)) - - ;; Favor vertical splits over horizontal ones. Monitors are trending toward - ;; wide, rather than tall. -(setq split-width-threshold 160 - split-height-threshold nil) - - -;; -;;; Minibuffer - -;; Allow for minibuffer-ception. Sometimes we need another minibuffer command -;; while we're in the minibuffer. -(setq enable-recursive-minibuffers t) - -;; Show current key-sequence in minibuffer ala 'set showcmd' in vim. Any -;; feedback after typing is better UX than no feedback at all. -(setq echo-keystrokes 0.02) - -;; Expand the minibuffer to fit multi-line text displayed in the echo-area. This -;; doesn't look too great with direnv, however... -(setq resize-mini-windows 'grow-only) - -;; Typing yes/no is obnoxious when y/n will do -(advice-add #'yes-or-no-p :override #'y-or-n-p) - -;; Try to keep the cursor out of the read-only portions of the minibuffer. -(setq minibuffer-prompt-properties '(read-only t intangible t cursor-intangible t face minibuffer-prompt)) -(add-hook 'minibuffer-setup-hook #'cursor-intangible-mode) - - -;; -;;; Built-in packages - -;;;###package ansi-color -(setq ansi-color-for-comint-mode t) - - -(after! comint - (setq comint-prompt-read-only t - comint-buffer-maximum-size 2048)) ; double the default - - -(after! compile - (setq compilation-always-kill t ; kill compilation process before starting another - compilation-ask-about-save nil ; save all buffers on `compile' - compilation-scroll-output 'first-error) - ;; Handle ansi codes in compilation buffer - (add-hook 'compilation-filter-hook #'doom-apply-ansi-color-to-compilation-buffer-h) - ;; Automatically truncate compilation buffers so they don't accumulate too - ;; much data and bog down the rest of Emacs. - (autoload 'comint-truncate-buffer "comint" nil t) - (add-hook 'compilation-filter-hook #'comint-truncate-buffer)) - - -(after! ediff - (setq ediff-diff-options "-w" ; turn off whitespace checking - ediff-split-window-function #'split-window-horizontally - ediff-window-setup-function #'ediff-setup-windows-plain) - - (defvar doom--ediff-saved-wconf nil) - ;; Restore window config after quitting ediff - (add-hook! 'ediff-before-setup-hook - (defun doom-ediff-save-wconf-h () - (setq doom--ediff-saved-wconf (current-window-configuration)))) - (add-hook! '(ediff-quit-hook ediff-suspend-hook) :append - (defun doom-ediff-restore-wconf-h () - (when (window-configuration-p doom--ediff-saved-wconf) - (set-window-configuration doom--ediff-saved-wconf))))) - - -(use-package! hl-line - ;; Highlights the current line - :hook (doom-first-buffer . global-hl-line-mode) - :init - (defvar global-hl-line-modes - '(prog-mode text-mode conf-mode special-mode - org-agenda-mode) - "What modes to enable `hl-line-mode' in.") - :config - ;; HACK I reimplement `global-hl-line-mode' so we can white/blacklist modes in - ;; `global-hl-line-modes' _and_ so we can use `global-hl-line-mode', - ;; which users expect to control hl-line in Emacs. - (define-globalized-minor-mode global-hl-line-mode hl-line-mode - (lambda () - (and (cond (hl-line-mode nil) - ((null global-hl-line-modes) nil) - ((eq global-hl-line-modes t)) - ((eq (car global-hl-line-modes) 'not) - (not (derived-mode-p global-hl-line-modes))) - ((apply #'derived-mode-p global-hl-line-modes))) - (hl-line-mode +1)))) - - ;; Temporarily disable `hl-line' when selection is active, since it doesn't - ;; serve much purpose when the selection is so much more visible. - (defvar doom--hl-line-mode nil) - - (add-hook! 'hl-line-mode-hook - (defun doom-truly-disable-hl-line-h () - (unless hl-line-mode - (setq-local doom--hl-line-mode nil)))) - - (add-hook! '(evil-visual-state-entry-hook activate-mark-hook) - (defun doom-disable-hl-line-h () - (when hl-line-mode - (hl-line-mode -1) - (setq-local doom--hl-line-mode t)))) - - (add-hook! '(evil-visual-state-exit-hook deactivate-mark-hook) - (defun doom-enable-hl-line-maybe-h () - (when doom--hl-line-mode - (hl-line-mode +1))))) - - -(use-package! winner - ;; undo/redo changes to Emacs' window layout - :preface (defvar winner-dont-bind-my-keys t) ; I'll bind keys myself - :hook (doom-first-buffer . winner-mode) - :config - (appendq! winner-boring-buffers - '("*Compile-Log*" "*inferior-lisp*" "*Fuzzy Completions*" - "*Apropos*" "*Help*" "*cvs*" "*Buffer List*" "*Ibuffer*" - "*esh command on file*"))) - - -(use-package! paren - ;; highlight matching delimiters - :hook (doom-first-buffer . show-paren-mode) - :config - (setq show-paren-delay 0.1 - show-paren-highlight-openparen t - show-paren-when-point-inside-paren t - show-paren-when-point-in-periphery t)) - - -;;;###package whitespace -(setq whitespace-line-column nil - whitespace-style - '(face indentation tabs tab-mark spaces space-mark newline newline-mark - trailing lines-tail) - whitespace-display-mappings - '((tab-mark ?\t [?› ?\t]) - (newline-mark ?\n [?¬ ?\n]) - (space-mark ?\ [?·] [?.]))) - - -;; -;;; Third party packages - -(use-package! all-the-icons - :commands (all-the-icons-octicon - all-the-icons-faicon - all-the-icons-fileicon - all-the-icons-wicon - all-the-icons-material - all-the-icons-alltheicon) - :preface - (add-hook! 'after-setting-font-hook - (defun doom-init-all-the-icons-fonts-h () - (when (fboundp 'set-fontset-font) - (dolist (font (list "Weather Icons" - "github-octicons" - "FontAwesome" - "all-the-icons" - "file-icons" - "Material Icons")) - (set-fontset-font t 'unicode font nil 'append))))) - :config - (cond ((daemonp) - (defadvice! doom--disable-all-the-icons-in-tty-a (fn &rest args) - "Return a blank string in tty Emacs, which doesn't support multiple fonts." - :around '(all-the-icons-octicon all-the-icons-material - all-the-icons-faicon all-the-icons-fileicon - all-the-icons-wicon all-the-icons-alltheicon) - (if (or (not after-init-time) (display-multi-font-p)) - (apply fn args) - ""))) - ((not (display-graphic-p)) - (defadvice! doom--disable-all-the-icons-in-tty-a (&rest _) - "Return a blank string for tty users." - :override '(all-the-icons-octicon all-the-icons-material - all-the-icons-faicon all-the-icons-fileicon - all-the-icons-wicon all-the-icons-alltheicon) - "")))) - -;; Hide the mode line in completion popups and MAN pages because they serve -;; little purpose there, and is better hidden. -;;;###package hide-mode-line-mode -(add-hook! '(completion-list-mode-hook Man-mode-hook) - #'hide-mode-line-mode) - -;; Many major modes do no highlighting of number literals, so we do it for them -(use-package! highlight-numbers - :hook ((prog-mode conf-mode) . highlight-numbers-mode) - :config (setq highlight-numbers-generic-regexp "\\_<[[:digit:]]+\\(?:\\.[0-9]*\\)?\\_>")) - -;;;###package image -(setq image-animate-loop t) - -;;;###package rainbow-delimiters -;; Helps us distinguish stacked delimiter pairs, especially in parentheses-drunk -;; languages like Lisp. I reduce it from it's default of 9 to reduce the -;; complexity of the font-lock keyword and hopefully buy us a few ms of -;; performance. -(setq rainbow-delimiters-max-face-count 4) - - -;; -;;; Line numbers - -;; Explicitly define a width to reduce the cost of on-the-fly computation -(setq-default display-line-numbers-width 3) - -;; Show absolute line numbers for narrowed regions to make it easier to tell the -;; buffer is narrowed, and where you are, exactly. -(setq-default display-line-numbers-widen t) - -;; Enable line numbers in most text-editing modes. We avoid -;; `global-display-line-numbers-mode' because there are many special and -;; temporary modes where we don't need/want them. -(add-hook! '(prog-mode-hook text-mode-hook conf-mode-hook) - #'display-line-numbers-mode) - -;; Fix #2742: cursor is off by 4 characters in `artist-mode' -;; REVIEW Reported upstream https://debbugs.gnu.org/cgi/bugreport.cgi?bug=43811 -;; DEPRECATED Fixed in Emacs 28; remove when we drop 27 support -(unless EMACS28+ - (add-hook 'artist-mode-hook #'doom-disable-line-numbers-h)) - - -;; -;;; Theme & font - -;; User themes should live in $DOOMDIR/themes, not ~/.emacs.d -(setq custom-theme-directory (concat doom-private-dir "themes/")) - -;; Always prioritize the user's themes above the built-in/packaged ones. -(setq custom-theme-load-path - (cons 'custom-theme-directory - (delq 'custom-theme-directory custom-theme-load-path))) - -(defun doom-init-fonts-h (&optional reload) - "Loads `doom-font'." - (when (fboundp 'set-fontset-font) - (let ((fn (doom-rpartial #'member (font-family-list)))) - (when-let (font (cl-find-if fn doom-symbol-fallback-font-families)) - (set-fontset-font t 'symbol font)) - (when-let (font (cl-find-if fn doom-emoji-fallback-font-families)) - (set-fontset-font t 'unicode font)) - (when doom-unicode-font - (set-fontset-font t 'unicode doom-unicode-font)))) - (apply #'custom-set-faces - (let ((attrs '(:weight unspecified :slant unspecified :width unspecified))) - (append (when doom-font - `((fixed-pitch ((t (:font ,doom-font ,@attrs)))))) - (when doom-serif-font - `((fixed-pitch-serif ((t (:font ,doom-serif-font ,@attrs)))))) - (when doom-variable-pitch-font - `((variable-pitch ((t (:font ,doom-variable-pitch-font ,@attrs))))))))) - ;; Never save these settings to `custom-file' - (dolist (sym '(fixed-pitch fixed-pitch-serif variable-pitch)) - (put sym 'saved-face nil)) - (cond - (doom-font - (when (or reload (daemonp)) - (set-frame-font doom-font t t)) - ;; I avoid `set-frame-font' at startup because it is expensive; doing extra, - ;; unnecessary work we can avoid by setting the frame parameter directly. - (setf (alist-get 'font default-frame-alist) - (cond ((stringp doom-font) doom-font) - ((fontp doom-font) (font-xlfd-name doom-font)) - ((signal 'wrong-type-argument - (list '(fontp stringp) doom-font)))))) - ((display-graphic-p) - (setq font-use-system-font t))) - ;; Give users a chance to inject their own font logic. - (run-hooks 'after-setting-font-hook)) - -(defun doom-init-theme-h (&rest _) - "Load the theme specified by `doom-theme' in FRAME." - (when (and doom-theme (not (custom-theme-enabled-p doom-theme))) - (load-theme doom-theme t))) - -(defadvice! doom--load-theme-a (fn theme &optional no-confirm no-enable) - "Record `doom-theme', disable old themes, and trigger `doom-load-theme-hook'." - :around #'load-theme - ;; Run `load-theme' from an estranged buffer, where we can ensure that - ;; buffer-local face remaps (by `mixed-pitch-mode', for instance) won't - ;; interfere with recalculating faces in new themes. - (with-temp-buffer - (let ((last-themes (copy-sequence custom-enabled-themes))) - ;; Disable previous themes so there are no conflicts. If you truly want - ;; multiple themes enabled, then use `enable-theme' instead. - (mapc #'disable-theme custom-enabled-themes) - (prog1 (funcall fn theme no-confirm no-enable) - (when (and (not no-enable) (custom-theme-enabled-p theme)) - (setq doom-theme theme) - (put 'doom-theme 'previous-themes (or last-themes 'none)) - (doom-run-hooks 'doom-load-theme-hook)))))) - - -;; -;;; Bootstrap - -(defun doom-init-ui-h (&optional _) - "Initialize Doom's user interface by applying all its advice and hooks." - (doom-run-hooks 'doom-init-ui-hook) - - (add-hook 'kill-buffer-query-functions #'doom-protect-fallback-buffer-h) - (add-hook 'after-change-major-mode-hook #'doom-highlight-non-default-indentation-h 'append) - - ;; Initialize custom switch-{buffer,window,frame} hooks: - ;; - ;; - `doom-switch-buffer-hook' - ;; - `doom-switch-window-hook' - ;; - `doom-switch-frame-hook' - ;; - ;; These should be done as late as possible, as not to prematurely trigger - ;; hooks during startup. - (add-hook 'window-buffer-change-functions #'doom-run-switch-buffer-hooks-h) - (add-hook 'window-selection-change-functions #'doom-run-switch-window-or-frame-hooks-h) - - ;; Only execute this function once. - (remove-hook 'window-buffer-change-functions #'doom-init-ui-h)) - -;; Apply fonts and theme -(let ((hook (if (daemonp) - 'server-after-make-frame-hook - 'after-init-hook))) - (add-hook hook #'doom-init-fonts-h -100) - (add-hook hook #'doom-init-theme-h -90)) - -;; Initialize UI as late as possible. `window-buffer-change-functions' runs -;; once, when the scratch/dashboard buffer is first displayed. -(add-hook 'window-buffer-change-functions #'doom-init-ui-h -100) - - -;; -;;; Fixes/hacks - -;; Doom doesn't support `customize' and it never will. It's a clumsy interface -;; that sets variables at a time where it can be easily and unpredictably -;; overwritten. Configure things from your $DOOMDIR instead. -(dolist (sym '(customize-option customize-browse customize-group customize-face - customize-rogue customize-saved customize-apropos - customize-changed customize-unsaved customize-variable - customize-set-value customize-customized customize-set-variable - customize-apropos-faces customize-save-variable - customize-apropos-groups customize-apropos-options - customize-changed-options customize-save-customized)) - (put sym 'disabled "Doom doesn't support `customize', configure Emacs from $DOOMDIR/config.el instead")) -(put 'customize-themes 'disabled "Set `doom-theme' or use `load-theme' in $DOOMDIR/config.el instead") - -;; Doesn't exist in terminal Emacs, but some Emacs packages (internal and -;; external) use it anyway, leading to a void-function error, so define a no-op -;; substitute to suppress them. -(unless (fboundp 'define-fringe-bitmap) - (fset 'define-fringe-bitmap #'ignore)) - -(after! whitespace - (defun doom-is-childframes-p () - "`whitespace-mode' inundates child frames with whitespace markers, so -disable it to fix all that visual noise." - (null (frame-parameter nil 'parent-frame))) - (add-function :before-while whitespace-enable-predicate #'doom-is-childframes-p)) - -(provide 'core-ui) -;;; core-ui.el ends here diff --git a/.config/emacs/core/core.el b/.config/emacs/core/core.el deleted file mode 100644 index 9c621f0..0000000 --- a/.config/emacs/core/core.el +++ /dev/null @@ -1,576 +0,0 @@ -;;; core.el --- the heart of the beast -*- lexical-binding: t; -*- - -(when (< emacs-major-version 27) - (error "Detected Emacs %s. Minimum supported version is 27.1." - emacs-version)) - -;; Ensure Doom's core libraries are visible for loading -(add-to-list 'load-path (file-name-directory load-file-name)) - -;; Remember these variables' initial values, so we can safely reset them at a -;; later time, or consult them without fear of contamination. -(dolist (var '(exec-path load-path process-environment)) - (unless (get var 'initial-value) - (put var 'initial-value (default-value var)))) - -;; Just the... bear necessities~ -(require 'core-lib) - - -;; -;;; Initialize internal state - -(defgroup doom nil - "An Emacs framework for the stubborn martian hacker." - :link '(url-link "https://doomemacs.org")) - -(defconst doom-version "21.12.0-alpha" - "Current version of Doom Emacs.") - -(defconst doom-core-version "3.0.0-alpha" - "Current version of Doom Emacs core.") - -(defvar doom-debug-p (or (getenv-internal "DEBUG") init-file-debug) - "If non-nil, Doom will log more. - -Use `doom-debug-mode' to toggle it. The --debug-init flag and setting the DEBUG -envvar will enable this at startup.") - -(defvar doom-init-p nil - "Non-nil if Doom has been initialized.") - -(defvar doom-init-time nil - "The time it took, in seconds, for Doom Emacs to initialize.") - -(defconst doom-interactive-p (not noninteractive) - "If non-nil, Emacs is in interactive mode.") - -(defconst NATIVECOMP (if (fboundp 'native-comp-available-p) (native-comp-available-p))) -(defconst EMACS28+ (> emacs-major-version 27)) -(defconst EMACS29+ (> emacs-major-version 28)) -(defconst IS-MAC (eq system-type 'darwin)) -(defconst IS-LINUX (eq system-type 'gnu/linux)) -(defconst IS-WINDOWS (memq system-type '(cygwin windows-nt ms-dos))) -(defconst IS-BSD (or IS-MAC (eq system-type 'berkeley-unix))) - - -;; -;;; Directory variables - -(defconst doom-emacs-dir user-emacs-directory - "The path to the currently loaded .emacs.d directory. Must end with a slash.") - -(defconst doom-core-dir (concat doom-emacs-dir "core/") - "The root directory of Doom's core files. Must end with a slash.") - -(defconst doom-modules-dir (concat doom-emacs-dir "modules/") - "The root directory for Doom's modules. Must end with a slash.") - -(defconst doom-local-dir - (if-let (localdir (getenv-internal "DOOMLOCALDIR")) - (expand-file-name (file-name-as-directory localdir)) - (concat doom-emacs-dir ".local/")) - "Root directory for local storage. - -Use this as a storage location for this system's installation of Doom Emacs. - -These files should not be shared across systems. By default, it is used by -`doom-etc-dir' and `doom-cache-dir'. Must end with a slash.") - -(defconst doom-etc-dir (concat doom-local-dir "etc/") - "Directory for non-volatile local storage. - -Use this for files that don't change much, like server binaries, external -dependencies or long-term shared data. Must end with a slash.") - -(defconst doom-cache-dir (concat doom-local-dir "cache/") - "Directory for volatile local storage. - -Use this for files that change often, like cache files. Must end with a slash.") - -(defconst doom-docs-dir (concat doom-emacs-dir "docs/") - "Where Doom's documentation files are stored. Must end with a slash.") - -(defconst doom-private-dir - (if-let (doomdir (getenv-internal "DOOMDIR")) - (expand-file-name (file-name-as-directory doomdir)) - (or (let ((xdgdir - (expand-file-name "doom/" - (or (getenv-internal "XDG_CONFIG_HOME") - "~/.config")))) - (if (file-directory-p xdgdir) xdgdir)) - "~/.doom.d/")) - "Where your private configuration is placed. - -Defaults to ~/.config/doom, ~/.doom.d or the value of the DOOMDIR envvar; -whichever is found first. Must end in a slash.") - -(defconst doom-autoloads-file - (concat doom-local-dir "autoloads." emacs-version ".el") - "Where `doom-reload-core-autoloads' stores its core autoloads. - -This file is responsible for informing Emacs where to find all of Doom's -autoloaded core functions (in core/autoload/*.el).") - -(defconst doom-env-file (concat doom-local-dir "env") - "The location of your envvar file, generated by `doom env`. - -This file contains environment variables scraped from your shell environment, -which is loaded at startup (if it exists). This is helpful if Emacs can't -\(easily) be launched from the correct shell session (particularly for MacOS -users).") - - -;; -;;; Custom error types - -(define-error 'doom-error "Error in Doom Emacs core") -(define-error 'doom-hook-error "Error in a Doom startup hook" 'doom-error) -(define-error 'doom-autoload-error "Error in Doom's autoloads file" 'doom-error) -(define-error 'doom-module-error "Error in a Doom module" 'doom-error) -(define-error 'doom-private-error "Error in private config" 'doom-error) -(define-error 'doom-package-error "Error with packages" 'doom-error) - - -;; -;;; Custom hooks - -(defvar doom-first-input-hook nil - "Transient hooks run before the first user input.") -(put 'doom-first-input-hook 'permanent-local t) - -(defvar doom-first-file-hook nil - "Transient hooks run before the first interactively opened file.") -(put 'doom-first-file-hook 'permanent-local t) - -(defvar doom-first-buffer-hook nil - "Transient hooks run before the first interactively opened buffer.") -(put 'doom-first-buffer-hook 'permanent-local t) - -(defvar doom-after-reload-hook nil - "A list of hooks to run after `doom/reload' has reloaded Doom.") - -(defvar doom-before-reload-hook nil - "A list of hooks to run before `doom/reload' has reloaded Doom.") - - -;; -;;; Native Compilation support (http://akrl.sdf.org/gccemacs.html) - -(when NATIVECOMP - ;; Don't store eln files in ~/.emacs.d/eln-cache (they are likely to be purged - ;; when upgrading Doom). - (add-to-list 'native-comp-eln-load-path (concat doom-cache-dir "eln/")) - - (with-eval-after-load 'comp - ;; HACK Disable native-compilation for some troublesome packages - (mapc (doom-partial #'add-to-list 'native-comp-deferred-compilation-deny-list) - (let ((local-dir-re (concat "\\`" (regexp-quote doom-local-dir)))) - (list (concat local-dir-re ".*/evil-collection-vterm\\.el\\'") - (concat local-dir-re ".*/with-editor\\.el\\'")))))) - - -;; -;;; Don't litter `doom-emacs-dir' - -;; We avoid `no-littering' because it's a mote too opinionated for our needs. -(setq async-byte-compile-log-file (concat doom-etc-dir "async-bytecomp.log") - custom-file (concat doom-private-dir "custom.el") - desktop-dirname (concat doom-etc-dir "desktop") - desktop-base-file-name "autosave" - desktop-base-lock-name "autosave-lock" - pcache-directory (concat doom-cache-dir "pcache/") - request-storage-directory (concat doom-cache-dir "request") - shared-game-score-directory (concat doom-etc-dir "shared-game-score/")) - -(defadvice! doom--write-to-sane-paths-a (fn &rest args) - "Write 3rd party files to `doom-etc-dir' to keep `user-emacs-directory' clean. - -Also writes `put' calls for saved safe-local-variables to `custom-file' instead -of `user-init-file' (which `en/disable-command' in novice.el.gz is hardcoded to -do)." - :around #'en/disable-command - :around #'locate-user-emacs-file - (let ((user-emacs-directory doom-etc-dir) - (user-init-file custom-file)) - (apply fn args))) - - -;; -;;; MODE-local-vars-hook - -;; File+dir local variables are initialized after the major mode and its hooks -;; have run. If you want hook functions to be aware of these customizations, add -;; them to MODE-local-vars-hook instead. -(defvar doom-inhibit-local-var-hooks nil) - -(defun doom-run-local-var-hooks-h () - "Run MODE-local-vars-hook after local variables are initialized." - (unless doom-inhibit-local-var-hooks - (setq-local doom-inhibit-local-var-hooks t) - (doom-run-hooks (intern (format "%s-local-vars-hook" major-mode))))) - -;; If the user has disabled `enable-local-variables', then -;; `hack-local-variables-hook' is never triggered, so we trigger it at the end -;; of `after-change-major-mode-hook': -(defun doom-run-local-var-hooks-maybe-h () - "Run `doom-run-local-var-hooks-h' if `enable-local-variables' is disabled." - (unless enable-local-variables - (doom-run-local-var-hooks-h))) - - -;; -;;; Reasonable defaults - -;; Emacs is essentially one huge security vulnerability, what with all the -;; dependencies it pulls in from all corners of the globe. Let's try to be at -;; least a little more discerning. -(setq gnutls-verify-error (and (fboundp 'gnutls-available-p) - (gnutls-available-p) - (not (getenv-internal "INSECURE"))) - gnutls-algorithm-priority - (when (boundp 'libgnutls-version) - (concat "SECURE128:+SECURE192:-VERS-ALL" - (if (and (not IS-WINDOWS) - (>= libgnutls-version 30605)) - ":+VERS-TLS1.3") - ":+VERS-TLS1.2")) - ;; `gnutls-min-prime-bits' is set based on recommendations from - ;; https://www.keylength.com/en/4/ - gnutls-min-prime-bits 3072 - tls-checktrust gnutls-verify-error - ;; Emacs is built with `gnutls' by default, so `tls-program' would not be - ;; used in that case. Otherwise, people have reasons to not go with - ;; `gnutls', we use `openssl' instead. For more details, see - ;; https://redd.it/8sykl1 - tls-program '("openssl s_client -connect %h:%p -CAfile %t -nbio -no_ssl3 -no_tls1 -no_tls1_1 -ign_eof" - "gnutls-cli -p %p --dh-bits=3072 --ocsp --x509cafile=%t \ ---strict-tofu --priority='SECURE192:+SECURE128:-VERS-ALL:+VERS-TLS1.2:+VERS-TLS1.3' %h" - ;; compatibility fallbacks - "gnutls-cli -p %p %h")) - -;; Emacs stores `authinfo' in $HOME and in plain-text. Let's not do that, mkay? -;; This file stores usernames, passwords, and other such treasures for the -;; aspiring malicious third party. -(setq auth-sources (list (concat doom-etc-dir "authinfo.gpg") - "~/.authinfo.gpg")) - -;; A second, case-insensitive pass over `auto-mode-alist' is time wasted, and -;; indicates misconfiguration (don't rely on case insensitivity for file names). -(setq auto-mode-case-fold nil) - -;; Disable bidirectional text scanning for a modest performance boost. I've set -;; this to `nil' in the past, but the `bidi-display-reordering's docs say that -;; is an undefined state and suggest this to be just as good: -(setq-default bidi-display-reordering 'left-to-right - bidi-paragraph-direction 'left-to-right) - -;; Disabling the BPA makes redisplay faster, but might produce incorrect display -;; reordering of bidirectional text with embedded parentheses and other bracket -;; characters whose 'paired-bracket' Unicode property is non-nil. -(setq bidi-inhibit-bpa t) ; Emacs 27 only - -;; Reduce rendering/line scan work for Emacs by not rendering cursors or regions -;; in non-focused windows. -(setq-default cursor-in-non-selected-windows nil) -(setq highlight-nonselected-windows nil) - -;; More performant rapid scrolling over unfontified regions. May cause brief -;; spells of inaccurate syntax highlighting right after scrolling, which should -;; quickly self-correct. -(setq fast-but-imprecise-scrolling t) - -;; Don't ping things that look like domain names. -(setq ffap-machine-p-known 'reject) - -;; Resizing the Emacs frame can be a terribly expensive part of changing the -;; font. By inhibiting this, we halve startup times, particularly when we use -;; fonts that are larger than the system default (which would resize the frame). -(setq frame-inhibit-implied-resize t) - -;; The GC introduces annoying pauses and stuttering into our Emacs experience, -;; so we use `gcmh' to stave off the GC while we're using Emacs, and provoke it -;; when it's idle. However, if the idle delay is too long, we run the risk of -;; runaway memory usage in busy sessions. If it's too low, then we may as well -;; not be using gcmh at all. -(setq gcmh-idle-delay 'auto ; default is 15s - gcmh-auto-idle-delay-factor 10 - gcmh-high-cons-threshold (* 16 1024 1024)) ; 16mb - -;; Emacs "updates" its ui more often than it needs to, so slow it down slightly -(setq idle-update-delay 1.0) ; default is 0.5 - -;; Font compacting can be terribly expensive, especially for rendering icon -;; fonts on Windows. Whether disabling it has a notable affect on Linux and Mac -;; hasn't been determined, but do it there anyway, just in case. This increases -;; memory usage, however! -(setq inhibit-compacting-font-caches t) - -;; PGTK builds only: this timeout adds latency to frame operations, like -;; `make-frame-invisible', which are frequently called without a guard because -;; it's inexpensive in non-PGTK builds. Lowering the timeout from the default -;; 0.1 should make childframes and packages that manipulate them (like `lsp-ui', -;; `company-box', and `posframe') feel much snappier. See emacs-lsp/lsp-ui#613. -(setq pgtk-wait-for-event-timeout 0.001) - -;; Increase how much is read from processes in a single chunk (default is 4kb). -;; This is further increased elsewhere, where needed (like our LSP module). -(setq read-process-output-max (* 64 1024)) ; 64kb - -;; Introduced in Emacs HEAD (b2f8c9f), this inhibits fontification while -;; receiving input, which should help a little with scrolling performance. -(setq redisplay-skip-fontification-on-input t) - -;; Performance on Windows is considerably worse than elsewhere. We'll need -;; everything we can get. -(when (boundp 'w32-get-true-file-attributes) - (setq w32-get-true-file-attributes nil ; decrease file IO workload - w32-pipe-read-delay 0 ; faster IPC - w32-pipe-buffer-size (* 64 1024)) ; read more at a time (was 4K) - - ;; The clipboard on Windows could be in another encoding (likely utf-16), so - ;; let Emacs/the OS decide what to use there. - (setq selection-coding-system 'utf-8)) - -;; Remove command line options that aren't relevant to our current OS; means -;; slightly less to process at startup. -(unless IS-MAC (setq command-line-ns-option-alist nil)) -(unless IS-LINUX (setq command-line-x-option-alist nil)) - -;; HACK `tty-run-terminal-initialization' is *tremendously* slow for some -;; reason; inexplicably doubling startup time for terminal Emacs. Keeping -;; it disabled will have nasty side-effects, so we simply delay it instead, -;; and invoke it later, at which point it runs quickly; how mysterious! -(unless (daemonp) - (advice-add #'tty-run-terminal-initialization :override #'ignore) - (add-hook! 'window-setup-hook - (defun doom-init-tty-h () - (advice-remove #'tty-run-terminal-initialization #'ignore) - (tty-run-terminal-initialization (selected-frame) nil t)))) - - -;; -;;; Reasonable defaults for interactive sessions - -;; Disable warnings from legacy advice system. They aren't useful, and what can -;; we do about them, besides changing packages upstream? -(setq ad-redefinition-action 'accept) - -;; Reduce debug output, well, unless we've asked for it. -(setq debug-on-error init-file-debug - jka-compr-verbose init-file-debug) - -;; Get rid of "For information about GNU Emacs..." message at startup, unless -;; we're in a daemon session where it'll say "Starting Emacs daemon." instead, -;; which isn't so bad. -(unless (daemonp) - (advice-add #'display-startup-echo-area-message :override #'ignore)) - -;; Reduce *Message* noise at startup. An empty scratch buffer (or the dashboard) -;; is more than enough. -(setq inhibit-startup-screen t - inhibit-startup-echo-area-message user-login-name - inhibit-default-init t - ;; Shave seconds off startup time by starting the scratch buffer in - ;; `fundamental-mode', rather than, say, `org-mode' or `text-mode', which - ;; pull in a ton of packages. `doom/open-scratch-buffer' provides a better - ;; scratch buffer anyway. - initial-major-mode 'fundamental-mode - initial-scratch-message nil) - - -;; -;;; Incremental lazy-loading - -(defvar doom-incremental-packages '(t) - "A list of packages to load incrementally after startup. Any large packages -here may cause noticeable pauses, so it's recommended you break them up into -sub-packages. For example, `org' is comprised of many packages, and can be -broken up into: - - (doom-load-packages-incrementally - '(calendar find-func format-spec org-macs org-compat - org-faces org-entities org-list org-pcomplete org-src - org-footnote org-macro ob org org-clock org-agenda - org-capture)) - -This is already done by the lang/org module, however. - -If you want to disable incremental loading altogether, either remove -`doom-load-packages-incrementally-h' from `emacs-startup-hook' or set -`doom-incremental-first-idle-timer' to nil. Incremental loading does not occur -in daemon sessions (they are loaded immediately at startup).") - -(defvar doom-incremental-first-idle-timer 2.0 - "How long (in idle seconds) until incremental loading starts. - -Set this to nil to disable incremental loading.") - -(defvar doom-incremental-idle-timer 0.75 - "How long (in idle seconds) in between incrementally loading packages.") - -(defvar doom-incremental-load-immediately (daemonp) - "If non-nil, load all incrementally deferred packages immediately at startup.") - -(defun doom-load-packages-incrementally (packages &optional now) - "Registers PACKAGES to be loaded incrementally. - -If NOW is non-nil, load PACKAGES incrementally, in `doom-incremental-idle-timer' -intervals." - (if (not now) - (appendq! doom-incremental-packages packages) - (while packages - (let* ((gc-cons-threshold most-positive-fixnum) - (req (pop packages))) - (unless (featurep req) - (doom-log "Incrementally loading %s" req) - (condition-case-unless-debug e - (or (while-no-input - ;; If `default-directory' is a directory that doesn't exist - ;; or is unreadable, Emacs throws up file-missing errors, so - ;; we set it to a directory we know exists and is readable. - (let ((default-directory doom-emacs-dir) - (inhibit-message t) - file-name-handler-alist) - (require req nil t)) - t) - (push req packages)) - (error - (message "Failed to load %S package incrementally, because: %s" - req e))) - (if (not packages) - (doom-log "Finished incremental loading") - (run-with-idle-timer doom-incremental-idle-timer - nil #'doom-load-packages-incrementally - packages t) - (setq packages nil))))))) - -(defun doom-load-packages-incrementally-h () - "Begin incrementally loading packages in `doom-incremental-packages'. - -If this is a daemon session, load them all immediately instead." - (if doom-incremental-load-immediately - (mapc #'require (cdr doom-incremental-packages)) - (when (numberp doom-incremental-first-idle-timer) - (run-with-idle-timer doom-incremental-first-idle-timer - nil #'doom-load-packages-incrementally - (cdr doom-incremental-packages) t)))) - - -;; -;;; Fixes/hacks - -;; Produce more helpful (and visible) error messages from errors emitted from -;; hooks (particularly mode hooks, that usually go unnoticed otherwise. -(advice-add #'run-hooks :override #'doom-run-hooks) - - -;; -;;; Bootstrapper - -(defun doom-display-benchmark-h (&optional return-p) - "Display a benchmark including number of packages and modules loaded. - -If RETURN-P, return the message as a string instead of displaying it." - (funcall (if return-p #'format #'message) - "Doom loaded %d packages across %d modules in %.03fs" - (- (length load-path) (length (get 'load-path 'initial-value))) - (if doom-modules (hash-table-count doom-modules) 0) - (or doom-init-time - (setq doom-init-time - (float-time (time-subtract (current-time) before-init-time)))))) - -(defun doom-initialize (&optional force-p) - "Bootstrap Doom, if it hasn't already (or if FORCE-P is non-nil). - -The bootstrap process ensures that everything Doom needs to run is set up; -essential directories exist, core packages are installed, `doom-autoloads-file' -is loaded (failing if it isn't), that all the needed hooks are in place, and -that `core-packages' will load when `package' or `straight' is used. - -The overall load order of Doom is as follows: - - ~/.emacs.d/init.el - ~/.emacs.d/core/core.el - ~/.doom.d/init.el - Module init.el files - `doom-init-modules-hook' - Module config.el files - `doom-configure-modules-hook' - ~/.doom.d/config.el - `after-init-hook' - `emacs-startup-hook' - `doom-init-ui-hook' - `window-setup-hook' - -Module load order is determined by your `doom!' block. See `doom-modules-dirs' -for a list of all recognized module trees. Order defines precedence (from most -to least)." - (when (or force-p (not doom-init-p)) - (setq doom-init-p t) - (doom-log "Initializing Doom") - - ;; Reset as much state as possible, so `doom-initialize' can be treated like - ;; a reset function. e.g. when reloading the config. - (dolist (var '(exec-path load-path)) - (set-default var (get var 'initial-value))) - - ;; Doom caches a lot of information in `doom-autoloads-file'. Module and - ;; package autoloads, autodefs like `set-company-backend!', and variables - ;; like `doom-modules', `doom-disabled-packages', `load-path', - ;; `auto-mode-alist', and `Info-directory-list'. etc. Compiling them into - ;; one place is a big reduction in startup time. - (condition-case-unless-debug e - ;; Avoid `file-name-sans-extension' for premature optimization reasons. - ;; `string-remove-suffix' is cheaper because it performs no file sanity - ;; checks; just plain ol' string manipulation. - (load (string-remove-suffix ".el" doom-autoloads-file) nil 'nomessage) - (file-missing - ;; If the autoloads file fails to load then the user forgot to sync, or - ;; aborted a doom command midway! - (if (locate-file doom-autoloads-file load-path) - ;; Something inside the autoloads file is triggering this error; - ;; forward it to the caller! - (signal 'doom-autoload-error e) - (signal 'doom-error - (list "Doom is in an incomplete state" - "run 'doom sync' on the command line to repair it"))))) - - (if doom-debug-p (doom-debug-mode +1)) - - ;; Load shell environment, optionally generated from 'doom env'. No need - ;; to do so if we're in terminal Emacs, where Emacs correctly inherits - ;; your shell environment. - (when (and (or (display-graphic-p) - (daemonp)) - doom-env-file) - (setq-default process-environment (get 'process-environment 'initial-value)) - (doom-load-envvars-file doom-env-file 'noerror)) - - ;; Loads `use-package' and all the helper macros modules (and users) can use - ;; to configure their packages. - (require 'core-modules) - - ;; There's a chance the user will later use package.el or straight in this - ;; interactive session. If they do, make sure they're properly initialized - ;; when they do. - (autoload 'doom-initialize-packages "core-packages") - (eval-after-load 'package '(require 'core-packages)) - (eval-after-load 'straight '(doom-initialize-packages)) - - (unless noninteractive - ;; Bootstrap the interactive session - (add-hook 'after-change-major-mode-hook #'doom-run-local-var-hooks-maybe-h 100) - (add-hook 'hack-local-variables-hook #'doom-run-local-var-hooks-h) - (add-hook 'emacs-startup-hook #'doom-load-packages-incrementally-h) - (add-hook 'window-setup-hook #'doom-display-benchmark-h) - (doom-run-hook-on 'doom-first-buffer-hook '(find-file-hook doom-switch-buffer-hook)) - (doom-run-hook-on 'doom-first-file-hook '(find-file-hook dired-initial-position-hook)) - (doom-run-hook-on 'doom-first-input-hook '(pre-command-hook)) - - (add-hook 'doom-first-buffer-hook #'gcmh-mode))) - - doom-init-p) - -(provide 'core) -;;; core.el ends here diff --git a/.config/emacs/core/packages.el b/.config/emacs/core/packages.el deleted file mode 100644 index 33c1816..0000000 --- a/.config/emacs/core/packages.el +++ /dev/null @@ -1,52 +0,0 @@ -;; -*- no-byte-compile: t; -*- -;;; core/packages.el - -;; core.el -(package! auto-minor-mode :pin "17cfa1b54800fdef2975c0c0531dad34846a5065") -(package! gcmh :pin "0089f9c3a6d4e9a310d0791cf6fa8f35642ecfd9") -(package! explain-pause-mode - :recipe (:host github - :repo "lastquestion/explain-pause-mode") - :pin "2356c8c3639cbeeb9751744dbe737267849b4b51") - -;; core-packages.el -(package! straight - :type 'core - :recipe `(:host github - :repo "raxod502/straight.el" - :branch ,straight-repository-branch - :local-repo "straight.el" - :files ("straight*.el")) - :pin "92d4153362a87a585d16f31a2591324dac48e9f0") - -;; core-modules.el -(package! use-package - :type 'core - :pin "a7422fb8ab1baee19adb2717b5b47b9c3812a84c") - -;; core-ui.el -(package! all-the-icons :pin "483dba65e897071c156cefec937edcf51aa333db") -(package! hide-mode-line :pin "bc5d293576c5e08c29e694078b96a5ed85631942") -(package! highlight-numbers :pin "8b4744c7f46c72b1d3d599d4fb75ef8183dee307") -(package! rainbow-delimiters :pin "d576e6694ad3a3e88b2bb1363305b38fa364c149") -(package! restart-emacs :pin "1607da2bc657fe05ae01f7fdf26f716eafead02c") - -;; core-editor.el -(package! better-jumper :pin "3148a17b5920bba8ec4f81b717b99acde5fd5b74") -(package! dtrt-indent :pin "1986ad4e60f2e21f69d77ef9fb14da80a6157866") -(package! helpful :pin "2afbde902742b1aa64daa31a635ba564f14b35ae") -(package! pcre2el :pin "0b5b2a2c173aab3fd14aac6cf5e90ad3bf58fa7d") -(package! smartparens :pin "f59a40d54f35299007c396bd667ce3e9ec4714e3") -(package! ws-butler - ;; Use my fork of ws-butler, which has a few choice improvements and - ;; optimizations (the original has been abandoned). - :recipe (:host github :repo "hlissner/ws-butler") - :pin "572a10c11b6cb88293de48acbb59a059d36f9ba5") - -;; core-projects.el -(package! projectile :pin "2bb7ec28b1275bbce7cac743ee9e7b2cf41c5bbd") -(package! project :pin "401e4aa68e5f46fe72ca6f9a1cb07cd84f5ee981") - -;; core-keybinds.el -(package! general :pin "9651024e7f40a8ac5c3f31f8675d3ebe2b667344") -(package! which-key :pin "1bb1f723dab2fc8b88b7f7273d0a7fa11134b936") diff --git a/.config/emacs/core/templates/BUG_REPORT b/.config/emacs/core/templates/BUG_REPORT deleted file mode 100644 index a46909c..0000000 --- a/.config/emacs/core/templates/BUG_REPORT +++ /dev/null @@ -1,29 +0,0 @@ -Please read through the following before you submit your issue. - -+ [ ] Running `make` (then restarting Emacs) did not fix my issue -+ [ ] If I have byte-compiled, I've tried recompiling with `make compile` -+ [ ] If I changed the version of Emacs installed, I've recompiled by plugins - with `make compile-elpa` -+ [ ] I ran `make doctor` and it produced no leads -+ [ ] My issue cannot be found [on the wiki](/docs/troubleshoot.org) -+ [ ] I filled out the four fields in the template below - -------------------------------------------------------------------- - -### Observed behavior - - - -### Expected behavior - - - -### Steps to reproduce - - - -### Extra details - - - -------------------------------------------------------------------- diff --git a/.config/emacs/core/templates/QUICKSTART_INTRO b/.config/emacs/core/templates/QUICKSTART_INTRO deleted file mode 100644 index 4614558..0000000 --- a/.config/emacs/core/templates/QUICKSTART_INTRO +++ /dev/null @@ -1,19 +0,0 @@ -But before you doom yourself, here are some things you should know: - -1. Don't forget to run 'doom sync', then restart Emacs, after modifying - ~/.doom.d/init.el or ~/.doom.d/packages.el. - - This command ensures needed packages are installed, orphaned packages are - removed, and your autoloads/cache files are up to date. When in doubt, run - 'doom sync'! - -2. If something goes wrong, run `doom doctor`. It diagnoses common issues with - your environment and setup, and may offer clues about what is wrong. - -3. Use 'doom upgrade' to update Doom. Doing it any other way will require - additional steps. Run 'doom help upgrade' to understand those extra steps. - -4. Access Doom's documentation from within Emacs via 'SPC h d h' or 'C-h d h' - (or 'M-x doom/help') - -Have fun! diff --git a/.config/emacs/core/templates/VANILLA_SANDBOX b/.config/emacs/core/templates/VANILLA_SANDBOX deleted file mode 100644 index 02a4182..0000000 --- a/.config/emacs/core/templates/VANILLA_SANDBOX +++ /dev/null @@ -1,12 +0,0 @@ -;; Welcome to the sandbox! -;; -;; This is a test bed for running Emacs Lisp in another instance of Emacs that -;; has varying amounts of Doom loaded: -;; -;; - vanilla Emacs (nothing loaded) \[doom--run-vanilla-emacs] -;; - vanilla Doom (only Doom core) \[doom--run-vanilla-doom] -;; - Doom + modules - your private config \[doom--run-vanilla-doom+] -;; - Doom + modules + your private config \[doom--run-full-doom] -;; -;; This is done without sacrificing access to installed packages. Use the sandbox -;; to reproduce bugs and determine if Doom is to blame. diff --git a/.config/emacs/core/templates/config.example.el b/.config/emacs/core/templates/config.example.el deleted file mode 100644 index 7560003..0000000 --- a/.config/emacs/core/templates/config.example.el +++ /dev/null @@ -1,54 +0,0 @@ -;;; $DOOMDIR/config.el -*- lexical-binding: t; -*- - -;; Place your private configuration here! Remember, you do not need to run 'doom -;; sync' after modifying this file! - - -;; Some functionality uses this to identify you, e.g. GPG configuration, email -;; clients, file templates and snippets. -(setq user-full-name "John Doe" - user-mail-address "john@doe.com") - -;; Doom exposes five (optional) variables for controlling fonts in Doom. Here -;; are the three important ones: -;; -;; + `doom-font' -;; + `doom-variable-pitch-font' -;; + `doom-big-font' -- used for `doom-big-font-mode'; use this for -;; presentations or streaming. -;; -;; They all accept either a font-spec, font string ("Input Mono-12"), or xlfd -;; font string. You generally only need these two: -;; (setq doom-font (font-spec :family "monospace" :size 12 :weight 'semi-light) -;; doom-variable-pitch-font (font-spec :family "sans" :size 13)) - -;; There are two ways to load a theme. Both assume the theme is installed and -;; available. You can either set `doom-theme' or manually load a theme with the -;; `load-theme' function. This is the default: -(setq doom-theme 'doom-one) - -;; If you use `org' and don't want your org files in the default location below, -;; change `org-directory'. It must be set before org loads! -(setq org-directory "~/org/") - -;; This determines the style of line numbers in effect. If set to `nil', line -;; numbers are disabled. For relative line numbers, set this to `relative'. -(setq display-line-numbers-type t) - - -;; Here are some additional functions/macros that could help you configure Doom: -;; -;; - `load!' for loading external *.el files relative to this one -;; - `use-package!' for configuring packages -;; - `after!' for running code after a package has loaded -;; - `add-load-path!' for adding directories to the `load-path', relative to -;; this file. Emacs searches the `load-path' when you load packages with -;; `require' or `use-package'. -;; - `map!' for binding new keys -;; -;; To get information about any of these functions/macros, move the cursor over -;; the highlighted symbol at press 'K' (non-evil users must press 'C-c c k'). -;; This will open documentation for it, including demos of how they are used. -;; -;; You can also try 'gd' (or 'C-c c d') to jump to their definition and see how -;; they are implemented. diff --git a/.config/emacs/core/templates/packages.example.el b/.config/emacs/core/templates/packages.example.el deleted file mode 100644 index b80e9cc..0000000 --- a/.config/emacs/core/templates/packages.example.el +++ /dev/null @@ -1,50 +0,0 @@ -;; -*- no-byte-compile: t; -*- -;;; $DOOMDIR/packages.el - -;; To install a package with Doom you must declare them here and run 'doom sync' -;; on the command line, then restart Emacs for the changes to take effect -- or -;; use 'M-x doom/reload'. - - -;; To install SOME-PACKAGE from MELPA, ELPA or emacsmirror: -;(package! some-package) - -;; To install a package directly from a remote git repo, you must specify a -;; `:recipe'. You'll find documentation on what `:recipe' accepts here: -;; https://github.com/raxod502/straight.el#the-recipe-format -;(package! another-package -; :recipe (:host github :repo "username/repo")) - -;; If the package you are trying to install does not contain a PACKAGENAME.el -;; file, or is located in a subdirectory of the repo, you'll need to specify -;; `:files' in the `:recipe': -;(package! this-package -; :recipe (:host github :repo "username/repo" -; :files ("some-file.el" "src/lisp/*.el"))) - -;; If you'd like to disable a package included with Doom, you can do so here -;; with the `:disable' property: -;(package! builtin-package :disable t) - -;; You can override the recipe of a built in package without having to specify -;; all the properties for `:recipe'. These will inherit the rest of its recipe -;; from Doom or MELPA/ELPA/Emacsmirror: -;(package! builtin-package :recipe (:nonrecursive t)) -;(package! builtin-package-2 :recipe (:repo "myfork/package")) - -;; Specify a `:branch' to install a package from a particular branch or tag. -;; This is required for some packages whose default branch isn't 'master' (which -;; our package manager can't deal with; see raxod502/straight.el#279) -;(package! builtin-package :recipe (:branch "develop")) - -;; Use `:pin' to specify a particular commit to install. -;(package! builtin-package :pin "1a2b3c4d5e") - - -;; Doom's packages are pinned to a specific commit and updated from release to -;; release. The `unpin!' macro allows you to unpin single packages... -;(unpin! pinned-package) -;; ...or multiple packages -;(unpin! pinned-package another-pinned-package) -;; ...Or *all* packages (NOT RECOMMENDED; will likely break things) -;(unpin! t) diff --git a/.config/emacs/core/test/test-autoload-buffers.el b/.config/emacs/core/test/test-autoload-buffers.el deleted file mode 100644 index f452783..0000000 --- a/.config/emacs/core/test/test-autoload-buffers.el +++ /dev/null @@ -1,160 +0,0 @@ -;; -*- no-byte-compile: t; -*- -;;; core/test/test-autoload-buffers.el - -(describe "core/autoload/buffers" - :var (a b c d) - - (require 'core-projects) - (load! "autoload/buffers" doom-core-dir) - - (before-each - (delete-other-windows) - (setq a (switch-to-buffer (get-buffer-create "a")) - b (get-buffer-create "b") - c (get-buffer-create "c") - d (get-buffer-create "d"))) - (after-each - (kill-buffer a) - (kill-buffer b) - (kill-buffer c) - (kill-buffer d)) - - (describe "buffer lists" - (describe "doom-buffer-list" - (it "should only see four buffers" - (expect (doom-buffer-list) :to-contain-items (list a b c d))))) - - ;; TODO predicate tests - (xdescribe "predicate functions" - (describe "doom-dired-buffer-p") - (describe "doom-special-buffer-p") - (describe "doom-temp-buffer-p") - (describe "doom-visible-buffer-p") - (describe "doom-buried-buffer-p") - (describe "doom-non-file-visiting-buffer-p") - (describe "doom-dired-buffer-p") - (describe "doom-buffer-frame-predicate")) - - (describe "doom-project-buffer-list" - :var (projectile-projects-cache-time projectile-projects-cache) - (before-all (require 'projectile)) - (after-all (unload-feature 'projectile t)) - - (before-each - (with-current-buffer a (setq default-directory doom-emacs-dir)) - (with-current-buffer b (setq default-directory doom-core-dir)) - (with-current-buffer c (setq default-directory "/tmp/")) - (with-current-buffer d (setq default-directory "~")) - (projectile-mode +1)) - (after-each - (projectile-mode -1)) - - (it "returns buffers in the same project" - (with-current-buffer a - (expect (doom-project-buffer-list) - :to-contain-items (list a b)))) - - (it "returns all buffers if not in a project" - (with-current-buffer c - (expect (doom-project-buffer-list) - :to-have-same-items-as (buffer-list))))) - - (describe "doom-fallback-buffer" - (it "returns a live buffer" - (expect (buffer-live-p (doom-fallback-buffer)))) - - (it "returns the scratch buffer" - (expect (doom-fallback-buffer) :to-equal (get-buffer "*scratch*")))) - - (describe "real buffers" - (before-each - (with-current-buffer b (setq buffer-file-name "x")) - (with-current-buffer c (rename-buffer "*C*"))) - - (describe "doom-mark-buffer-as-real-h" - (with-current-buffer a - (doom-mark-buffer-as-real-h) - (expect (buffer-local-value 'doom-real-buffer-p a)))) - - (describe "doom-set-buffer-real" - (it "sets `doom-real-buffer-p' buffer-locally" - (doom-set-buffer-real a t) - (expect (buffer-local-value 'doom-real-buffer-p a)))) - - (describe "doom-real-buffer-p" - (it "returns t for buffers manually marked real" - (doom-set-buffer-real a t) - (expect (doom-real-buffer-p a))) - (it "returns t for file-visiting buffers" - (expect (doom-real-buffer-p b))) - (it "returns nil for temporary buffers" - (expect (doom-real-buffer-p c) :to-be nil) - (expect (doom-real-buffer-p d) :to-be nil))) - - (describe "doom-unreal-buffer-p" - (it "returns t for unreal buffers" - (expect (doom-unreal-buffer-p c)) - (expect (doom-unreal-buffer-p d))) - (it "returns nil for real buffers" - (doom-set-buffer-real a t) - (expect (not (doom-unreal-buffer-p a))) - (expect (not (doom-unreal-buffer-p b))))) - - (describe "doom-real-buffer-list" - (it "returns only real buffers" - (expect (doom-real-buffer-list) :to-contain-items (list a b))))) - - (describe "buffer/window management" - (describe "buffer search methods" - (before-each - (with-current-buffer a (lisp-mode)) - (with-current-buffer b (text-mode)) - (with-current-buffer c (text-mode)) - (split-window) - (switch-to-buffer b)) - - (describe "doom-matching-buffers" - (it "can match buffers by regexp" - (expect (doom-matching-buffers "^[ac]$") :to-have-same-items-as (list a c)))) - - (describe "doom-buffers-in-mode" - (it "can match buffers by major-mode" - (expect (doom-buffers-in-mode 'text-mode) :to-have-same-items-as (list b c)))) - - (describe "doom-buried-buffers" - (it "can find all buried buffers" - (expect (doom-buried-buffers) :to-contain-items (list c d)))) - - (describe "doom-visible-buffers" - (it "can find all visible buffers" - (expect (doom-visible-buffers) - :to-have-same-items-as (list a b)))) - - (describe "doom-visible-windows" - (it "can find all visible windows" - (expect (doom-visible-windows) - :to-have-same-items-as - (mapcar #'get-buffer-window (list a b)))))) - - (describe "killing buffers/windows" - (describe "doom-kill-buffer-and-windows" - (before-each - (split-window) (switch-to-buffer b) - (split-window) (switch-to-buffer a)) - - (it "kills the selected buffers and all its windows" - (doom-kill-buffer-and-windows a) - (expect (buffer-live-p a) :to-be nil) - (expect (length (doom-visible-windows)) :to-be 1))) - - ;; TODO - (xdescribe "doom-fixup-windows") - (xdescribe "doom-kill-buffer-fixup-windows") - (xdescribe "doom-kill-buffers-fixup-windows")) - - (xdescribe "commands" - (describe "doom/kill-all-buffers") - (describe "doom/kill-other-buffers") - (describe "doom/kill-matching-buffers") - (describe "doom/kill-buried-buffers") - (describe "doom/kill-project-buffers")))) diff --git a/.config/emacs/core/test/test-autoload-files.el b/.config/emacs/core/test/test-autoload-files.el deleted file mode 100644 index 7429eb3..0000000 --- a/.config/emacs/core/test/test-autoload-files.el +++ /dev/null @@ -1,164 +0,0 @@ -;; -*- no-byte-compile: t; -*- -;;; core/test/test-autoload-files.el - -(describe "core/autoload/files" - - (load! "autoload/files" doom-core-dir) - - (describe "library" - (describe "file-exists-p!" - (it "is a (quasi) drop-in replacement for `file-exists-p'" - (let ((default-directory doom-emacs-dir) - (init-file "init.el")) - (expect (file-exists-p "init.el")) - (expect (and (file-exists-p! "init.el") - (file-exists-p "init.el"))) - (expect (and (file-exists-p! init-file) - (file-exists-p init-file))) - (expect (and (file-exists-p! doom-emacs-dir) - (file-exists-p doom-emacs-dir))) - (expect (and (not (file-exists-p! "/cant/possibly/exist/please/dont/exist")) - (not (file-exists-p "/cant/possibly/exist/please/dont/exist")))))) - - (it "returns the file path if it exists" - (expect (file-exists-p! "init.example.el" - doom-emacs-dir) - :to-equal (expand-file-name "init.example.el" doom-emacs-dir))) - - (it "understands compound statements" - (let ((default-directory doom-emacs-dir)) - (expect (file-exists-p! (and "init.el" "init.example.el"))) - (expect (file-exists-p! (or "doesnotexist" "init.example.el"))) - (expect (not (file-exists-p! (or "doesnotexist" "DOESNOTEXIST"))))) - (expect (file-exists-p! (and "init.el" "init.example.el") - doom-emacs-dir)) - (expect (file-exists-p! (and "init.el" "init.example.el") - doom-emacs-dir)) - (expect (file-exists-p! (or "doesnotexist" "init.example.el") - doom-emacs-dir)) - (expect (not (file-exists-p! (or "doesnotexist" "DOESNOTEXIST") - doom-emacs-dir)))) - - (it "understands nested compound statements" - (expect (file-exists-p! (and "init.el" "init.example.el" - (or "doesnotexist" "LICENSE")) - doom-emacs-dir)) - (expect (file-exists-p! (and "init.el" "init.example.el" - (and "LICENSE" "README.md" - (or "doesnotexist" - "early-init.el"))) - doom-emacs-dir)) - (expect (file-exists-p! (and "init.el" "init.example.el" - (or "edoesnotexist" "DOESNOTEXIST" - (and "idontexist" - "doanyofusexist?"))) - doom-emacs-dir) - :to-be nil)) - - (it "returns the last form if a compound file check succeeds" - (expect (file-exists-p! (and "init.el" "init.example.el" - (or "doesnotexist" "LICENSE")) - doom-emacs-dir) - :to-equal (expand-file-name "LICENSE" doom-emacs-dir)) - (expect (file-exists-p! (and "init.el" "init.example.el" - (or (or "doesnotexist" "DOESNOTEXIST") - "doanyofusreallyexist" - (or "cantexist" "LICENSE"))) - doom-emacs-dir) - :to-equal (expand-file-name "LICENSE" doom-emacs-dir))) - - (it "disregards the directory argument if given absolute path" - (expect (file-exists-p! "/tmp" "/directory/that/doesnt/exist")) - (expect (file-exists-p! doom-core-dir "/directory/that/doesnt/exist")) - (expect (file-exists-p! (and "/tmp" doom-core-dir) "/directory/that/doesnt/exist")) - (expect (file-exists-p! (or "/tmp" doom-core-dir) "/directory/that/doesnt/exist"))) - - (it "interpolates variables" - (let ((file-1 "init.el") - (file-2 "init.example.el") - (file-3 "LICENSE") - (file-404 "doesnotexistlikenoreally")) - (expect (file-exists-p! file-1 doom-emacs-dir)) - (expect (file-exists-p! (and file-1 file-2) doom-emacs-dir)) - (expect (file-exists-p! (and file-1 (or file-404 file-2)) doom-emacs-dir)) - (expect (file-exists-p! (or (and file-404 file-2) (and file-3 file-1)) - doom-emacs-dir)))) - - (it "interpolates forms" - (cl-letf (((symbol-function 'getfilename) - (lambda () "init.example.el"))) - (expect (file-exists-p! (and (or (if nil "init.el" "doesnotexist") - (getfilename)) - "LICENSE") - doom-emacs-dir) - :to-equal (expand-file-name "LICENSE" doom-emacs-dir))))) - - ;; TODO - (xdescribe "doom-glob") - (xdescribe "doom-path") - (xdescribe "doom-dir") - (xdescribe "doom-files-in") - (xdescribe "doom-file-size") - (xdescribe "doom-directory-size") - (xdescribe "doom-file-cookie-p")) - - (describe "interactive file operations" - :var (src dest projectile-projects-cache-time projectile-projects-cache) - - (require 'core-projects) - (require 'projectile) - - (before-each - (setq src (make-temp-file "test-src") - existing (make-temp-file "test-existing") - dest (expand-file-name "test-dest" temporary-file-directory)) - (quiet! (find-file-literally src)) - (spy-on 'y-or-n-p :and-return-value nil) - (projectile-mode +1)) - - (after-each - (projectile-mode -1) - (switch-to-buffer (doom-fallback-buffer)) - (ignore-errors (delete-file src)) - (ignore-errors (delete-file existing)) - (ignore-errors (delete-file dest))) - - (describe "move-this-file" - (it "won't move to itself" - (expect (quiet! (doom/move-this-file src)) :to-throw)) - (it "will move to another file" - (expect (quiet! (doom/move-this-file dest t))) - (expect (file-exists-p dest)) - (expect (file-exists-p src) :to-be nil)) - (it "will prompt if overwriting a file" - (quiet! (doom/move-this-file existing)) - (expect 'y-or-n-p :to-have-been-called-times 1) - (expect (file-exists-p src)))) - - (describe "copy-this-file" - (it "refuses to copy to itself" - (expect (quiet! (doom/copy-this-file src)) :to-throw)) - (it "copies to another file" - (expect (quiet! (doom/copy-this-file dest t))) - (expect (file-exists-p! src dest))) - (it "prompts if overwriting a file" - (quiet! (doom/copy-this-file existing)) - (expect 'y-or-n-p :to-have-been-called-times 1))) - - (describe "delete-this-file" - (it "fails gracefully on non-existent files" - (expect (quiet! (doom/delete-this-file dest)) :to-throw)) - (it "deletes existing files" - (quiet! (doom/delete-this-file existing t)) - (expect (file-exists-p existing) :to-be nil)) - (it "prompts to delete any existing file" - (quiet! (doom/delete-this-file existing)) - (expect 'y-or-n-p :to-have-been-called-times 1)))) - - (xdescribe "sudo {this,find} file" - (before-each - (spy-on 'find-file :and-return-value nil) - (spy-on 'find-alternate-file :and-return-value nil)) - - (describe "doom/sudo-find-file") - (describe "doom/sudo-this-file"))) diff --git a/.config/emacs/core/test/test-autoload-format.el b/.config/emacs/core/test/test-autoload-format.el deleted file mode 100644 index f3d5563..0000000 --- a/.config/emacs/core/test/test-autoload-format.el +++ /dev/null @@ -1,44 +0,0 @@ -;; -*- no-byte-compile: t; -*- -;;; core/test/test-autoload-message.el - -(describe "core/autoload/format" - (describe "format!" - :var (doom-output-backend) - (before-all - (setq doom-output-backend 'ansi)) - - (it "should be a drop-in replacement for `format'" - (expect (format! "Hello %s" "World") - :to-equal "Hello World")) - - (it "supports ansi coloring in noninteractive sessions" - (expect (format! (red "Hello %s") "World") - :to-equal "Hello World")) - - (it "supports text properties in interactive sessions" - (let ((doom-output-backend 'text-properties)) - (expect (get-text-property 0 'face (format! (red "Hello %s") "World")) - :to-equal (list :foreground (face-foreground 'term-color-red))))) - - (it "supports nested color specs" - (expect (format! (bold (red "Hello %s")) "World") - :to-equal (format "\e[%dm%s\e[0m" 1 - (format "\e[%dm%s\e[0m" 31 "Hello World"))) - (expect (format! (on-red (bold "Hello %s")) "World") - :to-equal (format "\e[%dm%s\e[0m" 41 - (format "\e[%dm%s\e[0m" 1 "Hello World"))) - (expect (format! (dark (white "Hello %s")) "World") - :to-equal (format "\e[%dm%s\e[0m" 2 - (format "\e[%dm%s\e[0m" 37 "Hello World")))) - - (it "supports dynamic color apply syntax" - (expect (format! (color 'red "Hello %s") "World") - :to-equal (format! (red "Hello %s") "World")) - (expect (format! (color (if nil 'red 'blue) "Hello %s") "World") - :to-equal (format! (blue "Hello %s") "World")))) - - (xdescribe "insert!") - (xdescribe "print!") - (xdescribe "print-group!") - (xdescribe "error!") - (xdescribe "user-error!")) diff --git a/.config/emacs/core/test/test-autoload-package.el b/.config/emacs/core/test/test-autoload-package.el deleted file mode 100644 index 0292330..0000000 --- a/.config/emacs/core/test/test-autoload-package.el +++ /dev/null @@ -1,5 +0,0 @@ -;; -*- no-byte-compile: t; -*- -;;; core/test/test-autoload-package.el -;;;###if nil - -(xdescribe "core/autoload/packages") diff --git a/.config/emacs/core/test/test-core-keybinds.el b/.config/emacs/core/test/test-core-keybinds.el deleted file mode 100644 index 52fe723..0000000 --- a/.config/emacs/core/test/test-core-keybinds.el +++ /dev/null @@ -1,256 +0,0 @@ -;; -*- no-byte-compile: t; -*- -;;; core/test/test-core-keybinds.el - -(describe "core/keybinds" - (require 'core-keybinds) - - ;; FIXME test against their side effects rather than their implementation - (describe "map!" - :var (doom--map-evil-p states-alist) - (before-each - (setq doom--map-evil-p t - states-alist '((:n . normal) - (:v . visual) - (:i . insert) - (:e . emacs) - (:o . operator) - (:m . motion) - (:r . replace)))) - - (describe "Single keybinds" - (it "binds a global key" - (expect '(map! "C-." #'a) - :to-expand-into '(general-define-key "C-." #'a))) - - (it "binds a key in one evil state" - (dolist (state states-alist) - (expect `(map! ,(car state) "C-." #'a) - :to-expand-into - `(general-define-key :states ',(cdr state) "C-." #'a)))) - - (it "binds a key in multiple evil states" - (expect '(map! :nvi "C-." #'a) - :to-expand-into - '(progn (general-define-key :states 'insert "C-." #'a) - (general-define-key :states 'visual "C-." #'a) - (general-define-key :states 'normal "C-." #'a)))) - - (it "binds evil keybinds together with global keybinds" - (expect '(map! :ng "C-." #'a) - :to-expand-into - '(progn - (general-define-key :states 'normal "C-." #'a) - (general-define-key "C-." #'a))))) - - (describe "Multiple keybinds" - (it "binds global keys and preserves order" - (expect '(map! "C-." #'a "C-," #'b "C-/" #'c) - :to-expand-into - '(general-define-key "C-." #'a "C-," #'b "C-/" #'c))) - - (it "binds multiple keybinds in an evil state and preserve order" - (dolist (state states-alist) - (expect `(map! ,(car state) "a" #'a - ,(car state) "b" #'b - ,(car state) "c" #'c) - :to-expand-into - `(general-define-key :states ',(cdr state) - "a" #'a - "b" #'b - "c" #'c)))) - - (it "binds multiple keybinds in different evil states" - (expect `(map! :n "a" #'a - :n "b" #'b - :n "e" #'e - :v "c" #'c - :i "d" #'d) - :to-expand-into - `(progn (general-define-key :states 'insert "d" #'d) - (general-define-key :states 'visual "c" #'c) - (general-define-key :states 'normal "a" #'a "b" #'b "e" #'e)))) - - (it "groups multi-state keybinds while preserving same-group key order" - (expect `(map! :n "a" #'a - :v "c" #'c - :n "b" #'b - :i "d" #'d - :n "e" #'e) - :to-expand-into - `(progn (general-define-key :states 'insert "d" #'d) - (general-define-key :states 'visual "c" #'c) - (general-define-key :states 'normal "a" #'a "b" #'b "e" #'e)))) - - (it "binds multiple keybinds in multiple evil states" - (expect `(map! :nvi "a" #'a - :nvi "b" #'b - :nvi "c" #'c) - :to-expand-into - '(progn (general-define-key :states 'insert "a" #'a "b" #'b "c" #'c) - (general-define-key :states 'visual "a" #'a "b" #'b "c" #'c) - (general-define-key :states 'normal "a" #'a "b" #'b "c" #'c))))) - - (describe "Nested keybinds" - (it "binds global keys" - (expect '(map! "C-." #'a - ("C-a" #'b) - ("C-x" #'c)) - :to-expand-into - '(progn (general-define-key "C-." #'a) - (general-define-key "C-a" #'b) - (general-define-key "C-x" #'c)))) - - (it "binds nested evil keybinds" - (expect '(map! :n "C-." #'a - (:n "C-a" #'b) - (:n "C-x" #'c)) - :to-expand-into - '(progn (general-define-key :states 'normal "C-." #'a) - (general-define-key :states 'normal "C-a" #'b) - (general-define-key :states 'normal "C-x" #'c)))) - - (it "binds global keybinds in between evil keybinds" - (expect '(map! :n "a" #'a - "b" #'b - :n "c" #'c) - :to-expand-into - '(progn (general-define-key "b" #'b) - (general-define-key :states 'normal "a" #'a "c" #'c))))) - - ;; - (describe "Properties" - (describe ":after" - (it "wraps `general-define-key' in a `after!' block" - (dolist (form '((map! :after helm "a" #'a "b" #'b) - (map! (:after helm "a" #'a "b" #'b)))) - (expect form :to-expand-into '(after! helm (general-define-key "a" #'a "b" #'b)))) - (expect '(map! "a" #'a (:after helm "b" #'b "c" #'c)) - :to-expand-into - '(progn - (general-define-key "a" #'a) - (after! helm - (general-define-key "b" #'b "c" #'c)))) - (expect '(map! (:after helm "b" #'b "c" #'c) "a" #'a) - :to-expand-into - '(progn - (after! helm - (general-define-key "b" #'b "c" #'c)) - (general-define-key "a" #'a)))) - - (it "nests `after!' blocks" - (expect '(map! :after x "a" #'a - (:after y "b" #'b - (:after z "c" #'c))) - :to-expand-into - '(after! x - (progn - (general-define-key "a" #'a) - (after! y - (progn - (general-define-key "b" #'b) - (after! z - (general-define-key "c" #'c)))))))) - - (it "nests `after!' blocks in other nested blocks" - (expect '(map! :after x "a" #'a - (:when t "b" #'b - (:after z "c" #'c))) - :to-expand-into - '(after! x - (progn - (general-define-key "a" #'a) - (when t - (progn - (general-define-key "b" #'b) - (after! z (general-define-key "c" #'c))))))))) - - (describe ":desc" - (it "add a :which-key property to a keybind's DEF" - (expect '(map! :desc "A" "a" #'a) - :to-expand-into - `(general-define-key "a" (list :def #'a :which-key "A"))))) - - (describe ":when/:unless" - (it "wraps keys in a conditional block" - (dolist (prop '(:when :unless)) - (let ((prop-fn (intern (doom-keyword-name prop)))) - (expect `(map! ,prop t "a" #'a "b" #'b) - :to-expand-into - `(,prop-fn t (general-define-key "a" #'a "b" #'b))) - (expect `(map! (,prop t "a" #'a "b" #'b)) - :to-expand-into - `(,prop-fn t (general-define-key "a" #'a "b" #'b)))))) - - (it "nests conditional blocks" - (expect '(map! (:when t "a" #'a (:when t "b" #'b))) - :to-expand-into - '(when t - (progn (general-define-key "a" #'a) - (when t (general-define-key "b" #'b))))))) - - (describe ":leader" - (it "uses leader definer" - (expect '(map! :leader "a" #'a "b" #'b) - :to-expand-into - '(doom--define-leader-key "a" #'a "b" #'b))) - - (it "it persists for nested keys" - (expect '(map! :leader "a" #'a ("b" #'b)) - :to-expand-into - '(progn (doom--define-leader-key "a" #'a) - (doom--define-leader-key "b" #'b))))) - - (describe ":localleader" - (it "uses localleader definer" - (expect '(map! :localleader "a" #'a "b" #'b) - :to-expand-into - '(define-localleader-key! "a" #'a "b" #'b))) - - (it "it persists for nested keys" - (expect '(map! :localleader "a" #'a ("b" #'b)) - :to-expand-into - '(progn (define-localleader-key! "a" #'a) - (define-localleader-key! "b" #'b))))) - - (describe ":map/:keymap" - (it "specifies a single keymap for keys" - (expect '(map! :map emacs-lisp-mode-map "a" #'a) - :to-expand-into - '(general-define-key :keymaps '(emacs-lisp-mode-map) "a" #'a))) - - (it "specifies multiple keymap for keys" - (expect '(map! :map (lisp-mode-map emacs-lisp-mode-map) "a" #'a) - :to-expand-into - '(general-define-key :keymaps '(lisp-mode-map emacs-lisp-mode-map) "a" #'a)))) - - (describe ":mode" - (it "appends -map to MODE" - (expect '(map! :mode emacs-lisp-mode "a" #'a) - :to-expand-into - '(general-define-key :keymaps '(emacs-lisp-mode-map) "a" #'a)))) - - (describe ":prefix" - (it "specifies a prefix for all keys" - (expect '(map! :prefix "a" "x" #'x "y" #'y "z" #'z) - :to-expand-into - '(general-define-key :prefix "a" "x" #'x "y" #'y "z" #'z))) - - (it "overwrites previous inline :prefix properties" - (expect '(map! :prefix "a" "x" #'x "y" #'y :prefix "b" "z" #'z) - :to-expand-into - '(progn (general-define-key :prefix "a" "x" #'x "y" #'y) - (general-define-key :prefix "b" "z" #'z)))) - - (it "accumulates keys when nested" - (expect '(map! (:prefix "a" "x" #'x (:prefix "b" "x" #'x))) - :to-expand-into - `(progn (general-define-key :prefix "a" "x" #'x) - (general-define-key :prefix (general--concat nil "a" "b") - "x" #'x))))) - - (describe ":textobj" - (it "defines keys in evil-{inner,outer}-text-objects-map" - (expect '(map! :textobj "a" #'inner #'outer) - :to-expand-into - '(map! (:map evil-inner-text-objects-map "a" #'inner) - (:map evil-outer-text-objects-map "a" #'outer)))))))) diff --git a/.config/emacs/core/test/test-core-lib.el b/.config/emacs/core/test/test-core-lib.el deleted file mode 100644 index ea3bacb..0000000 --- a/.config/emacs/core/test/test-core-lib.el +++ /dev/null @@ -1,271 +0,0 @@ -;; -*- no-byte-compile: t; -*- -;;; core/test/test-core-lib.el - -(describe "core-lib" - (before-all - (require 'core-lib)) - - ;; --- Helpers ---------------------------- - (describe "doom-unquote" - (it "unquotes a quoted form" - (expect (doom-unquote '(quote hello)) :to-be 'hello)) - (it "unquotes nested quoted forms" - (expect (doom-unquote '(quote (quote (a b c)))) :to-equal '(a b c))) - (it "unquotes function-quoted forms" - (expect (doom-unquote '(function a)) :to-be 'a)) - (it "does nothing to unquoted forms" - (expect (doom-unquote 'hello) :to-be 'hello) - (expect (doom-unquote 5) :to-be 5) - (expect (doom-unquote t) :to-be t))) - - (describe "doom-enlist" - (it "returns nil if given nil" - (expect (doom-enlist nil) :to-be nil)) - (it "creates a list out of non-lists" - (expect (doom-enlist 'a) :to-equal '(a))) - (it "returns lists as-is" - (expect (doom-enlist '(a)) :to-equal '(a)))) - - (describe "doom-keyword-intern" - (it "returns a keyword" - (expect (doom-keyword-intern "test") :to-equal :test)) - (it "errors if given anything but a string" - (expect (doom-keyword-intern t) :to-throw 'wrong-type-argument))) - - (describe "doom-keyword-name" - (it "returns the string name of a keyword" - (expect (doom-keyword-name :test) :to-equal "test")) - (it "errors if given anything but a keyword" - (expect (doom-keyword-name "test") :to-throw 'wrong-type-argument))) - - (describe "doom-partial" - (it "returns a closure" - (expect (functionp (doom-partial #'+ 1)))) - (it "returns a partial closure" - (expect (funcall (doom-partial #'+ 1) 2) :to-be 3))) - - (describe "doom-rpartial" - (it "returns a closure" - (expect (functionp (doom-rpartial #'+ 1)))) - (it "returns a partial closure with right-aligned arguments" - (expect (funcall (doom-rpartial #'/ 2) 10) :to-be 5))) - - - ;; --- Sugars ----------------------------- - (describe "lambda!" - (it "returns an interactive function" - (expect (commandp (lambda!))) - (expect (funcall (lambda! 5)) :to-equal 5))) - - (describe "lambda!!" - (it "returns an interactive function with a prefix argument" - (expect (commandp (lambda! #'ignore t))) - (expect (funcall (lambda!! (lambda (arg) - (interactive "P") - arg) - 5)) - :to-equal 5))) - - (describe "file!" - (it "returns the executing file" - (expect (eval-and-compile (file!)) - :to-equal - (eval-and-compile load-file-name)))) - - (describe "dir!" - (it "returns the executing directory" - (expect (eval-and-compile (dir!)) - :to-equal - (eval-and-compile - (directory-file-name (file-name-directory load-file-name)))))) - - (describe "pushnew!" - (it "pushes values onto a list symbol, in order" - (let ((a '(1 2 3))) - (expect (pushnew! a 9 8 7) - :to-equal '(7 8 9 1 2 3)))) - (it "only adds values that aren't already in the list" - (let ((a '(1 symbol 3.14 "test"))) - (expect (pushnew! a "test" 'symbol 3.14 1) - :to-equal '(1 symbol 3.14 "test"))))) - - (describe "prependq!" - (it "prepends a list to a list symbol" - (let ((list '(a b c))) - (expect (prependq! list '(d e f)) - :to-equal '(d e f a b c))))) - - (describe "append!" - (it "appends a list to a list symbol" - (let ((list '(a b c))) - (expect (appendq! list '(d e f)) - :to-equal '(a b c d e f))))) - - (describe "delq!" - (it "delete's a symbol from a list" - (let ((list '(a b c))) - (delq! 'b list) - (expect list :to-equal '(a c)))) - (it "delete's an element from an alist by key" - (let ((alist '((a 1) (b 2) (c 3)))) - (delq! 'b alist 'assq) - (expect alist :to-equal '((a 1) (c 3)))))) - - (describe "hooks" - (describe "add-hook!" - :var (fake-mode-hook other-mode-hook some-mode-hook) - (before-each - (setq fake-mode-hook '(first-hook) - other-mode-hook nil - some-mode-hook '(first-hook second-hook))) - - (it "resolves quoted hooks literally" - (expect '(add-hook! 'fake-mode-hook #'ignore) :to-expand-into - `(add-hook 'fake-mode-hook #'ignore nil nil))) - (it "resolves unquoted modes to their hook variables" - (expect '(add-hook! fake-mode #'ignore) :to-expand-into - `(add-hook 'fake-mode-hook #'ignore nil nil))) - - (it "adds one-to-one hook" - (add-hook! fake-mode #'hook-2) - (add-hook! 'fake-mode-hook #'hook-1) - (expect fake-mode-hook :to-equal '(hook-1 hook-2 first-hook))) - - (it "adds one-to-many hook" - (add-hook! (fake-mode other-mode some-mode) #'hook-2) - (add-hook! '(fake-mode-hook other-mode-hook some-mode-hook) #'hook-1) - (add-hook! (fake-mode other-mode some-mode) :append #'last-hook) - (expect fake-mode-hook :to-equal '(hook-1 hook-2 first-hook last-hook)) - (expect other-mode-hook :to-equal '(hook-1 hook-2 last-hook)) - (expect some-mode-hook :to-equal '(hook-1 hook-2 first-hook second-hook last-hook))) - - (it "adds many-to-many hooks and preserve provided order" - (add-hook! (fake-mode other-mode some-mode) #'(hook-3 hook-4)) - (add-hook! '(fake-mode-hook other-mode-hook some-mode-hook) #'(hook-1 hook-2)) - (add-hook! '(fake-mode-hook other-mode-hook some-mode-hook) :append #'(last-hook-1 last-hook-2)) - (expect fake-mode-hook :to-equal '(hook-1 hook-2 hook-3 hook-4 first-hook last-hook-1 last-hook-2)) - (expect other-mode-hook :to-equal '(hook-1 hook-2 hook-3 hook-4 last-hook-1 last-hook-2)) - (expect some-mode-hook :to-equal '(hook-1 hook-2 hook-3 hook-4 first-hook second-hook last-hook-1 last-hook-2))) - - (it "adds implicit lambda to one hook" - (add-hook! fake-mode (progn)) - (add-hook! 'other-mode-hook (ignore)) - (add-hook! 'some-mode-hook :append (ignore)) - (expect (caar fake-mode-hook) :to-be 'lambda) - (expect (caar other-mode-hook) :to-be 'lambda) - (expect (caar (last other-mode-hook)) :to-be 'lambda)) - - (it "handles inline defuns as hook symbols" - (add-hook! fake-mode (defun hook-a ())) - (add-hook! 'other-mode-hook - (defun hook-b ()) - (defun hook-c ())) - (expect (car fake-mode-hook) :to-be 'hook-a) - (expect other-mode-hook :to-equal '(hook-b hook-c)))) - - (describe "remove-hook!" - :var (fake-mode-hook) - (before-each - (setq fake-mode-hook '(first-hook second-hook third-hook fourth-hook))) - (it "removes one hook" - (remove-hook! fake-mode #'third-hook) - (remove-hook! 'fake-mode-hook #'second-hook) - (expect fake-mode-hook :to-equal '(first-hook fourth-hook))) - (it "removes multiple hooks" - (remove-hook! fake-mode #'(first-hook third-hook)) - (remove-hook! 'fake-mode-hook #'(second-hook fourth-hook)) - (expect fake-mode-hook :to-be nil))) - - (describe "add-transient-hook!" - (it "adds a transient function to hooks" - (let (hooks value) - (add-transient-hook! 'hooks (setq value t)) - (run-hooks 'hooks) - (expect value) - (expect hooks :to-be nil))) - (it "advises a function with a transient advisor" - (let (value) - (add-transient-hook! #'ignore (setq value (not value))) - (ignore t) - (expect value) - ;; repeat to ensure it was only run once - (ignore t) - (expect value)))) - - (describe "(un)setq-hook!" - :var (fake-hook x y z) - (before-each - (setq x 10 y 20 z 30)) - - (it "sets variables buffer-locally" - (setq-hook! 'fake-hook x 1) - (with-temp-buffer - (run-hooks 'fake-hook) - (expect (local-variable-p 'x)) - (expect (= x 1))) - (expect (= x 10))) - - (it "overwrites earlier hooks" - (setq-hook! 'fake-hook x 1 y 0) - (setq-hook! 'fake-hook x 5 y -1) - (with-temp-buffer - (run-hooks 'fake-hook) - (expect (= x 5)) - (expect (= y -1)))) - - (it "unset setq hooks" - (setq-hook! 'fake-hook x 1 y 0) - (unsetq-hook! 'fake-hook y) - (with-temp-buffer - (run-hooks 'fake-hook) - (expect (local-variable-p 'x)) - (expect (= x 1)) - (expect (not (local-variable-p 'y))) - (expect (= y 20)))))) - - (describe "load!" - (before-each - (spy-on 'load :and-return-value t)) - - (it "loads a file relative to the current directory" - (load! "path") - (expect 'load :to-have-been-called) - (expect 'load :to-have-been-called-with - (expand-file-name "path" (eval-when-compile (dir!))) nil 'nomessage)) - - (it "loads a file relative to a specified directory" - (load! "path" doom-etc-dir) - (expect 'load :to-have-been-called-with - (expand-file-name "path" doom-etc-dir) nil 'nomessage))) - - (describe "quiet!" - :var (doom-debug-mode) - (before-each - (setq doom-debug-mode nil)) - - (it "suppresses output from message" - (expect (message "hello world") :to-output "hello world\n") - (expect (message "hello world") :to-output) - (let (doom-interactive-mode) - (expect (quiet! (message "hello world")) :not :to-output)) - (let ((doom-interactive-mode t)) - (expect (quiet! inhibit-message)) - (expect (quiet! save-silently)))) - - (it "suppresses load messages from `load' & `load-file'" - (let ((tmpfile (make-temp-file "test" nil ".el"))) - (with-temp-file tmpfile) - (let (doom-interactive-mode) - (expect (load-file tmpfile) :to-output (format "Loading %s (source)...\n" tmpfile)) - (expect (quiet! (load-file tmpfile)) :not :to-output)) - (delete-file tmpfile))) - - (it "won't suppress output in debug mode" - (let ((doom-debug-mode t) - (tmpfile (make-temp-file "test" nil ".el"))) - (dolist (doom-interactive-mode (list t nil)) - (expect (quiet! (message "hello world")) - :to-output "hello world\n") - (with-temp-file tmpfile) - (expect (quiet! (load-file tmpfile)) - :to-output (format "Loading %s (source)...\n" tmpfile))))))) diff --git a/.config/emacs/core/test/test-core-modules.el b/.config/emacs/core/test/test-core-modules.el deleted file mode 100644 index f8c8966..0000000 --- a/.config/emacs/core/test/test-core-modules.el +++ /dev/null @@ -1,23 +0,0 @@ -;; -*- no-byte-compile: t; -*- -;;; core/test/test-core-modules.el - -(xdescribe "core-modules" - (require 'core-modules) - - (describe "doom!") - (describe "doom-modules") - - (describe "doom-module-p") - (describe "doom-module-get") - (describe "doom-module-put") - (describe "doom-module-set") - (describe "doom-module-path") - (describe "doom-module-locate-path") - (describe "doom-module-from-path") - (describe "doom-module-load-path") - - (describe "require!") - (describe "featurep!") - (describe "after!") - (describe "use-package!") - (describe "use-package-hook!")) diff --git a/.config/emacs/core/test/test-core-packages.el b/.config/emacs/core/test/test-core-packages.el deleted file mode 100644 index d4434ad..0000000 --- a/.config/emacs/core/test/test-core-packages.el +++ /dev/null @@ -1,5 +0,0 @@ -;; -*- no-byte-compile: t; -*- -;;; core/test/test-core-packages.el -;;;###if nil - -(xdescribe "core-packages") diff --git a/.config/emacs/core/test/test-core-projects.el b/.config/emacs/core/test/test-core-projects.el deleted file mode 100644 index c64304f..0000000 --- a/.config/emacs/core/test/test-core-projects.el +++ /dev/null @@ -1,40 +0,0 @@ -;; -*- no-byte-compile: t; -*- -;;; core/test/test-core-projects.el - -(describe "core/projects" - :var (projectile-enable-caching) - - (require 'core-projects) - (require 'projectile) - - (before-each - (setq projectile-enable-caching nil) - (projectile-mode +1)) - (after-each - (projectile-mode -1)) - - (describe "project-p" - (it "Should detect when in a valid project" - (expect (doom-project-p doom-emacs-dir))) - (it "Should detect when not in a valid project" - (expect (doom-project-p (expand-file-name "~")) :to-be nil))) - - (describe "project-root" - (it "should resolve to the project's root" - (expect (doom-project-root doom-core-dir) :to-equal-file doom-emacs-dir)) - (it "should return nil if not in a project" - (expect (doom-project-root (expand-file-name "~")) :to-be nil))) - - (describe "project-expand" - (it "expands to a path relative to the project root" - (expect (doom-project-expand "init.el" doom-core-dir) :to-equal-file - (expand-file-name "init.el" (doom-project-root doom-core-dir))))) - - (describe "project-file-exists-p!" - (let ((default-directory doom-core-dir)) - ;; Resolve from project root - (expect (project-file-exists-p! "init.el")) - ;; Chained file checks - (expect (project-file-exists-p! (and "init.el" "LICENSE"))) - (expect (project-file-exists-p! (or "init.el" "does-not-exist"))) - (expect (project-file-exists-p! (and "init.el" (or "LICENSE" "does-not-exist"))))))) diff --git a/.config/emacs/core/test/test-core-ui.el b/.config/emacs/core/test/test-core-ui.el deleted file mode 100644 index 5079aa9..0000000 --- a/.config/emacs/core/test/test-core-ui.el +++ /dev/null @@ -1,106 +0,0 @@ -;; -*- no-byte-compile: t; -*- -;;; ../core/test/test-core-ui.el - -(describe "core/ui" - (before-all - (with-demoted-errors "Import error: %s" - (require 'core-ui))) - - (describe "doom-protect-fallback-buffer-h" - :var (kill-buffer-query-functions) - (before-all - (setq kill-buffer-query-functions '(doom-protect-fallback-buffer-h))) - - (it "should kill other buffers" - (expect (kill-buffer (get-buffer-create "a")))) - - (it "shouldn't kill the fallback buffer" - (expect (not (kill-buffer (doom-fallback-buffer)))))) - - (describe "custom hooks" - (describe "switch hooks" - :var (before-hook after-hook a b) - (before-each - (setq a (switch-to-buffer (get-buffer-create "a")) - b (get-buffer-create "b")) - (spy-on 'hook) - (add-hook 'buffer-list-update-hook #'doom-run-switch-window-hooks-h) - (add-hook 'focus-in-hook #'doom-run-switch-frame-hooks-h) - (dolist (fn '(switch-to-buffer display-buffer)) - (advice-add fn :around #'doom-run-switch-buffer-hooks-a))) - (after-each - (remove-hook 'buffer-list-update-hook #'doom-run-switch-window-hooks-h) - (remove-hook 'focus-in-hook #'doom-run-switch-frame-hooks-h) - (dolist (fn '(switch-to-buffer display-buffer)) - (advice-remove fn #'doom-run-switch-buffer-hooks-a)) - (kill-buffer a) - (kill-buffer b)) - - (describe "switch-buffer" - :var (doom-switch-buffer-hook) - (before-each - (setq doom-switch-buffer-hook '(hook))) - (after-each - (setq doom-switch-buffer-hook nil)) - - (it "should trigger when switching buffers" - (switch-to-buffer b) - (switch-to-buffer a) - (switch-to-buffer b) - (expect 'hook :to-have-been-called-times 3)) - - (it "should trigger only once on the same buffer" - (switch-to-buffer b) - (switch-to-buffer b) - (switch-to-buffer a) - (expect 'hook :to-have-been-called-times 2))) - - - (describe "switch-window" - :var (doom-switch-window-hook x y) - (before-each - (delete-other-windows) - (setq x (get-buffer-window a) - y (save-selected-window (split-window))) - (with-selected-window y - (switch-to-buffer b)) - (select-window x) - (spy-calls-reset 'hook) - (setq doom-switch-window-hook '(hook))) - - (it "should trigger when switching windows" - (select-window y) - (select-window x) - (select-window y) - (expect 'hook :to-have-been-called-times 3)) - - (it "should trigger only once on the same window" - (select-window y) - (select-window y) - (select-window x) - (expect 'hook :to-have-been-called-times 2))) - - - (xdescribe "switch-frame" - :var (doom-switch-frame-hook x y) - (before-each - (delete-other-windows) - (setq x (get-buffer-window a) - y (save-selected-window (split-window))) - (with-selected-window y - (switch-to-buffer b)) - (select-window x) - (spy-calls-reset 'hook) - (setq doom-switch-window-hook '(hook))) - - (it "should trigger when switching windows" - (select-window y) - (select-window x) - (select-window y) - (expect 'hook :to-have-been-called-times 3)) - - (it "should trigger only once on the same window" - (select-window y) - (select-window y) - (select-window x) - (expect 'hook :to-have-been-called-times 2)))))) diff --git a/.config/emacs/core/test/test-core.el b/.config/emacs/core/test/test-core.el deleted file mode 100644 index e94768f..0000000 --- a/.config/emacs/core/test/test-core.el +++ /dev/null @@ -1,127 +0,0 @@ -;; -*- no-byte-compile: t; -*- -;;; core/test/test-core.el - -(describe "core" - :var (doom-interactive-p) - (before-each - (setq doom-interactive-p nil)) - - (describe "initialization" - (describe "doom-initialize" - :var (doom-init-p) - (before-each - (setq doom-init-p nil)) - - (it "initializes once" - (expect (doom-initialize nil 'noerror)) - (expect (not (doom-initialize nil 'noerror))) - (expect (not (doom-initialize nil 'noerror))) - (expect doom-init-p)) - - (it "initializes multiple times, if forced" - (expect (doom-initialize nil 'noerror)) - (expect (not (doom-initialize nil 'noerror))) - (expect (doom-initialize 'force 'noerror))) - - (describe "package initialization" - (before-each - (spy-on 'doom-initialize-packages :and-return-value t)) - - (it "initializes packages if core autoload file doesn't exist" - (let ((doom-autoloads-file "doesnotexist")) - (expect (doom-initialize nil 'noerror)) - (expect 'doom-initialize-packages :to-have-been-called)) - - (it "doesn't initialize packages if core autoload file was loaded" - (let ((doom-interactive-p t)) - (spy-on 'doom-load-autoloads-file :and-return-value t) - (doom-initialize nil 'noerror) - (expect 'doom-load-autoloads-file :to-have-been-called-with doom-package-autoload-file) - (expect 'doom-initialize-packages :to-have-been-called))) - - (it "initializes packages when forced" - (doom-initialize 'force 'noerror) - (expect 'doom-initialize-packages :to-have-been-called))) - - (describe "autoloads files" - (before-each - (spy-on 'doom-load-autoloads-file) - (spy-on 'warn :and-return-value t)) - - (it "loads autoloads files" - (ignore-errors (doom-initialize nil 'noerror)) - (expect 'doom-load-autoloads-file - :to-have-been-called-with doom-autoloads-file) - (expect 'doom-load-autoloads-file - :to-have-been-called-with doom-package-autoload-file)) - - (it "throws doom-autoload-error when autoload files don't exist" - (let ((doom-autoloads-file "doesnotexist") - (doom-package-autoload-file "doesnotexist")) - (expect (doom-initialize) :to-throw 'doom-autoload-error))))) - - (describe "doom-initialize-core" - (before-each - (spy-on 'require)) - - (it "loads all doom core libraries" - (doom-initialize-core) - (expect 'require :to-have-been-called-with 'core-keybinds) - (expect 'require :to-have-been-called-with 'core-ui) - (expect 'require :to-have-been-called-with 'core-projects) - (expect 'require :to-have-been-called-with 'core-editor)))) - - (describe "doom-load-autoloads-file" - :var (doom-autoloads-file doom-alt-autoload-file result) - (before-each - (setq doom-autoloads-file (make-temp-file "doom-autoload" nil ".el")) - (with-temp-file doom-autoloads-file) - (byte-compile-file doom-autoloads-file)) - (after-each - (delete-file doom-autoloads-file) - (delete-file (byte-compile-dest-file doom-autoloads-file))) - - (it "loads the byte-compiled autoloads file if available" - (doom-load-autoloads-file doom-autoloads-file) - (expect (caar load-history) :to-equal-file - (byte-compile-dest-file doom-autoloads-file)) - - (delete-file (byte-compile-dest-file doom-autoloads-file)) - (doom-load-autoloads-file doom-autoloads-file) - (expect (caar load-history) :to-equal-file doom-autoloads-file)) - - (it "returns non-nil if successful" - (expect (doom-load-autoloads-file doom-autoloads-file))) - - (it "returns nil on failure or error, non-fatally" - (expect (doom-load-autoloads-file "/does/not/exist") :to-be nil))) - - (describe "doom-load-envvars-file" - :var (doom-env-file process-environment) - (before-each - (setq process-environment nil - doom-env-file (make-temp-file "doom-env")) - (with-temp-file doom-env-file - (insert "A=1\nB=2\nC=3\n"))) - (after-each - (delete-file doom-env-file)) - - (it "throws a file-error if file doesn't exist" - (expect (doom-load-envvars-file "/tmp/envvardoesnotexist") - :to-throw 'file-error)) - - (it "to fail silently if NOERROR is non-nil" - (expect (doom-load-envvars-file "/tmp/envvardoesnotexist" 'noerror) - :not :to-throw)) - - (it "returns the new value for `process-environment'" - (expect (doom-load-envvars-file doom-env-file) - :to-have-same-items-as '("A" "B" "C"))) - - (it "alters environment variables" - (dolist (key '("A" "B" "C")) - (expect (getenv key) :not :to-be-truthy)) - (expect (doom-load-envvars-file doom-env-file)) - (expect (getenv "A") :to-equal "1") - (expect (getenv "B") :to-equal "2") - (expect (getenv "C") :to-equal "3")))) diff --git a/.config/emacs/docs/contributing.org b/.config/emacs/docs/contributing.org deleted file mode 100644 index 7d3d38d..0000000 --- a/.config/emacs/docs/contributing.org +++ /dev/null @@ -1,167 +0,0 @@ -#+TITLE: Contributing -#+STARTUP: nofold - -Doom Emacs is an active and ongoing project, maintained mostly by a single -person, but includes the efforts of 200 contributors and growing. There is no -shortage of things that need doing; bugs that need stomping, features that need -implementing, and documentation that needs documenting. If Doom's been useful to -you, convert some caffiene into code; it'd be a huge help! - -You are welcome to [[https://discord.gg/qvGgnVx][join us on our Discord server]], otherwise read on to learn how -to contribute to our fine corner of the interwebs. - -* Table of Contents :TOC_3: -- [[#where-can-i-help][Where can I help?]] -- [[#reporting-issues][Reporting issues]] - - [[#acquire-a-backtrace-from-errors][Acquire a backtrace from errors]] - - [[#create-a-step-by-step-reproduction-guide][Create a step-by-step reproduction guide]] - - [[#include-information-about-your-doom-install][Include information about your Doom install]] - - [[#debugging-crashes-with-gdb][Debugging crashes with gdb]] -- [[#suggesting-features-keybinds-andor-enhancements][Suggesting features, keybinds and/or enhancements]] -- [[#contributing-code][Contributing code]] - - [[#conventions][Conventions]] - - [[#code-style][Code style]] - - [[#naming-conventions][Naming conventions]] - - [[#commits--prs][Commits & PRs]] - - [[#keybind-conventions][Keybind conventions]] - - [[#your-first-code-contribution][Your first code contribution]] - - [[#submitting-pull-requests][Submitting pull requests]] - - [[#contributing-to-doom-core][Contributing to Doom core]] - - [[#contributing-to-an-existing-module][Contributing to an existing module]] - - [[#contributing-a-new-module][Contributing a new module]] -- [[#contributing-documentation][Contributing documentation]] - - [[#contributing-to-dooms-manual][Contributing to Doom's manual]] - - [[#contributing-module-documentation][Contributing module documentation]] -- [[#help-keep-packages-up-to-date][Help keep packages up-to-date!]] -- [[#other-ways-to-support-doom-emacs][Other ways to support Doom Emacs]] -- [[#special-thanks][Special thanks]] - -* Where can I help? -+ Our [[https://github.com/hlissner/doom-emacs/issues][issue tracker]] has many issues. If you find one that you have an answer to, - it would be a huge help! -+ Look for issues tagged [[https://github.com/hlissner/doom-emacs/labels/good%20first%20issue][good first issue]]. These were judged to have a low - barrier of entry. -+ Look for issues tagged [[https://github.com/hlissner/doom-emacs/labels/help%20wanted][help wanted]]. These tend to be a little (or a lot) - harder, and are issues outside my own expertise. -+ If you've encountered a bug, [[https://github.com/hlissner/doom-emacs/issues/new/choose][file a bug report]]. -+ The [[https://github.com/hlissner/doom-emacs/projects/3][development roadmap board]] is a rough timeline of what is being worked on - and when. It will give you an idea of what will change and where you can - redirect your efforts. -+ The [[https://github.com/hlissner/doom-emacs/projects/2][plugins under review board]] lists third party plugins being considered (or - rejected) for inclusion in Doom Emacs. Approved and unclaimed packages are - open for you to implement yourself. -+ The [[https://github.com/hlissner/doom-emacs/projects/5][upstream bugs board]] lists known issues that have external causes, but - affect Doom. If you're feeling adventurous (or are better acquainted with the - cause) perhaps you can address them at the source. - -* TODO Reporting issues -You've found a problem and you're ready to fire off that bug report. Hold up! -Before you do that, [[file:getting_started.org::*Troubleshoot][have a look at our Troubleshooting guide]]. If none of these -suggestions pan out, /then/ it is time to file a bug report. - -An effective bug report is informative. Please try to provide: - -+ A backtrace of all mentioned errors. -+ A step-by-step reproduction of the issue. -+ Information about your Doom config and system environment. -+ Screenshots/casts of the issue (if possible). - -This section will show you how to collect this information. - -** Acquire a backtrace from errors -See "[[file:getting_started.org::*How to extract a backtrace from an error][How to extract a backtrace from an error]]" in the [[file:getting_started.org][Getting Started]] guide. - -** TODO Create a step-by-step reproduction guide - -** TODO Include information about your Doom install - -** TODO Debugging crashes with gdb - -* TODO Suggesting features, keybinds and/or enhancements - -* TODO Contributing code -There's much to be done around here! We need bugfixes, new features, and -documentation. If you'd like to convert some caffeine into Emacs Lisp, here are -a few considerations before starting that PR: - -** TODO Conventions -*** TODO Code style -Doom conforms to [[https://github.com/bbatsov/emacs-lisp-style-guide][@bbatsov's emacs-lisp style guide]] with the following -exceptions: - -+ Use ~mapc~ instead of ~seq-do~. -+ No hanging parentheses -+ We use =DEPRECATED= to indicate code that will eventually be removed. - -*** Naming conventions -Doom has a number of naming conventions that it uses in addition to the standard -lisp conventions. Third party packages may use their own conventions as well. - -**** Lisp Naming Conventions -The lisp conventions are simple. Symbols follow ~NAMESPACE-SYMBOLNAME~ for -public variables/functions (e.g. ~bookmark-default-file~ or -~electric-indent-mode~) and ~NAMESPACE--SYMBOLNAME~ for private ones (e.g. -~byte-compile--lexical-environment~ and ~yas--tables~). - -~NAMESPACE~ is usually the name of the containing file or package. E.g. the -~company~ plugin prefixes all its variables/functions with ~company-~. - -**** Doom Naming Conventions -+ ~doom/NAME~ or ~+MODULE/NAME~ :: Denotes a public command designed to be used - interactively, via =M-x= or a keybinding. e.g. ~doom/info~, ~+popup/other~, - ~+ivy/rg~. -+ ~doom:NAME~ :: A public evil operator, motion or command. e.g. ~+evil:align~, - ~+ivy:rg~. -+ ~doom-[-]NAME-h~ or ~+MODULE-[-]NAME-h~ :: A non-interactive function meant to - be used (exclusively) as a hook. e.g. ~+cc-fontify-constants-h~, - ~+flycheck-buffer-h~. -+ ~doom-[-]NAME-a~ or ~+MODULE-[-]NAME-a~ :: Functions designed to be used as - advice for other functions. e.g. ~doom-set-jump-a~, - ~doom--fix-broken-smie-modes-a~, ~+org--babel-lazy-load-library-a~ -+ ~doom-[-]NAME-fn~ or ~+MODULE-[-]NAME-fn~ :: Indicates an [[https://en.wikipedia.org/wiki/Strategy_pattern][strategy]] function. A - good rule of thumb for what makes a strategy function is: is it - interchangeable? Can it be replaced with another function with a matching - signature? e.g. ~+lookup-dumb-jump-backend-fn~, ~+magit-display-buffer-fn~, - ~+workspaces-set-project-action-fn~ -+ ~abc!~ :: A public Doom "autodef" function or macro. An autodef should always - be defined, even if its containing module is disabled (i.e. they will not - throw a void-function error). The purpose of this is to avoid peppering module - configs with conditionals or `after!` blocks before using their APIs. They - should noop if their module is disabled, and should be zero-cost in the case - their module is disabled. - - Autodefs usually serve to configure Doom or a module. e.g. ~after!~, - ~set-company-backends!~, ~set-evil-initial-state!~ - -*** TODO Commits & PRs -+ Target =develop= instead of =master=. The only exception are hotfixes! - -*** TODO Keybind conventions - -** TODO Your first code contribution - -** TODO Submitting pull requests - -** TODO Contributing to Doom core - -** TODO Contributing to an existing module - -** TODO Contributing a new module - -* TODO Contributing documentation -Doom Emacs' documentation is an ongoing effort. If you have suggestions, -improvements, tutorials and/or articles to submit, don't hesitate to get in -contact via our [[https://discord.gg/bcZ6P3y][Discord server]] or [[mailto:henrik@lissner.net][email]]. I appreciate any help I can get! - -** TODO Contributing to Doom's manual - -** TODO Contributing module documentation - -* TODO Help keep packages up-to-date! -Doom pins all its packages to reduce the likelihood of upstream breakage leaking -into Doom Emacs. However, we may miss when a package releases hotfixes for -critical issues. Let us know or PR a bump to our pinned packages. - -* TODO Other ways to support Doom Emacs - -* TODO Special thanks diff --git a/.config/emacs/docs/faq.org b/.config/emacs/docs/faq.org deleted file mode 100644 index c5abbd9..0000000 --- a/.config/emacs/docs/faq.org +++ /dev/null @@ -1,1344 +0,0 @@ -#+TITLE: Frequently Asked Questions - -#+begin_quote -*Doom's FAQs have [[https://discourse.doomemacs.org/faq][moved to Discourse]].* This file will be removed soon. -#+end_quote - -* Table of Contents :TOC: -- [[#general][General]] - - [[#why-is-it-called-doom][Why is it called Doom?]] - - [[#is-doom-a-fork-of-spacemacspreludeetc][Is Doom a fork of Spacemacs/Prelude/etc?]] - - [[#does-doom-work-on-windows][Does Doom work on Windows?]] - - [[#is-doom-only-for-vimmers][Is Doom only for vimmers?]] - - [[#i-am-a-beginner-can-i-use-doom][I am a beginner. Can I use Doom?]] - - [[#how-does-doom-compare-to-spacemacs][How does Doom compare to Spacemacs?]] - - [[#why-such-a-complicated-package-management-system][Why such a complicated package management system?]] - - [[#how-does-doom-start-up-so-quickly][How does Doom start up so quickly?]] - - [[#why-is-startup-time-important-why-not-use-the-daemon][Why is startup time important? Why not use the daemon?]] - - [[#how-do-i-use-doom-alongside-other-emacs-configs][How do I use Doom alongside other Emacs configs?]] - - [[#why-should-i-use-doom-instead-of-rolling-my-own-config][Why should I use Doom instead of rolling my own config?]] - - [[#what-is-the-meaning-behind-dooms-naming-convention-in-its-source-code][What is the meaning behind Doom's naming convention in its source code?]] - - [[#what-version-of-doom-am-i-running][What version of Doom am I running?]] - - [[#is-discord-the-only-option-for-interacting-with-your-community][Is Discord the only option for interacting with your community?]] - - [[#why-is-emacsdoom-slow][Why is Emacs/Doom slow?]] -- [[#configuration][Configuration]] - - [[#how-do-i-configure-doom-emacs][How do I configure Doom Emacs?]] - - [[#does-doom-respect-xdg-directory-conventions][Does Doom respect XDG directory conventions]] - - [[#how-do-i-enable-or-disable-a-doom-module][How do I enable or disable a Doom module?]] - - [[#how-do-i-change-the-theme][How do I change the theme?]] - - [[#how-do-i-change-the-fonts][How do I change the fonts?]] - - [[#how-do-i-bind-my-own-keys-or-change-existing-ones][How do I bind my own keys (or change existing ones)?]] - - [[#how-do-i-get-motions-to-treat-underscores-as-word-delimiters][How do I get motions to treat underscores as word delimiters?]] - - [[#how-do-i-change-the-leaderlocalleader-keys][How do I change the leader/localleader keys?]] - - [[#how-do-i-change-the-style-of-line-numbers-or-disable-them-altogether][How do I change the style of line-numbers (or disable them altogether)?]] - - [[#how-do-i-change-the-behavior-and-appearance-of-popup-windows][How do I change the behavior and appearance of popup windows?]] - - [[#how-do-i-customize-a-theme-or-faces][How do I customize a theme or face(s)?]] - - [[#how-do-i-make-a-new-theme][How do I make a new theme?]] - - [[#can-doom-be-customized-without-restarting-emacs][Can Doom be customized without restarting Emacs?]] - - [[#can-vimevil-be-removed-for-a-more-vanilla-emacs-experience][Can Vim/Evil be removed for a more vanilla Emacs experience?]] - - [[#when-should-and-shouldnt-i-use-bindoom][When should and shouldn't I use ~bin/doom~?]] - - [[#when-to-run-doom-sync][When to run ~doom sync~]] - - [[#how-to-suppress-confirmation-prompts-while-bindoom-is-running][How to suppress confirmation prompts while ~bin/doom~ is running]] - - [[#which-terminal-should-i-use][Which terminal should I use?]] - - [[#how-do-i-enable-lsp-support-for-insert-language-here][How do I enable LSP support for ?]] - - [[#how-to-disable-smartparensautomatic-parentheses-completion][How to disable smartparens/automatic parentheses completion?]] - - [[#how-do-i-maximizefullscreen-emacs-on-startup][How do I maximize/fullscreen Emacs on startup?]] - - [[#how-do-i-sharesync-my-config-between-multiple-computers][How do I share/sync my config between multiple computers?]] -- [[#package-management][Package Management]] - - [[#how-do-i-install-a-package-from-elpa][How do I install a package from ELPA?]] - - [[#how-do-i-install-a-package-from-githubanother-source][How do I install a package from github/another source?]] - - [[#how-do-i-change-where-an-existing-package-is-installed-from][How do I change where an existing package is installed from?]] - - [[#how-do-i-disable-a-package-completely][How do I disable a package completely?]] - - [[#how-do-i-reconfigure-a-package-included-in-doom][How do I reconfigure a package included in Doom?]] - - [[#where-does-straight-clonebuild-packages-to][Where does straight clone/build packages to?]] -- [[#defaults][Defaults]] - - [[#why-ivy-over-helm][Why Ivy over Helm?]] - - [[#why-are-there-no-default-keybinds-for-smartparens-for-evil-users][Why are there no default keybinds for Smartparens (for evil users)?]] - - [[#why-do-non-evil-users-get-expand-region-but-not-evil-users][Why do non-evil users get expand-region, but not evil users?]] - - [[#why-not-use-exec-path-from-shell-instead-of-doom-env][Why not use exec-path-from-shell instead of ~doom env~?]] - - [[#why-wsbutler-over-delete-trailing-whitespace-or-whitespace-cleanup][Why wsbutler over delete-trailing-whitespace or whitespace-cleanup?]] -- [[#emacs-lisp][Emacs Lisp]] - - [[#why-do-you-quote-some-symbols-with-symbol][Why do you quote some symbols with ~#'symbol~?]] -- [[#common-issues][Common Issues]] - - [[#i-get-the-vanilla-emacs-splash-screen-at-startup][I get the vanilla Emacs splash screen at startup]] - - [[#i-see-a-blank-scratch-buffer-at-startup][I see a blank scratch buffer at startup]] - - [[#strange-or-incorrect-icons-are-displayed-everywhere][Strange (or incorrect) icons are displayed everywhere]] - - [[#void-variable-and-void-function-errors-on-startup][~void-variable~ and ~void-function~ errors on startup]] - - [[#doom-cant-find-my-executablesdoesnt-inherit-the-correct-path][Doom can't find my executables/doesn't inherit the correct ~PATH~]] - - [[#theres-artefacting-on-my-icon-fonts-in-gui-emacs-956][There's artefacting on my icon fonts in GUI Emacs (#956)]] - - [[#the-s-and-s-keys-dont-behave-like-they-do-in-vimevil-1307][The =s= and =S= keys don't behave like they do in vim/evil (#1307)]] - - [[#changes-to-my-config-arent-taking-effect][Changes to my config aren't taking effect]] - - [[#the-frame-goes-black-on-macos-while-in-full-screen-mode][The frame goes black on MacOS, while in full-screen mode]] - - [[#doom-crashes-when][Doom crashes when...]] - - [[#cant-load-my-theme-unable-to-find-theme-file-for-x-errors][Can't load my theme; ~unable to find theme file for X~ errors]] - - [[#tramp-connections-hang-forever-when-connecting][TRAMP connections hang forever when connecting]] - - [[#an-upstream-package-was-broken-and-i-cant-update-it][An upstream package was broken and I can't update it]] - - [[#why-do-i-see-ugly-indentation-highlights-for-tabs][Why do I see ugly indentation highlights for tabs?]] - - [[#clipetty--emit-opening-output-file-permission-denied-devpts29-error]["clipetty--emit: Opening output file: Permission denied, /dev/pts/29" error]] - - [[#the-directory-emacsdserver-is-unsafe-error-at-startup]["The directory ~/.emacs.d/server is unsafe" error at startup]] - - [[#my-new-keybinds-dont-work][My new keybinds don't work]] - -* General -** Why is it called Doom? -It's an homage to idsoftware's classic game, whose [[https://github.com/id-Software/DOOM][source code]] was my first -exposure to programming, back in the Cretaceous period (1999). - -Also, Emacs is an all consuming black hole. Its users doom themselves, -eternally. - -** Is Doom a fork of Spacemacs/Prelude/etc? -No. I started it from scratch in mid-2014. I hadn't heard of other distros until -some years later, when a Doom user suggested this was a Spacemacs fork. I still -see this misconception pop up from time to time. - -However, that's not to say Doom hasn't taken any inspiration from these since. -Early versions of Doom drew inspiration from prelude's project structure (until -Doom introduced a module system) and some concepts (like SPC as a leader key) -were adopted from Spacemacs or PRed from migrating users. - -As our userbase grows, more similarities (and differences) will no doubt emerge. - -** Does Doom work on Windows? -It does, /but/ there are caveats: - -+ Emacs is inherently slower on Windows. -+ There are more steps to setting up Emacs (and Doom) on Windows. -+ Windows support will always lag behind macOS/Linux support, because I (and - many of Doom's users) don't use Windows. That means fewer guinea p--I mean, - pioneers, willing to test Doom on Windows. - -That said, Doom does have happy Windows users (using WSL or scoop/chocolatey). -[[file:getting_started.org::On Windows][The Getting Starting guide]] will walk you through what we know. - -Help us improve our documentation if you managed to get Doom running on Windows! - -** Is Doom only for vimmers? -No, *vim/evil emulation is optional*. However, its maintainer /is/ a -dyed-in-the-wool vimmer with almost two decades of vim muscle memory, so the -non-vim experience will be less polished. Still, our growing user base of -non-vim users continue to improve the situation, and we welcome suggestions and -contributions! - -If you'd like a go at it, see the [[file:../modules/editor/evil/README.org::Removing evil-mode][removing evil-mode]] section in the [[file:../modules/editor/evil/README.org][:editor evil]] -module's documentation. - -** I am a beginner. Can I use Doom? -This isn't a choice I can make for you. How new is "new"? Are you new to the -shell? To programming in general? Or just Emacs/vim? - -If all of the above is true then Emacs is a rough place to start. Doom or not. - -Emacs' main draw is its unparalleled extensibility, but anything so extensible -has a learning curve. Not to suggest it's impossible -- and we'll try to help -you [[https://discord.gg/qvGgnVx][if you ask]] -- but expect a hefty commitment and a bumpy journey. Don't pass -up on the [[file:index.org][Documentation]]: it'll work you through setting Doom up and includes -links to external resources created by myself or the community. - -** How does Doom compare to Spacemacs? -To paraphrase (and expand upon) a [[https://www.reddit.com/r/emacs/comments/6pa0oq/quickstart_tutorial_for_emacs_newbies_with_doom/dkp1bhd/][reddit answer]] to this question by [[https://github.com/gilbertw1][@gilbertw1]]: - -+ *Doom is lighter than Spacemacs.* Doom starts up faster and is better - optimized, but Spacemacs has more features. -+ *Doom is thinner than Spacemacs.* There are fewer abstractions between you and - vanilla Emacs, and what abstractions do exist are thin by design. This means - there's less to understand and it's easier to hack. -+ *Doom is much more opinionated than Spacemacs.* Doom does not strive to be a - one-size-fits-all, beginner-friendly solution, nor is it configured by - consensus. It is [mostly] the work of one developer and caters to his - vim-slanted tastes. Doom's defaults enforce very particular (albeit optional) - workflows. -+ *Doom lacks manpower.* Bugs stick around longer, documentation is lighter and - development is at the mercy of it's maintainer's schedule, health and whims. -+ *Doom is not beginner friendly.* Doom lacks a large community to constantly - improve and produce tutorials/guides for it. Spacemacs is more likely to work - right out of the box. Doom also holds your hand less. A little elisp, shell - and git-fu will go a long way to ease you into Doom. -+ *Doom is managed through it's command line interface.* The ~bin/doom~ script - allows you to script package management, manage your config, or utilize elisp - functionality externally, like org tangling or batch processing. -+ *Doom's package manager is declarative and rolling release is opt-in.* Doom - takes a little after nix, striving for as much config reproducibility as Emacs - (and git) will permit. Spacemacs uses package.el, which is only rolling - release. - -** Why such a complicated package management system? -Doom had +four+ *five* goals for its package management system: - -1. *Scriptability:* package management should be shell-scriptable, so updating - can be automated. -2. *Reach:* allow users to install packages from sources other than ELPA (like - github or gitlab), and from specific commits, branches or tags. Some plugins - are out-of-date through official channels, have changed hands, have a - superior fork, or aren't available in ELPA repos. -3. *Performance:* lazy-loading the package management system is a tremendous - boon to start up speed. Initializing package.el and straight (and/or checking - that your packages are installed) or loading package autoloads files each - time you start up is expensive. -4. *Organization:* an Emacs configuration grows so quickly, in complexity and - size. A clear separation of concerns (configuration of packages from their - installation) is easier to manage. -5. *Reproducibility:* Emacs is a tumultuous ecosystem; packages break left and - right, and we rely on hundreds of them. By pinning our packages we achieve a - degree of (optional) config reproducibility and significantly limit the - damage upstream changes can do. Better yet, we stave off having to deal with - those issues until we are ready to. Although technical limitations prevent us - from achieving true reproducibility, this is better than nothing. - -** How does Doom start up so quickly? -Doom employs a number of techniques to cut down startup time. Here are its most -effective techniques: - -*** Avoid garbage collection at startup -The GC can easily double startup time, so we suppress it at startup by turning -up ~gc-cons-threshold~ (and perhaps ~gc-cons-percentage~) temporarily: - -#+BEGIN_SRC emacs-lisp -(setq gc-cons-threshold most-positive-fixnum ; 2^61 bytes - gc-cons-percentage 0.6) - -;; ... your emacs config here ... -#+END_SRC - -However, it is important to reset it eventually. Not doing so will cause garbage -collection freezes during long-term interactive use. Conversely, a -~gc-cons-threshold~ that is too small will cause stuttering. We use 16mb as our -default. - -#+BEGIN_SRC emacs-lisp -(add-hook 'emacs-startup-hook - (lambda () - (setq gc-cons-threshold 16777216 ; 16mb - gc-cons-percentage 0.1))) -#+END_SRC - -It may also be wise to raise ~gc-cons-threshold~ while the minibuffer is active, -so the GC doesn't slow down expensive commands (or completion frameworks, like -helm and ivy). Here is how Doom does it: - -#+BEGIN_SRC emacs-lisp -(defun doom-defer-garbage-collection-h () - (setq gc-cons-threshold most-positive-fixnum)) - -(defun doom-restore-garbage-collection-h () - ;; Defer it so that commands launched immediately after will enjoy the - ;; benefits. - (run-at-time - 1 nil (lambda () (setq gc-cons-threshold doom-gc-cons-threshold)))) - -(add-hook 'minibuffer-setup-hook #'doom-defer-garbage-collection-h) -(add-hook 'minibuffer-exit-hook #'doom-restore-garbage-collection-h) -#+END_SRC - -Another alternative (which is [[https://github.com/hlissner/doom-emacs/blob/develop/core/core.el#L269-L274][what Doom uses]]) is the [[https://gitlab.com/koral/gcmh/][gcmh]] package; which staves -off the GC until you are idle. Doom also triggers GC when you unfocus the Emacs -frame. - -*** Concatenate package autoloads -When you install a package, a PACKAGE-autoloads.el file is generated. This file -maps autoloaded functions and snippets to their containing package so Emacs will -know where to find them when they are used. In your conventional Emacs config, -every one of these autoloads files are loaded immediately at startup (when -~package-initialize~ is called). - -Since you'll commonly have hundreds of packages, loading hundreds of autoloads -file can hurt startup times, especially without an SSD. We get around this by -concatenating these files into one giant one when you run ~doom sync~. - -Emacs 27+ introduces a ~package-quickstart~ command that does this for you, and -=straight= (which powers our package manager) does this for you too, but [[https://github.com/hlissner/doom-emacs/tree/develop/core/cli/autoloads.el][Doom -Emacs has its own specialized mechanism]] for this, topped off with a few -Doom-specific optimizations. - -*** Lazy load package management system(s) -Initializing package.el or straight.el at startup is expensive. We can save some -time by delaying that initialization until we actually need these libraries (and -load them only when we're doing package management, e.g. when we run ~doom -sync~). - -Among other things, ~doom sync~ does a lot for us. It generates concatenated -autoloads files; caches expensive variables like caches ~load-path~, -~Info-directory-list~ and ~auto-mode-alist~; and preforms all your package -management activities there -- far away from your interactive sessions. - -How exactly Doom accomplishes all this is a long story, so here is a boiled-down -version you can use in your own configs (for package.el, not straight.el): - -#+BEGIN_SRC emacs-lisp -(defvar cache-file "~/.emacs.d/cache/autoloads") - -(defun initialize () - (unless (load cache-file t t) - (setq package-activated-list nil) - (package-initialize) - (with-temp-buffer - (cl-pushnew doom-core-dir load-path :test #'string=) - (dolist (desc (delq nil (mapcar #'cdr package-alist))) - (let ((load-file-name (concat (package--autoloads-file-name desc) ".el"))) - (when (file-readable-p load-file-name) - (condition-case _ - (while t (insert (read (current-buffer)))) - (end-of-file))))) - (prin1 `(setq load-path ',load-path - auto-mode-alist ',auto-mode-alist - Info-directory-list ',Info-directory-list) - (current-buffer)) - (write-file (concat cache-file ".el")) - (byte-compile-file cache-file)))) - -(initialize) -#+END_SRC - -You'll need to delete ~cache-files~ any time you install, remove, or update a -new package. You could advise ~package-install~ and ~package-delete~ to call -~initialize~ when they succeed, or make ~initialize~ interactive and call it -manually when necessary. Up to you! - -Note: package.el is sneaky, and will initialize itself if you're not careful. -*Not on my watch, criminal scum!* - -#+BEGIN_SRC emacs-lisp -;; in ~/.emacs.d/init.el (or ~/.emacs.d/early-init.el in Emacs 27) -(setq package-enable-at-startup nil ; don't auto-initialize! - ;; don't add that `custom-set-variables' block to my init.el! - package--init-file-ensured t) -#+END_SRC - -*** Lazy load more than everything -~use-package~ can defer your packages. Using it is a no-brainer, but Doom goes a -step further. There are some massive plugins out there for which ordinary lazy -loading techniques don't work. To name a few: - -+ The =lang/org= module defers loading babel packages until their src blocks are - executed or read. You no longer need ~org-babel-do-load-languages~ in your - config -- in fact, you shouldn't use it at all! -+ =org-protocol= needs to be loaded to intercept requests for org-protocol:// - URLs. Since org-protocol depends on org, this can be expensive to load - yourself, so Doom loads as soon as a org-protocol:// request is received, just - before it is processed. -+ Company and yasnippet are loaded as late as possible (waiting until the user - opens a non-read-only, file-visiting buffer (that isn't in fundamental-mode)). -+ The =evil-easymotion= package binds many keys, none of which are available - until you load the package. Instead of loading it at startup, =gs= is bound to - a command that loads the package, populates =gs=, then simulates the =gs= key - press as though those new keys had always been there. - -In addition, Doom loads some packages "incrementally". i.e. after a few seconds -of idle time post-startup, Doom loads packages piecemeal (one dependency at a -time) while Emacs. It aborts if it detects input, as to make the process as -subtle as possible. - -For example, instead of loading =org= (a giant package), it will load these -dependencies, one at a time, before finally loading =org=: - -#+BEGIN_SRC elisp -(calendar find-func format-spec org-macs org-compat org-faces - org-entities org-list org-pcomplete org-src org-footnote - org-macro ob org org-agenda org-capture) -#+END_SRC - -This ensures packages load as quickly as possible when you first load an org -file. - -*** Unset ~file-name-handler-alist~ temporarily -Emacs consults this variable every time a file is read or library loaded, or -when certain functions in the file API are used (like ~expand-file-name~ or -~file-truename~). - -Emacs does this to check if a special handler is needed to read that file, but -none of them are (typically) necessary at startup, so we disable them -(temporarily!): - -#+BEGIN_SRC emacs-lisp -(defvar doom--file-name-handler-alist file-name-handler-alist) -(setq file-name-handler-alist nil) - -;; ... your whole emacs config here ... - -;; Then restore it later: -(setq file-name-handler-alist doom--file-name-handler-alist) - -;; Alternatively, restore it even later: -(add-hook 'emacs-startup-hook - (lambda () - (setq file-name-handler-alist doom--file-name-handler-alist))) -#+END_SRC - -Don't forget to restore ~file-name-handler-alist~, otherwise TRAMP won't work -and compressed/encrypted files won't open. - -*** Use [[https://www.gnu.org/software/emacs/manual/html_node/elisp/Lexical-Binding.html][lexical-binding]] everywhere -Add ~;; -*- lexical-binding: t; -*-~ to the top of your elisp files. This can -break code if you've written it to depend on undeclared dynamic variables, but -I've designed Doom not to. - -This buys a small improvement in performance, but every little bit helps. You'll -find more about it in: - -+ [[http://nullprogram.com/blog/2017/01/30/]["How to Write Fast(er) Emacs Lisp."]] -+ [[http://nullprogram.com/blog/2016/12/22/]["Some Performance Advantages of Lexical Scope."]] - -** Why is startup time important? Why not use the daemon? -It /isn't/ terribly important, but I believe a) faster software is a better user -experience, b) Emacs doesn't have to be slower than it needs to be, and c) we -shouldn't have to manage yet-another-tool simply to get sane startup times out -of Emacs. - -A fast startup time also facilitates: - -- Emacs as a viable alternative to vim for quick, one-shot editing in the - terminal (without ~-Q~). -- Running multiple, independent instances of Emacs (e.g. on a per-project basis, - or for nix-shell users, or to isolate one instance for IRC from an instance - for writing code, etc). -- Quicker restarting of Emacs, to reload package settings or recover from - disastrous errors which can leave Emacs in a broken state. -- Faster integration with "edit in Emacs" solutions (like [[https://github.com/alpha22jp/atomic-chrome][atomic-chrome]]), and - without a daemon. - -It's up to you to decide if these are good enough reasons not to use a daemon, -but it's nice to have more options, isn't it? - -** How do I use Doom alongside other Emacs configs? -I recommend [[https://github.com/plexus/chemacs][Chemacs]]. Think of it as a bootloader for Emacs. You'll [[file:getting_started.org::*Alongside other Emacs configs (with Chemacs)][find -instructions on how to use it with Doom in the user manual]]. - -You will need a separate folder for personal configuration (=~/.doom.d= or -=~/.config/doom= by default). Use the ~DOOMDIR~ environment variable to use -another location: - -#+BEGIN_SRC bash -# First install Doom somewhere -git clone https://github.com/hlissner/doom-emacs ~/fakehome/doom-emacs -# Then create a place to store our private doom configs. The bin/doom script -# recognizes the DOOMDIR environment variable. -export DOOMDIR=~/fakehome/doom-emacs-config -mkdir -p "$DOOMDIR" - -# Set up Doom for the first time; this may take a while -cd ~/fakehome/doom-emacs -bin/doom install - -# then launch Doom Emacs from this folder with: -bin/doom run -#+END_SRC - -#+begin_quote -Warning: the way ~bin/doom run~ starts Doom bypasses many of its startup -optimizations. Treat it as a convenience for testing rather than a permanent -entry point. -#+end_quote - -** Why should I use Doom instead of rolling my own config? -Two reasons: - -1. *Doom's package manager.* It's powered by straight.el, is declarative, - non-rolling release and (nominally) reproducible; which is unique on the Emacs - distro scene. Don't let upstream issues surprise you. Roll back or re-pin - packages when you don't have the time to deal with issues. - - It also integrates with command line workflows, so automate to your heart's - content! - -2. *Time.* If you care about personalizing the software you use on a daily - basis, even half as much as I do, then you need professional help, but you - also know it is time consuming. Emacs out-of-the-box is a wasteland of - archaic defaults, full of plugins rife with gotchas and oddities that may or - may not be abandonware. It will be an uphill battle. Let Doom deal with all - that noise. Save yourself some time. - - Time you could otherwise spend attending your daughter's dance recitals, that - baseball game your son's team almost won last Thursday, or answering the court - summons to fight for custody of your kids. - -Also, Doom's fast yo. - -** What is the meaning behind Doom's naming convention in its source code? -You'll find [[file:contributing.org::*Conventions][an overview of Doom's code conventions]] in the [[file:contributing.org][contributing guide]]. - -** What version of Doom am I running? -The current version of Doom is displayed in the modeline on the dashboard. It -can also be retrieved using ~M-x doom/version~ (bound to =SPC h d v= or =C-h d -v= by default) or ~bin/doom version~ on the command line. - -** Is Discord the only option for interacting with your community? -Yes. Discord is already woven into my social and work life, and was selected to -maximize my availability to the community. I don't want to juggle multiple -platforms (like Matrix, IRC or Slack), or add bridges for them, even if they are -better suited to the task. I already have my hands full managing the one. - -I /am/ considering a [[https://www.discourse.org][discourse]], so we have a public knowledge base of workflows -and inter-user support (since Discord isn't a great archive), but it will be -some time until this is set up. - -Email is a possible alternative, but is constantly swamped; expect a turn-around -time of weeks. - -** Why is Emacs/Doom slow? -This comes up often. The first thing folks fresh off the boat from other editors -will notice is that Emacs has a low threshold for performance issues. It doesn't -take much to get it to scroll like molasses. - -Retina/4K/high res users have it especially hard. MacOS users too, where Emacs -seem even slower. Add to that files that are large (perhaps 1mb+) or have long -lines (200 characters+) and we've got ourselves a really poor experience. And -that's before we factor in plugins and poorly optimized major modes. - -There is an unfortunate but necessary adjustment of expectations new users must -undergo, when they adopt Emacs. Doom has inherited this curse. Its raison d'etre -is to improve the situation, but I can only go so far, especially if you choose -to enable all the most expensive features. You will unavoidably find cases where -Emacs *is just slow*. - -What can you do about it? - -1. Upgrade to Emacs 27. This should yield a noteworthy gain in general - performance, particularly for LSP users. -2. Try out [[http://akrl.sdf.org/gccemacs.html][gccemacs]], which promises significant strides in Emacs performance, - but can be a bit of a hassle to set up. There are packages available for - [[https://aur.archlinux.org/packages/emacs-native-comp-git/][Arch Linux]], [[https://github.com/flatwhatson/guix-channel][Guix]] and [[https://github.com/nix-community/emacs-overlay][Nix users]]. [[https://www.emacswiki.org/emacs/GccEmacs][More information available on EmacsWiki]]. -3. Disable some of Doom's slowest modules. The biggest offenders tend to be: - =:ui tabs=, =:ui indent-guides=, =:ui ligatures=, =:editor word-wrap= and =:ui - vc-gutter=. -4. Turn off line numbers ~(setq display-line-numbers-type nil)~. It's known to - slow down scrolling, in particular. -5. Org users can turn off ~org-superstar-mode~: ~(remove-hook 'org-mode-hook - #'org-superstar-mode)~. It's an aesthetic plugin that offers fancier bullets. - Emacs seems to struggle to display those characters with some fonts. - - Org uses can also turn off the rest of org's eye candy: - #+BEGIN_SRC elisp - (after! org - (setq org-fontify-quote-and-verse-blocks nil - org-fontify-whole-heading-line nil - org-hide-leading-stars nil - org-startup-indented nil)) - #+END_SRC -6. Turn on =M-x so-long-minor-mode=. This is a minor mode that disables - non-essential functionality and can be used to temporarily view files that - would be too slow otherwise. =M-x so-long-mode= is its extreme version; it - turns off /everything/, including syntax highlighting. -7. Try replacing the =:ui modeline= module with =:ui (modeline +light)=. There - are aspects of the default modeline that can be unpredictably slow. -8. Don't mash =j= (or =C-n=) to scroll. Evil users can scroll long distances - with =C-d= and =C-u=, for instance, or evil-easymotion under =gs=, to avoid - that slowness. Otherwise, use search mechanisms to move around, like isearch - (=C-s=) or evil-search (=/=). - -* Configuration -** How do I configure Doom Emacs? -Canonically, your private config is kept in =~/.doom.d/= (or =~/.config/doom/=). -This directory is referred to as your ~$DOOMDIR~. - -Your private config is typically comprised of an =init.el=, =config.el= and -=packages.el= file. Put all your config in =config.el=, install packages by -adding ~package!~ declarations to =packages.el=, and enable/disable modules in -your ~doom!~ block, which should have been created in your =init.el= when you -first ran ~doom install~. - -You shouldn't need to fork Doom or modify =~/.emacs.d=. If you have to do this -to achieve something, it can be considered a bug. - -Check out the [[file:getting_started.org::Customize][Customize section]] in the [[file:getting_started.org][Getting Started]] guide for details. - -** Does Doom respect XDG directory conventions -Yes. Your private config (normally in =~/.doom.d=) can be moved to -=~/.config/doom=. - -And as of Emacs 27, =~/.emacs.d= can be moved to =~/.config/emacs=. - -** How do I enable or disable a Doom module? -Comment or uncomment the module in your ~doom!~ block, found in -=~/.doom.d/init.el=. - -Remember to run ~bin/doom sync~ afterwards, on the command line, to sync your -module list with Doom. - -See the "[[file:getting_started.org::*Configuration modules][Configuration modules]]" section of the [[file:getting_started.org][Getting Started]] guide for more -information. - -** How do I change the theme? -There are two ways to load a theme. Both assume the theme is installed and -available. You can either set ~doom-theme~ or manually load a theme with the -~load-theme~ function. - -#+BEGIN_SRC emacs-lisp -;;; add to ~/.doom.d/config.el -(setq doom-theme 'doom-tomorrow-night) -;; or -(load-theme 'doom-tomorrow-night t) -#+END_SRC - -#+begin_quote -At the moment, the only difference between the two is that ~doom-theme~ is -loaded when Emacs has finished initializing at startup and ~load-theme~ loads -the theme immediately. Which you choose depends on your needs, but I recommend -setting ~doom-theme~ because, if I later discover a better way to load themes, I -can easily change how Doom uses ~doom-theme~, but I can't (easily) control how -you use the ~load-theme~ function. -#+end_quote - -*** Installing a third party theme -To install a theme from a third party plugin, say, [[https://github.com/bbatsov/solarized-emacs][solarized]], you need only -install it, then load it: - -#+BEGIN_SRC emacs-lisp -;;; add to ~/.doom.d/packages.el -(package! solarized-theme) - -;;; add to ~/.doom.d/config.el -(setq doom-theme 'solarized-dark) -#+END_SRC - -Don't forget to run ~doom sync~ after adding that ~package!~ statement to ensure -the package is installed. - -** How do I change the fonts? -Doom exposes five (optional) variables for controlling fonts in Doom, they are: - -+ ~doom-font~ -+ ~doom-variable-pitch-font~ -+ ~doom-serif-font~ -+ ~doom-unicode-font~ (the fallback font for unicode symbols that your default - font doesn't support) -+ ~doom-big-font~ (used for ~doom-big-font-mode~) - -They all accept either a =font-spec=, font string (="Input Mono-12"=), or [[https://wiki.archlinux.org/index.php/X_Logical_Font_Description][xlfd -font string]]. - -e.g. -#+BEGIN_SRC emacs-lisp -;;; Add to ~/.doom.d/config.el -(setq doom-font (font-spec :family "Input Mono Narrow" :size 12 :weight 'semi-light) - doom-variable-pitch-font (font-spec :family "Fira Sans") ; inherits `doom-font''s :size - doom-unicode-font (font-spec :family "Input Mono Narrow" :size 12) - doom-big-font (font-spec :family "Fira Mono" :size 19)) -#+END_SRC - -** How do I bind my own keys (or change existing ones)? -There are many options. Emacs provides a number of keybind functions: - -+ ~define-key KEYMAP KEY DEF~ -+ ~global-set-key KEY DEF~ -+ ~local-set-key KEY DEF~ -+ ~evil-define-key STATES KEYMAP KEY DEF &rest ...~ - -However, Doom provides a ~map!~ macro, which conveniently wraps up the above -four into a more succinct syntax. Comprehensive examples of ~map!~'s usage can -be found in its documentation (via =SPC h f map\!= or =C-h f map\!= -- or [[file:api.org][in -docs/api]]). - -There are also live examples ~map!~'s usage in [[file:../modules/config/default/+evil-bindings.el][config/default/+evil-bindings.el]]. - -** How do I get motions to treat underscores as word delimiters? -(This explanation comes from [[https://github.com/emacs-evil/evil#underscore-_-is-not-a-word-character][emacs-evil/evil]]'s readme) - -An underscore "_" is a word character in Vim. This means that word-motions like -=w= skip over underlines in a sequence of letters as if it was a letter itself. -In contrast, in Evil the underscore is often a non-word character like -operators, e.g. =+=. - -The reason is that Evil uses Emacs' definition of a word and this definition -does not often include the underscore. Word characters in Emacs are determined -by the syntax-class of the buffer. The syntax-class usually depends on the -major-mode of this buffer. This has the advantage that the definition of a -"word" may be adapted to the particular type of document being edited. Evil uses -Emacs' definition and does not simply use Vim's definition in order to be -consistent with other Emacs functions. For example, word characters are exactly -those characters that are matched by the regular expression character class -~[:word:]~. - -If you want the underscore to be recognized as word character, you can modify -its entry in the syntax-table: - -#+BEGIN_SRC emacs-lisp -(modify-syntax-entry ?_ "w") -#+END_SRC - -This gives the underscore the word syntax-class. You can use a mode-hook to -modify the syntax-table in all buffers of some mode, e.g.: - -#+BEGIN_SRC emacs-lisp -;; For python -(add-hook! 'python-mode-hook (modify-syntax-entry ?_ "w")) -;; For ruby -(add-hook! 'ruby-mode-hook (modify-syntax-entry ?_ "w")) -;; For Javascript -(add-hook! 'js2-mode-hook (modify-syntax-entry ?_ "w")) -#+END_SRC - -** How do I change the leader/localleader keys? -These variables control what key to use for leader and localleader keys: - -+ For Evil users: - + ~doom-leader-key~ (default: =SPC=) - + ~doom-localleader-key~ (default: =SPC m=) -+ For Emacs and Insert state (evil users), and non-evil users: - + ~doom-leader-alt-key~ (default: =M-SPC= for evil users, =C-c= otherwise) - + ~doom-localleader-alt-key~ (default: =M-SPC m= for evil users, =C-c l= - otherwise) - -e.g. -#+BEGIN_SRC emacs-lisp -;;; add to ~/.doom.d/config.el -(setq doom-leader-key "," - doom-localleader-key "\\") -#+END_SRC - -** How do I change the style of line-numbers (or disable them altogether)? -Doom uses the ~display-line-numbers~ package, which is built into Emacs 26+. - -*** Disabling line numbers entirely -#+BEGIN_SRC elisp -;;; add to ~/.doom.d/config.el -(setq display-line-numbers-type nil) -;; or -(remove-hook! '(prog-mode-hook text-mode-hook conf-mode-hook) - #'display-line-numbers-mode) -#+END_SRC - -*** Switching to relative line numbers (permanently) -To change the style of line numbers, change the value of the -~display-line-numbers-type~ variable. It accepts the following values: - -#+begin_example -t normal line numbers -'relative relative line numbers -'visual relative line numbers in screen space -nil no line numbers -#+end_example - -For example: - -#+BEGIN_SRC elisp -;;; add to ~/.doom.d/config.el -(setq display-line-numbers-type 'relative) -#+END_SRC - -You'll find more precise documentation on the variable through = v -display-line-numbers-type= (== is =SPC h= for evil users, =C-h= -otherwise). - -*** Switching the style of line numbers (temporarily) -Use ~M-x doom/toggle-line-numbers~ (bound to =SPC t l= by default) to cycle -through the available line number styles in the current buffer. - -e.g. =normal -> relative -> visual -> disabled -> normal=. - -** How do I change the behavior and appearance of popup windows? -The =:ui popup= module tries to standardize how Emacs handles "temporary" -windows. It includes a set of default rules that tell Emacs where to open them -(and how big they should be). - -Check out the [[file:../modules/ui/popup/README.org::Configuration][:ui popup module's documentation]] for more on defining your own -rules. - -You'll find more comprehensive documentation on ~set-popup-rule!~ in its -docstring (available through =SPC h f= -- or =C-h f= for non-evil users). - -** How do I customize a theme or face(s)? -Doom provides the ~custom-set-faces!~ and ~custom-theme-set-faces!~ macros as a -convenience. - -See =SPC h f custom-set-faces\!= (or =C-h f custom-set-faces\!=) for -documentation on and examples of its use. - -#+begin_quote -Other sources may recommend ~M-x customize~, ~M-x customize-themes~ or ~M-x -customize-face~. *Do not use these commands.* Doom does not support them and -their settings could break any time. -#+end_quote - -** How do I make a new theme? -Doom will look for themes in =~/.doom.d/themes/= (determined by -~custom-theme-directory~). - -Its filename must take the format =XYZ-theme.el=, where =XYZ= is the theme's -name declared in that theme's ~deftheme~ or ~def-doom-theme~ call. The theme can -then be loaded with: - -#+BEGIN_SRC elisp -;; add to ~/.doom.d/config.el -(setq doom-theme 'XYZ) - -;; or - -(load-theme 'XYZ t) -#+END_SRC - -** Can Doom be customized without restarting Emacs? -Short answer: You can, but you shouldn't. - -Long answer: Restarting Emacs is always your safest bet, but Doom provides a few -tools for experienced Emacs users to skirt around it (most of the time): - -- Evaluate your changes on-the-fly with ~+eval/region~ (bound to the =gr= - operator for evil users) or ~eval-last-sexp~ (bound to =C-x C-e=). Changes - take effect immediately. -- On-the-fly evaluation won't work for all changes. e.g. Changing your ~doom!~ - block (i.e. the list of modules for Doom to enable). - - But rather than running ~doom sync~ and restarting Emacs, Doom provides ~M-x - doom/reload~ for your convenience (bound to =SPC h r r= and =C-h r r=). This - runs ~doom sync~, restarts the Doom initialization process and re-evaluates - your personal config. However, this won't clear pre-existing state; Doom won't - unload modules/packages that have already been loaded and it can't anticipate - complications arising from your private config. -- You can quickly restart Emacs and restore the last session with - ~doom/restart-and-restore~ (bound to =SPC q r=). - -** Can Vim/Evil be removed for a more vanilla Emacs experience? -Yes! See the [[file:../modules/editor/evil/README.org::Removing evil-mode][Removing evil-mode]] section in [[file:../modules/editor/evil/README.org][:editor evil]]'s documentation. - -** When should and shouldn't I use ~bin/doom~? -~bin/doom~ is your best friend. It'll keep all your secrets (mostly because it's -a shell script incapable of sentience and thus incapable of retaining, much less -divulging, your secrets to others). - -You can run ~bin/doom help~ to see what it's capable of, but here are some -commands that you may find particularly useful: - -+ ~doom doctor~ :: Diagnose common issues in your environment and list missing - external dependencies for your enabled modules. -+ ~doom sync~ :: Ensures that all missing packages are installed, orphaned - packages are removed, and metadata properly generated. -+ ~doom install~ :: Install any missing packages. -+ ~doom update~ :: Update all packages that Doom's (enabled) modules use. -+ ~doom env~ :: Regenerates your envvar file, which contains a snapshot of your - shell environment for Doom Emacs to load on startup. You need to run this for - changes to your shell environment to take effect. -+ ~doom purge -g~ :: Purge orphaned packages (i.e. ones that aren't needed - anymore) and regraft your repos. -+ ~doom upgrade~ :: Upgrade Doom to the latest version (then update your - packages). This is equivalent to: - - #+BEGIN_SRC bash - git pull - doom sync - doom update - #+END_SRC - -** When to run ~doom sync~ -As a rule of thumb you should run ~doom sync~ whenever you: - -+ Update Doom with ~git pull~ instead of ~doom upgrade~, -+ Change your ~doom!~ block in =$DOOMDIR/init.el=, -+ Change autoload files in any module (or =$DOOMDIR=), -+ Or change the packages.el file in any module (or =$DOOMDIR=). -+ Install an Emacs package or dependency outside of Emacs (i.e. through your OS - package manager). - -If anything is misbehaving, it's a good idea to run ~doom sync~ first. ~doom -sync~ is responsible for regenerating your autoloads file (which tells Doom -where to find lazy-loaded functions and libraries), installing missing packages, -and uninstall orphaned (unneeded) packages. - -** How to suppress confirmation prompts while ~bin/doom~ is running -The ~-y~ and ~--yes~ flags (or the ~YES~ environment variable) will force -~bin/doom~ to auto-accept confirmation prompts: - -#+BEGIN_SRC bash -doom -y update -doom --yes update -YES=1 doom update -#+END_SRC - -** Which terminal should I use? -Looking for a terminal in Emacs? Doom offers four modules: - -+ =:term eshell= -+ =:term shell=, -+ =:term term= -+ =:term vterm=. - -But which do you choose? - -+ =eshell= is a shell completely implemented in Emacs Lisp. It's stable, works - anywhere Emacs runs (on any OS) and has no external dependencies, /but/ lacks - features you'll expect from mature shells, tends to be slower than them, and - does not support command line tools with TUIs (e.g. curses, ncdu, nmtui, top, - etc). -+ =shell= is a shell /for/ your shell. Think of it like a REPL for bash/zsh, - rather than a terminal emulator. Due to its simplicity, you're less likely to - encounter edge cases (e.g. against your shell config), but it has the smallest - feature set. It also won't work with TUI programs like htop or vim. -+ =term= is Emacs' built-in terminal emulator. Term runs a shell and understand - many (but not all) terminal escape codes, so many TUI programs (like top or - vim) will work. However, term's performance is inferior to standalone - terminals, especially with large bursts of output. -+ =vterm= is as good as terminal emulation gets in Emacs (at the time of - writing), and is the most performant, as it is an external library written - in C. However, it requires extra steps to set up. a) Emacs must be built with - dynamic modules support and b) you'll need to compile vterm-module.so, which - has external dependencies (libvterm). It is automatically built when you first - open =vterm=, but this will fail on Windows, NixOS and Guix out of the box. - Except for Windows, you'll find install instructions for nix/guix in [[file:../modules/term/vterm/README.org][the :term - vterm module's documentation]]. - -For a terminal in Emacs, =eshell= and =vterm= are generally the best options. - -** How do I enable LSP support for ? -Doom supports LSP, but it is not enabled by default. To enable it, you must: - -1. Enable the =:tools lsp= module, -2. Enable the =+lsp= flag for the appropriate modules you want LSP support for - (e.g. =:lang (python +lsp)= or =:lang (rust +lsp)=), -3. Install the prerequisite LSP servers through your package manager or other - means. You can find a list of supported servers on [[https://github.com/emacs-lsp/lsp-mode#supported-languages][the lsp-mode project page]]. -4. Run ~doom sync~ on the command line and restart Emacs. - -Some language modules may lack LSP support (either because it hasn't been -implemented yet or I'm not aware of it yet -- let us know!). To enable LSP for -these languages, add this to =$DOOMDIR/config.el=: - -#+BEGIN_SRC elisp -(add-hook 'MAJOR-MODE-local-vars-hook #'lsp!) -;; Where =MAJOR-MODE= is the major mode you're targeting. e.g. -;; lisp-mode-local-vars-hook -#+END_SRC -** How to disable smartparens/automatic parentheses completion? -Some outdated sources may tell you to do this, *but it is no longer correct*: - -#+BEGIN_SRC elisp -(after! smartparens - (smartparens-global-mode -1)) -#+END_SRC - -Instead, use the following: -#+BEGIN_SRC elisp -(remove-hook 'doom-first-buffer-hook #'smartparens-global-mode) -#+END_SRC - -Note that the package itself cannot be disabled with ~package!~, because it is a -core package. This may change one day, but not in the near future. -** How do I maximize/fullscreen Emacs on startup? -#+BEGIN_SRC elisp -(add-to-list 'initial-frame-alist '(fullscreen . maximized)) -#+END_SRC - -Some window managers may not understand/work with =maximized= (or may not -produce the desired effect), in that case try ~fullboth~ or ~fullscreen~. - -** How do I share/sync my config between multiple computers? -TL;DR: it is perfectly safe to sync =~/.doom.d=, but not =~/.emacs.d=. - -Long answer: =~/.emacs.d/.local= can contain baked-in absolute paths and -non-portable byte-code. It is never a good idea to sync it across multiple -computers. - -If you must, for some reason, copy =~/.emacs.d= from one system to another, -remember to run ~doom sync && doom build~ on the target machine. - -* Package Management -** How do I install a package from ELPA? -See the "[[file:getting_started.org::*Installing packages][Installing packages]]" section of the [[file:getting_started.org][Getting Started]] guide. - -** How do I install a package from github/another source? -See the "[[file:getting_started.org::*Installing packages from external sources][Installing packages from external sources]]" section of the [[file:getting_started.org][Getting -Started]] guide. - -** How do I change where an existing package is installed from? -See the "[[file:getting_started.org::*Changing a recipe for a included package][Changing a recipe for a included package]]" section of the [[file:getting_started.org][Getting -Started]] guide. - -** How do I disable a package completely? -See the "[[file:getting_started.org::*Disabling packages][disabling packages]]" section of the [[file:getting_started.org][Getting Started]] guide. - -** How do I reconfigure a package included in Doom? -See the "[[file:getting_started.org::*Configuring packages][configuring packages]]" section of the Getting Started guide. - -** Where does straight clone/build packages to? -Doom has configured straight to clone packages to -=~/.emacs.d/.local/straight/repos/REPO-NAME=. It then builds (byte-compiles and -symlinks) them to =~/.emacs.d/.local/straight/build/PACKAGE-NAME=. - -* Defaults -** Why Ivy over Helm? -Short answer: ivy is simpler to maintain. - -Long answer: Features and performance appear to be the main talking points when -comparing the two, but as far as I'm concerned they are equal in both respects -(not all across the board, but on average). - -Instead, maintainability is most important for someone that frequently tinkers -with their editor. When I have an issue, I spend disproportionately more time -dealing helm than I do ivy, for little or no gain. Though both frameworks are -excellent, the difference in complexity is reflected in their plugin ecosystems; -ivy plugins tend to be lighter, simpler, more consistent and significantly -easier to hack if I want to change something. Unless you like helm /just/ the -way it is out of the box, ivy is just the simpler choice. - -And since I dogfood it, Ivy's integration into Doom will always be a step or -three ahead of helm's. - -** Why are there no default keybinds for Smartparens (for evil users)? -Doom only uses smartparens to manage pair "completion" (it does the job better -than electric-{pair,quote}-mode or the multitude of other pair-management -solutions in the Emacs ecosystem at the time of writing). - -None of smartparen's commands have default keybinds for evil users because they -are redundant with motions and text-objects provided by evil/vim. If you -disagree, I recommend trying the =:editor lispy= or =:editor parinfer= modules. - -** Why do non-evil users get expand-region, but not evil users? -~expand-region~ is redundant with and less precise than evil's text objects and -motions. - -- There's a text object for every "step" of expansion that expand-region - provides (and more). To select the word at point = =viw=, symbol at point = - =vio=, line at point = =V=, the block at point (by indentation) = =vii=, the - block at point (by braces) = =vib=, sentence at point = =vis=, paragraph = - =vip=, and so on. -- Selection expansion can be emulated by using text objects consecutively: =viw= - to select a word, followed by =io= to expand to a symbol, then =ib= expands to - the surrounding brackets/parentheses, etc. There is no reverse of this - however; you'd have to restart visual state. - -The expand-region way dictates you start at some point and expand/contract until -you have what you want selected. The vim/evil way would rather you select -exactly what you want from the get go. In the rare event a text object fails -you, a combination of =o= (swaps your cursor between the two ends of the region) -and motion keys can adjust the ends of your selection. - -#+BEGIN_QUOTE -There are also text objects for xml tags (=x=), C-style function arguments -(=a=), angle brackets, and single/double quotes. -#+END_QUOTE - -This is certainly more to remember compared to a pair of expand and contract -commands, but text objects (and motions) are the bread and butter of vim's modal -editing paradigm. Vimmers will feel right at home. To everyone else: mastering -them will have a far-reaching effect on your productivity. I highly recommend -putting in the time to learn them. - -Otherwise, it is trivial to install expand-region and binds keys to it yourself: - -#+BEGIN_SRC elisp -;;; add to ~/.doom.d/packages.el -(package! expand-region) - -;;; add to ~/.doom.d/config.el -(map! :nv "C-=" #'er/contract-region - :nv "C-+" #'er/expand-region) -#+END_SRC - -** Why not use exec-path-from-shell instead of ~doom env~? -The ~doom env~ approach is a faster and more reliable solution. - -1. ~exec-path-from-shell~ must spawn (at least) one process at startup to scrape - your shell environment. This can be slow depending on the user's shell - configuration. A single program (like pyenv or nvm) or config framework (like - oh-my-zsh) could undo Doom's startup optimizations in one fell swoop. - -2. ~exec-path-from-shell~ takes a whitelist approach and captures only ~PATH~ - and ~MANPATH~ by default. You must be proactive in order to capture all the - envvars relevant to your development environment and tools. - -~doom env~ takes the blacklist approach and captures all of your shell -environment. This front loads the debugging process, which is nicer than dealing -with it later, while you're getting work done. - -That said, if you still want ~exec-path-from-shell~, it is trivial to install -yourself: - -#+BEGIN_SRC emacs-lisp -;;; add to ~/.doom.d/packages.el -(package! exec-path-from-shell) - -;;; add to ~/.doom.d/config.el -(require 'exec-path-from-shell) -(when (display-graphic-p) - (exec-path-from-shell-initialize)) -#+END_SRC - -** Why wsbutler over delete-trailing-whitespace or whitespace-cleanup? -TL;DR: =ws-butler= is less imposing. - -Don't be that guy who PRs 99 whitespace adjustments around his one-line -contribution. Don't automate this aggressive behavior by attaching -~delete-trailing-whitespace~ (or ~whitespace-cleanup~) to ~before-save-hook~. If -you have rambunctious colleagues peppering trailing whitespace into your -project, you need to have a talk (with wiffle bats, preferably) rather than play -a passive-aggressive game of whack-a-mole. - -Here at Doom Inc we believe that operations that mutate entire files (or worse, -projects) should not be automated. Rather, they should be invoked deliberately, -only when and where it is needed, by someone that is aware of the consequences. -This is where =ws-butler= comes in. It only cleans up whitespace /on the lines -you've touched/ *and* it leaves behind virtual whitespace (which is never -written to the file) so your cursor doesn't get thrown around in all that -cleanup work. - -In any case, if you had used =ws-butler= from the beginning, trailing whitespace -and newlines would never be a problem! - -* Emacs Lisp -** Why do you quote some symbols with ~#'symbol~? -~#'symbol~ is short for ~(function symbol)~, the same way ~'symbol~ is short for -~(quote symbol)~. - -In elisp there is no /functional/ difference between the two syntaxes, but the -sharp-quote does hint to the byte-compiler that "this symbol refers to a -function", which it can perform additional checks on when the code is -byte-compiled. - -My reason for using it is to make it explicit to readers how I intend (or -expect) the symbol to be used. No sharp-quote means I'm using the symbol as a -literal data value. - -* Common Issues -** I get the vanilla Emacs splash screen at startup -The most common cause for this is a =~/.emacs= file. If it exists, Emacs will -read this file instead of the =~/.emacs.d= directory, ignoring Doom altogether. - -If this isn't the case, try running ~bin/doom doctor~. It can detect a variety -of common issues and may give you some clues as to what is wrong. - -** I see a blank scratch buffer at startup -This commonly means that Emacs can't find your private doom config (in -=~/.doom.d= or =~/.config/doom=). Make sure *only one of these two* folders -exist, and that it has an init.el file with a ~doom!~ block. Running ~doom -install~ will populate your private doom directory with the bare minimum you -need to get going. - -If nothing else works, try running ~bin/doom doctor~. It can detect a variety of -common issues and may give you some clues as to what is wrong. - -** Strange (or incorrect) icons are displayed everywhere -Many of Doom's UI modules use the =all-the-icons= plugin, which uses special -fonts to display icons. These fonts must be installed for them to work properly, -otherwise you'll get a bunch of squares and mismatched icons. When running ~doom -install~, you will be asked whether you want these installed for you or not. - -If you did not accept or need to reinstall those fonts, MacOS and Linux users -can install them with ~M-x all-the-icons-install-fonts~. Windows users will need -to use this command to download the fonts somewhere, then they must install them -manually (e.g. by double-clicking each file in explorer). - -** ~void-variable~ and ~void-function~ errors on startup -The most common culprit for these types of errors are: - -1. An out-of-date autoloads file. Run ~doom sync~ to regenerate them. - - To avoid this issue, remember to run ~doom sync~ whenever you modify your - ~doom!~ block in =~/.doom.d/init.el=, or add ~package!~ declarations to - =~/.doom.d/packages.el=. Or if you modify =~/.emacs.d/.local= by hand, for - whatever reason. - - See ~doom help sync~ for details on what this command does and when you - should use it. - -2. Emacs byte-code isn't forward compatible. If you've recently switched to a - newer (or older) version of Emacs, you'll need to either reinstall or - recompile your installed plugins. This can be done by: - - + Running ~doom build~, - + Or deleting =~/.emacs.d/.local/straight= then running ~doom install~ (this - will take a while). - -** Doom can't find my executables/doesn't inherit the correct ~PATH~ -The two most common causes for PATH issues in Doom are: - -1. Your shell configuration doesn't configure ~PATH~ correctly. If ~which - ~ doesn't emit the path you expect on the command line then this is - likely the case. - -2. Your app launcher (rofi, albert, docky, dmenu, sxhkd, etc) is launching Emacs - with the wrong shell, either because it defaults to a different shell from - the one you use or the app launcher itself inherits the wrong environment - because /it/ was launched from the wrong shell. - -3. You're a Mac user launching Emacs from an Emacs.app bundle. MacOS launches - these apps from an isolated environment. - -As long as your shell is properly configured, there is a simple solution to -issues #1 and #3: generate an envvar file by running ~doom env~. This scrapes -your shell environment into a file that is loaded when Doom Emacs starts up. -Check out ~doom help env~ for details on how this works. - -For issue #2, you'll need to investigate your launcher. [[https://discord.gg/qvGgnVx][Our Discord]] is a good -place to ask about it. - -** There's artefacting on my icon fonts in GUI Emacs ([[https://github.com/hlissner/doom-emacs/issues/956][#956]]) -Check your font rendering settings. Changing the RGBA order to "rgba" will often -fix this issue. See [[https://github.com/hlissner/doom-emacs/issues/956][#956]] for details. - -** The =s= and =S= keys don't behave like they do in vim/evil ([[https://github.com/hlissner/doom-emacs/issues/1307][#1307]]) -This is intentional. =s= and =S= have been replaced by the evil-snipe plugin, -which provides 2-character versions of the f/F motion keys, ala vim-seek or -vim-sneak. - -These keys were changed because they are redundant with =cl= and =cc= -respectively (and the new behavior was deemed more useful). - -If you still want to restore the old behavior, simply disable evil-snipe-mode: - -#+BEGIN_SRC emacs-lisp -;; in ~/.doom.d/config.el -(remove-hook 'doom-first-input-hook #'evil-snipe-mode) -#+END_SRC - -** Changes to my config aren't taking effect -1. Make sure you don't have both =~/.doom.d= and =~/.config/doom= directories. - Doom will ignore the former if the latter exists. - -2. Remember to run ~doom sync~ when it is necessary. To get to know when, - exactly, you should run this command, run ~doom help sync~. - -If neither of these solve your issue, try ~bin/doom doctor~. It will detect a -variety of common issues, and may give you some clues as to what is wrong. - -** The frame goes black on MacOS, while in full-screen mode -There are known issues with childframes and macOS's fullscreen mode. There is no -known fix for this. To work around it, you must either: - -1. Avoid MacOS native fullscreen by maximizing Emacs instead, - -2. Disable childframes (controlled by the =+childframe= flag on the modules that - support it), - -3. Install Emacs via the =emacs-mac= homebrew formula. - -** Doom crashes when... -Here are a few common causes for random crashes: - -+ On some systems (particularly MacOS), manipulating the fringes or window - margins can cause Emacs to crash. This is most prominent in the Doom Dashboard - (which tries to center its contents), in org-mode buffers (which uses - ~org-indent-mode~ to create virtual indentation), or magit. There is currently - no known fix for this, as it can't be reliably reproduced. Your best bet is to - reinstall/rebuild Emacs or disable the errant plugins/modules. e.g. - - To disable org-indent-mode: - - #+BEGIN_SRC emacs-lisp - (after! org - (setq org-startup-indented nil)) - #+END_SRC - - Or disable the =:ui doom-dashboard= & =:tools magit= modules (see [[https://github.com/hlissner/doom-emacs/issues/1170][#1170]]). -+ Ligatures and some fonts can cause Emacs to crash. You may want to try a - different font, or disable the =:ui ligatures module. - -** Can't load my theme; ~unable to find theme file for X~ errors -This means Emacs can't find the X-theme.el file for the theme you want to load. -Emacs will search for this file in ~custom-theme-load-path~ and -~custom-theme-directory~. There are a couple reasons why it can't be found: - -1. It is generally expected that third party themes will [[https://github.com/hlissner/emacs-doom-themes/blob/master/doom-themes.el#L400-L405][add themselves]] to - ~custom-theme-load-path~, but you will occasionally encounter a theme that - does not. This should be reported upstream. - - In the meantime, you can get around this by eagerly loading the package: - - #+BEGIN_SRC elisp - (require 'third-party-theme) - (setq doom-theme 'third-party) - #+END_SRC -2. You've appended ~-theme~ to the end of your theme's name. - - #+BEGIN_SRC elisp - (setq doom-theme 'third-party-theme) - #+END_SRC - - When you load a theme Emacs searches for ~X-theme.el~. If you set - ~doom-theme~ to ~'third-party-theme~, it will search for - ~third-party-theme-theme.el~. This is rarely intentional. Omit the ~-theme~ - suffix. -3. Did you run ~doom sync~ after adding your third party theme plugin's - ~package!~ declaration to =~/.doom.d/packages.el=? - -** TRAMP connections hang forever when connecting -You'll find solutions [[https://www.emacswiki.org/emacs/TrampMode#toc7][on the emacswiki]]. - -** An upstream package was broken and I can't update it -Sometimes, if you've installed a [[https://github.com/hlissner/doom-emacs/issues/2213][broken package]] which was subsequently fixed -upstream, you can't run ~doom update~ to get the latest fixes due to evaluation -errors. - -In those cases, you need to delete the broken local copy before you can install -the new one, which is achieved by either deleting it from -=~/.emacs.d/.local/straight/repos=, or by cycling the module that installs it: - -1. Comment out the broken module/package. -2. Run ~doom sync~. -3. Uncomment the module/package. -4. Run ~doom sync~. - -** Why do I see ugly indentation highlights for tabs? -[[https://github.com/hlissner/doom-emacs/blob/develop/core/core-ui.el#L132-L150][Doom highlights non-standard indentation]]. i.e. Indentation that doesn't match -the indent style you've set for that file. Spaces are Doom's default style for -most languages (excluding languages where tabs are the norm, like Go). - -There are a couple ways to address this: - -1. Fix your indentation! If it's highlighted, you have tabs when you should have - spaces (or spaces when you should be using tabs). - - Two easy commands for that: - - - =M-x tabify= - - =M-x untabify= - -2. Change ~indent-tabs-mode~ (nil = spaces, t = tabs) in =~/.doom.d/config.el=: - - #+BEGIN_SRC elisp - ;; use tab indentation everywhere - (setq-default indent-tabs-mode t) - - ;; or only in certain modes - (setq-hook! 'sh-mode-hook indent-tabs-mode t) ; shell scripts - (setq-hook! '(c-mode-hook c++-mode-hook) indent-tabs-mode t) ; C/C++ - #+END_SRC - -3. Use [[https://editorconfig.org/][editorconfig]] to configure code style on a per-project basis. If you - enable Doom's =:tools editorconfig= module, Doom will recognize - =.editorconfigrc= files. - -4. Or trust in dtrt-indent; a plugin Doom uses to analyze and detect indentation - when you open a file (that isn't in a project with an editorconfig file). - This isn't foolproof, and won't work for files that have no content in them, - but it can help in one-off scenarios. - -** "clipetty--emit: Opening output file: Permission denied, /dev/pts/29" error -This applies to tmux users, in particular. See -https://github.com/spudlyo/clipetty/issues/15 for a solution. - -** "The directory ~/.emacs.d/server is unsafe" error at startup -If you're getting this error you must reset the owner of -=C:\Users\USERNAME\.emacs.d= to your own account: - -1. Right-click the =~/.emacs.d/server= directory in Windows Explorer, -2. Click Properties, -3. Select the "Security" tab, -4. Click the "Advanced" button, -5. Select the "Owner" tab -6. Change the owner to your account name - -([[https://stackoverflow.com/questions/885793/emacs-error-when-calling-server-start][source]]) - -** My new keybinds don't work -Emacs has a complex and hierarchical keybinding system. If a global keybind -doesn't take effect, it's likely that another keymap is in effect with higher -priority than the global keymap. For example, non-evil users may have tried -something like this, to rebind =C-left= and =C-right=: -#+BEGIN_SRC elisp -(map! "" #'something - "" #'something) -#+END_SRC - -Just to find that the rebinding had no effect (i.e. ~C-h k C-left~ reports that -it's still bound to ~sp-backward-slurp-sexp~). That's because these keys are -bound in ~smartparens-mode-map~. They need to be unbound for your global -keybinds to work: - -#+BEGIN_SRC elisp -(map! :after smartparens - :map smartparens-mode-map - [C-right] nil - [C-left] nil) -#+END_SRC - -#+begin_quote -I use ~[C-left]~ because it is easier to type than ~""~, but are -equivalent; two different ways to refer to the same key. -#+end_quote diff --git a/.config/emacs/docs/getting_started.org b/.config/emacs/docs/getting_started.org deleted file mode 100644 index 1398005..0000000 --- a/.config/emacs/docs/getting_started.org +++ /dev/null @@ -1,1677 +0,0 @@ -#+TITLE: Getting Started Guide -#+STARTUP: nofold - -GNU Emacs is one grand ol' adventure, let alone Doom Emacs. Before you start -you'll need to set up Emacs, Doom, and its packages, then learn how to take care -of your new puppy/operating system. This guide will walk you through installing, -using, configuring and troubleshooting all of these things, to smooth you into -your Emacs journey. - -This guide will gloss over many technicalities so you can get up and running as -soon as possible. A more technical user manual is in the works for aspiring -contributors who want a deeper understanding of how Doom Emacs works. - -#+begin_quote -If you feel like we've missed something, [[https://discord.gg/qvGgnVx][join us on our Discord server]] and let -us know! -#+end_quote - -* Table of Contents :TOC_4: -- [[#install][Install]] - - [[#emacs--dependencies][Emacs & dependencies]] - - [[#on-linux][On Linux]] - - [[#ubuntu][Ubuntu]] - - [[#fedora][Fedora]] - - [[#arch-linux][Arch Linux]] - - [[#nixos][NixOS]] - - [[#opensuse][openSUSE]] - - [[#gentoo-linux][Gentoo Linux]] - - [[#on-macos][On macOS]] - - [[#with-homebrew][With Homebrew]] - - [[#with-macports][With MacPorts]] - - [[#on-windows][On Windows]] - - [[#with-chocolatey--scoop][With chocolatey / scoop]] - - [[#with-a-precompiled-binary--git-bash][With a precompiled binary + Git Bash]] - - [[#with-wsl--ubuntu-1804-lts][With WSL + Ubuntu 18.04 LTS]] - - [[#doom-emacs][Doom Emacs]] - - [[#the-bindoom-utility][The ~bin/doom~ utility]] - - [[#install-doom-manually][Install Doom Manually]] - - [[#install-doom-alongside-other-configs-with-chemacs2][Install Doom alongside other configs (with Chemacs2)]] - - [[#externalsystem-dependencies][External/system dependencies]] -- [[#update--rollback][Update & Rollback]] - - [[#rollback][Rollback]] - - [[#updowngrading-emacs][Up/Downgrading Emacs]] -- [[#migrate][Migrate]] - - [[#from-vanilla-emacs][From vanilla Emacs]] - - [[#from-spacemacs][From Spacemacs]] -- [[#configure][Configure]] - - [[#modules][Modules]] - - [[#package-management][Package management]] - - [[#installing-packages][Installing packages]] - - [[#installing-packages-from-external-sources][Installing packages from external sources]] - - [[#pinning-packages-to-specific-commits][Pinning packages to specific commits]] - - [[#disabling-packages][Disabling packages]] - - [[#changing-a-recipe-for-an-included-package][Changing a recipe for an included package]] - - [[#usingloading-local-packages][Using/loading local packages]] - - [[#configuring-doom][Configuring Doom]] - - [[#configuring-packages][Configuring packages]] - - [[#reloading-your-config][Reloading your config]] - - [[#binding-keys][Binding keys]] - - [[#writing-your-own-modules][Writing your own modules]] - - [[#file-structure][File structure]] - - [[#initel][=init.el=]] - - [[#configel][=config.el=]] - - [[#packagesel][=packages.el=]] - - [[#autoloadel-or-autoloadel][=autoload/*.el= OR =autoload.el=]] - - [[#doctorel][=doctor.el=]] - - [[#cliel][=cli.el=]] - - [[#testtest-el][=test/**/test-*.el=]] - - [[#additional-files][Additional files]] - - [[#load-order][Load order]] - - [[#flags][Flags]] - - [[#doom-cookies][Doom cookies]] - - [[#if][~;;;###if~]] - - [[#package][~;;;###package~]] - - [[#autodef][~;;;###autodef~]] - - [[#common-mistakes-when-configuring-doom-emacs][Common mistakes when configuring Doom Emacs]] - - [[#packages-are-eagerly-loaded][Packages are eagerly loaded]] - - [[#manual-package-management][Manual package management]] - - [[#using-org-babel-do-load-languages-to-load-your-babel-packages][Using ~org-babel-do-load-languages~ to load your babel packages]] - - [[#using-delete-trailing-whitespaces-or-whitespace-cleanup-to-manage-leftover-whitespace][Using ~delete-trailing-whitespaces~ or ~whitespace-cleanup~ to manage leftover whitespace]] -- [[#troubleshoot][Troubleshoot]] - - [[#looking-up-documentation-and-state-from-within-emacs][Looking up documentation and state from within Emacs]] - - [[#variables-functions-faces-etc][Variables, functions, faces, etc.]] - - [[#for-doom-modules-packages-autodefs-etc][For Doom Modules, packages, autodefs, etc.]] - - [[#how-to-extract-a-backtrace-from-an-error][How to extract a backtrace from an error]] - - [[#enabling-debug-on-error][Enabling ~debug-on-error~]] - - [[#a-backtrace-from-bindoom][A backtrace from ~bin/doom~]] - - [[#evaluating-elisp-on-the-fly][Evaluating Elisp on-the-fly]] - - [[#how-to-determine-the-origin-of-a-bug][How to determine the origin of a bug]] - - [[#testing-in-dooms-sandbox][Testing in Doom's sandbox]] - - [[#opening-the-sandbox][Opening the sandbox]] - - [[#launching-the-sandbox][Launching the sandbox]] - - [[#testing-packages-in-the-sandbox][Testing packages in the sandbox]] - - [[#bisecting-your-private-config][Bisecting your private config]] - - [[#bisecting-doom-emacs][Bisecting Doom Emacs]] - -* Install -This is what you'll have installed by the end of this section: - -- Git 2.23+ -- Emacs 27.1+ *(27.2 is recommended, or [[https://www.emacswiki.org/emacs/GccEmacs][native-comp]])* -- [[https://github.com/BurntSushi/ripgrep][ripgrep]] 11.0+ -- GNU Find -- (Optional) [[https://github.com/sharkdp/fd][fd]] 7.3.0+ (known as ~fd-find~ on Debian, Ubuntu & derivatives) -- - improves performance for many file indexing commands - -These packages ought to be available through the package managers of your -operating system; i.e. homebrew & macports on macOS, scoop/chocolatey on -Windows, or pacman/aptitude/etc on the various Linux distributions. - -** Emacs & dependencies -*** On Linux -Installation instructions for Emacs 27.1+ are listed below for many popular -Linux distributions. In the unusual case that 27.1 or newer is unavailable on -your system, you'll have to [[https://www.gnu.org/software/emacs/manual/html_node/efaq/Installing-Emacs.html][build it from source]] instead. - -**** Ubuntu -Emacs 27.x is not available through Ubuntu's package manager out-of-the-box, but -is available through a PPA: - -#+BEGIN_SRC bash -add-apt-repository ppa:kelleyk/emacs -apt-get update -apt-get install emacs27 -#+END_SRC - -Or through snap: - -#+BEGIN_SRC bash -snap install emacs --classic -#+END_SRC - -In some cases, you may need to delete old version of emacs and it's dependencies first, before installing emacs27: -#+BEGIN_SRC bash -sudo apt remove emacs -sudo apt autoremove -#+END_SRC - -***** Other dependencies -Then install Doom's other dependencies: -#+BEGIN_SRC bash -apt-get install ripgrep fd-find - -# On 18.04 or older, ripgrep and fd-find won't be available in -# official repos. You'll need to install them another way, e.g. -sudo dpkg -i fd_8.2.1_amd64.deb # adapt version number and architecture -sudo dpkg -i fd_8.2.1_amd64.deb # adapt version number and architecture -#+END_SRC - -**** Fedora -#+BEGIN_SRC bash -# required dependencies -dnf install emacs git ripgrep -# optional dependencies -dnf install fd-find # is 'fd' in Fedora <28 -#+END_SRC - -**** Arch Linux -#+BEGIN_SRC bash -# required dependencies -pacman -S git emacs ripgrep -# optional dependencies -pacman -S fd -#+END_SRC - -The above installs Emacs 27 (at the time of writing). - -**** NixOS -On NixOS Emacs 27.2 can be installed via ~nix-env -Ai nixos.emacs~, or -permanently with the following added to ~etc/nixos/configuration.nix~: - -#+BEGIN_SRC nix -environment.systemPackages = with pkgs; [ - # required dependencies - git - emacs # Emacs 27.2 - ripgrep - # optional dependencies - coreutils # basic GNU utilities - fd - clang -]; -#+END_SRC - -Installing Emacs 28+ will require [[https://github.com/nix-community/emacs-overlay/issues][nix-community/emacs-overlay]]: -#+BEGIN_SRC nix -nixpkgs.overlays = [ - (import (builtins.fetchTarball https://github.com/nix-community/emacs-overlay/archive/master.tar.gz)) -]; - -environment.systemPackages = [ - pkgs.emacsGcc # Installs Emacs 28 + native-comp -]; -#+END_SRC - -**** openSUSE -***** Emacs 27.1 -Emacs can be installed from the [[https://software.opensuse.org/download.html?project=editors&package=emacs][package list]], or manually via zypper. - -For example, to install on openSUSE Leap 15.1 (requires root): -#+BEGIN_SRC bash -zypper addrepo https://download.opensuse.org/repositories/editors/openSUSE_Leap_15.1/editors.repo -zypper refresh -zypper install emacs -#+END_SRC - -If you already have an older version of Emacs installed, you will be prompted to -install the update candidate (Emacs 27.1). - -***** ripgrep -Download ripgrep 11.0.2 from [[https://software.opensuse.org/download/package?package=ripgrep&project=openSUSE%3AFactory][the package list]] or installed manually (requires -root). -#+BEGIN_SRC bash -zypper addrepo https://download.opensuse.org/repositories/openSUSE:Factory/standard/openSUSE:Factory.repo -zypper refresh -zypper install ripgrep -#+END_SRC - -Only ripgrep 0.8.1 is officially available on Leap 15.1 and 15.2, so you will -need to install Rust to build ripgrep from source. Rust can be downloaded [[https://software.opensuse.org/package/rust][from -the package list]] or installed manually via zypper (requires root), e.g. -#+BEGIN_SRC bash -zypper addrepo https://download.opensuse.org/repositories/openSUSE:Leap:15.1:Update/standard/openSUSE:Leap:15.1:Update.repo -zypper refresh -zypper install rust -#+END_SRC - -See the [[https://github.com/BurntSushi/ripgrep#building][ripgrep documentation]] for instructions on building from source. - -**** Gentoo Linux -Everything you need is in Gentoo's official =::gentoo= repository. - -***** Emacs -To use Emacs graphically, enable the =gui= USE flag. And enable the =xft= USE flag to render fonts correctly (see -[[https://github.com/hlissner/doom-emacs/issues/4876][issue #4876]]) -#+begin_src sh -echo "app-editors/emacs gui xft" >> /etc/portage/package.use/emacs -#+end_src - -To install the latest unmasked version compatible with Doom: -#+begin_src sh -emerge '>=app-editors/emacs-27.0' -#+end_src - -Or, for GCCEmacs/Native Compilation, use the live ebuild for version 28.0 with the =jit= USE flag: - -Unmask the desired ebuild by adding the following to =package.accept_keywords=: -#+begin_src -=app-editors/emacs-28.0.9999 ** -#+end_src - -Add the =jit= USE flag to =package.use=: -#+begin_src -=app-editors/emacs-28.0.9999 jit -#+end_src - -And emerge: -#+begin_src sh -emerge =app-editors/emacs-28.0.9999 -#+end_src - -***** Other Dependencies -#+begin_src sh -# required -emerge '>=dev-vcs/git-2.23' '>=sys-apps/ripgrep-11.0' sys-apps/findutils -# optional -emerge '>=sys-apps/fd-7.3.0' -#+end_src - -*** On macOS -MacOS users have many options for installing Emacs, but not all of them are well -suited to Doom. Before we get to that you'll need either the Homebrew or -MacPorts package manager installed (you only need one): - -+ [[http://brew.sh/][How to install Homebrew]] -+ [[https://www.macports.org/install.php][How to install MacPorts]] - -**** With Homebrew -First, Doom's dependencies: -#+BEGIN_SRC bash -# required dependencies -brew install git ripgrep -# optional dependencies -brew install coreutils fd -# Installs clang -xcode-select --install -#+END_SRC - -For Emacs itself, these three formulas are the best options, ordered from most -to least recommended for Doom (based on compatibility). - -- [[https://bitbucket.org/mituharu/emacs-mac/overview][emacs-mac]]. It offers good integration - with macOS, native emojis and better childframe support. - #+BEGIN_SRC bash - brew tap railwaycat/emacsmacport - brew install emacs-mac --with-modules - ln -s /usr/local/opt/emacs-mac/Emacs.app /Applications/Emacs.app - #+END_SRC - -- [[https://github.com/d12frosted/homebrew-emacs-plus][emacs-plus]]. Some users have - experienced [flashing artifacts when scrolling](https://github.com/d12frosted/homebrew-emacs-plus/issues/314): - #+BEGIN_SRC bash - brew tap d12frosted/emacs-plus - brew install emacs-plus - ln -s /usr/local/opt/emacs-plus/Emacs.app /Applications/Emacs.app - #+END_SRC - -- [[https://formulae.brew.sh/formula/emacs][emacs]] is another acceptable option, **but does not provide a Emacs.app**: - #+BEGIN_SRC bash - brew install emacs - #+END_SRC - -***** Where *not* to install Emacs from -These builds/forks have known compatibility issues with Doom and are *very -likely* to cause issues later on. They are not recommended: - -+ emacsformacosx.com -+ ~brew cask install emacs~ (installs from emacsformacosx.com) -+ AquaMacs -+ XEmacs - -**** With MacPorts -There are four ports (at time of writing) available through MacPorts, and they -are all acceptable options: - -+ [[https://ports.macports.org/port/emacs/summary][emacs]] (27.2) and [[https://ports.macports.org/port/emacs-devel/summary][emacs-devel]] (28) -- Installs terminal-only Emacs -+ [[https://ports.macports.org/port/emacs-app/summary][emacs-app]] (27.2), [[https://ports.macports.org/port/emacs-app-devel/summary][emacs-app-devel]] (28) -- Installs GUI Emacs -+ [[https://ports.macports.org/port/emacs-mac-app/summary][emacs-mac-app]] (27.2) -- the [[https://bitbucket.org/mituharu/emacs-mac][Mitsuharu Yamamoto mac port]] - -Some of these ports do not add an =emacs= binary to your ~PATH~, which is -necessary for Doom's installation process. You'll have to do so yourself by -adding this to your shell config: - -#+BEGIN_SRC sh -# Add this to ~/.zshrc or ~/.bash_profile -export PATH="/Applications/MacPorts/Emacs.app/Contents/MacOS:$PATH" -#+END_SRC - -Or by replacing ~/usr/local/bin/emacs~ with a shim script containing: -#+BEGIN_SRC -#!/bin/sh -/Applications/MacPorts/Emacs.app/Contents/MacOS/Emacs "$@" -#+END_SRC - -*** On Windows -#+begin_quote -*WARNING:* Emacs on Windows is much slower than its Linux or macOS counterparts. -There are some suggestions on how to speed it up later in this section. -#+end_quote - -There are three methods for installing Emacs 27.x on Windows, each with their -pros and cons: - -+ With chocolatey/scoop -+ With a precompiled binary + Git Bash -+ With WSL2 + Ubuntu - -If you don't know which to choose, I highly recommend WSL; it produces the -fastest and most stable environment of the three, but has the most complex -installation process. - -Before moving on to installing Emacs et co, a few steps to prepare Windows for -Emacs are necessary: - -1. Create a ~HOME~ [[https://mywindowshub.com/how-to-edit-system-environment-variables-for-a-user-in-windows-10/][system environment variable]]. - - Set it to =C:\Users\USERNAME\=, otherwise Emacs will treat - =C:\Users\USERNAME\AppData\Roaming= as your ~HOME~, which will cause issues - later. - -2. Add =C:\Users\USERNAME\.emacs.d\bin= to your ~PATH~. - - This way, you don't have to type all of =C:\Users\USERNAME\.emacs.d\bin\doom= - every time you need to run this script (and you'll need to, often). - - #+begin_quote - A pre-existing PATH variable should already exist among your system - variables. It contains a string of file paths separated by colons; - ~pathA:pathB:pathC~. Prepend the path to bin/doom to that string, like so: - ~C:\Users\username\.emacs.d\bin:pathA:pathB:pathC~ - #+end_quote - -3. Restart your system so your new values for ~HOME~ and ~PATH~ take effect. - -Now we're ready to move on! - -**** With [[https://chocolatey.org/][chocolatey]] / scoop -[[https://chocolatey.org/][Chocolatey]] is a package manager for Windows, and is the simplest way to install -Emacs and Doom's dependencies: -#+BEGIN_SRC sh -choco install git emacs ripgrep -# Optional dependencies -choco install fd llvm -#+END_SRC - -Scoop will work too, but because Emacs is a GUI application you'll need to -enable the 'extras' Scoop bucket: -#+BEGIN_SRC sh -scoop bucket add extras -scoop install git emacs ripgrep -# Optional dependencies -scoop install fd llvm -#+END_SRC - -**** With a precompiled binary + Git Bash -(Credit goes to @earvingad and [[https://earvingad.github.io/posts/doom_emacs_windows/][his fantastic tutorial]] for informing this guide) - -1. Download and install Git from https://git-scm.com/download/win -2. Download and extract Emacs, ripgrep and fd where you want them, but in - different folders: - - Emacs 27.2 from http://ftp.wayne.edu/gnu/emacs/windows/emacs-27/ - - Ripgrep from https://github.com/BurntSushi/ripgrep/releases - - (optional) fd from https://github.com/sharkdp/fd/releases -3. Add the three folders from step 2 to your ~PATH~ - - Go to Control panel -> User Accounts -> Change my environment variables. - - Click "New", type HOME and set your C:\Users\USERNAME and OK. - - Select "Path", click "edit", prepend =C:\path\to\the\emacs\bin:= to it and - click OK. - - Select "Path", click "edit", prepend =C:\path\to\the\ripgrep:= to it and - click OK. - - Select "Path", click "edit", prepend =C:\path\to\the\fd:= to it and click - OK. - - Click Ok. - -And done! Keep git-bash.exe open, you'll need it for the rest of this guide. - -#+begin_quote -*IMPORTANT:* you'll need to open git-bash.exe whenever you want to run a -bin/doom command. -#+end_quote - -**** With WSL + Ubuntu 18.04 LTS -(Credit goes to @lunias and [[https://ethanaa.com/blog/switching-to-doom-emacs/#installing-on-windows-10 -][his fantastic tutorial]] for informing this guide) - -1. Install Powershell as admin (Windows key + x) with: - #+BEGIN_SRC - Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Windows-Subsystem-Linux - #+END_SRC -2. Restart your Computer -3. Download and install Ubuntu 18.04 L>TS from the Microsoft Store -4. Launch Ubuntu 18.04 LTS -5. Update and upgrade Ubuntu - #+BEGIN_SRC - sudo apt update && sudo apt upgrade - #+END_SRC -6. Then install Emacs: - #+BEGIN_SRC sh - sudo add-apt-repository ppa:kelleyk/emacs - sudo apt update - sudo apt install emacs27 - #+END_SRC -7. Then Doom's dependencies: - #+BEGIN_SRC sh - # required dependencies - sudo apt-get install git ripgrep - # optional dependencies - sudo apt-get install fd-find - #+END_SRC - -And done! Keep Ubuntu open, you'll need it for the rest of this guide. - -** Doom Emacs -With Emacs and Doom's dependencies installed, next is to install Doom Emacs -itself: - -#+BEGIN_SRC bash -git clone https://github.com/hlissner/doom-emacs ~/.emacs.d -~/.emacs.d/bin/doom install -#+END_SRC - -=doom install= will set up your =DOOMDIR= at =~/.doom.d= (if it doesn't already -exist) and will work you through the first-time setup of Doom Emacs. Carefully -follow any instructions it puts out. - -If this is your first time, you should run ~doom doctor~. This will diagnose -common issues with your system or config. - -#+BEGIN_QUOTE -If you'd like a more technical break down of ~doom install~, it's been -translated into shell commands below, in the "Install Doom Manually" section. -#+END_QUOTE - -*** The ~bin/doom~ utility -This utility is your new best friend. It won't spot you a beer, but it'll -shoulder much of the work associated with managing and maintaining your Doom -Emacs configuration, and then some. Not least of which is installation of and -updating Doom and your installed packages. - -It exposes a variety of commands. ~bin/doom help~ will list them all, but here -is a summary of the most important ones: - -+ ~doom sync~: This synchronizes your config with Doom Emacs. It ensures that - needed packages are installed, orphaned packages are removed and necessary - metadata correctly generated. Run this whenever you modify your ~doom!~ block - or =packages.el= file. You'll need ~doom sync -u~ if you override the recipe - of package installed by another module. -+ ~doom upgrade~: Updates Doom Emacs (if available) and all its packages. -+ ~doom env~: (Re)generates an "envvar file", which is a snapshot of your - shell environment that Doom loads at startup. If your app launcher or OS - launches Emacs in the wrong environment you will need this. **This is required - for GUI Emacs users on MacOS.** -+ ~doom doctor~: If Doom misbehaves, the doc will diagnose common issues with - your installation, system and environment. -+ ~doom purge~: Over time, the repositories for Doom's plugins will accumulate. - Run this command from time to time to delete old, orphaned packages, and with - the ~-g~ switch to compact existing package repos. - -Use ~doom help~ to see an overview of the available commands that =doom= -provides, and ~doom help COMMAND~ to display documentation for a particular -~COMMAND~. - -#+begin_quote -I recommend you add =~/.emacs.d/bin= to your ~PATH~ so you can call =doom= -directly and from anywhere. Accomplish this by adding this to your .bashrc or -.zshrc file: ~export PATH="$HOME/.emacs.d/bin:$PATH"~ -#+end_quote - -*** Install Doom Manually -If you'd rather install Doom yourself, instead of rely on the magic of =doom -install=, here is its equivalent in bash shell commands (assuming -=hlissner/doom-emacs= has been cloned to =~/.emacs.d=): - -#+BEGIN_SRC bash -# So we don't have to write ~/.emacs.d/bin/doom every time -PATH="$HOME/.emacs.d/bin:$PATH" - -# Create a directory for our private config -mkdir ~/.doom.d # or ~/.config/doom - -# The init.example.el file contains an example doom! call, which tells Doom what -# modules to load and in what order. -cp ~/.emacs.d/init.example.el ~/.doom.d/init.el -cp ~/.emacs.d/core/templates/config.example.el ~/.doom.d/config.el -cp ~/.emacs.d/core/templates/packages.example.el ~/.doom.d/packages.el - -# You might want to edit ~/.doom.d/init.el here and make sure you only have the -# modules you want enabled. - -# Then synchronize Doom with your config: -doom sync - -# If you know Emacs won't be launched from your shell environment (e.g. you're -# on macOS or use an app launcher that doesn't launch programs with the correct -# shell) then create an envvar file to ensure Doom correctly inherits your shell -# environment. -# -# If you don't know whether you need this or not, there's no harm in doing it -# anyway. `doom install` will have prompted you to generate one. If you -# responded no, you can generate it later with the following command: -doom env - -# Lastly, install the icon fonts Doom uses: -emacs --batch -f all-the-icons-install-fonts -# On Windows, `all-the-icons-install-fonts` will only download the fonts, you'll -# have to install them by hand afterwards! -#+END_SRC - -To understand the purpose of the =~/.doom.d= directory and =~/.doom.d/init.el= -file, see the [[#configure][Configure]] section further below. - -*** Install Doom alongside other configs (with Chemacs2) -[[https://github.com/plexus/chemacs2][Chemacs2]] is a bootloader for Emacs. It allows you to switch between multiple -Emacs configurations. Here is a quick guide for setting it up with Doom Emacs as -the default config: - -1. First, install Doom somewhere: - #+BEGIN_SRC sh :eval no - git clone https://github.com/hlissner/doom-emacs ~/doom-emacs - ~/doom-emacs/bin/doom install - #+END_SRC - -2. Move aside any existing config and install Chemacs2 as your new =~/.emacs.d=: - #+BEGIN_SRC bash :eval no - [ -f ~/.emacs ] && mv ~/.emacs ~/.emacs.bak - [ -d ~/.emacs.d ] && mv ~/.emacs.d ~/.emacs.legacy - git clone https://github.com/plexus/chemacs2.git ~/.emacs.d - #+END_SRC - -3. Create =~/.emacs-profiles.el= with a list of your Emacs profiles. This file - is structured like a =.dir-locals.el= file. Here is an example with Doom (as - the default), Spacemacs, and Prelude: - #+BEGIN_SRC emacs-lisp :eval no - (("default" . ((user-emacs-directory . "~/doom-emacs"))) - ("legacy" . ((user-emacs-directory . "~/.emacs.legacy"))) - ("spacemacs" . ((user-emacs-directory . "~/spacemacs")))) - #+END_SRC - -To start Emacs with a specific config, use the =--with-profile= option: - -#+BEGIN_SRC bash -emacs --with-profile spacemacs -#+END_SRC - -If no profile is specified, the =default= profile is used. - -** External/system dependencies -Doom is comprised of approximately 160 modules which provide its features, -language support and integration with external tools. Many of these have -external dependencies that you must install yourself. You'll find what a module -needs and how to install them in that module's README.org file or by running -~bin/doom doctor~. - -The [[file:modules.org][Module Index]] lists all Doom's available modules, with links to their -documentation. Documentation is a work-in-progrees; some modules may not have -README.org files yet! - -#+begin_quote -Use ~M-x doom/help-modules~ (bound to =SPC h d m= or =C-h d m=) to jump to a -module's documentation from within Doom, otherwise, place your cursor on a -module in your ~doom!~ block (in =~/.doom.d/init.el=) and press =K= to jump to -its documentation (or =gd= to jump to its source code). =C-c g k= and =C-c g d= -for non-evil users, respectively. -#+end_quote - -* Update & Rollback -Doom is an active project and many of its 300+ packages are in active -development as well. It is wise to occasionally update: -#+BEGIN_SRC bash -doom upgrade # or 'doom up' -#+END_SRC - -If you want to update Doom manually, ~doom upgrade~ is equivalent to: -#+BEGIN_SRC bash -cd ~/.emacs.d -git pull # updates Doom -doom clean # Ensure your config isn't byte-compiled -doom sync # synchronizes your config with Doom Emacs -doom update # updates installed packages -#+END_SRC - -To upgrade only your packages (and not Doom itself): - -#+BEGIN_SRC bash -doom upgrade --packages -#+END_SRC - -#+begin_quote -To minimize issues while upgrading, avoid modifying Doom's source files in -=~/.emacs.d=. All your customization should be kept in your =DOOMDIR= (e.g. -=~/.doom.d=). Read the [[#Configure][Configure]] section for more on configuring Doom. -#+end_quote - -** TODO Rollback -The =bin/doom= script doesn't currently offer rollback support for Doom or its -packages (yet). - -** Up/Downgrading Emacs -*You may encounter errors after up/downgrading Emacs.* Run ~doom sync~ on the -command line after changing the installed version of Emacs. If you've changed -the major version (e.g. 27 -> 28 or vice versa) run ~doom build~ too. - -+ ~doom sync~ will re-index any built-in/site loaddef files. This is especially - necessary if paths to built-in libraries have changed. -+ ~doom build~ will recompile all your installed packages, which is necessary - because Emacs bytecode not generally forward compatible across major releases - (e.g. 27 -> 28). Alternatively, reinstall all your packages by deleting - =~/.emacs.d/.local=, then run ~doom sync~. - -* TODO Migrate -If you're here from another Emacs distribution (or your own), here are a few -things to be aware of while you convert your old config to Doom: - -+ Doom does not use =package.el= to manage its packages, but ~use-package~ does! - You will see errors if you have ~:ensure ...~ properties in your ~use-package~ - blocks. Remove these and, instead, add ~package!~ declarations to - =~/.doom.d/packages.el= to install your packages. - - See [[#package-management]["Package Management"]], further in this guide. - -(This section is incomplete) - -** TODO From vanilla Emacs -#+begin_quote -Have you migrated from your own config? Help me flesh out this section by -letting me know what kind of hurdles you faced in doing so. You'll find me [[https://discord.gg/qvGgnVx][on -our Discord server]]. -#+end_quote - -** TODO From Spacemacs -#+begin_quote -Have you migrated from Spacemacs? Help me flesh out this section by letting me -know what kind of hurdles you faced in doing so. You'll find me [[https://discord.gg/qvGgnVx][on our Discord -server]]. -#+end_quote - -* Configure -You can configure Doom by tweaking the files found in your =DOOMDIR=. Doom -expects this directory to be found in one of: - -1. =~/.config/doom= (respects ~$XDG_CONFIG_HOME~) -2. or =~/.doom.d= - -This directory is referred to as your =DOOMDIR=. Only one of these directories -should exist (Doom will only recognize one). - -#+begin_quote -Change the =DOOMDIR= environment variable to change where Doom looks for this -directory. Symlinks will work as well. -#+end_quote - -When you ran ~doom install~, it deployed a simple Doom configuration to your -=DOOMDIR=, comprised of these three files: - -+ init.el :: Where you'll find your ~doom!~ block, which controls what Doom - modules are enabled and in what order they will be loaded. - - This file is evaluated early when Emacs is starting up; before any other - module has loaded. You generally shouldn't add code to this file unless you're - targeting Doom's CLI or something that needs to be configured very early in - the startup process. -+ config.el :: Here is where 99.99% of your private configuration should go. - Anything in here is evaluated /after/ all other modules have loaded, when - starting up Emacs. -+ packages.el :: Package management is done from this file; where you'll declare - what packages to install and where from. - -#+begin_quote -Note: do not use ~M-x customize~ or the customize API in general. Doom is -designed to be configured programmatically from your config.el, which can -conflict with Customize's way of modifying variables. - -If you're concerned about ~defcustom~ setters, Doom has a ~setq!~ macro that -will trigger them. -#+end_quote - -** Modules -Doom consists of around 160 modules and growing. A Doom module is a bundle of -packages, configuration and commands, organized into a unit that can be toggled -easily by tweaking your ~doom!~ block (found in =$DOOMDIR/init.el=). - -#+begin_quote -If =$DOOMDIR/init.el= doesn't exist, you haven't run ~doom install~ yet. See [[#install][the -"Install" section]] above. -#+end_quote - -Your ~doom!~ block should look something like this: - -#+BEGIN_SRC emacs-lisp -;; To comment something out, you insert at least one semicolon before it and the -;; Emacs Lisp interpreter will ignore everything until the end of the line. -(doom! :lang - python ; this module is not commented, therefore enabled - ;;javascript ; this module is commented out, therefore disabled - ;;lua ; this module is disabled - ruby ; this module is enabled - php) ; this module is enabled -#+END_SRC - -It controls what modules are enabled and in what order they are loaded. Some -modules have *optional features* that can be enabled by passing them flags, -denoted by a plus prefix: - -#+BEGIN_SRC emacs-lisp -(doom! :completion - (company +childframe) - :lang - (csharp +unity) - (org +brain +dragndrop +gnuplot +hugo +jupyter) - (sh +fish)) -#+END_SRC - -Different modules support different flags. You'll find a comprehensive list of -available modules and their supported flags in [[file:modules.org][Module Index]]. Flags that a -module does not recognize will be silently ignored. - -#+begin_quote -*IMPORTANT:* any changes to your ~doom!~ block won't take effect until you run - ~doom sync~ on the command line. -#+end_quote - -#+begin_quote -~doom doctor~ will detect issues with your ~doom!~ block, such as duplicate or -misspelled modules and flags. -#+end_quote - -** Package management -**Doom Emacs does not use package.el** (the package manager built into Emacs). -Instead, it uses its own declarative package manager built on top of -[[https://github.com/raxod502/straight.el][straight.el]]. - -Packages are declared in ~packages.el~ files. You'll find one in your =DOOMDIR= -and in many of Doom's modules. Read on to learn how to use this system to -install your own packages. - -#+begin_quote -*WARNING:* Do not install packages directly (with ~M-x package-install~ or ~M-x -straight-use-package~). Without an accompanying ~package!~ declaration somewhere -these packages will be forgotten when you restart Emacs and uninstalled the next -time you run ~doom sync~ or ~doom purge~. -#+end_quote - -#+begin_quote -*WARNING:* If you're here from another Emacs distro (or vanilla Emacs), be wary -of the ~:ensure~ property in ~use-package~ blocks, because it will attempt (and -fail) to install packages through package.el. Tutorials will recommend you -install packages this way too! -#+end_quote - -*** Installing packages -To install a package, add a ~package!~ declaration for it to -=DOOMDIR/packages.el=: -#+BEGIN_SRC emacs-lisp -;; Install a package named "example" from ELPA, MELPA, or Emacsmirror -(package! example) -#+END_SRC - -If a package could not be found in any known repo you will get an error like: - -#+begin_quote -Could not find package X in recipe repositories: (org-elpa melpa gnu-elpa-mirror -emacsmirror-mirror) -#+end_quote - -The most likely cause for this is either: - -- You've misspelled the package's name. -- Or the package really doesn't exist on ELPA, MELPA, or EmacsMirror and you'll - need to [[*Installing packages from external sources][specify a recipe for it]]. - -~package!~ will return non-nil if the package is cleared for install and hasn't -been disabled elsewhere. Use this fact to chain package dependencies together. -e.g. -#+BEGIN_SRC elisp -(when (package! example) - (package! plugin-that-example-depends-on)) -#+END_SRC - -#+begin_quote -*IMPORTANT:* New packages won't be installed until you run ~doom sync~. -#+end_quote - -*** Installing packages from external sources -To install a package straight from an external source (like github, gitlab, -etc), you'll need to specify a [[https://github.com/raxod502/straight.el#the-recipe-format][MELPA-style straight recipe]]: - -Here are a few examples: -#+BEGIN_SRC elisp -;; Install it directly from a github repository. For this to work, the package -;; must have an appropriate PACKAGENAME.el file which must contain at least a -;; Package-Version or Version line in its header. -(package! example - :recipe (:host github :repo "username/my-example-fork")) - -;; If the source files for a package are in a subdirectory in said repo, use -;; `:files' to target them. -(package! example :recipe - (:host github - :repo "username/my-example-fork" - :files ("*.el" "src/lisp/*.el"))) - -;; To grab a particular branch or tag: -(package! example :recipe - (:host gitlab - :repo "username/my-example-fork" - :branch "develop")) - -;; If a package has a default recipe on MELPA or emacsmirror, you may omit -;; keywords and the recipe will inherit the rest of the recipe from their -;; original. -(package! example :recipe (:branch "develop")) - -;; If the repo pulls in many unneeded submodules, you can disable recursive cloning -(package! example :recipe (:nonrecursive t)) - -;; A package can be installed straight from a git repo by setting :host to nil: -(package! example - :recipe (:host nil :repo "https://some/git/repo")) -#+END_SRC - -The specification for the ~package!~ macro's ~:recipe~ is laid out [[https://github.com/raxod502/straight.el#the-recipe-format][in -Straight.el's README]]. - -#+begin_quote -*IMPORTANT:* Run ~bin/doom sync~ whenever you modify packages.el files to -ensure your changes take effect. -#+end_quote - -*** Pinning packages to specific commits -All of Doom's packages are pinned by default. A pinned package is a package -locked to a specific commit, like so: -#+BEGIN_SRC elisp -(package! evil :pin "e00626d9fd") -#+END_SRC - -To unpin a package, use the ~unpin!~ macro: -#+BEGIN_SRC elisp -(unpin! evil) - -;; It can be used to unpin multiple packages at once -(unpin! evil helm org-mode) - -;; Or to unpin all packages in modules -(unpin! (:lang python ruby rust) (:tools docker)) - -;; Or to unpin an entire category of modules -(unpin! :completion :lang :tools) - -;; This will work too, if you prefer the syntax, but it provides no concise -;; syntax for unpinning multiple packages: -(package! helm :pin nil) -#+END_SRC - -Though it is *highly* discouraged, you may unpin all packages and make Doom -Emacs rolling release: -#+BEGIN_SRC elisp -(unpin! t) -#+END_SRC - -#+begin_quote -Unpinning all packages is discouraged because Doom's modules are designed -against the pinned versions of its packages. More volatile packages (like -lsp-mode, ein and org) change rapidly, and are likely to cause breakages if -unpinned. - -Instead, it's a better to selectively unpin packages, or repin them to the exact -commit you want. -#+end_quote - -*** Disabling packages -The ~package!~ macro possesses a ~:disable~ property: -#+BEGIN_SRC emacs-lisp -(package! irony :disable t) -(package! rtags :disable t) -#+END_SRC - -Once a package is disabled, ~use-package!~ and ~after!~ blocks for it will be -ignored, and the package is removed the next time you run ~bin/doom sync~. Use -this to disable Doom's packages that you don't want or need. - -There is also the ~disable-packages!~ macro for conveniently disabling multiple -packages: -#+BEGIN_SRC elisp -(disable-packages! irony rtags) -#+END_SRC - -#+begin_quote -*IMPORTANT:* Run ~bin/doom sync~ whenever you modify packages.el files to -ensure your changes take effect. -#+end_quote - -*** Changing a recipe for an included package -If a Doom module installs package X from one place, but you'd like to install it -from another (say, a superior fork), add a ~package!~ declaration for it in your -=DOOMDIR/packages.el=. Your private declarations always have precedence over -modules (even your own). -#+BEGIN_SRC elisp -;; in modules/editor/evil/packages.el -(package! evil) ; installs from MELPA - -;; in DOOMDIR/packages.el -(package! evil :recipe (:host github :repo "username/my-evil-fork")) -#+END_SRC - -To install a package only if a built-in package doesn't exist, use ~:built-in -'prefer~: -#+BEGIN_SRC elisp -(package! so-long :built-in 'prefer) -#+END_SRC - -#+begin_quote -*IMPORTANT:* Remember to run ~doom sync -u~ after changing recipes for existing -packages. At the time of writing, ~doom sync~ alone will not pick up on recipe -changes. -#+end_quote - -*** Using/loading local packages -Say you are developing an Emacs package locally and want to "install" it for -live testing. To do this specify a ~:local-repo~ in that package's recipe: -#+BEGIN_SRC elisp -(package! my-package - :recipe (:local-repo "/path/to/my/package")) - -;; Relative paths are expanded to ~/.emacs.d/.local/straight/repos/{local-repo} -;; or ~/.doom.d/{local-repo} -- the first that is found. -(package! my-package - :recipe (:local-repo "my/package")) ; looks for ~/.doom.d/my/package/my-package.el - -(package! my-package - :recipe (:local-repo "/path/to/my/package" - - ;; By default, the package manager grabs all *.el files at the root - ;; of the project and nothing else. To include other files, or - ;; accommodate unconventional project structures, specify what :files - ;; you want: - :files ("*.el" "src/lisp/*.el") - - ;; With this you can avoid having to run 'doom sync' every time you - ;; change the package. - :build (:not compile))) -#+END_SRC - -Alternatively, add the package's location to Emacs' ~load-path~. Do this if you -don't need/care for autoload cookies or byte-compilation: -#+BEGIN_SRC elisp -;; Doom has modified `use-package's `:load-path' to expand relative paths from -;; your DOOMDIR. e.g. ~/.doom.d/lisp/package -(use-package my-package - :load-path "lisp/package") - -;; or - -(add-load-path! "lisp/package") -#+END_SRC - -#+begin_quote -*IMPORTANT:* Remember to run ~doom sync~ to rebuild your package after you've -changed it, and to re-index any autoloads in it. -#+end_quote - -** Configuring Doom -*** Configuring packages -If your configuration needs are simple, the ~use-package!~, ~after!~, -~add-hook!~ and ~setq-hook!~ macros are your bread and butter. - -#+BEGIN_SRC emacs-lisp -;;; ~/.doom.d/config.el (example) -(setq doom-font (font-spec :family "Fira Mono" :size 12)) - -;; Takes a feature symbol or a library name (string) -(after! evil - (setq evil-magic nil)) - -;; Takes a major-mode, a quoted hook function or a list of either -(add-hook! python-mode - (setq python-shell-interpreter "bpython")) - -;; These are equivalent -(setq-hook! 'python-mode-hook python-indent-offset 2) -(setq-hook! python-mode python-indent-offset 2) - -(use-package! hl-todo - ;; if you omit :defer, :hook, :commands, or :after, then the package is loaded - ;; immediately. By using :hook here, the `hl-todo` package won't be loaded - ;; until prog-mode-hook is triggered (by activating a major mode derived from - ;; it, e.g. python-mode) - :hook (prog-mode . hl-todo-mode) - :init - ;; code here will run immediately - :config - ;; code here will run after the package is loaded - (setq hl-todo-highlight-punctuation ":")) -#+END_SRC - -For more flexibility, the ~use-package-hook!~ is another option, but should be -considered a last resort (because there is usually a better way). It allows you -to disable, append/prepend to and/or overwrite Doom's ~use-package!~ blocks. -These are powered by ~use-package~'s inject-hooks under the hood. - -~use-package-hook!~ *must be used before that package's ~use-package!~ block*. -Therefore it must be used from your private init.el file. - -#+BEGIN_SRC emacs-lisp -;;; ~/.doom.d/init.el (example) -;; If a :pre-init / :pre-config hook returns nil, it overwrites that package's -;; original :init / :config block. Exploit this to overwrite Doom's config. -(use-package-hook! doom-themes - :pre-config - (setq doom-neotree-file-icons t) - nil) - -;; ...otherwise, make sure they always return non-nil! -(use-package-hook! evil - :pre-init - (setq evil-magic nil) - t) - -;; `use-package-hook' also has :post-init and :post-config hooks -#+END_SRC - -*** Reloading your config -You may find it helpful to have your changes take effect immediately. For things -that don't require a complete restart of Doom Emacs (like changing your enabled -modules or installed packages), you can evaluate Emacs Lisp code on-the-fly. - -+ Evil users can use the =gr= operator to evaluate a segment of code. The return - value is displayed in the minibuffer or in a popup (if the result is large - enough to warrant one). - - =gr= works for most languages, but using it on Elisp is a special case; it's - executed within your current session of Emacs. You can use this to modify - Emacs' state on the fly. -+ Non-evil users can use =C-x C-e= to run ~eval-last-sexp~, as well as ~M-x - +eval/buffer-or-region~ (on =SPC c e=). -+ Another option is to open a scratch buffer with =SPC x=, change its major mode - (~M-x emacs-lisp-mode~), and use the above keys to evaluate your code. -+ An ielm REPL is available by pressing =SPC o r= - (~+eval/open-repl-other-window~). -+ There's also =M-:= or =SPC ;=, which invokes ~eval-expression~, which you can - use to run elisp code inline. - -While all this is helpful for reconfiguring your running Emacs session, it can -also be helpful for debugging. - -*** TODO Binding keys -+ define-key -+ global-set-key -+ map! -+ undefine-key! -+ define-key! - -** Writing your own modules -To create your own module you need only create a directory for it in -=~/.doom.d/modules/abc/xyz=, then add =:abc xyz= to your ~doom!~ block in -=~/.doom.d/init.el= to enable it. - -#+begin_quote -In this example, =:abc= is called the category and =xyz= is the name of the -module. Doom refers to modules in one of two formats: =:abc xyz= and =abc/xyz=. -#+end_quote - -If a private module possesses the same name as a built-in Doom module (say, -=:lang org=), it replaces the built-in module. Use this fact to rewrite modules -you don't agree with. - -Of course, an empty module isn't terribly useful, but it goes to show that nothing in a module is required. The typical module will have: - -+ A =packages.el= to declare all the packages it will install, -+ A =config.el= to configure and load those packages, -+ And, sometimes, an =autoload.el= to store that module's functions, to be - loaded when they are used. - -These are a few exceptional examples of a well-rounded module: -+ [[file:../modules/completion/company/README.org][:completion company]] - -The remainder of this guide will go over the technical details of a Doom module. - -*** File structure -Doom recognizes a handful of special file names, none of which are required for -a module to function. They are: - -#+begin_example -category/ - module/ - test/*.el - autoload/*.el - autoload.el - init.el - cli.el - config.el - packages.el - doctor.el -#+end_example - -**** =init.el= -This file is loaded early, before anything else, but after Doom core is loaded. -It is loaded in both interactive and non-interactive sessions (it's the only -file, besides =cli.el= that is loaded when the =bin/doom= starts up). - -Do: -+ Configure Emacs or perform setup/teardown operations that must be set early; - before other modules are (or this module is) loaded. -+ Reconfigure packages defined in Doom modules with ~use-package-hook!~ (as a - last resort, when ~after!~ and hooks aren't enough). -+ Configure behavior of =bin/doom= in a way that must also apply in - interactive sessions. - -Don't: -+ Configure packages with ~use-package!~ or ~after!~ from here -+ Preform expensive or error-prone operations; these files are evaluated - whenever =bin/doom= is used; a fatal error in this file can make Doom - unbootable (but not irreversibly). -+ Define new =bin/doom= commands here. That's what =cli.el= is for. - -**** =config.el= -The heart of every module. Code in this file should expect dependencies (in -=packages.el=) to be installed and available. Use it to load and configure its -packages. - -Do: -+ Use ~after!~ or ~use-package!~ to configure packages. - #+BEGIN_SRC emacs-lisp - ;; from modules/completion/company/config.el - (use-package! company ; `use-package!' is a thin wrapper around `use-package' - ; it is required that you use this in Doom's modules, - ; but not required to be used in your private config. - :commands (company-mode global-company-mode company-complete - company-complete-common company-manual-begin company-grab-line) - :config - (setq company-idle-delay nil - company-tooltip-limit 10 - company-dabbrev-downcase nil - company-dabbrev-ignore-case nil) - [...]) - #+END_SRC -+ Lazy load packages with ~use-package~'s ~:defer~ property. -+ Use the ~featurep!~ macro to make some configuration conditional based on the - state of another module or the presence of a flag. - -Don't: -+ Use ~package!~ -+ Install packages with =package.el= or ~use-package~'s ~:ensure~ property. Doom - has its own package manager. That's what =packages.el= is for. - -**** =packages.el= -This file is where package declarations belong. It's also a good place to look -if you want to see what packages a module manages (and where they are installed -from). - -Do: -+ Declare packages with the ~package!~ macro -+ Disable single packages with ~package!~'s ~:disable~ property or multiple - packages with the ~disable-packages!~ macro. -+ Use the ~featurep!~ macro to make packages conditional based on the state of - another module or the presence of a flag. - -Don't: -+ Configure packages here (definitely no ~use-package!~ or ~after!~ in here!). - This file is read in an isolated environment and will have no lasting effect. - The only exception is configuration targeting =straight.el=. -+ Perform expensive calculations. These files are read often and sometimes - multiple times. -+ Produce any side-effects, for the same reason. - -#+begin_quote -The "[[#package-management][Package Management]]" section goes over the ~package!~ macro and how to deal -with packages. -#+end_quote - -**** =autoload/*.el= OR =autoload.el= -These files are where you'll store functions that shouldn't be loaded until -they're needed and logic that should be autoloaded (evaluated very, very early -at startup). - -This is all made possible thanks to these autoload cookie: ~;;;###autoload~. -Placing this on top of a lisp form will do one of two things: - -1. Add a ~autoload~ call to Doom's autoload file (found in - =~/.emacs.d/.local/autoloads.el=, which is read very early in the startup - process). -2. Or copy that lisp form to Doom's autoload file verbatim (usually the case for - anything other than ~def*~ forms, like ~defun~ or ~defmacro~). - -Doom's autoload file is generated by scanning these files when you execute ~doom -sync~. - -For example: -#+BEGIN_SRC emacs-lisp -;; from modules/lang/org/autoload/org.el -;;;###autoload -(defun +org/toggle-checkbox () - (interactive) - [...]) - -;; from modules/lang/org/autoload/evil.el -;;;###autoload (autoload '+org:attach "lang/org/autoload/evil" nil t) -(evil-define-command +org:attach (&optional uri) - (interactive "") - [...]) -#+END_SRC - -**** =doctor.el= -When you execute ~doom doctor~, this file defines a series of tests for the -module. These should perform sanity checks on the environment, such as: - -+ Check if the module's dependencies are satisfied, -+ Warn if any of the enabled flags are incompatible, -+ Check if the system has any issues that may interfere with the operation of - this module. - -Use the ~warn!~, ~error!~ and ~explain!~ macros to communicate issues to the -user and, ideally, explain how to fix them. - -For example, the ~:lang cc~ module's doctor checks to see if the irony server is -installed: -#+BEGIN_SRC emacs-lisp -;; from lang/cc/doctor.el -(require 'irony) -(unless (file-directory-p irony-server-install-prefix) - (warn! "Irony server isn't installed. Run M-x irony-install-server")) -#+END_SRC - -**** TODO =cli.el= -This file is read when =bin/doom= starts up. Use it to define your own CLI -commands or reconfigure existing ones. - -**** TODO =test/**/test-*.el= -Doom's unit tests go here. More information on them to come... - -**** Additional files -Any files beyond the ones I have already named are not given special treatment. -They must be loaded manually to be loaded at all. In this way modules can be -organized in any way you wish. Still, there is one convention that has emerged -in Doom's community that you may choose to adopt: extra files in the root of the -module are prefixed with a plus, e.g. =+extra.el=. There is no syntactical or -functional significance to this convention. - -These can be loaded with the ~load!~ macro, which will load an elisp file -relative to the file it's used from. e.g. - -#+BEGIN_SRC emacs-lisp -;; Omitting the file extension allows Emacs to load the byte-compiled version, -;; if it is available: -(load! "+git") ; loads ./+git.el -#+END_SRC - -This can be useful for splitting up your configuration into multiple files, -saving you the hassle of creating multiple modules. - -*** Load order -A module's files have a precise load-order, which differs slightly depending on -what kind of session it is. Doom has three types of sessions: - -+ Interactive session :: the typical session you open when you intend to use - Emacs (e.g. for text editing). This loads the most, because you will likely be - using a lot of it. -+ Batch session :: this is a non-interactive session, loaded when you execute - Emacs commands on the command line with no UI, e.g. ~emacs --batch --eval - '(message "Hello world")'~. - - The expectation for these sessions is that it should quickly spin up, run the - command then quit, therefore very little is loaded in this session. -+ CLI session :: this is the same as a batch session /except/ it is what starts - up when you run any =bin/doom= command. - -With that out of the way, here is the load order of Doom's most important files: - -| File | Interactive | Batch | CLI | -|---------------------------------------------+-------------+-------+-----| -| ~/.emacs.d/early-init.el (Emacs 27+ only) | yes | no | no | -| ~/.emacs.d/init.el | yes | no | no | -| $DOOMDIR/init.el | yes | yes | yes | -| {~/.emacs.d,$DOOMDIR}/modules/*/*/init.el | yes | yes | yes | -| $DOOMDIR/cli.el | no | no | yes | -| {~/.emacs.d,$DOOMDIR}/modules/*/*/cli.el | no | no | yes | -| {~/.emacs.d,$DOOMDIR}/modules/*/*/config.el | yes | no | no | -| $DOOMDIR/config.el | yes | no | no | - -*** Flags -A module's flag is an arbitrary symbol. By convention, these symbols are -prefixed with a ~+~ or a ~-~ to denote the addition or removal of a feature, -respectively. There is no functional significance to this notation. - -A module may choose to interpret flags however it wishes, and can be tested for -using the ~featurep!~ macro: - -#+BEGIN_SRC elisp -;; Has the current module been enabled with the +my-feature flag? -(when (featurep! +my-feature) ...) - -;; It can be used to check the presence of flags in other modules: -(when (featurep! :lang python +lsp) ...) -#+END_SRC - -Use this fact to make aspects of a module conditional. e.g. Prevent company -plugins from loading if the =:completion company= module isn't enabled. - -*** Doom cookies -Autoload cookies were mentioned [[*=autoload/*.el= OR =autoload.el=][earlier]]. A couple more exist that are specific -to Doom Emacs. This section will go over what they do and how to use them. - -**** ~;;;###if~ -Any file in a module can have a ~;;;###if FORM~ cookie at or near the top of the -file (must be within the first 256 bytes of the file). =FORM= is evaluated to -determine whether or not to include this file for autoloads scanning (on ~doom -sync~) or byte-compilation (on ~doom compile~). - -i.e. if =FORM= returns ~nil~, Doom will neither index its ~;;;###autoload~ -cookies nor byte-compile the file. - -Use this to prevent errors that would occur if certain conditions aren't met. -For example, say =file.el= is using a certain function that won't be available -if the containing module wasn't enabled with a particular flag. We could safe -guard against this with: -#+BEGIN_SRC emacs-lisp -;;;###if (featurep! +particular-flag) -#+END_SRC - -This will prevent errors at compile time or if/when that file is loaded. - -Another example, this time contingent on =so-long= *not* being present: -#+BEGIN_SRC emacs-lisp -;;;###if (not (locate-library "so-long")) -#+END_SRC - -#+begin_quote -Keep in mind that =FORM= runs in a limited, non-interactive sub-session. I don't -recommend doing anything expensive or especially complicated in them. -#+end_quote - -**** ~;;;###package~ -This cookie exists solely to assist the ~doom/help-packages~ command. This -command shows you documentation about packages in the Emacs ecosystem, including -the ones that are installed. It also lists a) all the modules that install said -package and b) all the places it is configured. - -It accomplishes A by scanning for at ~package!~ declarations for that package, -but it accomplishes B by scanning for: - -+ ~after!~ calls -+ ~use-package!~ or ~use-package~ calls -+ and ~;;;###package X~ cookies, where X is the name of the package - -Use it to let ~doom/help-packages~ know where to find config for packages where -no ~after!~ or ~use-package!~ call is involved. - -**** ~;;;###autodef~ -An autodef is a special kind of autoloaded function (or macro) which Doom -guarantees will /always/ be defined, whether or not its containing module is -enabled (but will no-op if it is disabled). - -#+begin_quote -If the containing module is disabled the definition is replaced with a macro -that does not process its arguments, so it is a zero-cost abstraction. -#+end_quote - -You can browse the available autodefs in your current session with ~M-x -doom/help-autodefs~ (=SPC h d u= or =C-h d u=). - -An autodef cookie is used in exactly the same way as the autoload cookie: -#+BEGIN_SRC elisp -;;;###autodef -(defun set-something! (value) - ...) -#+END_SRC - -An example would be the ~set-company-backend!~ function that the =:completion -company= module exposes. It lets you register company completion backends with -certain major modes. For instance: -#+BEGIN_SRC emacs-lisp -(set-company-backend! 'python-mode '(company-anaconda)) -#+END_SRC - -And if =:completion company= is disabled, this call and its arguments are left -unprocessed and ignored. - -** Common mistakes when configuring Doom Emacs -Having helped many users configure Doom, I've spotted a few recurring oversights -that I will list here, in the hopes that it will help you avoid the same -mistakes: - -*** Packages are eagerly loaded -Using ~use-package!~ without a deferring keyword (one of: ~:defer :after -:commands :defer-incrementally :after-call~) will load the package immediately. -This causes other packages to be pulled in and loaded, which will compromise -many of Doom's startup optimizations. - -This is usually by accident. Choosing which keyword to use depends on the -needs of the package, so there is no simple answer to this. - -*** Manual package management -A lot of Emacs documentation and help will contain advice to install packages -with package.el's API (e.g. ~package-install~) or with use-package's ~:ensure~ -keyword). You are free to do this, if it is your preference, but otherwise, Doom -has its own package management system. - -Migrating ~use-package~ code to Doom is usually a case of removing the ~:ensure~ -keyword and adding a ~(package! PACKAGENAME)~ to =~/.doom.d/packages.el= (and -running ~doom sync~ to sync your config). - -*** Using ~org-babel-do-load-languages~ to load your babel packages -You don't need ~org-babel-do-load-languages~. Doom lazy loads babel packages -based on the language name in ~#+BEGIN_SRC~ blocks needed. As long as the babel -plugin is installed and the plugin is named after its language (e.g. -~#+BEGIN_SRC rust~ will load ~ob-rust~), you don't need to do anything else. - -There may be some special cases, however. Doom tries to handle a couple of them -(e.g. with ob-jupyter, ob-ipython and ob-async). If you are experiencing errors -while trying to use a certain language in org src blocks, check out the [[file:../modules/lang/org/README.org][:lang -org module documentation]] for details on how to add support for it. - -*** Using ~delete-trailing-whitespaces~ or ~whitespace-cleanup~ to manage leftover whitespace -#+BEGIN_SRC elisp -(add-hook 'after-save-hook #'delete-trailing-whitespace) -;; or -(add-hook 'after-save-hook #'whitespace-cleanup) -#+END_SRC - -These two lines are a common sight in Emacs configs, but they are unnecessary -for Doom Emacs. We already use the more sophisticated =ws-butler= to manage -extraneous whitespace. However, you might have the impression that it isn't -working. That's because =ws-butler= works in two unusual ways, meant to be less -imposing than its alternatives: - -1. It only cleans up trailing whitespace /on lines that you've touched/ (but - always strips newlines at EOF). - - Why do this? Because I believe file-wide reformatting should be a deliberate - act (and not blindly automated). If it is necessary, chances are you're - working on somebody else's project -- or with other people, but here, large - scale whitespace changes could cause problems or simply be rude. We don't - endorse PRs that are 1% contribution and 99% whitespace! - - However, if it's truly deliberate, ~M-x delete-trailing-whitespaces~ and ~M-x - whitespace-cleanup~ are available to be called =deliberately=, instead. - -2. =ws-butler= replaces trailing whitespace and newlines with *virtual* - whitespace. This is whitespace that only exists in the Emacs buffer, but - isn't actually written to the file. - - Why do this? Because you might have wanted to use that space for something in - your current editing session, and it would be inconvenient for the editor to - delete it before you got to it. - - If you use it, it's there. If you don't, it isn't written to the file. - -* Troubleshoot -When problems arise, you should be prepared to collect information in order to -solve them, or for the bug report you're about to write. Both Emacs and Doom -provide tools to make this easier. Here are a few things you can try, first: - -+ Investigate the =*Messages*= log for warnings or error messages. This log can - be opened with =SPC h e=, =C-h e= or =M-x view-echo-area-messages=. - -+ Look up errors/warnings [[file:faq.org::Common Issues][on the FAQ]] and [[https://github.com/hlissner/doom-emacs/issues][Doom's issue tracker]]. It is possible - that a solution for your issue already exists. The FAQ can be searched from - inside Doom with =SPC h d f= (or =C-h d f= for non-evil users). - -+ Run ~bin/doom doctor~ on the command line to diagnose common issues with your - environment and config. It will suggest solutions for them as well. - -+ ~bin/doom clean~ will ensure the problem isn't stale bytecode in your private - config or Doom core. If you haven't used ~bin/doom compile~, there's no need - to do this. - -+ ~bin/doom sync~ will ensure the problem isn't missing packages or outdated - autoloads files - -+ ~bin/doom build~ will ensure the problem isn't stale package bytecode or - broken symlinks. - -+ ~bin/doom update~ will ensure that your packages are up-to-date, eliminating - issues that originate from upstream. - -+ If you happen to know what module(s) are relevant to your issue, check their - documentation (press = h d m= to jump to a module's documentation). Your - issue may be documented. - -+ If possible, see if the issue can be reproduced in vanilla Emacs (Emacs - without Doom) and/or vanilla Doom (Doom without your private config). [[#testing-in-dooms-sandbox][Doom's - sandbox can help you check]]. - -+ Ask for help on [[https://discord.gg/qvGgnVx][our Discord server]]. It is the quickest way to get help, - sometimes straight from Doom's maintainer, who is very active there. - -If none of these things have helped you, then it's time to open a bug report. -See "[[file:contributing.org::*Reporting issues][Reporting Issues]]" in the [[file:contributing.org][contributing guidelines]] on how to file an -effective bug report. - -** Looking up documentation and state from within Emacs -... - -*** Variables, functions, faces, etc. -Emacs is a Lisp interpreter whose state you can access on-the-fly with tools -provided to you by Emacs itself. They're available on the =SPC h= prefix by -default. Use them to debug your sessions. - -Here are some of the more important ones: - -+ ~describe-variable~ (=SPC h v=) -+ ~describe-function~ (=SPC h f=) -+ ~describe-face~ (=SPC h F=) -+ ~describe-bindings~ (=SPC h b=) -+ ~describe-key~ (=SPC h k=) -+ ~describe-char~ (=SPC h '=) -+ ~find-library~ (=SPC h P=) - -You can also evaluate code with ~eval-expression~ (=M-;= or =SPC ;=). - -*** TODO For Doom Modules, packages, autodefs, etc. -+ ~doom/open-news~ (=SPC h n=) :: - ... -+ ~doom/help~ (=SPC h d h=) :: - Open the index of Doom's manual. -+ ~doom/help-modules~ (=SPC h d m=) :: - Jumps to a module's documentation. -+ ~doom/help-autodefs~ (=SPC h u=) :: - Jumps to the documentation for an autodef function/macro. These are special - functions that are always defined, whether or not their containing modules - are enabled. -+ ~doom/help-packages~ (=SPC h p=) :: - Look up packages that are installed, by whom (what modules) and where jump - to all the places it is being configured. -+ ~doom/info~ :: - ... - -** How to extract a backtrace from an error -If you encounter an error while using Doom Emacs, you're probably about to head -off and file a bug report (or request help on [[https://discord.gg/qvGgnVx][our Discord server]]). Before you -do, please generate a backtrace to include with it. - -To do so you must enable ~debug-on-error~ then recreate the error. - -*** Enabling ~debug-on-error~ -There are three ways to enable ~debug-on-error~: - -1. Start Emacs with ~emacs --debug-init~. Use this for errors that occur at - startup. -2. Evil users can press =SPC h d d= and non-evil users can press =C-h d d=. -3. If the above don't work, there's always: ~M-x toggle-debug-on-error~ - -Now that ~debug-on-error~ is on, recreate the error. A window should pop up with -a backtrace. - -*** A backtrace from ~bin/doom~ -If the error you've encountered is emitted from ~bin/doom~, you can re-run the -same command with the ~-d~ or ~--debug~ switches to force it to emit a backtrace -when an error occurs. The ~DEBUG~ environment variable will work to. - -#+BEGIN_SRC sh -doom -d sync -doom --debug install -DEBUG=1 doom update -#+END_SRC - -#+BEGIN_QUOTE -Note: switch order is important. ~-d~ / ~--debug~ /must/ come right after ~doom~ -and before the subcommand. This will be fixed eventually. -#+END_QUOTE - -** Evaluating Elisp on-the-fly -Often, you may find it helpful for debugging to evaluate some Emacs Lisp. Here -are couple things you can do: - -+ Use =M-:= (bound to ~eval-expression~), -+ =SPC x= will open a scratch buffer. ~M-x emacs-lisp-mode~ will change it to - the appropriate major mode, then use ~+eval:region~ (=gr=) and ~+eval/buffer~ - (=gR=) to evaluate code, - -** How to determine the origin of a bug -** Testing in Doom's sandbox -"The sandbox" is one of Doom Emacs' features; it is a test bed for running elisp -in a fresh instance of Emacs with varying amounts of Doom loaded (none at all, -all of it, or somewhere in between). This can be helpful for isolating bugs to -determine who you should report a bug to. - -If you can recreate a bug in vanilla Emacs then it should be reported to the -developers of the relevant packages or, perhaps, the Emacs devs themselves. - -Otherwise, it is best to bring it up on the Doom Emacs issue list, rather than -confusing and inundating the Emacs community with Doom-specific issues. - -*** Opening the sandbox -There are three common ways to access the sandbox: - -+ =SPC h E= (for evil users) -+ =C-h E= (for non-evil users) -+ ~M-x doom/sandbox~ - -Doing any of the above will pop up a ~*doom:sandbox*~ window. What you enter -into this buffer will be executed in the new instance of Emacs when you decide -to launch it. - -*** Launching the sandbox -You have four options when it comes to launching the sandbox: - -- =C-c C-c= :: This launches "vanilla Emacs". Vanilla means nothing is loaded; - purely Emacs and nothing else. If you can reproduce an error here, then the - issue likely lies in the plugin(s) you are testing or in Emacs itself. -- =C-c C-d= :: This launches "vanilla Doom", which is vanilla Emacs plus Doom's - core. This does not load your private config, nor any of Doom's (or your) - modules. -- =C-c C-p= :: This launches "vanilla Doom+". That is, Doom core plus the - modules that you have specified in the ~doom!~ block of your private config - (in =~/.doom.d/init.el=). This *does not* load your private config, however. -- =C-c C-f= :: This launches "full Doom". It loads Doom's core, your enabled - modules, and your private config. This instance should be identical to the - instance you launched it from. - -#+BEGIN_QUOTE -All new instances will inherit your ~load-path~ so you can access any packages -you have installed. -#+END_QUOTE -*** Testing packages in the sandbox -Instances of Emacs launched from the sandbox have inherited your ~load-path~. -This means you can load packages -- even in Vanilla Emacs -- without worrying -about installing or setting them up. Just ~(require PACKAGE)~ and launch the -sandbox. e.g. - -#+BEGIN_SRC elisp -(require 'magit) -(find-file "~/some/file/in/a/repo") -(call-interactively #'magit-status) -#+END_SRC - -** TODO Bisecting your private config -** TODO Bisecting Doom Emacs diff --git a/.config/emacs/docs/index.org b/.config/emacs/docs/index.org deleted file mode 100644 index 484d797..0000000 --- a/.config/emacs/docs/index.org +++ /dev/null @@ -1,106 +0,0 @@ -#+TITLE: Doom Emacs Documentation -#+STARTUP: nofold - -Doom is a configuration framework for [[https://www.gnu.org/software/emacs/][GNU Emacs 26.3+]] tailored for Emacs -bankruptcy veterans who want less framework in their frameworks and the -performance of a hand rolled config (or better). It can be a foundation for your -own config or a resource for Emacs enthusiasts to learn more about our favorite -OS. - -Doom is an opinionated collection of reasonable (and optional) defaults with a -focus on performance (both runtime and startup) and on abstraction-light, -readable code design, so that there is less between you and Emacs. - -#+begin_quote -The documentation is designed to be viewed within Doom Emacs. Access it by -pressing =SPC h d h= (or =C-h d h= for non-evil users), or search it with =SPC h -d s= (or =C-h d s=). -#+end_quote - -* Table of Contents :TOC: -- [[#release-notes][Release Notes]] -- [[#documentation][Documentation]] - - [[#getting-started][Getting Started]] - - [[#frequently-asked-questions][Frequently Asked Questions]] - - [[#contributing][Contributing]] - - [[#workflow-tips-tricks--tutorials][Workflow Tips, Tricks & Tutorials]] - - [[#module-appendix][Module Appendix]] -- [[#community-resources][Community Resources]] - - [[#asking-for-help][Asking for help]] - - [[#project-roadmap][Project roadmap]] - - [[#tutorials--guides][Tutorials & guides]] - - [[#projects-that-supportcomplement-doom][Projects that support/complement Doom]] - - [[#similar-projects][Similar projects]] - -* TODO Release Notes - -* Documentation -** [[file:getting_started.org][Getting Started]] -- [[file:getting_started.org::*Install][Install]] -- [[file:getting_started.org::*Update & Rollback][Update & Rollback]] -- [[file:getting_started.org::*Configure][Configure]] -- [[file:getting_started.org::*Migrate][Migrate]] -- [[file:getting_started.org::*Troubleshoot][Troubleshoot]] - -** [[file:faq.org][Frequently Asked Questions]] -- [[file:faq.org::*General][General]] -- [[file:faq.org::*Configuration][Configuration]] -- [[file:faq.org::*Package Management][Package Management]] -- [[file:faq.org::*Defaults][Defaults]] -- [[file:faq.org::Common Issues][Common Issues]] -- [[file:faq.org::Contributing][Contributing]] - -** TODO [[file:contributing.org][Contributing]] -- [[file:contributing.org::*Where can I help?][Where to get help?]] -- Reporting issues -- Suggesting features, keybinds and enhancements -- Contributing code or documentation -- Other ways to support Doom Emacs -- Special thanks - -** TODO [[file:workflow.org][Workflow Tips, Tricks & Tutorials]] - -** [[file:modules.org][Module Appendix]] - -* Community Resources -** Asking for help -- [[https://discord.gg/qvGgnVx][Our Discord server]] -- [[https://github.com/hlissner/doom-emacs/issues][Our issue tracker]] - -** Project roadmap -- [[https://github.com/hlissner/doom-emacs/projects/3][Development roadmap]] - A timeline outlining what's being worked on and when it - is expected to be done. -- [[https://github.com/hlissner/doom-emacs/projects/2][Plugins under review]] - A sitrep on third party plugins that we've considered, - rejected, or awaiting integration into Doom. -- [[https://github.com/hlissner/doom-emacs/projects/5][Upstream bugs]] - Tracks issues originating from plugins and external programs - that Doom relies on. - -** Tutorials & guides -+ *Doom Emacs* - - (videos) [[https://www.youtube.com/playlist?list=PLyy8KUDC8P7X6YkegqrnEnymzMWCNB4bN][Doom Emacs Tutorials]] by [[https://www.youtube.com/channel/UCVls1GmFKf6WlTraIb_IaJg][DistroTube]] - - (videos) [[https://www.youtube.com/playlist?list=PLhXZp00uXBk4np17N39WvB80zgxlZfVwj][DoomCasts]] by @zaiste - - [[https://noelwelsh.com/posts/doom-emacs][Noel's crash course on Doom Emacs]] - - [[https://medium.com/@aria_39488/getting-started-with-doom-emacs-a-great-transition-from-vim-to-emacs-9bab8e0d8458][Getting Started with Doom Emacs -- a great transition from Vim to Emacs]] - - [[https://medium.com/@aria_39488/the-niceties-of-evil-in-doom-emacs-cabb46a9446b][The Niceties of evil in Doom Emacs]] - - (video) [[https://www.youtube.com/watch?v=GK3fij-D1G8][Org-mode, literate programming in (Doom) Emacs]] -+ *Emacs & Emacs Lisp* - - [[https://www.gnu.org/software/emacs/manual/html_node/elisp/index.html][The Official Emacs manual]] - - A variety of Emacs resources - https://github.com/ema2159/awesome-emacs - - Quick crash courses on Emacs Lisp's syntax for programmers: - - https://learnxinyminutes.com/docs/elisp/ - - http://steve-yegge.blogspot.com/2008/01/emergency-elisp.html - - Workflows for customizing Emacs and its packages (and its C/C++ modes): - - https://david.rothlis.net/emacs/customize_c.html - - *Tools in Emacs* - - [[https://www.emacswiki.org/emacs/Calc_Tutorials_by_Andrew_Hyatt][How to use M-x calc]] -+ *Vim & Evil* - - [[https://gist.github.com/dmsul/8bb08c686b70d5a68da0e2cb81cd857f][A crash course on modal editing and Ex commands]] - -** Projects that support/complement Doom -+ [[https://github.com/plexus/chemacs][plexus/chemacs]] -+ [[https://github.com/r-darwish/topgrade][r-darwish/topgrade]] - -** Similar projects -+ [[https://github.com/purcell/emacs.d][purcell/emacs.d]] -+ [[https://github.com/seagle0128/.emacs.d][seagle0128/.emacs.d]] -+ [[https://github.com/syl20bnr/spacemacs][syl20bnr/spacemacs]] diff --git a/.config/emacs/docs/modules.org b/.config/emacs/docs/modules.org deleted file mode 100644 index 33b2bdb..0000000 --- a/.config/emacs/docs/modules.org +++ /dev/null @@ -1,224 +0,0 @@ -#+TITLE: Module Index -#+STARTUP: nofold - -Functionality in Doom is divided into collections of code called modules (à la -Spacemacs' layers). A module is a bundle of packages, configuration and -commands, organized into a unit that can be enabled or disabled by adding or -removing them from your ~doom!~ block in =$DOOMDIR/init.el=. - -* Table of Contents :TOC: -- [[#app][:app]] -- [[#checkers][:checkers]] -- [[#completion][:completion]] -- [[#config][:config]] -- [[#editor][:editor]] -- [[#emacs][:emacs]] -- [[#email][:email]] -- [[#input][:input]] -- [[#lang][:lang]] -- [[#os][:os]] -- [[#term][:term]] -- [[#tools][:tools]] -- [[#ui][:ui]] - -* :app -Application modules are complex and opinionated modules that transform Emacs -toward a specific purpose. They may have additional dependencies and *should be -loaded last*, before =:config= modules. - -+ [[file:../modules/app/calendar/README.org][calendar]] - TODO -+ [[file:../modules/app/emms/README.org][emms]] - TODO -+ [[file:../modules/app/everywhere/README.org][everywhere]] - TODO -+ [[file:../modules/app/irc/README.org][irc]] - how neckbeards socialize -+ [[file:../modules/app/rss/README.org][rss]] =+org= - an RSS client in Emacs -+ [[file:../modules/app/twitter/README.org][twitter]] - A twitter client for Emacs - -* :checkers -+ syntax =+childframe= - Live error/warning highlights -+ [[file:../modules/checkers/spell/README.org][spell]] =+aspell +flyspell +enchant +everywhere +hunspell= - Spell checking -+ [[file:../modules/checkers/grammar/README.org][grammar]] - TODO - -* :completion -Modules that provide new interfaces or frameworks for completion, including code -completion. - -+ [[file:../modules/completion/company/README.org][company]] =+childframe +tng= - The ultimate code completion backend -+ helm =+fuzzy +childframe= - *Another* search engine for love and life -+ ido - The /other/ *other* search engine for love and life -+ [[file:../modules/completion/ivy/README.org][ivy]] =+fuzzy +prescient +childframe +icons= - /The/ search engine for love and life -+ [[file:../modules/completion/vertico/README.org][vertico]] =+icons= - The search engine of the future - -* :config -Modules that configure Emacs one way or another, or focus on making it easier -for you to customize it yourself. It is best to load these last. - -+ [[file:../modules/config/literate/README.org][literate]] - For users with literate configs. This will tangle+compile a - config.org in your ~doom-private-dir~ when it changes. -+ [[file:../modules/config/default/README.org][default]] =+bindings +smartparens= - The default module sets reasonable defaults - for Emacs. It also provides a Spacemacs-inspired keybinding scheme and a - smartparens config. Use it as a reference for your own modules. - -* :editor -Modules that affect and augment your ability to manipulate or insert text. - -+ [[file:../modules/editor/evil/README.org][evil]] =+everywhere= - transforms Emacs into Vim -+ [[file:../modules/editor/file-templates/README.org][file-templates]] - Auto-inserted templates in blank new files -+ [[file:../modules/editor/fold/README.org][fold]] - universal code folding -+ format =+onsave= - TODO -+ god - TODO -+ [[file:../modules/editor/lispy/README.org][lispy]] - TODO -+ multiple-cursors - TODO -+ [[file:../modules/editor/objed/README.org][objed]] =+manual= - TODO -+ [[file:../modules/editor/parinfer/README.org][parinfer]] - TODO -+ rotate-text - TODO -+ [[file:../modules/editor/snippets/README.org][snippets]] - Snippet expansion for lazy typists -+ [[file:../modules/editor/word-wrap/README.org][word-wrap]] - soft wrapping with language-aware indent - -* :emacs -Modules that reconfigure or augment packages or features built into Emacs. - -+ [[file:../modules/emacs/dired/README.org][dired]] =+ranger +icons= - TODO -+ electric - TODO -+ [[file:../modules/emacs/ibuffer/README.org][ibuffer]] =+icons= - TODO -+ [[file:../modules/emacs/undo/README.org][undo]] =+tree= - A smarter, more intuitive & persistent undo history -+ [[file:../modules/emacs/vc/README.org][vc]] - TODO - -* :email -+ [[file:../modules/email/mu4e/README.org][mu4e]] =+org +gmail= - TODO -+ [[file:../modules/email/notmuch/README.org][notmuch]] - TODO -+ wanderlust =+gmail= - TODO - -* :input -+ [[file:../modules/input/chinese/README.org][chinese]] - TODO -+ [[file:../modules/input/japanese/README.org][japanese]] - TODO -+ [[file:../modules/input/layout/README.org][layout]] =+azerty +bepo= - TODO - -* :lang -Modules that bring support for a language or group of languages to Emacs. - -+ [[file:../modules/lang/agda/README.org][agda]] =+local= - TODO -+ [[file:../modules/lang/beancount/README.org][beancount]] =+lsp= - TODO -+ [[file:../modules/lang/cc/README.org][cc]] =+lsp= - TODO -+ [[file:../modules/lang/clojure/README.org][clojure]] =+lsp= - TODO -+ common-lisp - TODO -+ [[file:../modules/lang/coq/README.org][coq]] - TODO -+ [[file:../modules/lang/crystal/README.org][crystal]] - TODO -+ [[file:../modules/lang/csharp/README.org][csharp]] =+lsp +unity= - TODO -+ [[file:../modules/lang/dart/README.org][dart]] =+lsp +flutter= -+ data - TODO -+ [[file:../modules/lang/elixir/README.org][elixir]] =+lsp= - TODO -+ elm =+lsp= - TODO -+ [[file:../modules/lang/emacs-lisp/README.org][emacs-lisp]] - TODO -+ [[file:../modules/lang/erlang/README.org][erlang]] =+lsp= - TODO -+ [[file:../modules/lang/ess/README.org][ess]] =+lsp= - TODO -+ [[file:../modules/lang/factor/README.org][factor]] - TODO -+ [[file:../modules/lang/faust/README.org][faust]] - TODO -+ [[file:../modules/lang/fsharp/README.org][fsharp]] =+lsp= - TODO -+ [[file:../modules/lang/fstar/README.org][fstar]] - F* support -+ [[file:../modules/lang/gdscript/README.org][gdscript]] =+lsp= - TODO -+ [[file:../modules/lang/go/README.org][go]] =+lsp= - TODO -+ [[file:../modules/lang/haskell/README.org][haskell]] =+lsp= - TODO -+ hy - TODO -+ [[file:../modules/lang/idris/README.org][idris]] - TODO -+ java =+meghanada +eclim +lsp= - TODO -+ [[file:../modules/lang/javascript/README.org][javascript]] =+lsp= - JavaScript, TypeScript, and CoffeeScript support -+ [[file:../modules/lang/json/README.org][json]] =+lsp= - TODO -+ [[file:../modules/lang/julia/README.org][julia]] =+lsp= - TODO -+ [[file:../modules/lang/kotlin/README.org][kotlin]] =+lsp= - TODO -+ [[file:../modules/lang/latex/README.org][latex]] =+latexmk +cdlatex +fold +lsp= - TODO -+ lean - TODO -+ [[file:../modules/lang/ledger/README.org][ledger]] - TODO -+ [[file:../modules/lang/lua/README.org][lua]] =+fennel +moonscript= - TODO -+ [[file:../modules/lang/markdown/README.org][markdown]] =+grip= - TODO -+ [[file:../modules/lang/nim/README.org][nim]] - TODO -+ [[file:../modules/lang/nix/README.org][nix]] - TODO -+ [[file:../modules/lang/ocaml/README.org][ocaml]] =+lsp= - TODO -+ [[file:../modules/lang/org/README.org][org]] =+brain +dragndrop +gnuplot +hugo +ipython +journal +jupyter +noter +pandoc +pomodoro +present +pretty +roam= - TODO -+ [[file:../modules/lang/php/README.org][php]] =+hack +lsp= - TODO -+ plantuml - TODO -+ purescript =+lsp= - TODO -+ [[file:../modules/lang/python/README.org][python]] =+cython +lsp +pyright +pyenv +conda +poetry= - TODO -+ qt - TODO -+ [[file:../modules/lang/racket/README.org][racket]] =+lsp +xp= - TODO -+ [[file:../modules/lang/raku/README.org][raku]] - TODO -+ [[file:../modules/lang/rest/README.org][rest]] - TODO -+ rst - TODO -+ [[file:../modules/lang/ruby/README.org][ruby]] =+lsp +rvm +rbenv +rails +chruby= -+ [[file:../modules/lang/rust/README.org][rust]] =+lsp= - TODO -+ [[file:../modules/lang/scala/README.org][scala]] =+lsp= - TODO -+ [[file:../modules/lang/scheme/README.org][scheme]] =+chez +chibi +chicken +gambit +gauche +guile +kawa +mit +racket= - TODO -+ [[file:../modules/lang/sh/README.org][sh]] =+fish +lsp +powershell= - TODO -+ [[file:../modules/lang/sml/README.org][sml]] - TODO -+ [[file:../modules/lang/solidity/README.org][solidity]] - TODO -+ swift =+lsp= - TODO -+ terra - TODO -+ web =+lsp= - HTML and CSS (SCSS/SASS/LESS/Stylus) support. -+ [[file:../modules/lang/yaml/README.org][yaml]] =+lsp= - TODO -+ [[file:../modules/lang/zig/README.org][zig]] =+lsp= - Zig support. - - -* :os -Modules to improve integration into your OS, system, or devices. - -+ [[file:../modules/os/macos/README.org][macos]] - Improve Emacs' compatibility with macOS -+ [[file:../modules/os/tty/README.org][tty]] =+osc= - Improves the terminal Emacs experience. - -* :term -Modules that offer terminal emulation. - -+ [[file:../modules/term/eshell/README.org][eshell]] - TODO -+ shell - TODO -+ term - TODO -+ [[file:../modules/term/vterm/README.org][vterm]] - TODO - -* :tools -Small modules that give Emacs access to external tools & services. - -+ ansible - TODO -+ debugger =+lsp= - A (nigh-)universal debugger in Emacs -+ [[file:../modules/tools/direnv/README.org][direnv]] - TODO -+ [[file:../modules/tools/docker/README.org][docker]] =+lsp= - TODO -+ [[file:../modules/tools/editorconfig/README.org][editorconfig]] - TODO -+ [[file:../modules/tools/ein/README.org][ein]] - TODO -+ [[file:../modules/tools/eval/README.org][eval]] =+overlay= - REPL & code evaluation support for a variety of languages -+ gist - TODO -+ [[file:../modules/tools/lookup/README.org][lookup]] =+dictionary +docsets +offline= - Universal jump-to & documentation lookup - backend -+ [[file:../modules/tools/lsp/README.org][lsp]] =+peek +eglot= - Installation and configuration of language server protocol client (lsp-mode or eglot) -+ [[file:../modules/tools/magit/README.org][magit]] =+forge= - TODO -+ make - TODO -+ [[file:../modules/tools/pass/README.org][pass]] =+auth= - TODO -+ [[file:../modules/tools/pdf/README.org][pdf]] - TODO -+ prodigy - TODO -+ [[file:../modules/tools/rgb/README.org][rgb]] - TODO -+ [[file:../modules/tools/taskrunner/README.org][taskrunner]] - TODO -+ [[file:../modules/tools/terraform/README.org][terraform]] - TODO -+ tmux - TODO -+ [[file:../modules/tools/upload/README.org][upload]] - TODO - -* :ui -Aesthetic modules that affect the Emacs interface or user experience. - -+ [[file:../modules/ui/deft/README.org][deft]] - TODO -+ [[file:../modules/ui/doom/README.org][doom]] - TODO -+ [[file:../modules/ui/doom-dashboard/README.org][doom-dashboard]] - TODO -+ [[file:../modules/ui/doom-quit/README.org][doom-quit]] - TODO -+ [[file:../modules/ui/emoji/README.org][emoji]] =+ascii +github +unicode= - Adds emoji support to Emacs -+ [[file:../modules/ui/hl-todo/README.org][hl-todo]] - TODO -+ [[file:../modules/ui/hydra/README.org][hydra]] - TODO -+ indent-guides - TODO -+ [[file:../modules/ui/ligatures/README.org][ligatures]] =+extra +fira +hasklig +iosevka +pragmata-pro= - Ligature support for Emacs -+ [[file:../modules/ui/minimap/README.org][minimap]] - TODO -+ [[file:../modules/ui/modeline/README.org][modeline]] =+light= - TODO -+ [[file:../modules/ui/nav-flash/README.org][nav-flash]] - TODO -+ [[file:../modules/ui/neotree/README.org][neotree]] - TODO -+ [[file:../modules/ui/ophints/README.org][ophints]] - TODO -+ [[file:../modules/ui/popup/README.org][popup]] =+all +defaults= - Makes temporary/disposable windows less intrusive -+ [[file:../modules/ui/tabs/README.org][tabs]] - TODO -+ [[file:../modules/ui/treemacs/README.org][treemacs]] - =+lsp= - A tree layout file explorer for Emacs -+ [[file:../modules/ui/unicode/README.org][unicode]] - TODO -+ vc-gutter - TODO -+ vi-tilde-fringe - TODO -+ [[file:../modules/ui/window-select/README.org][window-select]] =+switch-window +numbers= - TODO -+ [[file:../modules/ui/workspaces/README.org][workspaces]] - Isolated workspaces -+ [[file:../modules/ui/zen/README.org][zen]] - Distraction-free coding (or writing) diff --git a/.config/emacs/early-init.el b/.config/emacs/early-init.el deleted file mode 100644 index 2ee09f9..0000000 --- a/.config/emacs/early-init.el +++ /dev/null @@ -1,81 +0,0 @@ -;;; early-init.el -*- lexical-binding: t; -*- - -;; Emacs 27.1 introduced early-init.el, which is run before init.el, before -;; package and UI initialization happens, and before site files are loaded. - -;; A big contributor to startup times is garbage collection. We up the gc -;; threshold to temporarily prevent it from running, then reset it later by -;; enabling `gcmh-mode'. Not resetting it will cause stuttering/freezes. -(setq gc-cons-threshold most-positive-fixnum) - -;; Prevent unwanted runtime compilation for gccemacs (native-comp) users; -;; packages are compiled ahead-of-time when they are installed and site files -;; are compiled when gccemacs is installed. -(setq native-comp-deferred-compilation nil) - -;; In Emacs 27+, package initialization occurs before `user-init-file' is -;; loaded, but after `early-init-file'. Doom handles package initialization, so -;; we must prevent Emacs from doing it early! -(setq package-enable-at-startup nil) - -;; In noninteractive sessions, prioritize non-byte-compiled source files to -;; prevent the use of stale byte-code. Otherwise, it saves us a little IO time -;; to skip the mtime checks on every *.elc file. -(setq load-prefer-newer noninteractive) - -(unless (or (daemonp) noninteractive) - (let ((old-file-name-handler-alist file-name-handler-alist)) - ;; `file-name-handler-alist' is consulted on each `require', `load' and - ;; various path/io functions. You get a minor speed up by unsetting this. - ;; Some warning, however: this could cause problems on builds of Emacs where - ;; its site lisp files aren't byte-compiled and we're forced to load the - ;; *.el.gz files (e.g. on Alpine). - (setq-default file-name-handler-alist nil) - ;; ...but restore `file-name-handler-alist' later, because it is needed for - ;; handling encrypted or compressed files, among other things. - (defun doom-reset-file-handler-alist-h () - (setq file-name-handler-alist - ;; Merge instead of overwrite because there may have bene changes to - ;; `file-name-handler-alist' since startup we want to preserve. - (delete-dups (append file-name-handler-alist - old-file-name-handler-alist)))) - (add-hook 'emacs-startup-hook #'doom-reset-file-handler-alist-h 101)) - - ;; Premature redisplays can substantially affect startup times and produce - ;; ugly flashes of unstyled Emacs. - (setq-default inhibit-redisplay t - inhibit-message t) - (add-hook 'window-setup-hook - (lambda () - (setq-default inhibit-redisplay nil - inhibit-message nil) - (redisplay))) - - ;; Site files tend to use `load-file', which emits "Loading X..." messages in - ;; the echo area, which in turn triggers a redisplay. Redisplays can have a - ;; substantial effect on startup times and in this case happens so early that - ;; Emacs may flash white while starting up. - (define-advice load-file (:override (file) silence) - (load file nil 'nomessage)) - - ;; Undo our `load-file' advice above, to limit the scope of any edge cases it - ;; may introduce down the road. - (define-advice startup--load-user-init-file (:before (&rest _) init-doom) - (advice-remove #'load-file #'load-file@silence))) - - -;; -;;; Bootstrap - -;; Contrary to what many Emacs users have in their configs, you don't need -;; more than this to make UTF-8 the default coding system: -(set-language-environment "UTF-8") - -;; set-language-enviornment sets default-input-method, which is unwanted -(setq default-input-method nil) - -;; Ensure Doom is running out of this file's directory -(setq user-emacs-directory (file-name-directory load-file-name)) - -;; Load the heart of Doom Emacs -(load (concat user-emacs-directory "core/core") nil 'nomessage) diff --git a/.config/emacs/init.el b/.config/emacs/init.el deleted file mode 100644 index 556c7a0..0000000 --- a/.config/emacs/init.el +++ /dev/null @@ -1,57 +0,0 @@ -;;; init.el -*- lexical-binding: t; -*- -;; -;; Author: Henrik Lissner -;; URL: https://github.com/hlissner/doom-emacs -;; -;; ================= =============== =============== ======== ======== -;; \\ . . . . . . .\\ //. . . . . . .\\ //. . . . . . .\\ \\. . .\\// . . // -;; ||. . ._____. . .|| ||. . ._____. . .|| ||. . ._____. . .|| || . . .\/ . . .|| -;; || . .|| ||. . || || . .|| ||. . || || . .|| ||. . || ||. . . . . . . || -;; ||. . || || . .|| ||. . || || . .|| ||. . || || . .|| || . | . . . . .|| -;; || . .|| ||. _-|| ||-_ .|| ||. . || || . .|| ||. _-|| ||-_.|\ . . . . || -;; ||. . || ||-' || || `-|| || . .|| ||. . || ||-' || || `|\_ . .|. .|| -;; || . _|| || || || || ||_ . || || . _|| || || || |\ `-_/| . || -;; ||_-' || .|/ || || \|. || `-_|| ||_-' || .|/ || || | \ / |-_.|| -;; || ||_-' || || `-_|| || || ||_-' || || | \ / | `|| -;; || `' || || `' || || `' || || | \ / | || -;; || .===' `===. .==='.`===. .===' /==. | \/ | || -;; || .==' \_|-_ `===. .===' _|_ `===. .===' _-|/ `== \/ | || -;; || .==' _-' `-_ `=' _-' `-_ `=' _-' `-_ /| \/ | || -;; || .==' _-' '-__\._-' '-_./__-' `' |. /| | || -;; ||.==' _-' `' | /==.|| -;; ==' _-' \/ `== -;; \ _-' `-_ / -;; `'' ``' -;; -;; These demons are not part of GNU Emacs. -;; -;;; License: MIT - -;; In the strange case that early-init.el wasn't loaded (e.g. you're using -;; Chemacs 1? Or you're loading this file directly?), we do it explicitly: -(unless (boundp 'doom-version) - (load (concat (file-name-directory load-file-name) "early-init") - nil t)) - -;; Ensure Doom's core libraries are properly initialized, autoloads file is -;; loaded, and hooks set up for an interactive session. -(doom-initialize) - -;; Now we load all enabled modules in the order dictated by your `doom!' block -;; in $DOOMDIR/init.el. `doom-initialize-modules' loads them (and hooks) in the -;; given order: -;; -;; $DOOMDIR/init.el -;; {$DOOMDIR,~/.emacs.d}/modules/*/*/init.el -;; `doom-before-init-modules-hook' -;; {$DOOMDIR,~/.emacs.d}/modules/*/*/config.el -;; `doom-init-modules-hook' -;; $DOOMDIR/config.el -;; `doom-after-init-modules-hook' -;; `after-init-hook' -;; `emacs-startup-hook' -;; `doom-init-ui-hook' -;; `window-setup-hook' -;; -;; And then we're good to go! -(doom-initialize-modules) diff --git a/.config/emacs/init.example.el b/.config/emacs/init.example.el deleted file mode 100644 index 7e0ae31..0000000 --- a/.config/emacs/init.example.el +++ /dev/null @@ -1,191 +0,0 @@ -;;; init.el -*- lexical-binding: t; -*- - -;; This file controls what Doom modules are enabled and what order they load -;; in. Remember to run 'doom sync' after modifying it! - -;; NOTE Press 'SPC h d h' (or 'C-h d h' for non-vim users) to access Doom's -;; documentation. There you'll find a "Module Index" link where you'll find -;; a comprehensive list of Doom's modules and what flags they support. - -;; NOTE Move your cursor over a module's name (or its flags) and press 'K' (or -;; 'C-c c k' for non-vim users) to view its documentation. This works on -;; flags as well (those symbols that start with a plus). -;; -;; Alternatively, press 'gd' (or 'C-c c d') on a module to browse its -;; directory (for easy access to its source code). - -(doom! :input - ;;chinese - ;;japanese - ;;layout ; auie,ctsrnm is the superior home row - - :completion - company ; the ultimate code completion backend - ;;helm ; the *other* search engine for love and life - ;;ido ; the other *other* search engine... - ;;ivy ; a search engine for love and life - vertico ; the search engine of the future - - :ui - ;;deft ; notational velocity for Emacs - doom ; what makes DOOM look the way it does - doom-dashboard ; a nifty splash screen for Emacs - doom-quit ; DOOM quit-message prompts when you quit Emacs - ;;(emoji +unicode) ; 🙂 - hl-todo ; highlight TODO/FIXME/NOTE/DEPRECATED/HACK/REVIEW - ;;hydra - ;;indent-guides ; highlighted indent columns - ;;ligatures ; ligatures and symbols to make your code pretty again - ;;minimap ; show a map of the code on the side - modeline ; snazzy, Atom-inspired modeline, plus API - ;;nav-flash ; blink cursor line after big motions - ;;neotree ; a project drawer, like NERDTree for vim - ophints ; highlight the region an operation acts on - (popup +defaults) ; tame sudden yet inevitable temporary windows - ;;tabs ; a tab bar for Emacs - ;;treemacs ; a project drawer, like neotree but cooler - ;;unicode ; extended unicode support for various languages - vc-gutter ; vcs diff in the fringe - vi-tilde-fringe ; fringe tildes to mark beyond EOB - ;;window-select ; visually switch windows - workspaces ; tab emulation, persistence & separate workspaces - ;;zen ; distraction-free coding or writing - - :editor - (evil +everywhere); come to the dark side, we have cookies - file-templates ; auto-snippets for empty files - fold ; (nigh) universal code folding - ;;(format +onsave) ; automated prettiness - ;;god ; run Emacs commands without modifier keys - ;;lispy ; vim for lisp, for people who don't like vim - ;;multiple-cursors ; editing in many places at once - ;;objed ; text object editing for the innocent - ;;parinfer ; turn lisp into python, sort of - ;;rotate-text ; cycle region at point between text candidates - snippets ; my elves. They type so I don't have to - ;;word-wrap ; soft wrapping with language-aware indent - - :emacs - dired ; making dired pretty [functional] - electric ; smarter, keyword-based electric-indent - ;;ibuffer ; interactive buffer management - undo ; persistent, smarter undo for your inevitable mistakes - vc ; version-control and Emacs, sitting in a tree - - :term - ;;eshell ; the elisp shell that works everywhere - ;;shell ; simple shell REPL for Emacs - ;;term ; basic terminal emulator for Emacs - ;;vterm ; the best terminal emulation in Emacs - - :checkers - syntax ; tasing you for every semicolon you forget - ;;(spell +flyspell) ; tasing you for misspelling mispelling - ;;grammar ; tasing grammar mistake every you make - - :tools - ;;ansible - ;;biblio ; Writes a PhD for you (citation needed) - ;;debugger ; FIXME stepping through code, to help you add bugs - ;;direnv - ;;docker - ;;editorconfig ; let someone else argue about tabs vs spaces - ;;ein ; tame Jupyter notebooks with emacs - (eval +overlay) ; run code, run (also, repls) - ;;gist ; interacting with github gists - lookup ; navigate your code and its documentation - ;;lsp ; M-x vscode - magit ; a git porcelain for Emacs - ;;make ; run make tasks from Emacs - ;;pass ; password manager for nerds - ;;pdf ; pdf enhancements - ;;prodigy ; FIXME managing external services & code builders - ;;rgb ; creating color strings - ;;taskrunner ; taskrunner for all your projects - ;;terraform ; infrastructure as code - ;;tmux ; an API for interacting with tmux - ;;upload ; map local to remote projects via ssh/ftp - - :os - (:if IS-MAC macos) ; improve compatibility with macOS - ;;tty ; improve the terminal Emacs experience - - :lang - ;;agda ; types of types of types of types... - ;;beancount ; mind the GAAP - ;;cc ; C > C++ == 1 - ;;clojure ; java with a lisp - ;;common-lisp ; if you've seen one lisp, you've seen them all - ;;coq ; proofs-as-programs - ;;crystal ; ruby at the speed of c - ;;csharp ; unity, .NET, and mono shenanigans - ;;data ; config/data formats - ;;(dart +flutter) ; paint ui and not much else - ;;dhall - ;;elixir ; erlang done right - ;;elm ; care for a cup of TEA? - emacs-lisp ; drown in parentheses - ;;erlang ; an elegant language for a more civilized age - ;;ess ; emacs speaks statistics - ;;factor - ;;faust ; dsp, but you get to keep your soul - ;;fortran ; in FORTRAN, GOD is REAL (unless declared INTEGER) - ;;fsharp ; ML stands for Microsoft's Language - ;;fstar ; (dependent) types and (monadic) effects and Z3 - ;;gdscript ; the language you waited for - ;;(go +lsp) ; the hipster dialect - ;;(haskell +lsp) ; a language that's lazier than I am - ;;hy ; readability of scheme w/ speed of python - ;;idris ; a language you can depend on - ;;json ; At least it ain't XML - ;;(java +meghanada) ; the poster child for carpal tunnel syndrome - ;;javascript ; all(hope(abandon(ye(who(enter(here)))))) - ;;julia ; a better, faster MATLAB - ;;kotlin ; a better, slicker Java(Script) - ;;latex ; writing papers in Emacs has never been so fun - ;;lean ; for folks with too much to prove - ;;ledger ; be audit you can be - ;;lua ; one-based indices? one-based indices - markdown ; writing docs for people to ignore - ;;nim ; python + lisp at the speed of c - ;;nix ; I hereby declare "nix geht mehr!" - ;;ocaml ; an objective camel - org ; organize your plain life in plain text - ;;php ; perl's insecure younger brother - ;;plantuml ; diagrams for confusing people more - ;;purescript ; javascript, but functional - ;;python ; beautiful is better than ugly - ;;qt ; the 'cutest' gui framework ever - ;;racket ; a DSL for DSLs - ;;raku ; the artist formerly known as perl6 - ;;rest ; Emacs as a REST client - ;;rst ; ReST in peace - ;;(ruby +rails) ; 1.step {|i| p "Ruby is #{i.even? ? 'love' : 'life'}"} - ;;rust ; Fe2O3.unwrap().unwrap().unwrap().unwrap() - ;;scala ; java, but good - ;;(scheme +guile) ; a fully conniving family of lisps - sh ; she sells {ba,z,fi}sh shells on the C xor - ;;sml - ;;solidity ; do you need a blockchain? No. - ;;swift ; who asked for emoji variables? - ;;terra ; Earth and Moon in alignment for performance. - ;;web ; the tubes - ;;yaml ; JSON, but readable - ;;zig ; C, but simpler - - :email - ;;(mu4e +org +gmail) - ;;notmuch - ;;(wanderlust +gmail) - - :app - ;;calendar - ;;emms - ;;everywhere ; *leave* Emacs!? You must be joking - ;;irc ; how neckbeards socialize - ;;(rss +org) ; emacs as an RSS reader - ;;twitter ; twitter client https://twitter.com/vnought - - :config - ;;literate - (default +bindings +smartparens)) diff --git a/.config/emacs/modules/.gitignore b/.config/emacs/modules/.gitignore deleted file mode 100644 index fc2f6ae..0000000 --- a/.config/emacs/modules/.gitignore +++ /dev/null @@ -1,19 +0,0 @@ -.DS_Store -.idea -*.log -tmp/ -*~ -*.*~ -\#* -.\#* -*.cache* -*.log -test/.local*/ -test/result - -# compiled files -*.elc -*.lib -*.fas -*.dat -*.eld diff --git a/.config/emacs/modules/LICENSE b/.config/emacs/modules/LICENSE deleted file mode 100644 index e51b9a5..0000000 --- a/.config/emacs/modules/LICENSE +++ /dev/null @@ -1,22 +0,0 @@ -The MIT License (MIT) - -Copyright (c) 2021 Henrik Lissner - -Permission is hereby granted, free of charge, to any person obtaining -a copy of this software and associated documentation files (the -"Software"), to deal in the Software without restriction, including -without limitation the rights to use, copy, modify, merge, publish, -distribute, sublicense, and/or sell copies of the Software, and to -permit persons to whom the Software is furnished to do so, subject to -the following conditions: - -The above copyright notice and this permission notice shall be -included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY -CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, -TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/.config/emacs/modules/app/calendar/README.org b/.config/emacs/modules/app/calendar/README.org deleted file mode 100644 index 19dc032..0000000 --- a/.config/emacs/modules/app/calendar/README.org +++ /dev/null @@ -1,50 +0,0 @@ -#+TITLE: app/calendar -#+DATE: January 13, 2018 -#+SINCE: v2.1 -#+STARTUP: inlineimages - -* Table of Contents :TOC: -- [[#description][Description]] - - [[#module-flags][Module Flags]] - - [[#packages][Packages]] -- [[#configuration][Configuration]] - - [[#changing-calendar-sources][Changing calendar sources]] - - [[#synchronizing-org-and-google-calendar][Synchronizing Org and Google Calendar]] - -* Description -This module adds a calendar view for Emacs, with org and google calendar sync -support. - -** Module Flags -This module provides no flags. - -** Packages -+ [[https://github.com/kiwanami/emacs-calfw][calfw]] -+ [[https://github.com/kiwanami/emacs-calfw][calfw-org]] -+ [[https://github.com/kidd/org-gcal.el][org-gcal]] - -* Configuration -** Changing calendar sources -By defining your own calendar commands, you can control what sources to pull -calendar data from: - -#+BEGIN_SRC emacs-lisp -(defun my-open-calendar () - (interactive) - (cfw:open-calendar-buffer - :contents-sources - (list - (cfw:org-create-source "Green") ; org-agenda source - (cfw:org-create-file-source "cal" "/path/to/cal.org" "Cyan") ; other org source - (cfw:howm-create-source "Blue") ; howm source - (cfw:cal-create-source "Orange") ; diary source - (cfw:ical-create-source "Moon" "~/moon.ics" "Gray") ; ICS source1 - (cfw:ical-create-source "gcal" "https://..../basic.ics" "IndianRed") ; google calendar ICS - ))) -#+END_SRC - -The [[https://github.com/kiwanami/emacs-calfw][kiwanami/emacs-calfw]] project readme contains more examples. - -** Synchronizing Org and Google Calendar -The [[https://github.com/kidd/org-gcal.el][kidd/org-gcal.el]] project README contains more detailed instructions on how -to link your calendar with Google calendars. diff --git a/.config/emacs/modules/app/calendar/autoload.el b/.config/emacs/modules/app/calendar/autoload.el deleted file mode 100644 index bb44693..0000000 --- a/.config/emacs/modules/app/calendar/autoload.el +++ /dev/null @@ -1,63 +0,0 @@ -;;; app/calendar/autoload.el -*- lexical-binding: t; -*- - -(defvar +calendar--wconf nil) - -(defun +calendar--init () - (if-let (win (cl-find-if (lambda (b) (string-match-p "^\\*cfw:" (buffer-name b))) - (doom-visible-windows) - :key #'window-buffer)) - (select-window win) - (call-interactively +calendar-open-function))) - -;;;###autoload -(defun =calendar () - "Activate (or switch to) `calendar' in its workspace." - (interactive) - (if (featurep! :ui workspaces) - (progn - (+workspace-switch "Calendar" t) - (doom/switch-to-scratch-buffer) - (+calendar--init) - (+workspace/display)) - (setq +calendar--wconf (current-window-configuration)) - (delete-other-windows) - (switch-to-buffer (doom-fallback-buffer)) - (+calendar--init))) - -;;;###autoload -(defun +calendar/quit () - "TODO" - (interactive) - (if (featurep! :ui workspaces) - (when (+workspace-exists-p "Calendar") - (+workspace/delete "Calendar")) - (when (window-configuration-p +calendar--wconf) - (set-window-configuration +calendar--wconf)) - (setq +calendar--wconf nil)) - (doom-kill-matching-buffers "^\\*cfw[:-]")) - -;;;###autoload -(defun +calendar/open-calendar () - "TODO" - (interactive) - (cfw:open-calendar-buffer - ;; :custom-map cfw:my-cal-map - :contents-sources - (list - (cfw:org-create-source (face-foreground 'default)) ; orgmode source - ))) - -;;;###autoload -(defun +calendar-cfw:render-button-a (title command &optional state) - "render-button - TITLE - COMMAND - STATE" - (let ((text (concat " " title " ")) - (keymap (make-sparse-keymap))) - (cfw:rt text (if state 'cfw:face-toolbar-button-on - 'cfw:face-toolbar-button-off)) - (define-key keymap [mouse-1] command) - (cfw:tp text 'keymap keymap) - (cfw:tp text 'mouse-face 'highlight) - text)) diff --git a/.config/emacs/modules/app/calendar/config.el b/.config/emacs/modules/app/calendar/config.el deleted file mode 100644 index 65907cf..0000000 --- a/.config/emacs/modules/app/calendar/config.el +++ /dev/null @@ -1,94 +0,0 @@ -;;; app/calendar/config.el -*- lexical-binding: t; -*- - -(defvar +calendar-open-function #'+calendar/open-calendar - "TODO") - - -;; -;; Packages - -(use-package! calfw - :commands cfw:open-calendar-buffer - :config - ;; better frame for calendar - (setq cfw:face-item-separator-color nil - cfw:render-line-breaker 'cfw:render-line-breaker-none - cfw:fchar-junction ?╋ - cfw:fchar-vertical-line ?┃ - cfw:fchar-horizontal-line ?━ - cfw:fchar-left-junction ?┣ - cfw:fchar-right-junction ?┫ - cfw:fchar-top-junction ?┯ - cfw:fchar-top-left-corner ?┏ - cfw:fchar-top-right-corner ?┓) - - (set-popup-rule! "^\\*cfw:details" :quit t :ttl 0 :select t :size 0.4) - - (define-key cfw:calendar-mode-map "q" #'+calendar/quit) - (when (featurep! :editor evil +everywhere) - (set-evil-initial-state! '(cfw:calendar-mode cfw:details-mode) 'motion) - (add-hook! (cfw:calendar-mode cfw:details-mode) #'evil-normalize-keymaps) - (map! (:map cfw:calendar-mode-map - :m "q" #'+calendar/quit - :m "SPC" #'cfw:show-details-command - :m "RET" #'cfw:show-details-command - :m "TAB" #'cfw:navi-prev-item-command - :m [tab] #'cfw:navi-prev-item-command - :m [backtab] #'cfw:navi-next-item-command - :m "$" #'cfw:navi-goto-week-end-command - :m "." #'cfw:navi-goto-today-command - :m "<" #'cfw:navi-previous-month-command - :m ">" #'cfw:navi-next-month-command - :m "C-h" #'cfw:navi-previous-month-command - :m "C-l" #'cfw:navi-next-month-command - :m "D" #'cfw:change-view-day - :m "M" #'cfw:change-view-month - :m "T" #'cfw:change-view-two-weeks - :m "W" #'cfw:change-view-week - :m "^" #'cfw:navi-goto-week-begin-command - :m "gr" #'cfw:refresh-calendar-buffer - :m "h" #'cfw:navi-previous-day-command - :m "H" #'cfw:navi-goto-first-date-command - :m "j" #'cfw:navi-next-week-command - :m "k" #'cfw:navi-previous-week-command - :m "l" #'cfw:navi-next-day-command - :m "L" #'cfw:navi-goto-last-date-command - :m "t" #'cfw:navi-goto-today-command) - (:map cfw:details-mode-map - :m "SPC" #'cfw:details-kill-buffer-command - :m "RET" #'cfw:details-kill-buffer-command - :m "TAB" #'cfw:details-navi-prev-item-command - :m [tab] #'cfw:details-navi-prev-item-command - :m [backtab] #'cfw:details-navi-next-item-command - :m "q" #'cfw:details-kill-buffer-command - :m "C-h" #'cfw:details-navi-prev-command - :m "C-l" #'cfw:details-navi-next-command - :m "C-k" #'cfw:details-navi-prev-item-command - :m "C-j" #'cfw:details-navi-next-item-command))) - - (add-hook 'cfw:calendar-mode-hook #'doom-mark-buffer-as-real-h) - (add-hook 'cfw:calendar-mode-hook #'hide-mode-line-mode) - - (advice-add #'cfw:render-button :override #'+calendar-cfw:render-button-a)) - - -(use-package! calfw-org - :commands (cfw:open-org-calendar - cfw:org-create-source - cfw:org-create-file-source - cfw:open-org-calendar-withkevin)) - - -(use-package! calfw-cal - :commands (cfw:cal-create-source)) - - -(use-package! calfw-ical - :commands (cfw:ical-create-source)) - - -(use-package! org-gcal - :defer t - :init - (defvar org-gcal-dir (concat doom-cache-dir "org-gcal/")) - (defvar org-gcal-token-file (concat org-gcal-dir "token.gpg"))) diff --git a/.config/emacs/modules/app/calendar/packages.el b/.config/emacs/modules/app/calendar/packages.el deleted file mode 100644 index 8bba857..0000000 --- a/.config/emacs/modules/app/calendar/packages.el +++ /dev/null @@ -1,8 +0,0 @@ -;; -*- no-byte-compile: t; -*- -;;; app/calendar/packages.el - -(package! calfw :pin "03abce97620a4a7f7ec5f911e669da9031ab9088") -(package! calfw-org :pin "03abce97620a4a7f7ec5f911e669da9031ab9088") -(package! calfw-cal :pin "03abce97620a4a7f7ec5f911e669da9031ab9088") -(package! calfw-ical :pin "03abce97620a4a7f7ec5f911e669da9031ab9088") -(package! org-gcal :pin "8b6df4b727339e3933c68045e104b6b1d99816f7") diff --git a/.config/emacs/modules/app/emms/README.org b/.config/emacs/modules/app/emms/README.org deleted file mode 100644 index 6741690..0000000 --- a/.config/emacs/modules/app/emms/README.org +++ /dev/null @@ -1,71 +0,0 @@ -#+TITLE: app/emms -#+DATE: March 6, 2021 -#+SINCE: v3.0.0 -#+STARTUP: inlineimages nofold - -* Table of Contents :TOC_3:noexport: -- [[#description][Description]] - - [[#maintainers][Maintainers]] - - [[#module-flags][Module Flags]] - - [[#plugins][Plugins]] -- [[#prerequisites][Prerequisites]] - - [[#arch-linux][Arch Linux]] - - [[#nixos][NixOS]] - - [[#ubuntu][Ubuntu]] -- [[#troubleshooting][Troubleshooting]] - - [[#new-music-files-not-showing-up-in-database][New music files not showing up in database]] -- [[#appendix][Appendix]] - - [[#keybinds][Keybinds]] - -* Description -This module enables Emacs to be used as a music player. It uses [[https://www.musicpd.org/][mpd]] as a backend -server and [[https://musicpd.org/clients/mpc/][mpc]] to update your music database. - -** Maintainers -This module has no dedicated maintainers. - -** Module Flags -This module provides no flags. - -** Plugins -+ [[https://git.savannah.gnu.org/git/emms.git/][emms]] - -* Prerequisites -This module requires an active MPD server, the MPC utility, and a music library. - -** Arch Linux -#+BEGIN_SRC bash -pacman -S mpd mpc -#+END_SRC - -** NixOS -#+BEGIN_SRC nix -services.mpd.enable = true; -environment.systemPackages = [ pkgs.mpc_cli ]; -#+END_SRC - -** Ubuntu -#+BEGIN_SRC bash -apt install mpd mpc -#+END_SRC - -* Troubleshooting -** New music files not showing up in database -Try =M-x +emms/mpd-restart-music-daemon=. If that doesn't work restart emacs. - -* Appendix -** Keybinds -+ =SPC m l= Toggles whether or not the player repeats the playlist. -+ =SPC m m= Mixes the playlist. -+ =SPC m i= Insert specific song -+ =SPC m s= Save the current playlist to a file -+ =SPC m p= Insert playlist save into current playlist -+ =g a= Sort the browser by artists -+ =g b= Sort the browser by genre -+ =X= Stops the player -+ =x= pauses the player -+ =D= in the playlist window removes that item -+ =C= clears the playlist -+ =>= move five seconds forward in the current track -+ =<= Opposite five back -+ =RET= In browser adds the artist's songs to the playlist, in the playlist starts playlist. diff --git a/.config/emacs/modules/app/emms/autoload.el b/.config/emacs/modules/app/emms/autoload.el deleted file mode 100644 index f08aa78..0000000 --- a/.config/emacs/modules/app/emms/autoload.el +++ /dev/null @@ -1,30 +0,0 @@ -;;; app/emms/autoload.el -*- lexical-binding: t; -*- - -;;;###autoload -(defun +emms/mpd-start-music-daemon () - (interactive) - (start-process "mpd" nil "mpd") - (+emms/mpc-update-database) - (emms-player-mpd-connect) - (emms-cache-set-from-mpd-all) - (message "MPD Started!")) - -;;;###autoload -(defun +emms/mpd-kill-music-daemon () - (interactive) - (emms-stop) - (call-process "mpd" nil nil nil "--kill") - (message "MPD Killed!")) - -;;;###autoload -(defun +emms/mpc-update-database () - (interactive) - (call-process "mpc" nil nil nil "update") - (message "MPD Database Updated!")) - -;;;###autoload -(defun +emms/mpd-restart-music-daemon () - (interactive) - (+emms/mpd-kill-music-daemon) - (+emms/mpd-start-music-daemon) - (message "MPD Restarted!")) diff --git a/.config/emacs/modules/app/emms/config.el b/.config/emacs/modules/app/emms/config.el deleted file mode 100644 index d78be20..0000000 --- a/.config/emacs/modules/app/emms/config.el +++ /dev/null @@ -1,18 +0,0 @@ -;;; app/emms/config.el -*- lexical-binding: t; -*- - -(use-package! emms - :defer t - :init - (setq emms-directory (concat doom-etc-dir "emms") - emms-cache-file (concat doom-cache-dir "emms")) - :config - (emms-all) - (emms-default-players) - (map! :map emms-playlist-mode-map - :localleader - "l" #'emms-toggle-repeat-playlist - "p" #'emms-insert-playlist - "i" #'emms-insert-file - "t" #'emms-toggle-repeat-track - "s" #'emms-playlist-save - "m" #'emms-shuffle)) diff --git a/.config/emacs/modules/app/emms/packages.el b/.config/emacs/modules/app/emms/packages.el deleted file mode 100644 index 977be8c..0000000 --- a/.config/emacs/modules/app/emms/packages.el +++ /dev/null @@ -1,4 +0,0 @@ -;; -*- no-byte-compile: t; -*- -;;; app/emms/packages.el - -(package! emms :pin "32ff8a70ca9726dd0e3b8ad68430bc6fd66bf387") diff --git a/.config/emacs/modules/app/everywhere/README.org b/.config/emacs/modules/app/everywhere/README.org deleted file mode 100644 index 2d75cf8..0000000 --- a/.config/emacs/modules/app/everywhere/README.org +++ /dev/null @@ -1,58 +0,0 @@ -#+title: app/everywhere -#+date: February 7, 2021 -#+since: v3.0 -#+startup: inlineimages nofold - -* Table of Contents :TOC_3:noexport: -- [[#description][Description]] - - [[#maintainers][Maintainers]] - - [[#module-flags][Module Flags]] - - [[#plugins][Plugins]] -- [[#prerequisites][Prerequisites]] -- [[#features][Features]] -- [[#configuration][Configuration]] - -* Description -This module adds system-wide popup Emacs windows for quick edits. - -** Maintainers -+ [[https://github.com/tecosaur][@tecosaur]] - -** Module Flags - -This module provides no flags. - -** Plugins -+ [[https://github.com/tecosaur/emacs-everywhere][emacs-everywhere]] - -* Prerequisites - -On Linux =xclip=, =xdotool=, =xprop=, and =xwininfo= are needed. - -On MacOS, Emacs must be allowed to "control your computer" under *Settings > Accessibility*. - -* Features - -To use this, invoke the =emacs-everywhere= executable. This can be done in two -ways: -+ ~emacsclient --eval "(emacs-everywhere)"~ -+ ~doom everywhere~ - -It is recommended that you add a keybinding for this. - -From here, you can edit away to your hearts content in the created frame, then -return to the original window and paste the content with =C-c C-c= or =SPC q f=. -To exit without pasting, use =C-c C-k=. - -* Configuration - -=emacs-everywhere= likes to guess if you triggered it from an application which -supports markdown. Configure ~emacs-everywhere-markdown-windows~ and -~emacs-everywhere-markdown-apps~ to improve how accurate this is on your system. - -By default, when markdown is detected, ~markdown-mode~ is used. It is possible to -instead use pandoc to convert the content to Org (and export to markdown when -closing the frame) by setting ~emacs-everywhere-major-mode-function~ to -=#'org-mode=. - -Most other behaviour is implemented as hooks on ~emacs-everywhere-init-hooks~. diff --git a/.config/emacs/modules/app/everywhere/cli.el b/.config/emacs/modules/app/everywhere/cli.el deleted file mode 100644 index 819fdf4..0000000 --- a/.config/emacs/modules/app/everywhere/cli.el +++ /dev/null @@ -1,5 +0,0 @@ -;;; app/everywhere/cli.el -*- lexical-binding: t; -*- - -(defcli! everywhere () - "Spawn an emacsclient window for quick edits." - (throw 'exit (list "emacsclient" "--eval" "(emacs-everywhere)"))) diff --git a/.config/emacs/modules/app/everywhere/config.el b/.config/emacs/modules/app/everywhere/config.el deleted file mode 100644 index 4e5e042..0000000 --- a/.config/emacs/modules/app/everywhere/config.el +++ /dev/null @@ -1,35 +0,0 @@ -;;; app/everywhere/config.el -*- lexical-binding: t; -*- - -(use-package! emacs-everywhere - ;; Entry points into this package are autoloaded; i.e. the `emacs-everywhere' - ;; function, meant to be called directly via emacsclient. See this module's - ;; readme for details. - :defer t - :config - (set-yas-minor-mode! 'emacs-everywhere-mode) - - (after! doom-modeline - (doom-modeline-def-segment emacs-everywhere - (concat - (doom-modeline-spc) - (when (emacs-everywhere-markdown-p) - (concat - (all-the-icons-octicon "markdown" :face 'all-the-icons-green :v-adjust 0.02) - (doom-modeline-spc))) - (propertize (emacs-everywhere-app-class emacs-everywhere-current-app) - 'face 'doom-modeline-project-dir) - (doom-modeline-spc) - (propertize (truncate-string-to-width - (emacs-everywhere-app-title emacs-everywhere-current-app) - 45 nil nil "…") - 'face 'doom-modeline-buffer-minor-mode))) - (doom-modeline-def-modeline 'emacs-everywhere - '(bar modals emacs-everywhere buffer-position word-count parrot selection-info) - '(input-method major-mode checker)) - (add-hook! 'emacs-everywhere-mode-hook - (defun +everywhere-set-modeline () - (doom-modeline-set-modeline 'emacs-everywhere)))) - (add-hook! 'emacs-everywhere-init-hooks - (defun +everywhere-clear-persp-info-h () - (when (bound-and-true-p persp-mode) - (setq persp-emacsclient-init-frame-behaviour-override nil))))) diff --git a/.config/emacs/modules/app/everywhere/doctor.el b/.config/emacs/modules/app/everywhere/doctor.el deleted file mode 100644 index 8e72237..0000000 --- a/.config/emacs/modules/app/everywhere/doctor.el +++ /dev/null @@ -1,12 +0,0 @@ -;;; app/everywhere/doctor.el -*- lexical-binding: t; -*- - -(when IS-WINDOWS - (error! "emacs-everywhere package does not support windows.")) - -(when IS-LINUX - (let (unmet-deps) - (dolist (dep '("xclip" "xdotool" "xprop" "xwininfo")) - (unless (executable-find dep) - (push dep unmet-deps))) - (when unmet-deps - (error! "Unmet dependencies: %s" (string-join unmet-deps ", "))))) diff --git a/.config/emacs/modules/app/everywhere/packages.el b/.config/emacs/modules/app/everywhere/packages.el deleted file mode 100644 index d5326a9..0000000 --- a/.config/emacs/modules/app/everywhere/packages.el +++ /dev/null @@ -1,4 +0,0 @@ -;; -*- no-byte-compile: t; -*- -;;; app/everywhere/packages.el - -(package! emacs-everywhere :pin "ed03b9396da9ef16e498a2d33a51ec5596021b0e") diff --git a/.config/emacs/modules/app/irc/README.org b/.config/emacs/modules/app/irc/README.org deleted file mode 100644 index 41e2983..0000000 --- a/.config/emacs/modules/app/irc/README.org +++ /dev/null @@ -1,164 +0,0 @@ -#+TITLE: app/irc -#+DATE: June 11, 2017 -#+SINCE: v2.0.3 -#+STARTUP: inlineimages - -* Table of Contents :TOC: -- [[#description][Description]] - - [[#module-flags][Module Flags]] - - [[#plugins][Plugins]] -- [[#prerequisites][Prerequisites]] - - [[#macos][macOS]] - - [[#debian--ubuntu][Debian / Ubuntu]] - - [[#arch-linux][Arch Linux]] - - [[#nixos][NixOS]] -- [[#features][Features]] - - [[#an-irc-client-in-emacs][An IRC Client in Emacs]] -- [[#configuration][Configuration]] - - [[#pass-the-unix-password-manager][Pass: the unix password manager]] - - [[#emacs-auth-source-api][Emacs' auth-source API]] -- [[#troubleshooting][Troubleshooting]] - -* Description -This module turns Emacs into an IRC client, capable of OS notifications. - -** Module Flags -This module provides no flags. - -** Plugins -+ [[https://github.com/jorgenschaefer/circe][circe]] -+ [[https://github.com/eqyiel/circe-notifications][circe-notifications]] - -* Prerequisites -This module requires =gnutls= for secure IRC connections to work. - -** macOS -#+BEGIN_SRC sh -brew install gnutls -#+END_SRC - -** Debian / Ubuntu -#+BEGIN_SRC sh -apt install gnutls-bin -#+END_SRC - -** Arch Linux -#+BEGIN_SRC sh -pacman -S gnutls -#+END_SRC -** NixOS -#+BEGIN_SRC nix -environment.systemPackages = [ pkgs.gnutls ]; -#+END_SRC - -* Features -** An IRC Client in Emacs -To connect to IRC you can invoke the ~=irc~ function using =M-x= or your own -custom keybinding. - -| command | description | -|---------+-------------------------------------------| -| ~=irc~ | Connect to IRC and all configured servers | - -When in a circe buffer these keybindings will be available. - -| command | key | description | -|-----------------------------+-----------+----------------------------------------------| -| ~+irc/tracking-next-buffer~ | =SPC m a= | Switch to the next active buffer | -| ~circe-command-JOIN~ | =SPC m j= | Join a channel | -| ~+irc/send-message~ | =SPC m m= | Send a private message | -| ~circe-command-NAMES~ | =SPC m n= | List the names of the current channel | -| ~circe-command-PART~ | =SPC m p= | Part the current channel | -| ~+irc/quit~ | =SPC m Q= | Kill the current circe session and workgroup | -| ~circe-reconnect~ | =SPC m R= | Reconnect the current server | - -* Configuration -Use ~set-irc-server! SERVER PLIST~ to configure IRC servers. Its second argument (a plist) -takes the same arguments as ~circe-network-options~. - -#+BEGIN_SRC emacs-lisp :tangle no -;; if you omit =:host=, ~SERVER~ will be used instead. -(after! circe - (set-irc-server! "irc.libera.chat" - `(:tls t - :port 6697 - :nick "doom" - :sasl-username "myusername" - :sasl-password "mypassword" - :channels ("#emacs")))) -#+END_SRC - -However, *it is a obviously a bad idea to store your password in plaintext,* so -here are ways to avoid that: - -** Pass: the unix password manager -[[https://www.passwordstore.org/][Pass]] is my tool of choice. I use it to manage my passwords. If you activate the -[[../../../modules/tools/pass/README.org][:tools pass]] module you get an elisp API through which to access your -password store. - -~set-irc-server!~ accepts a plist can use functions instead of strings. -~+pass-get-user~ and ~+pass-get-secret~ can help here: - -#+BEGIN_SRC emacs-lisp :tangle no -(set-irc-server! "irc.libera.chat" - `(:tls t - :port 6697 - :nick "doom" - :sasl-username ,(+pass-get-user "irc/libera.chat") - :sasl-password ,(+pass-get-secret "irc/libera.chat") - :channels ("#emacs"))) -#+END_SRC - -But wait, there's more! This stores your password in a public variable which -could be accessed or appear in backtraces. Not good! So we go a step further: - -#+BEGIN_SRC emacs-lisp :tangle no -(set-irc-server! "irc.libera.chat" - `(:tls t - :port 6697 - :nick "doom" - :sasl-username ,(+pass-get-user "irc/libera.chat") - :sasl-password (lambda (&rest _) (+pass-get-secret "irc/libera.chat")) - :channels ("#emacs"))) -#+END_SRC - -And you're good to go! - -Note that =+pass-get-user= tries to find your username by looking for the fields -listed in =+pass-user-fields= (by default =login=, =user==, =username== and -=email=)=). An example configuration looks like - -#+begin_example -mysecretpassword -username: myusername -#+end_example - -** Emacs' auth-source API -~auth-source~ is built into Emacs. As suggested [[https://github.com/jorgenschaefer/circe/wiki/Configuration#safer-password-management][in the circe wiki]], you can store -(and retrieve) encrypted passwords with it. - -#+BEGIN_SRC emacs-lisp :tangle no -(setq auth-sources '("~/.authinfo.gpg")) - -(defun my-fetch-password (&rest params) - (require 'auth-source) - (let ((match (car (apply #'auth-source-search params)))) - (if match - (let ((secret (plist-get match :secret))) - (if (functionp secret) - (funcall secret) - secret)) - (error "Password not found for %S" params)))) - -(defun my-nickserv-password (server) - (my-fetch-password :user "forcer" :host "irc.libera.chat")) - -(set-irc-server! "irc.libera.chat" - '(:tls t - :port 6697 - :nick "doom" - :sasl-password my-nickserver-password - :channels ("#emacs"))) -#+END_SRC - -* TODO Troubleshooting diff --git a/.config/emacs/modules/app/irc/autoload/irc.el b/.config/emacs/modules/app/irc/autoload/irc.el deleted file mode 100644 index b44c470..0000000 --- a/.config/emacs/modules/app/irc/autoload/irc.el +++ /dev/null @@ -1,113 +0,0 @@ -;;; app/irc/autoload/email.el -*- lexical-binding: t; -*- - -(defvar +irc--workspace-name "*IRC*") - -(defun +irc-setup-wconf (&optional inhibit-workspace) - (when (and (featurep! :ui workspaces) - (not inhibit-workspace)) - (+workspace-switch +irc--workspace-name 'auto-create)) - (let ((buffers (doom-buffers-in-mode 'circe-mode nil t))) - (if (not (member (window-buffer) buffers)) - (if buffers - (ignore (switch-to-buffer (car buffers))) - (require 'circe) - (delete-other-windows) - (switch-to-buffer (doom-fallback-buffer)) - t) - (user-error "IRC buffer is already active and selected")))) - -;;;###autoload -(defun =irc (&optional inhibit-workspace) - "Connect to IRC and auto-connect to all registered networks. - -If INHIBIT-WORKSPACE (the universal argument) is non-nil, don't spawn a new -workspace for it." - (interactive "P") - (+irc-setup-wconf inhibit-workspace) - (cond ((doom-buffers-in-mode 'circe-mode (doom-buffer-list) t) - (message "Circe buffers are already open")) - (circe-network-options - (mapc #'circe (mapcar #'car circe-network-options))) - ((call-interactively #'circe)))) - -;;;###autoload -(defun +irc/connect (&optional inhibit-workspace) - "Connect to a specific registered server. - -If INHIBIT-WORKSPACE (the universal argument) is non-nil, don't spawn a new -workspace for it." - (interactive "P") - (and (+irc-setup-wconf inhibit-workspace) - (call-interactively #'circe))) - -;;;###autoload -(defun +irc/send-message (who what) - "Send WHO a message containing WHAT." - (interactive "sWho: \nsWhat: ") - (circe-command-MSG who what)) - -;;;###autoload -(defun +irc/quit () - "Kill current circe session and workgroup." - (interactive) - (unless (y-or-n-p "Really kill IRC session?") - (user-error "Aborted")) - (let (circe-channel-killed-confirmation - circe-server-killed-confirmation) - (when +irc--defer-timer - (cancel-timer +irc--defer-timer)) - (disable-circe-notifications) - (mapc #'kill-buffer (doom-buffers-in-mode 'circe-mode (buffer-list) t)) - (when (featurep! :ui workspaces) - (when (equal (+workspace-current-name) +irc--workspace-name) - (+workspace/delete +irc--workspace-name))))) - -;;;###autoload -(defun +irc/jump-to-channel (&optional this-server) - "Jump to an open channel or server buffer. If THIS-SERVER (universal -argument) is non-nil only show channels in current server." - (interactive "P") - (call-interactively - (cond ((featurep! :completion ivy) #'+irc/ivy-jump-to-channel) - ((featurep! :completion vertico) #'+irc/vertico-jump-to-channel) - ((user-error "No jump-to-channel backend is enabled. Enable vertico or ivy!"))))) - -;;;###autoload -(defun +irc--circe-all-buffers () - (cl-loop with servers = (circe-server-buffers) - for server in servers - collect server - nconc - (with-current-buffer server - (cl-loop for buf in (circe-server-chat-buffers) - collect buf)))) - -;;;###autoload -(defun +irc/tracking-next-buffer () - "Disables switching to an unread buffer unless in the irc workspace." - (interactive) - (when (derived-mode-p 'circe-mode) - (tracking-next-buffer))) - - -;; -;;; Hooks/fns - -;;;###autoload -(defun +circe-buffer-p (buf) - "Return non-nil if BUF is a `circe-mode' buffer." - (with-current-buffer buf - (derived-mode-p 'circe-mode))) - -;;;###autoload -(defun +irc--add-circe-buffer-to-persp-h () - (when (and (bound-and-true-p persp-mode) - (+workspace-exists-p +irc--workspace-name)) - (let ((persp (get-current-persp)) - (buf (current-buffer))) - ;; Add a new circe buffer to irc workspace when we're in another workspace - (unless (eq (safe-persp-name persp) +irc--workspace-name) - ;; Add new circe buffers to the persp containing circe buffers - (persp-add-buffer buf (persp-get-by-name +irc--workspace-name)) - ;; Remove new buffer from accidental workspace - (persp-remove-buffer buf persp))))) diff --git a/.config/emacs/modules/app/irc/autoload/ivy.el b/.config/emacs/modules/app/irc/autoload/ivy.el deleted file mode 100644 index 7fc06fc..0000000 --- a/.config/emacs/modules/app/irc/autoload/ivy.el +++ /dev/null @@ -1,30 +0,0 @@ -;;; app/irc/autoload/ivy.el -*- lexical-binding: t; -*- -;;;###if (featurep! :completion ivy) - -;;;###autoload -(defun +irc/ivy-jump-to-channel (&optional this-server) - "Jump to an open channel or server buffer with ivy. If THIS-SERVER (universal -argument) is non-nil only show channels in current server." - (interactive "P") - (if (not (circe-server-buffers)) - (message "No circe buffers available") - (when (and this-server (not circe-server-buffer)) - (setq this-server nil)) - (ivy-read (format "Jump to%s: " (if this-server (format " (%s)" (buffer-name circe-server-buffer)) "")) - (cl-loop with servers = (if this-server (list circe-server-buffer) (circe-server-buffers)) - with current-buffer = (current-buffer) - for server in servers - collect (buffer-name server) - nconc - (with-current-buffer server - (cl-loop for buf in (circe-server-chat-buffers) - unless (eq buf current-buffer) - collect (format " %s" (buffer-name buf))))) - :action #'+irc--ivy-switch-to-buffer-action - :preselect (buffer-name (current-buffer)) - :keymap ivy-switch-buffer-map - :caller '+irc/ivy-jump-to-channel))) - -(defun +irc--ivy-switch-to-buffer-action (buffer) - (when (stringp buffer) - (ivy--switch-buffer-action (string-trim-left buffer)))) diff --git a/.config/emacs/modules/app/irc/autoload/settings.el b/.config/emacs/modules/app/irc/autoload/settings.el deleted file mode 100644 index 53e4bc0..0000000 --- a/.config/emacs/modules/app/irc/autoload/settings.el +++ /dev/null @@ -1,18 +0,0 @@ -;;; app/irc/autoload/settings.el -*- lexical-binding: t; -*- - -;;;###autodef -(defun set-irc-server! (server plist) - "Registers an irc SERVER for circe. - -SERVER can either be a name for the network (in which case you must specify a -:host), or it may be the hostname itself, in which case it will be used as the -:host. - -See `circe-network-options' for details." - (declare (indent 1)) - (after! circe - (unless (plist-member plist :host) - (plist-put! plist :host server)) - (setf (alist-get server circe-network-options - nil nil #'equal) - plist))) diff --git a/.config/emacs/modules/app/irc/autoload/vertico.el b/.config/emacs/modules/app/irc/autoload/vertico.el deleted file mode 100644 index c97edec..0000000 --- a/.config/emacs/modules/app/irc/autoload/vertico.el +++ /dev/null @@ -1,23 +0,0 @@ -;;; app/irc/autoload/vertico.el -*- lexical-binding: t; -*- -;;;###if (featurep! :completion vertico) - -;;;###autoload -(defun +irc/vertico-jump-to-channel () - "Jump to an open channel or server buffer with vertico." - (interactive) - (require 'consult) - (consult--multi (list (plist-put (copy-sequence +irc--consult-circe-source) - :hidden nil)) - :narrow nil - :require-match t - :prompt "Jump to:" - :sort nil)) - -;;;###autoload -(defvar +irc--consult-circe-source - `(:name "circe" - :hidden t - :narrow ?c - :category buffer - :state ,#'consult--buffer-state - :items ,(lambda () (mapcar #'buffer-name (+irc--circe-all-buffers))))) diff --git a/.config/emacs/modules/app/irc/config.el b/.config/emacs/modules/app/irc/config.el deleted file mode 100644 index ad079d3..0000000 --- a/.config/emacs/modules/app/irc/config.el +++ /dev/null @@ -1,258 +0,0 @@ -;;; app/irc/config.el -*- lexical-binding: t; -*- - -(defvar +irc-left-padding 13 - "By how much spaces the left hand side of the line should be padded. -Below a value of 12 this may result in uneven alignment between the various -types of messages.") - -(defvar +irc-truncate-nick-char ?… - "Character to displayed when nick > `+irc-left-padding' in length.") - -(defvar +irc-scroll-to-bottom-on-commands - '(self-insert-command yank hilit-yank) - "If these commands are called pre prompt the buffer will scroll to `point-max'.") - -(defvar +irc-disconnect-hook nil - "Runs each hook when circe noticies the connection has been disconnected. -Useful for scenarios where an instant reconnect will not be successful.") - -(defvar +irc-bot-list '("fsbot" "rudybot") - "Nicks listed have `circe-fool-face' applied and will not be tracked.") - -(defvar +irc-time-stamp-format "%H:%M" - "The format of time stamps. - -See `format-time-string' for a full description of available -formatting directives. ") - -(defvar +irc-notifications-watch-strings nil - "A list of strings which can trigger a notification. You don't need to put -your nick here. - -See `circe-notifications-watch-strings'.") - -(defvar +irc-defer-notifications nil - "How long to defer enabling notifications, in seconds (e.g. 5min = 300). -Useful for ZNC users who want to avoid the deluge of notifications during buffer -playback.") - -(defvar +irc--defer-timer nil) - -(defsubst +irc--pad (left right) - (format (format "%%%ds | %%s" +irc-left-padding) - (concat "*** " left) right)) - - -;; -;; Packages - -(use-package! circe - :commands circe circe-server-buffers - :config - (setq circe-default-quit-message nil - circe-default-part-message nil - circe-use-cycle-completion t - circe-reduce-lurker-spam t - - circe-format-say (format "{nick:+%ss} │ {body}" +irc-left-padding) - circe-format-self-say circe-format-say - circe-format-action (format "{nick:+%ss} * {body}" +irc-left-padding) - circe-format-self-action circe-format-action - circe-format-server-notice - (let ((left "-Server-")) (concat (make-string (- +irc-left-padding (length left)) ? ) - (concat left " _ {body}"))) - circe-format-notice (format "{nick:%ss} _ {body}" +irc-left-padding) - circe-format-server-topic - (+irc--pad "Topic" "{userhost}: {topic-diff}") - circe-format-server-join-in-channel - (+irc--pad "Join" "{nick} ({userinfo}) joined {channel}") - circe-format-server-join - (+irc--pad "Join" "{nick} ({userinfo})") - circe-format-server-part - (+irc--pad "Part" "{nick} ({userhost}) left {channel}: {reason}") - circe-format-server-quit - (+irc--pad "Quit" "{nick} ({userhost}) left IRC: {reason}]") - circe-format-server-quit-channel - (+irc--pad "Quit" "{nick} ({userhost}) left {channel}: {reason}]") - circe-format-server-rejoin - (+irc--pad "Re-join" "{nick} ({userhost}), left {departuredelta} ago") - circe-format-server-netmerge - (+irc--pad "Netmerge" "{split}, split {ago} ago (Use /WL to see who's still missing)") - circe-format-server-nick-change - (+irc--pad "Nick" "{old-nick} ({userhost}) is now known as {new-nick}") - circe-format-server-nick-change-self - (+irc--pad "Nick" "You are now known as {new-nick} ({old-nick})") - circe-format-server-nick-change-self - (+irc--pad "Nick" "{old-nick} ({userhost}) is now known as {new-nick}") - circe-format-server-mode-change - (+irc--pad "Mode" "{change} on {target} by {setter} ({userhost})") - circe-format-server-lurker-activity - (+irc--pad "Lurk" "{nick} joined {joindelta} ago")) - - (add-hook 'doom-real-buffer-functions #'+circe-buffer-p) - (add-hook 'circe-channel-mode-hook #'turn-on-visual-line-mode) - (add-hook 'circe-mode-hook #'+irc--add-circe-buffer-to-persp-h) - (add-hook 'circe-mode-hook #'turn-off-smartparens-mode) - - ;; HACK Fix #1862: circe hangs on TLS connections when using OpenSSL versions - ;; > 1.1.0, where tls.el does not correctly determine the end of the info - ;; block. This fixes proposed in jorgenschaefer/circe#340 - (setq-hook! 'circe-mode-hook - tls-end-of-info - (concat "\\(" - ;; `openssl s_client' regexp. See ssl/ssl_txt.c lines 219-220. - ;; According to apps/s_client.c line 1515 `---' is always the last - ;; line that is printed by s_client before the real data. - "^ Verify return code: .+\n\\(\\|^ Extended master secret: .+\n\\)\\(\\|^ Max Early Data: .+\n\\)---\n\\|" - ;; `gnutls' regexp. See src/cli.c lines 721-. - "^- Simple Client Mode:\n" - "\\(\n\\|" ; ignore blank lines - ;; According to GnuTLS v2.1.5 src/cli.c lines 640-650 and 705-715 in - ;; `main' the handshake will start after this message. If the - ;; handshake fails, the programs will abort. - "^\\*\\*\\* Starting TLS handshake\n\\)*" - "\\)")) - - (defadvice! +irc--circe-run-disconnect-hook-a (&rest _) - "Runs `+irc-disconnect-hook' after circe disconnects." - :after #'circe--irc-conn-disconnected - (run-hooks '+irc-disconnect-hook)) - - (add-hook! 'lui-pre-output-hook - (defun +irc-circe-truncate-nicks-h () - "Truncate long nicknames in chat output non-destructively." - (when-let (beg (text-property-any (point-min) (point-max) 'lui-format-argument 'nick)) - (goto-char beg) - (let ((end (next-single-property-change beg 'lui-format-argument)) - (nick (plist-get (plist-get (text-properties-at beg) 'lui-keywords) - :nick))) - (when (> (length nick) +irc-left-padding) - (compose-region (+ beg +irc-left-padding -1) end - +irc-truncate-nick-char)))))) - - (add-hook! 'circe-message-option-functions - (defun +irc-circe-message-option-bot-h (nick &rest ignored) - "Fontify known bots and mark them to not be tracked." - (when (member nick +irc-bot-list) - '((text-properties . (face circe-fool-face lui-do-not-track t)))))) - - ;; Let `+irc/quit' and `circe' handle buffer cleanup - (define-key circe-mode-map [remap kill-buffer] #'bury-buffer) - ;; Fail gracefully if not in a circe buffer - (global-set-key [remap tracking-next-buffer] #'+irc/tracking-next-buffer) - - (when (featurep! :completion vertico) - (after! consult - (add-to-list 'consult-buffer-sources '+irc--consult-circe-source 'append))) - - (map! :localleader - (:map circe-mode-map - "a" #'tracking-next-buffer - "j" #'circe-command-JOIN - "m" #'+irc/send-message - "p" #'circe-command-PART - "Q" #'+irc/quit - "R" #'circe-reconnect - "c" #'+irc/jump-to-channel) - (:map circe-channel-mode-map - "n" #'circe-command-NAMES))) - - -(use-package! circe-color-nicks - :hook (circe-channel-mode . enable-circe-color-nicks) - :config - (setq circe-color-nicks-min-constrast-ratio 4.5 - circe-color-nicks-everywhere t)) - - -(use-package! circe-new-day-notifier - :after circe - :config - (enable-circe-new-day-notifier) - (setq circe-new-day-notifier-format-message - (+irc--pad "Day" "Date changed [{day}]"))) - - -(use-package! circe-notifications - :commands enable-circe-notifications - :init - (add-hook! 'circe-server-connected-hook - (defun +irc-init-circe-notifications-h () - (if (numberp +irc-defer-notifications) - (setq +irc--defer-timer - (run-at-time +irc-defer-notifications nil - #'enable-circe-notifications)) - (enable-circe-notifications)))) - :config - (setq circe-notifications-watch-strings +irc-notifications-watch-strings - circe-notifications-emacs-focused nil - circe-notifications-alert-style - (cond (IS-MAC 'osx-notifier) - (IS-LINUX 'libnotify) - (circe-notifications-alert-style)))) - - -(use-package! lui - :commands lui-mode - :config - (define-key lui-mode-map "\C-u" #'lui-kill-to-beginning-of-line) - (setq lui-fill-type nil) - - (when (featurep! :checkers spell) - (setq lui-flyspell-p t)) - - (after! evil - (defun +irc-evil-insert-h () - "Ensure entering insert mode will put us at the prompt, unless editing -after prompt marker." - (when (> (marker-position lui-input-marker) (point)) - (goto-char (point-max)))) - - (add-hook! 'lui-mode-hook - (add-hook 'evil-insert-state-entry-hook #'+irc-evil-insert-h - nil 'local)) - - (mapc (lambda (cmd) (push cmd +irc-scroll-to-bottom-on-commands)) - '(evil-paste-after evil-paste-before evil-open-above evil-open-below))) - - - (defun +irc-preinput-scroll-to-bottom-h () - "Go to the end of the buffer in all windows showing it. -Courtesy of esh-mode.el" - (when (memq this-command +irc-scroll-to-bottom-on-commands) - (let* ((selected (selected-window)) - (current (current-buffer))) - (when (> (marker-position lui-input-marker) (point)) - (walk-windows - (function - (lambda (window) - (when (eq (window-buffer window) current) - (select-window window) - (goto-char (point-max)) - (select-window selected)))) - nil t))))) - - (add-hook! 'lui-mode-hook - (add-hook 'pre-command-hook #'+irc-preinput-scroll-to-bottom-h nil t)) - - ;; enable a horizontal line marking the last read message - (add-hook 'lui-mode-hook #'enable-lui-track-bar) - - (add-hook! 'lui-mode-hook - (defun +irc-init-lui-margins-h () - (setq lui-time-stamp-position 'right-margin - lui-time-stamp-format +irc-time-stamp-format - right-margin-width (length (format-time-string lui-time-stamp-format)))) - (defun +irc-init-lui-wrapping-a () - (setq fringes-outside-margins t - word-wrap t - wrap-prefix (make-string (+ +irc-left-padding 3) ? ))))) - - -(use-package! lui-logging - :after lui - :config (enable-lui-logging)) - - -(use-package! lui-autopaste - :hook (circe-channel-mode . enable-lui-autopaste)) diff --git a/.config/emacs/modules/app/irc/packages.el b/.config/emacs/modules/app/irc/packages.el deleted file mode 100644 index 14e2209..0000000 --- a/.config/emacs/modules/app/irc/packages.el +++ /dev/null @@ -1,5 +0,0 @@ -;; -*- no-byte-compile: t; -*- -;;; app/irc/packages.el - -(package! circe :pin "77e16de3b9fbaa0417b56a9acc70a9bca17c4ad0") -(package! circe-notifications :pin "291149ac12877bbd062da993479d3533a26862b0") diff --git a/.config/emacs/modules/app/rss/README.org b/.config/emacs/modules/app/rss/README.org deleted file mode 100644 index 2cd1f36..0000000 --- a/.config/emacs/modules/app/rss/README.org +++ /dev/null @@ -1,114 +0,0 @@ -#+TITLE: app/rss -#+DATE: May 12, 2020 -#+SINCE: v2.0.9 -#+STARTUP: inlineimages nofold - -* Table of Contents :TOC_3:noexport: -- [[#description][Description]] - - [[#maintainers][Maintainers]] - - [[#module-flags][Module Flags]] - - [[#plugins][Plugins]] - - [[#hacks][Hacks]] -- [[#prerequisites][Prerequisites]] -- [[#features][Features]] -- [[#configuration][Configuration]] - - [[#without-org][Without +org]] - - [[#with-org][With +org]] - - [[#keybindings][Keybindings]] - - [[#news-filtering][News filtering]] - - [[#automatically-updating-feed-when-opening-elfeed][Automatically updating feed when opening elfeed]] -- [[#troubleshooting][Troubleshooting]] - -* Description -+ Read RSS feeds in the comfort of DOOM (Emacs) - -** Maintainers -This module has no dedicated maintainers. - -** Module Flags -+ =+org= to enable ~elfeed-org~ to use ~org-directory/elfeed.org~ - -** Plugins -+ [[https://github.com/skeeto/elfeed][elfeed]] -+ [[https://github.com/algernon/elfeed-goodies][elfeed-goodies]] -+ =+org= - + [[https://github.com/remyhonig/elfeed-org][elfeed-org]] - -** Hacks -+ By default ~elfeed-search-filter~ is set to ~@2-weeks-ago~ and makes the last 2 weeks of entries visible. This needs to be set after elfeed has loaded like so in your ~config.el~ - #+begin_src elisp -(after! elfeed - (setq elfeed-search-filter "@1-month-ago +unread")) - #+end_src - -* Prerequisites -This module has no prerequisites. - -* Features -+ As there isn't currently binding for ~elfeed-update~ you can run it with ~M-x elfeed-update~ - -* Configuration -** Without +org -When you don't want to use org mode to manage your elfeed feeds you can put your subscriptions to personal ~config.el~ file, ex: -#+BEGIN_SRC elisp -(setq elfeed-feeds - '("https://this-week-in-rust.org/rss.xml" - "http://feeds.bbci.co.uk/news/rss.xml")) -#+END_SRC - -** With +org -When using ~+org~ flag then configuration is easier. You can use ~org-mode~ to configure feeds to follow. -#+BEGIN_SRC org -,* root :elfeed: -,** Programming :programming: -,*** [[https://this-week-in-rust.org/rss.xml][This Week in Rust]] :rust: -,** News :news: -,*** Top news :tops: -,**** http://feeds.bbci.co.uk/news/rss.xml -#+END_SRC -+ Root of ~elfeed-org~ needs to have ~:elfeed:~ tag. This is where ~elfeed-org~ starts to read. -+ You can have subheaders as in example ~:programming:~, and ~elfeed-org~ applies that tag to all subheader feeds, in example it adds it to ~This Week in Rust~. -+ You can "name" feeds as you please with ~org-mode~ ~org-insert-link~ (~C-c C-l~) and put name as you want into ~description~. -+ If you don't want to use ~org-directory/elfeed.org~ file you can specify it with ~(setq rmh-elfeed-org-files '("path/to/your/elfeed/file.org))~ - -** Keybindings -+ General - | Key | Mode | Description | - |---------+--------------------+--------------------------------| - | =S-RET= | Elfeed-search-mode | Open link into browser | - | =RET= | Elfeed-search-mode | Open item | - | =s= | Elfeed-search-mode | Filter | - | =C-j= | Elfeed-show-mode | Move to next item | - | =C-k= | Elfeed-show-mode | Move to previous item | - -+ If ~:editor evil +everywhere~ - | Key | Description | - |-----+-----------------------------| - | q | elfeed-kill-buffer | - | r | elfeed-search-update--force | - | g c | Copy link of current entry | - -** News filtering -+ Time filtering - + ~@2-days-ago~ Past two days - + ~@2-weeks-ago~ Past two weeks - + ~@2-years-ago~ Past two years - + ~@2020-06-19~ To show specific day - + ~@2020-06-19--2020-03-10~ Span of time -+ Tag filtering - + Include ~+news~ - + Exclude ~-rust~ - + Both ~+news -rust~ -+ String filtering, this is case insensitive - + Include - + ~DOOM~ - + ~Linu[sx]~ Search for both ~Linus~ and ~Linux~ - + Exclude ~!something~ - -** Automatically updating feed when opening elfeed -Hook ~elfeed-update~ to ~elfeed-search-mode-hook~ -#+BEGIN_SRC elisp -(add-hook! 'elfeed-search-mode-hook 'elfeed-update) -#+END_SRC - -* TODO Troubleshooting diff --git a/.config/emacs/modules/app/rss/autoload.el b/.config/emacs/modules/app/rss/autoload.el deleted file mode 100644 index a53ceae..0000000 --- a/.config/emacs/modules/app/rss/autoload.el +++ /dev/null @@ -1,141 +0,0 @@ -;;; app/rss/autoload.el -*- lexical-binding: t; -*- - -(defvar +rss--wconf nil) - -;;;###autoload -(defun =rss () - "Activate (or switch to) `elfeed' in its workspace." - (interactive) - (if (featurep! :ui workspaces) - (progn - (+workspace-switch "rss" t) - (doom/switch-to-scratch-buffer) - (elfeed) - (+workspace/display)) - (setq +rss--wconf (current-window-configuration)) - (delete-other-windows) - (switch-to-buffer (doom-fallback-buffer)) - (elfeed))) - -;;;###autoload -(defun +rss/delete-pane () - "Delete the *elfeed-entry* split pane." - (interactive) - (let* ((buf (get-buffer "*elfeed-entry*")) - (window (get-buffer-window buf))) - (delete-window window) - (when (buffer-live-p buf) - (kill-buffer buf)))) - -;;;###autoload -(defun +rss/open (entry) - "Display the currently selected item in a buffer." - (interactive (list (elfeed-search-selected :ignore-region))) - (when (elfeed-entry-p entry) - (elfeed-untag entry 'unread) - (elfeed-search-update-entry entry) - (elfeed-show-entry entry))) - -;;;###autoload -(defun +rss/next () - "Show the next item in the elfeed-search buffer." - (interactive) - (funcall elfeed-show-entry-delete) - (with-current-buffer (elfeed-search-buffer) - (forward-line) - (call-interactively '+rss/open))) - -;;;###autoload -(defun +rss/previous () - "Show the previous item in the elfeed-search buffer." - (interactive) - (funcall elfeed-show-entry-delete) - (with-current-buffer (elfeed-search-buffer) - (forward-line -1) - (call-interactively '+rss/open))) - -;;;###autoload -(defun +rss/copy-link () - "Copy current link to clipboard." - (interactive) - (let ((link (elfeed-entry-link elfeed-show-entry))) - (when link - (kill-new link) - (message "Copied %s to clipboard" link)))) -;; -;; Hooks - -;;;###autoload -(defun +rss-elfeed-wrap-h () - "Enhances an elfeed entry's readability by wrapping it to a width of -`fill-column'." - (let ((inhibit-read-only t) - (inhibit-modification-hooks t)) - (setq-local truncate-lines nil) - (setq-local shr-use-fonts nil) - (setq-local shr-width 85) - (set-buffer-modified-p nil))) - -;;;###autoload -(defun +rss-cleanup-h () - "Clean up after an elfeed session. Kills all elfeed and elfeed-org files." - (interactive) - ;; `delete-file-projectile-remove-from-cache' slows down `elfeed-db-compact' - ;; tremendously, so we disable the projectile cache: - (let (projectile-enable-caching) - (elfeed-db-compact)) - (let ((buf (previous-buffer))) - (when (or (null buf) (not (doom-real-buffer-p buf))) - (switch-to-buffer (doom-fallback-buffer)))) - (let ((search-buffers (doom-buffers-in-mode 'elfeed-search-mode)) - (show-buffers (doom-buffers-in-mode 'elfeed-show-mode)) - kill-buffer-query-functions) - (dolist (file (bound-and-true-p rmh-elfeed-org-files)) - (when-let (buf (get-file-buffer (expand-file-name file org-directory))) - (kill-buffer buf))) - (dolist (b search-buffers) - (with-current-buffer b - (remove-hook 'kill-buffer-hook #'+rss-cleanup-h :local) - (kill-buffer b))) - (mapc #'kill-buffer show-buffers)) - (if (featurep! :ui workspaces) - (+workspace/delete "rss") - (when (window-configuration-p +rss--wconf) - (set-window-configuration +rss--wconf)) - (setq +rss--wconf nil))) - - -;; -;; Functions - -;;;###autoload -(defun +rss-dead-feeds (&optional years) - "Return a list of feeds that haven't posted anything in YEARS." - (let* ((years (or years 1.0)) - (living-feeds (make-hash-table :test 'equal)) - (seconds (* years 365.0 24 60 60)) - (threshold (- (float-time) seconds))) - (with-elfeed-db-visit (entry feed) - (let ((date (elfeed-entry-date entry))) - (when (> date threshold) - (setf (gethash (elfeed-feed-url feed) living-feeds) t)))) - (cl-loop for url in (elfeed-feed-list) - unless (gethash url living-feeds) - collect url))) - -;;;###autoload -(defun +rss-put-sliced-image-fn (spec alt &optional flags) - "TODO" - (letf! (defun insert-image (image &optional alt _area _slice) - (let ((height (cdr (image-size image t)))) - (insert-sliced-image image alt nil (max 1 (/ height 20.0)) 1))) - (shr-put-image spec alt flags))) - -;;;###autoload -(defun +rss-render-image-tag-without-underline-fn (dom &optional url) - "TODO" - (let ((start (point))) - (shr-tag-img dom url) - ;; And remove underlines in case images are links, otherwise we get an - ;; underline beneath every slice. - (put-text-property start (point) 'face '(:underline nil)))) diff --git a/.config/emacs/modules/app/rss/config.el b/.config/emacs/modules/app/rss/config.el deleted file mode 100644 index ddb41b1..0000000 --- a/.config/emacs/modules/app/rss/config.el +++ /dev/null @@ -1,87 +0,0 @@ -;;; app/rss/config.el -*- lexical-binding: t; -*- - -;; This is an opinionated workflow that turns Emacs into an RSS reader, inspired -;; by apps Reeder and Readkit. It can be invoked via `=rss'. Otherwise, if you -;; don't care for the UI you can invoke elfeed directly with `elfeed'. - -(defvar +rss-split-direction 'below - "What direction to pop up the entry buffer in elfeed.") - -(defvar +rss-enable-sliced-images t - "Automatically slice images shown in elfeed-show-mode buffers, making them -easier to scroll through.") - - -;; -;; Packages - -(use-package! elfeed - :commands elfeed - :init - (setq elfeed-db-directory (concat doom-local-dir "elfeed/db/") - elfeed-enclosure-default-dir (concat doom-local-dir "elfeed/enclosures/")) - :config - (setq elfeed-search-filter "@2-week-ago " - elfeed-show-entry-switch #'pop-to-buffer - elfeed-show-entry-delete #'+rss/delete-pane - shr-max-image-proportion 0.8) - - (set-popup-rule! "^\\*elfeed-entry" - :size 0.75 :actions '(display-buffer-below-selected) - :select t :quit nil :ttl t) - - (make-directory elfeed-db-directory t) - - ;; Ensure elfeed buffers are treated as real - (add-hook! 'doom-real-buffer-functions - (defun +rss-buffer-p (buf) - (string-match-p "^\\*elfeed" (buffer-name buf)))) - - ;; Enhance readability of a post - (add-hook 'elfeed-show-mode-hook #'+rss-elfeed-wrap-h) - (add-hook! 'elfeed-search-mode-hook - (add-hook 'kill-buffer-hook #'+rss-cleanup-h nil 'local)) - - ;; Large images are annoying to scroll through, because scrolling follows the - ;; cursor, so we force shr to insert images in slices. - (when +rss-enable-sliced-images - (setq-hook! 'elfeed-show-mode-hook - shr-put-image-function #'+rss-put-sliced-image-fn - shr-external-rendering-functions '((img . +rss-render-image-tag-without-underline-fn)))) - - ;; Keybindings - (after! elfeed-show - (define-key! elfeed-show-mode-map - [remap next-buffer] #'+rss/next - [remap previous-buffer] #'+rss/previous)) - (when (featurep! :editor evil +everywhere) - (evil-define-key 'normal elfeed-search-mode-map - "q" #'elfeed-kill-buffer - "r" #'elfeed-search-update--force - (kbd "M-RET") #'elfeed-search-browse-url) - (map! (:map elfeed-show-mode-map - :n "gc" nil - :n "gc" #'+rss/copy-link)))) - - - -(use-package! elfeed-org - :when (featurep! +org) - :after elfeed - :preface - (setq rmh-elfeed-org-files (list "elfeed.org")) - :config - (elfeed-org) - (defadvice! +rss-skip-missing-org-files-a (&rest _) - :before '(elfeed rmh-elfeed-org-mark-feed-ignore elfeed-org-export-opml) - (unless (file-name-absolute-p (car rmh-elfeed-org-files)) - (let* ((default-directory org-directory) - (files (mapcar #'expand-file-name rmh-elfeed-org-files))) - (dolist (file (cl-remove-if #'file-exists-p files)) - (message "elfeed-org: ignoring %S because it can't be read" file)) - (setq rmh-elfeed-org-files (cl-remove-if-not #'file-exists-p files)))))) - -(use-package! elfeed-goodies - :after elfeed - :config - (elfeed-goodies/setup)) diff --git a/.config/emacs/modules/app/rss/packages.el b/.config/emacs/modules/app/rss/packages.el deleted file mode 100644 index 9eb71db..0000000 --- a/.config/emacs/modules/app/rss/packages.el +++ /dev/null @@ -1,7 +0,0 @@ -;; -*- no-byte-compile: t; -*- -;;; app/rss/packages.el - -(package! elfeed :pin "162d7d545ed41c27967d108c04aa31f5a61c8e16") -(package! elfeed-goodies :pin "95b4ea632fbd5960927952ec8f3394eb88da4752") -(when (featurep! +org) - (package! elfeed-org :pin "268efdd0121fa61f63b722c30e0951c5d31224a4")) diff --git a/.config/emacs/modules/app/twitter/README.org b/.config/emacs/modules/app/twitter/README.org deleted file mode 100644 index 38d9694..0000000 --- a/.config/emacs/modules/app/twitter/README.org +++ /dev/null @@ -1,96 +0,0 @@ -#+TITLE: app/twitter -#+DATE: October 11, 2019 -#+SINCE: v2.0 -#+STARTUP: inlineimages - -* Table of Contents :TOC_3:noexport: -- [[#description][Description]] - - [[#module-flags][Module Flags]] - - [[#plugins][Plugins]] - - [[#hacks][Hacks]] -- [[#prerequisites][Prerequisites]] -- [[#features][Features]] -- [[#configuration][Configuration]] -- [[#troubleshooting][Troubleshooting]] -- [[#appendix][Appendix]] - - [[#commands--keybindings][Commands & Keybindings]] - -* Description -Enjoy twitter from emacs. - -+ View various timelines side by side, e.g. user's timeline, home, etc. -+ Post new tweets -+ Send direct messages -+ Retweet -+ Follow and un-follow users -+ Favorite tweets - -** Module Flags -This module provides no flags. - -** Plugins -+ [[https://github.com/hayamiz/twittering-mode][twittering-mode]] -+ [[https://github.com/abo-abo/avy][avy]] - -** TODO Hacks -{A list of internal modifications to included packages} - -* Prerequisites - -+ For SSL connection (required by Twitter's API), one of the followings is required: - + [[http://curl.haxx.se/][cURL]] - + [[http://www.gnu.org/software/wget/][GNU Wget]] - + [[http://www.openssl.org/][OpenSSL]] - + [[http://www.gnu.org/software/gnutls/][GnuTLS]] -+ [[http://www.gnupg.org/][GnuPG]] is required for keeping the OAuth token encrypted in local storage. -+ ~twittering-icon-mode~ converts retrieved icons into XPM by default. To - achieve this and for displaying icons in formats that are not supported by - Emacs as well as for resizing icon images, [[http://www.imagemagick.org/][ImageMagick]] is required. - - To build emacs with ImageMagick support the ~--with-imagemagick~ flag needs to - be passed to the ~configure~ script, e.g. ~./configure --with-imagemagick~. - For detailed instruction on how to build Emacs from source please refer to - [[https://git.savannah.gnu.org/cgit/emacs.git/tree/INSTALL][INSTALL]] in Emacs' savannah repository. -+ For keeping retrieved icons in local storage, [[http://www.gzip.org/][gzip]] is required. - -* TODO Features -An in-depth list of features, how to use them, and their dependencies. - -* TODO Configuration -How to configure this module, including common problems and how to address them. - -* Troubleshooting -Currently ~twittering-mode~ binds =SPC=, breaking its functionality as a leader -key. To work around this issue you may use =M-SPC= instead when in -~twittering-mode~. - -* Appendix -** Commands & Keybindings -Here is a list of available commands and their default keybindings (defined in -[[./config.el][config.el]]). - -| command | key / ex command | description | -|---------------------+------------------+-------------------------------------------------------------| -| ~+twitter/quit~ | =q= | Close current window | -| ~+twitter/quit-all~ | =Q= | Close all twitter windows and buffers, and delete workspace | - -And when ~:editor evil +everywhere~ is active: - -| command | key / ex command | description | -|--------------------------------------------------+------------------+------------------------------------------------------------------| -| ~twittering-favorite~ | =f= | Favorite/Like a tweet | -| ~twittering-unfavorite~ | =F= | Un-favorite/Un-like a tweet | -| ~twittering-follow~ | =C-f= | Follow user | -| ~twittering-unfollow~ | =C-F= | Un-follow user | -| ~twittering-delete-status~ | =d= | Delete a tweet | -| ~twittering-retweet~ | =r= | Retweet | -| ~twittering-toggle-or-retrieve-replied-statuses~ | =R= | Toggle or retrieve replies | -| ~twittering-update-status-interactive~ | =o= | Update tweets | -| ~+twitter/ace-link~ | =O= | Open some visible link from a ~twittering-mode~ buffer using ace | -| ~twittering-search~ | =/= | Search | -| ~twittering-goto-next-status~ | =J= | Go to next tweet | -| ~twittering-goto-previous-status~ | =K= | Go to previous tweet | -| ~twittering-goto-first-status~ | =gg= | Go to first tweet | -| ~twittering-goto-last-status~ | =G= | Go to last tweet | -| ~twittering-goto-next-status-of-user~ | =gj= | Go to next tweet of user | -| ~twittering-goto-previous-status-of-user)))~ | =gk= | Go to previous tweet of user | diff --git a/.config/emacs/modules/app/twitter/autoload.el b/.config/emacs/modules/app/twitter/autoload.el deleted file mode 100644 index 6dc777f..0000000 --- a/.config/emacs/modules/app/twitter/autoload.el +++ /dev/null @@ -1,104 +0,0 @@ -;;; app/twitter/autoload.el -*- lexical-binding: t; -*- - -(defvar +twitter-workspace-name "*Twitter*" - "The name to use for the twitter workspace.") - -;;;###autoload -(defun +twitter-display-buffer-fn (buf) - "A replacement display-buffer command for `twittering-pop-to-buffer-function' -that works with the ui/popup module." - (let ((win (selected-window))) - (display-buffer buf) - ;; This is required because the new window generated by `pop-to-buffer' - ;; may hide the region following the current position. - (twittering-ensure-whole-of-status-is-visible win))) - -;;;###autoload -(defun +twitter-buffer-p (buf) - "Return non-nil if BUF is a `twittering-mode' buffer." - (eq 'twittering-mode (buffer-local-value 'major-mode buf))) - - -;; -;; Commands - -(defvar +twitter--old-wconf nil) -;;;###autoload -(defun =twitter (arg) - "Opens a workspace dedicated to `twittering-mode'." - (interactive "P") - (condition-case _ - (progn - (if (and (not arg) (featurep! :ui workspaces)) - (+workspace/new +twitter-workspace-name) - (setq +twitter--old-wconf (current-window-configuration)) - (delete-other-windows) - (switch-to-buffer (doom-fallback-buffer))) - (call-interactively #'twit) - (unless (get-buffer (car twittering-initial-timeline-spec-string)) - (error "Failed to open twitter")) - (switch-to-buffer (car twittering-initial-timeline-spec-string)) - (dolist (name (cdr twittering-initial-timeline-spec-string)) - (split-window-horizontally) - (switch-to-buffer name)) - (balance-windows) - (call-interactively #'+twitter/rerender-all)) - ('error (+twitter/quit-all)))) - -;;;###autoload -(defun +twitter/quit () - "Close the current `twitter-mode' buffer." - (interactive) - (when (eq major-mode 'twittering-mode) - (twittering-kill-buffer) - (cond ((one-window-p) (+twitter/quit-all)) - ((featurep! :ui workspaces) - (+workspace/close-window-or-workspace)) - ((delete-window))))) - -;;;###autoload -(defun +twitter/quit-all () - "Close all open `twitter-mode' buffers and the associated workspace, if any." - (interactive) - (when (featurep! :ui workspaces) - (+workspace/delete +twitter-workspace-name)) - (when +twitter--old-wconf - (set-window-configuration +twitter--old-wconf) - (setq +twitter--old-wconf nil)) - (dolist (buf (doom-buffers-in-mode 'twittering-mode (buffer-list) t)) - (twittering-kill-buffer buf))) - -;;;###autoload -(defun +twitter/rerender-all () - "Rerender all `twittering-mode' buffers." - (interactive) - (dolist (buf (doom-buffers-in-mode 'twittering-mode (buffer-list) t)) - (with-current-buffer buf - (twittering-rerender-timeline-all buf) - (setq-local line-spacing 0.2) - (goto-char (point-min))))) - -;;;###autoload -(defun +twitter/ace-link () - "Open a visible link, username or hashtag in a `twittering-mode' buffer." - (interactive) - (require 'avy) - ;; REVIEW Is this necessary anymore with `link-hint' - (let ((pt (avy-with +twitter/ace-link - (avy--process - (+twitter--collect-links) - (avy--style-fn avy-style))))) - (when (number-or-marker-p pt) - (goto-char pt) - (let ((uri (get-text-property (point) 'uri))) - (if uri (browse-url uri)))))) - -(defun +twitter--collect-links () - (let ((end (window-end)) - points) - (save-excursion - (goto-char (window-start)) - (while (and (< (point) end) - (ignore-errors (twittering-goto-next-thing) t)) - (push (point) points)) - (nreverse points)))) diff --git a/.config/emacs/modules/app/twitter/config.el b/.config/emacs/modules/app/twitter/config.el deleted file mode 100644 index 5e194e0..0000000 --- a/.config/emacs/modules/app/twitter/config.el +++ /dev/null @@ -1,76 +0,0 @@ -;;; app/twitter/config.el -*- lexical-binding: t; -*- - -(use-package! twittering-mode - :commands twit - :config - (setq twittering-private-info-file - (expand-file-name "twittering-mode.gpg" doom-etc-dir) - twittering-use-master-password t - twittering-request-confirmation-on-posting t - ;; twittering-icon-mode t - ;; twittering-use-icon-storage t - ;; twittering-icon-storage-file (concat doom-cache-dir "twittering-mode-icons.gz") - ;; twittering-convert-fix-size 12 - twittering-timeline-header "" - twittering-timeline-footer "" - twittering-edit-skeleton 'inherit-any - twittering-status-format "%FACE[font-lock-function-name-face]{ @%s} %FACE[italic]{%@} %FACE[error]{%FIELD-IF-NONZERO[❤ %d]{favorite_count}} %FACE[warning]{%FIELD-IF-NONZERO[↺ %d]{retweet_count}} -%FOLD[ ]{%FILL{%t}%QT{ -%FOLD[ ]{%FACE[font-lock-function-name-face]{@%s}\t%FACE[shadow]{%@} -%FOLD[ ]{%FILL{%t}} -}}} - -%FACE[twitter-divider]{ } -" - ;; twittering-timeline-spec-alias '() - twittering-initial-timeline-spec-string - '(":home" ":mentions" ":direct_messages")) - - (set-popup-rule! "^\\*twittering-edit" :size 15 :ttl nil :quit nil :select t) - - (defface twitter-divider - '((((background dark)) (:underline (:color "#141519"))) - (((background light)) (:underline (:color "#d3d3d3")))) - "The vertical divider between tweets." - :group 'twittering-mode) - - (add-hook 'doom-real-buffer-functions #'+twitter-buffer-p) - (when (featurep! :ui popup) - (setq twittering-pop-to-buffer-function #'+twitter-display-buffer-fn)) - - ;; Custom header-line for twitter buffers - (add-hook! 'twittering-mode-hook - (defun +twitter-switch-mode-and-header-line-h () - (setq header-line-format mode-line-format - mode-line-format nil))) - - ;; `epa--decode-coding-string' isn't defined in later versions of Emacs 27 - (unless (fboundp 'epa--decode-coding-string) - (defalias 'epa--decode-coding-string #'decode-coding-string)) - - (define-key! twittering-mode-map - "q" #'+twitter/quit - "Q" #'+twitter/quit-all - [remap twittering-kill-buffer] #'+twitter/quit - [remap delete-window] #'+twitter/quit - [remap +workspace/close-window-or-workspace] #'+twitter/quit) - (when (featurep! :editor evil +everywhere) - (define-key! twittering-mode-map - [remap evil-window-delete] #'+twitter/quit - "f" #'twittering-favorite - "F" #'twittering-unfavorite - "\C-f" #'twittering-follow - "\C-F" #'twittering-unfollow - "d" #'twittering-delete-status - "r" #'twittering-retweet - "R" #'twittering-toggle-or-retrieve-replied-statuses - "o" #'twittering-update-status-interactive - "O" #'+twitter/ace-link - "/" #'twittering-search - "J" #'twittering-goto-next-status - "K" #'twittering-goto-previous-status - "g" nil - "gg" #'twittering-goto-first-status - "G" #'twittering-goto-last-status - "gj" #'twittering-goto-next-status-of-user - "gk" #'twittering-goto-previous-status-of-user))) diff --git a/.config/emacs/modules/app/twitter/packages.el b/.config/emacs/modules/app/twitter/packages.el deleted file mode 100644 index dedc07e..0000000 --- a/.config/emacs/modules/app/twitter/packages.el +++ /dev/null @@ -1,5 +0,0 @@ -;; -*- no-byte-compile: t; -*- -;;; app/twitter/packages.el - -(package! twittering-mode :pin "114891e8fdb4f06b1326a6cf795e49c205cf9e29") -(package! avy :pin "e92cb37457b43336b765630dbfbea8ba4be601fa") diff --git a/.config/emacs/modules/checkers/grammar/README.org b/.config/emacs/modules/checkers/grammar/README.org deleted file mode 100644 index 1f51b3e..0000000 --- a/.config/emacs/modules/checkers/grammar/README.org +++ /dev/null @@ -1,68 +0,0 @@ -#+TITLE: checkers/grammar -#+DATE: January 9, 2020 -#+SINCE: v3.0.0 -#+STARTUP: inlineimages nofold - -* Table of Contents :TOC_3:noexport: -- [[#description][Description]] - - [[#maintainers][Maintainers]] - - [[#module-flags][Module Flags]] - - [[#plugins][Plugins]] -- [[#prerequisites][Prerequisites]] -- [[#features][Features]] - - [[#language-tool][Language Tool]] - - [[#commands][Commands]] - - [[#writegood-mode][writegood-mode]] -- [[#configuration][Configuration]] -- [[#troubleshooting][Troubleshooting]] - -* Description -This module adds grammar checking to Emacs to aid your writing by combining -=lang-tool= and =writegood-mode=. - -** Maintainers -This module has no dedicated maintainers. - -** Module Flags -This module provides no flags. - -** Plugins -+ [[https://github.com/mhayashi1120/Emacs-langtool][langtool]] -+ [[https://github.com/bnbeckwith/writegood-mode][writegood-mode]] - -* Prerequisites -This module requires langtool (which requires =Java 1.8+=). - -It can be acquired either from https://languagetool.org/ or your OS's package -manager: - -+ macOS: ~brew install languagetool~ -+ Arch Linux: ~pacman -S languagetool~ - -This module tries to guess the location of languagetool-commandline.jar. If you -get a warning that Doom =couldn't find languagetool-commandline.jar=, you will -need to set ~langtool-language-tool-jar~ to its location. - -* Features -An in-depth list of features, how to use them, and their dependencies. - -** Language Tool -[[https://www.languagetool.org/][Language Tool]] is a polyglot proofreader service that checks for grammar and -stylistic issues in your writing. This requires Java 1.8+. - -#+begin_quote -This requires Java 1.8+ -#+end_quote - -*** Commands -- ~langtool-check~ -- ~langtool-correct-buffer~ - -** writegood-mode -This minor mode highlights weasel words, duplication and passive voice. - -* Configuration -How to configure this module, including common problems and how to address them. - -* Troubleshooting -Common issues and their solution, or places to look for help. diff --git a/.config/emacs/modules/checkers/grammar/config.el b/.config/emacs/modules/checkers/grammar/config.el deleted file mode 100644 index 9f987c1..0000000 --- a/.config/emacs/modules/checkers/grammar/config.el +++ /dev/null @@ -1,37 +0,0 @@ -;;; checkers/grammar/config.el -*- lexical-binding: t; -*- - -(use-package! langtool - :commands (langtool-check - langtool-check-done - langtool-show-message-at-point - langtool-correct-buffer) - :init (setq langtool-default-language "en-US") - :config - (unless (or langtool-bin - langtool-language-tool-jar - langtool-java-classpath) - (cond (IS-MAC - (cond - ;; is user using home brew? - ((file-directory-p "/usr/local/Cellar/languagetool") - (setq langtool-language-tool-jar - (locate-file "libexec/languagetool-commandline.jar" - (doom-files-in "/usr/local/Cellar/languagetool" - :type 'dirs - :depth 2)))) - ;; macports compatibility - ((file-directory-p "/opt/local/share/java/LanguageTool") - (setq langtool-java-classpath "/opt/local/share/java/LanguageTool/*")))) - (IS-LINUX - (setq langtool-java-classpath "/usr/share/languagetool:/usr/share/java/languagetool/*"))))) - - -;; Detects weasel words, passive voice and duplicates. Proselint would be a -;; better choice. -(use-package! writegood-mode - :hook (org-mode markdown-mode rst-mode asciidoc-mode latex-mode LaTeX-mode) - :config - (map! :localleader - :map writegood-mode-map - "g" #'writegood-grade-level - "r" #'writegood-reading-ease)) diff --git a/.config/emacs/modules/checkers/grammar/packages.el b/.config/emacs/modules/checkers/grammar/packages.el deleted file mode 100644 index 39da67b..0000000 --- a/.config/emacs/modules/checkers/grammar/packages.el +++ /dev/null @@ -1,5 +0,0 @@ -;; -*- no-byte-compile: t; -*- -;;; checkers/grammar/packages.el - -(package! langtool :pin "8276eccc5587bc12fd205ee58a7a982f0a136e41") -(package! writegood-mode :pin "ed42d918d98826ad88928b7af9f2597502afc6b0") diff --git a/.config/emacs/modules/checkers/spell/README.org b/.config/emacs/modules/checkers/spell/README.org deleted file mode 100644 index b0fb697..0000000 --- a/.config/emacs/modules/checkers/spell/README.org +++ /dev/null @@ -1,195 +0,0 @@ -#+TITLE: checkers/spell -#+DATE: February 20, 2017 -#+SINCE: v2.0 -#+STARTUP: inlineimages nofold - -* Table of Contents :TOC_3:noexport: -- [[#description][Description]] - - [[#maintainers][Maintainers]] - - [[#module-flags][Module Flags]] - - [[#plugins][Plugins]] -- [[#prerequisites][Prerequisites]] - - [[#aspell][Aspell]] - - [[#hunspell][Hunspell]] - - [[#enchant][Enchant]] -- [[#features][Features]] -- [[#configuration][Configuration]] - - [[#changing-how-quickly-spell-fu-spellchecks-after-changes][Changing how quickly spell-fu spellchecks after changes]] - - [[#spell-fu-users][Spell-fu users]] - - [[#flyspell-users][Flyspell users]] - - [[#reducing-false-positives-by-disabling-spelling-on-certain-faces][Reducing false positives by disabling spelling on certain faces]] - - [[#spell-fu-users-1][Spell-fu users]] - - [[#flyspell-users-1][Flyspell users]] - - [[#adding-or-removing-words-to-your-personal-dictionary][Adding or removing words to your personal dictionary]] -- [[#troubleshooting][Troubleshooting]] - -* Description -This modules provides spellchecking powered by =aspell=, =hunspell= or =enchant=. - -Spellcheck is automatically loaded in many ~text-mode~ derivatives, which -includes ~org-mode~, ~markdown-mode~, the Git Commit buffer (from magit), -~mu4e-compose-mode~, and others. - -** Maintainers -This module has no dedicated maintainers. - -** Module Flags -+ =+flyspell= Use =flyspell= instead of =spell-fu=. It's significantly slower, - but supports multiple languages and dictionaries. -+ =+aspell= Use =aspell= as a backend for correcting words. -+ =+hunspell= Use =hunspell= as a backend for correcting words. -+ =+enchant= Use =enchant-2= as a backend for correcting words. -+ =+everywhere= Spell check in programming modes as well (in comments). - -** Plugins -+ if =+flyspell= - + [[https://github.com/d12frosted/flyspell-correct][flyspell-correct]] - + [[https://github.com/d12frosted/flyspell-correct#flyspell-correct-ivy-interface][flyspell-correct-ivy]] (=completion/ivy=) - + [[https://github.com/d12frosted/flyspell-correct#flyspell-correct-helm-interface][flyspell-correct-helm]] (=completion/helm=) - + [[https://github.com/d12frosted/flyspell-correct#flyspell-correct-popup-interface][flyspell-correct-popup]] (if *neither* =completion/ivy=, =completion/helm= or =completion/vertico=) - + [[https://github.com/rolandwalker/flyspell-lazy][flyspell-lazy]] -+ else - + [[https://gitlab.com/ideasman42/emacs-spell-fu][spell-fu]] - -* Prerequisites -This module requires one of =aspell=, =hunspell= or =enchant-2= -installed on your system and in your ~PATH~. -They also need dictionaries for your language(s). - -#+begin_quote -If you *are not* using =+flyspell=, you will need aspell (and a dictionary) -installed whether or not you have =+hunspell= or =+enchant= enabled. -This is because =spell-fu= does not support generating the word list -with anything other than =aspell= yet. -#+end_quote - -** Aspell -+ Ubuntu: ~apt-get install aspell aspell-en~ -+ macOS: ~brew install aspell~ -+ Arch Linux: ~pacman -S aspell aspell-en~ -+ NixOS: - #+BEGIN_SRC nix - { - environment.systemPackages = with pkgs; [ - (aspellWithDicts (dicts: with dicts; [ en en-computers en-science ])) - ]; - } - #+END_SRC - -** Hunspell -+ Ubuntu: ~apt-get install hunspell~ -+ macOS: ~brew install hunspell~ -+ Arch Linux: ~pacman -S hunspell~ -+ NixOS: - #+BEGIN_SRC nix - { - environment.systemPackages = with pkgs; [ - hunspell - ]; - } - #+END_SRC - -** Enchant -+ Ubuntu: ~apt-get install enchant-2~ -+ macOS: ~brew install enchant~ -+ Arch Linux: ~pacman -S enchant~ -+ NixOS: - #+BEGIN_SRC nix - { - environment.systemPackages = with pkgs; [ - enchant - ]; - } - #+END_SRC - - Enchant is just a wrapper for other spelling libraries - and you will need to have at least one of the supported backends installed as well. - -* Features -+ Spell checking and correction using =aspell=, =hunspell= or =enchant=. -+ Ignores source code inside org or markdown files. -+ Lazily spellchecking recent changes only when idle. -+ Choosing suggestions using completion interfaces (=ivy= or =helm=). - -When using =+everywhere=, spell checking is performed for as many major modes as -possible, and not only ~text-mode~ derivatives. e.g. in comments for programming -major modes. - -* Configuration -Dictionary is set by =ispell-dictionary= variable. Can be changed locally with -the function =ispell-change-dictionary=. - -** Changing how quickly spell-fu spellchecks after changes -*** Spell-fu users -Adjust ~spell-fu-idle-delay~ to change how long Emacs waits to spellcheck after -recent changes. -#+BEGIN_SRC elisp -(after! spell-fu - (setq spell-fu-idle-delay 0.5)) ; default is 0.25 -#+END_SRC - -*** Flyspell users -Lazy spellcheck is provided by =flyspell-lazy= package. - -=flyspell-lazy-idle-seconds= sets how many idle seconds until spellchecking -recent changes (default as 1), while =flyspell-lazy-window-idle-seconds= sets -how many seconds until the whole window is spellchecked (default as 3). -#+BEGIN_SRC elisp -(after! flyspell - (setq flyspell-lazy-idle-seconds 2)) -#+END_SRC - -** Reducing false positives by disabling spelling on certain faces -*** Spell-fu users -Users can exclude what faces to preform spellchecking on by adjusting -~+spell-excluded-faces-alist~ in a buffer-local hook: -#+BEGIN_SRC elisp -(setf (alist-get 'markdown-mode +spell-excluded-faces-alist) - '(markdown-code-face - markdown-reference-face - markdown-link-face - markdown-url-face - markdown-markup-face - markdown-html-attr-value-face - markdown-html-attr-name-face - markdown-html-tag-name-face)) -#+END_SRC - -*** Flyspell users -Flyspell will run a series of predicate functions to determine if a word should be spell checked. You can add your own with ~set-flyspell-predicate!~: -#+BEGIN_SRC elisp -(set-flyspell-predicate! '(markdown-mode gfm-mode) - #'+markdown-flyspell-word-p) -#+END_SRC - -Flyspell predicates take no arguments and must return a boolean to determine if -the word at point should be spell checked. For example: -#+BEGIN_SRC elisp -(defun +markdown-flyspell-word-p () - "Return t if point is on a word that should be spell checked. - -Return nil if on a link url, markup, html, or references." - (let ((faces (doom-enlist (get-text-property (point) 'face)))) - (or (and (memq 'font-lock-comment-face faces) - (memq 'markdown-code-face faces)) - (not (cl-loop with unsafe-faces = '(markdown-reference-face - markdown-url-face - markdown-markup-face - markdown-comment-face - markdown-html-attr-name-face - markdown-html-attr-value-face - markdown-html-tag-name-face - markdown-code-face) - for face in faces - if (memq face unsafe-faces) - return t))))) -#+END_SRC - -** Adding or removing words to your personal dictionary -Use ~M-x +spell/add-word~ and ~M-x +spell/remove-word~ to whitelist words that -you know are not misspellings. For evil users these are bound to =zg= and =zw=, -respectively. =+flyspell= users can also add/remove words from the -~flyspell-correct~ popup interface (there will be extra options on the list of -corrections for "save word to dictionary"). - -* TODO Troubleshooting diff --git a/.config/emacs/modules/checkers/spell/autoload/+flyspell.el b/.config/emacs/modules/checkers/spell/autoload/+flyspell.el deleted file mode 100644 index 97feb83..0000000 --- a/.config/emacs/modules/checkers/spell/autoload/+flyspell.el +++ /dev/null @@ -1,86 +0,0 @@ -;;; checkers/spell/autoload/+flyspell.el -*- lexical-binding: t; -*- -;;;###if (featurep! +flyspell) - -;;;###autodef -(defalias 'flyspell-mode! #'flyspell-mode) - -(defvar +spell--flyspell-predicate-alist nil - "TODO") - -;;;###autodef -(defun set-flyspell-predicate! (modes predicate) - "TODO" - (declare (indent defun)) - (dolist (mode (doom-enlist modes) +spell--flyspell-predicate-alist) - (add-to-list '+spell--flyspell-predicate-alist (cons mode predicate)))) - -;;;###autoload -(defun +spell-init-flyspell-predicate-h () - "TODO" - (when-let (pred (assq major-mode +spell--flyspell-predicate-alist)) - (setq-local flyspell-generic-check-word-predicate (cdr pred)))) - -;;;###autoload -(defun +spell-correction-at-point-p (&optional point) - "TODO" - (cl-loop for ov in (overlays-at (or point (point))) - if (overlay-get ov 'flyspell-overlay) - return t)) - -;;;###autoload -(defun +spell/add-word (word &optional scope) - "Add WORD to your personal dictionary, within SCOPE. - -SCOPE can be `buffer' or `session' to exclude words only from the current buffer -or session. Otherwise, the addition is permanent." - (interactive - (list (progn (require 'flyspell) - (car (flyspell-get-word))) - (cond ((equal current-prefix-arg '(16)) - 'session) - ((equal current-prefix-arg '(4)) - 'buffer)))) - (require 'flyspell) - (cond - ((null scope) - (ispell-send-string (concat "*" word "\n")) - (ispell-send-string "#\n") - (flyspell-unhighlight-at (point)) - (setq ispell-pdict-modified-p '(t))) - ((memq scope '(buffer session)) - (ispell-send-string (concat "@" word "\n")) - (add-to-list 'ispell-buffer-session-localwords word) - (or ispell-buffer-local-name ; session localwords might conflict - (setq ispell-buffer-local-name (buffer-name))) - (flyspell-unhighlight-at (point)) - (if (null ispell-pdict-modified-p) - (setq ispell-pdict-modified-p - (list ispell-pdict-modified-p))) - (if (eq scope 'buffer) - (ispell-add-per-file-word-list word)))) - (ispell-pdict-save t)) - -;;;###autoload -(defun +spell/remove-word (word &optional _scope) - "Remove WORD from your personal dictionary." - (interactive) - (user-error "Not supported yet with +flyspell")) - -;;;###autoload -(defun +spell/next-error () - "Jump to next flyspell error." - (interactive) - (call-interactively - (if (featurep 'evil) - #'evil-next-flyspell-error - #'flyspell-goto-next-error))) - -;;;###autoload -(defun +spell/previous-error () - "Jump to previous flyspell error." - (interactive) - (call-interactively - (if (featurep 'evil) - #'evil-prev-flyspell-error - ;; TODO Implement this - (user-error "Not supported")))) diff --git a/.config/emacs/modules/checkers/spell/autoload/+spell-fu.el b/.config/emacs/modules/checkers/spell/autoload/+spell-fu.el deleted file mode 100644 index 33450ee..0000000 --- a/.config/emacs/modules/checkers/spell/autoload/+spell-fu.el +++ /dev/null @@ -1,116 +0,0 @@ -;;; checkers/spell/autoload/+spell-fu.el -*- lexical-binding: t; -*- -;;;###if (not (featurep! +flyspell)) - -(defun +spell--correct (replace poss word orig-pt start end) - (cond ((eq replace 'ignore) - (goto-char orig-pt) - nil) - ((eq replace 'save) - (goto-char orig-pt) - (ispell-send-string (concat "*" word "\n")) - (ispell-send-string "#\n") - (setq ispell-pdict-modified-p '(t))) - ((or (eq replace 'buffer) (eq replace 'session)) - (ispell-send-string (concat "@" word "\n")) - (add-to-list 'ispell-buffer-session-localwords word) - (or ispell-buffer-local-name ; session localwords might conflict - (setq ispell-buffer-local-name (buffer-name))) - (if (null ispell-pdict-modified-p) - (setq ispell-pdict-modified-p - (list ispell-pdict-modified-p))) - (goto-char orig-pt) - (if (eq replace 'buffer) - (ispell-add-per-file-word-list word))) - (replace - (let ((new-word (if (atom replace) - replace - (car replace))) - (orig-pt (+ (- (length word) (- end start)) - orig-pt))) - (unless (equal new-word (car poss)) - (delete-region start end) - (goto-char start) - (insert new-word)))) - ((goto-char orig-pt) - nil))) - -(defun +spell-correct-ivy-fn (candidates word) - (ivy-read (format "Corrections for %S: " word) candidates)) - -(defun +spell-correct-helm-fn (candidates word) - (helm :sources (helm-build-sync-source - "Ispell" - :candidates candidates) - :prompt (format "Corrections for %S: " word))) - -(defun +spell-correct-generic-fn (candidates word) - (completing-read (format "Corrections for %S: " word) candidates)) - -;;;###autoload -(defun +spell/correct () - "Correct spelling of word at point." - (interactive) - ;; spell-fu fails to initialize correctly if it can't find aspell or a similar - ;; program. We want to signal the error, not tell the user that every word is - ;; spelled correctly. - (unless (;; This is what spell-fu uses to check for the aspell executable - or (and ispell-really-aspell ispell-program-name) - (executable-find "aspell")) - (user-error "Aspell is required for spell checking")) - - (ispell-set-spellchecker-params) - (save-current-buffer - (ispell-accept-buffer-local-defs)) - (if (not (or (featurep! :completion ivy) - (featurep! :completion helm) - (featurep! :completion vertico))) - (call-interactively #'ispell-word) - (cl-destructuring-bind (start . end) - (or (bounds-of-thing-at-point 'word) - (user-error "No word at point")) - (let ((word (thing-at-point 'word t)) - (orig-pt (point)) - poss ispell-filter) - (ispell-send-string "%\n") - (ispell-send-string (concat "^" word "\n")) - (while (progn (accept-process-output ispell-process) - (not (string= "" (car ispell-filter))))) - ;; Remove leading empty element - (setq ispell-filter (cdr ispell-filter)) - ;; ispell process should return something after word is sent. Tag word as - ;; valid (i.e., skip) otherwise - (unless ispell-filter - (setq ispell-filter '(*))) - (when (consp ispell-filter) - (setq poss (ispell-parse-output (car ispell-filter)))) - (cond - ((or (eq poss t) (stringp poss)) - ;; don't correct word - (message "%s is correct" (funcall ispell-format-word-function word)) - t) - ((null poss) - ;; ispell error - (error "Ispell: error in Ispell process")) - (t - ;; The word is incorrect, we have to propose a replacement. - (setq res (funcall +spell-correct-interface (nth 2 poss) word)) - ;; Some interfaces actually eat 'C-g' so it's impossible to stop rapid - ;; mode. So when interface returns nil we treat it as a stop. - (unless res (setq res (cons 'break word))) - (cond - ((stringp res) - (+spell--correct res poss word orig-pt start end)) - ((let ((cmd (car res)) - (wrd (cdr res))) - (unless (or (eq cmd 'skip) - (eq cmd 'break) - (eq cmd 'stop)) - (+spell--correct cmd poss wrd orig-pt start end) - (unless (string-equal wrd word) - (+spell--correct wrd poss word orig-pt start end)))))) - (ispell-pdict-save t))))))) - -;;;###autoload (defalias '+spell/add-word #'spell-fu-word-add) -;;;###autoload (defalias '+spell/remove-word #'spell-fu-word-remove) -;;;###autoload (defalias '+spell/next-error #'spell-fu-goto-next-error) -;;;###autoload (defalias '+spell/previous-error #'spell-fu-goto-previous-error) diff --git a/.config/emacs/modules/checkers/spell/config.el b/.config/emacs/modules/checkers/spell/config.el deleted file mode 100644 index c97d2c3..0000000 --- a/.config/emacs/modules/checkers/spell/config.el +++ /dev/null @@ -1,245 +0,0 @@ -;;; checkers/spell/config.el -*- lexical-binding: t; -*- - -;; -;;; Ispell - -;; `elisp-mode' is loaded at startup. In order to lazy load its config we need -;; to pretend it isn't loaded -(delq! 'ispell features) - -(global-set-key [remap ispell-word] #'+spell/correct) - -(after! ispell - ;; Don't spellcheck org blocks - (pushnew! ispell-skip-region-alist - '(":\\(PROPERTIES\\|LOGBOOK\\):" . ":END:") - '("#\\+BEGIN_SRC" . "#\\+END_SRC") - '("#\\+BEGIN_EXAMPLE" . "#\\+END_EXAMPLE")) - - ;; Enable either aspell, hunspell or enchant. - ;; If no module flags are given, enable either aspell, hunspell or enchant - ;; if their binary is found. - ;; If one of the flags `+aspell', `+hunspell' or `+enchant' is given, - ;; only enable that spell checker. - (pcase (cond ((featurep! +aspell) 'aspell) - ((featurep! +hunspell) 'hunspell) - ((featurep! +enchant) 'enchant) - ((executable-find "aspell") 'aspell) - ((executable-find "hunspell") 'hunspell) - ((executable-find "enchant-2") 'enchant)) - (`aspell - (setq ispell-program-name "aspell" - ispell-extra-args '("--sug-mode=ultra" - "--run-together")) - - (unless ispell-aspell-dict-dir - (setq ispell-aspell-dict-dir - (ispell-get-aspell-config-value "dict-dir"))) - (unless ispell-aspell-data-dir - (setq ispell-aspell-data-dir - (ispell-get-aspell-config-value "data-dir"))) - (unless ispell-personal-dictionary - (setq ispell-personal-dictionary - (expand-file-name (concat "ispell/" ispell-dictionary ".pws") - doom-etc-dir))) - - (add-hook! 'text-mode-hook - (defun +spell-remove-run-together-switch-for-aspell-h () - (setq-local ispell-extra-args (remove "--run-together" ispell-extra-args)))) - - (defun +spell-init-ispell-extra-args-a (orig-fun &rest args) - :around '(ispell-word flyspell-auto-correct-word) - (let ((ispell-extra-args (remove "--run-together" ispell-extra-args))) - (ispell-kill-ispell t) - (apply orig-fun args) - (ispell-kill-ispell t)))) - - (`hunspell - (setq ispell-program-name "hunspell")) - - (`enchant - (setq ispell-program-name "enchant-2")) - - (_ (doom-log "Spell checker not found. Either install `aspell', `hunspell' or `enchant'")))) - - -;; -;;; Implementations - -(eval-if! (not (featurep! +flyspell)) - - (use-package! spell-fu - :when (executable-find "aspell") - :hook (text-mode . spell-fu-mode) - :general ([remap ispell-word] #'+spell/correct) - :preface - (defvar +spell-correct-interface - (cond ((featurep! :completion ivy) - #'+spell-correct-ivy-fn) - ((featurep! :completion helm) - #'+spell-correct-helm-fn) - (#'+spell-correct-generic-fn)) - "Function to use to display corrections.") - - :init - (defvar +spell-excluded-faces-alist - '((markdown-mode - . (markdown-code-face - markdown-html-attr-name-face - markdown-html-attr-value-face - markdown-html-tag-name-face - markdown-inline-code-face - markdown-link-face - markdown-markup-face - markdown-plain-url-face - markdown-reference-face - markdown-url-face)) - (org-mode - . (org-block - org-block-begin-line - org-block-end-line - org-code - org-cite - org-cite-key - org-date - org-footnote - org-formula - org-latex-and-related - org-link - org-meta-line - org-property-value - org-ref-cite-face - org-special-keyword - org-tag - org-todo - org-todo-keyword-done - org-todo-keyword-habt - org-todo-keyword-kill - org-todo-keyword-outd - org-todo-keyword-todo - org-todo-keyword-wait - org-verbatim)) - (latex-mode - . (font-latex-math-face - font-latex-sedate-face - font-lock-function-name-face - font-lock-keyword-face - font-lock-variable-name-face))) - "Faces in certain major modes that spell-fu will not spellcheck.") - - (setq spell-fu-directory (concat doom-etc-dir "spell-fu")) - (when (featurep! +everywhere) - (add-hook! '(yaml-mode-hook - conf-mode-hook - prog-mode-hook) - #'spell-fu-mode)) - :config - ;; TODO PR this fix upstream! - (defadvice! +spell--fix-face-detection-a (fn &rest args) - "`spell-fu--faces-at-point' uses face detection that won't penetrary -overlays (like `hl-line'). This makes `spell-fu-faces-exclude' demonstrably less -useful when it'll still spellcheck excluded faces on any line that `hl-line' is -displayed on, even momentarily." - :around #'spell-fu--faces-at-point - (letf! (defun get-char-property (pos prop &optional obj) - (or (plist-get (text-properties-at pos) prop) - (funcall get-char-property pos prop obj))) - (apply fn args))) - - (defadvice! +spell--create-word-dict-a (_word words-file _action) - "Prevent `spell-fu--word-add-or-remove' from throwing non-existant -directory errors when writing a personal dictionary file (by creating the -directory first)." - :before #'spell-fu--word-add-or-remove - (unless (file-exists-p words-file) - (make-directory (file-name-directory words-file) t) - (with-temp-file words-file - (insert (format "personal_ws-1.1 %s 0\n" ispell-dictionary))))) - - (add-hook! 'spell-fu-mode-hook - (defun +spell-init-excluded-faces-h () - "Set `spell-fu-faces-exclude' according to `+spell-excluded-faces-alist'." - (when-let (excluded (cdr (cl-find-if #'derived-mode-p +spell-excluded-faces-alist :key #'car))) - (setq-local spell-fu-faces-exclude excluded)))) - - ;; TODO custom `spell-fu-check-range' function to reduce false positives - ;; more intelligently, or modify `spell-fu-word-regexp' to include - ;; non-latin charactersets. - ) - - (use-package! flyspell ; built-in - :defer t - :preface - ;; `flyspell' is loaded at startup. In order to lazy load its config we need - ;; to pretend it isn't loaded. - (defer-feature! flyspell flyspell-mode flyspell-prog-mode) - :init - (add-hook! '(org-mode-hook - markdown-mode-hook - TeX-mode-hook - rst-mode-hook - mu4e-compose-mode-hook - message-mode-hook - git-commit-mode-hook) - #'flyspell-mode) - - (when (featurep! +everywhere) - (add-hook! '(yaml-mode-hook - conf-mode-hook - prog-mode-hook) - #'flyspell-prog-mode)) - - :config - (provide 'ispell) ; forcibly load ispell configs - - (setq flyspell-issue-welcome-flag nil - ;; Significantly speeds up flyspell, which would otherwise print - ;; messages for every word when checking the entire buffer - flyspell-issue-message-flag nil) - - (add-hook! 'flyspell-mode-hook - (defun +spell-inhibit-duplicate-detection-maybe-h () - "Don't mark duplicates when style/grammar linters are present. -e.g. proselint and langtool." - (and (or (and (bound-and-true-p flycheck-mode) - (executable-find "proselint")) - (featurep 'langtool)) - (setq-local flyspell-mark-duplications-flag nil)))) - - ;; Ensure mode-local predicates declared with `set-flyspell-predicate!' are - ;; used in their respective major modes. - (add-hook 'flyspell-mode-hook #'+spell-init-flyspell-predicate-h) - - (let ((flyspell-correct - (cmds! (and (not mark-active) - (not (and (bound-and-true-p evil-local-mode) - (or (evil-insert-state-p) - (evil-emacs-state-p)))) - (memq 'flyspell-incorrect (face-at-point nil t))) - #'flyspell-correct-at-point))) - (map! :map flyspell-mouse-map - "RET" flyspell-correct - [return] flyspell-correct - [mouse-1] #'flyspell-correct-at-point))) - - - (use-package! flyspell-correct - :commands flyspell-correct-previous - :general ([remap ispell-word] #'flyspell-correct-at-point) - :config - (cond ((and (featurep! :completion helm) - (require 'flyspell-correct-helm nil t))) - ((and (featurep! :completion ivy) - (require 'flyspell-correct-ivy nil t))) - ((featurep! :completion vertico)) ; vertico doesn't need any extra configuration - ((require 'flyspell-correct-popup nil t) ; only use popup if no compatible completion UI is enabled - (setq flyspell-popup-correct-delay 0.8) - (define-key popup-menu-keymap [escape] #'keyboard-quit)))) - - - (use-package! flyspell-lazy - :after flyspell - :config - (setq flyspell-lazy-idle-seconds 1 - flyspell-lazy-window-idle-seconds 3) - (flyspell-lazy-mode +1))) diff --git a/.config/emacs/modules/checkers/spell/doctor.el b/.config/emacs/modules/checkers/spell/doctor.el deleted file mode 100644 index b24824e..0000000 --- a/.config/emacs/modules/checkers/spell/doctor.el +++ /dev/null @@ -1,10 +0,0 @@ -;;; checkers/spell/doctor.el -*- lexical-binding: t; -*- - -(when (or (not (featurep! +flyspell)) - (featurep! +aspell)) - (unless (executable-find "aspell") - (warn! "Couldn't find aspell executable; spell checker will not work"))) - -(when (featurep! +hunspell) - (unless (executable-find "hunspell") - (warn! "Couldn't find hunspell executable; spell checker will not work"))) diff --git a/.config/emacs/modules/checkers/spell/packages.el b/.config/emacs/modules/checkers/spell/packages.el deleted file mode 100644 index 65b2da9..0000000 --- a/.config/emacs/modules/checkers/spell/packages.el +++ /dev/null @@ -1,13 +0,0 @@ -;; -*- no-byte-compile: t; -*- -;;; checkers/spell/packages.el - -(if (not (featurep! +flyspell)) - (package! spell-fu :pin "10823ae58f88874aff2a6a35f2da75c8503e726e") - (package! flyspell-correct :pin "00357953a736e21d0a1c8d76f5605820990544fe") - (cond ((featurep! :completion ivy) - (package! flyspell-correct-ivy)) - ((featurep! :completion helm) - (package! flyspell-correct-helm)) - ((not (featurep! :completion vertico)) - (package! flyspell-correct-popup))) - (package! flyspell-lazy :pin "0fc5996bcee20b46cbd227ae948d343c3bef7339")) diff --git a/.config/emacs/modules/checkers/syntax/README.org b/.config/emacs/modules/checkers/syntax/README.org deleted file mode 100644 index 08c9b13..0000000 --- a/.config/emacs/modules/checkers/syntax/README.org +++ /dev/null @@ -1,66 +0,0 @@ -#+TITLE: checkers/syntax -#+DATE: February 20, 2017 -#+SINCE: v2.0 -#+STARTUP: inlineimages nofold - -* Table of Contents :TOC_3:noexport: -- [[#description][Description]] - - [[#maintainers][Maintainers]] - - [[#module-flags][Module Flags]] - - [[#plugins][Plugins]] - - [[#hacks][Hacks]] -- [[#prerequisites][Prerequisites]] -- [[#features][Features]] -- [[#configuration][Configuration]] -- [[#troubleshooting][Troubleshooting]] - -* Description -This module provides syntax checking and error highlighting, powered by [[https://github.com/flycheck/flycheck][flycheck]] - -+ If possible, include a brief list of feature highlights here -+ Like code completion, syntax checking or available snippets -+ Include links to packages & external things where possible - -** Maintainers -This module has no dedicated maintainers. - -** Module Flags -+ =+childframe= Enables displaying completion candidates in a child frame, rather than an overlay or tooltip (among with other UI enhancements). - - -** Plugins -+ [[https://github.com/flycheck/flycheck][flycheck]] -+ [[https://github.com/flycheck/flycheck-popup-tip][flycheck-popup-tip]] -+ =+childframe= - + [[https://github.com/alexmurray/flycheck-posframe][flycheck-posframe]] - -** Hacks -If =lsp-ui-mode= is active, most of the aesthetic functionality of this module is turned off, as they show the same information. - -* Prerequisites -This module has no direct prerequisites. - -However, some major modes may require a specific linter or program to work, and some major modes may not work at all. The best way to find these dependencies is by either reading the documentation for that module, or running =doom doctor=. - -* Features -Most of flycheck's features are under =C-c !=, regardless of whether evil mode is used. -| Keybind | Description | -| C-c ! ? | Describe Checker ] | -| C-c ! c | Check syntax in buffer | -| C-c ! l | List errors | -| C-c ! n | Next Error | -| C-c ! p | Previous error | -| C-c ! C | Clear all errors in buffer | -| C-c ! e | Explain error at point | -| C-c ! h | Display all errors at point | - -Evil Specific -| Keybind | Description | -| SPC t f | Toggle Flycheck | -| SPC c x | List errors | -| ] e | Next error | -| [ e | Prevous error | - -* TODO Configuration - -* TODO Troubleshooting diff --git a/.config/emacs/modules/checkers/syntax/autoload.el b/.config/emacs/modules/checkers/syntax/autoload.el deleted file mode 100644 index 4dc9635..0000000 --- a/.config/emacs/modules/checkers/syntax/autoload.el +++ /dev/null @@ -1,25 +0,0 @@ -;;; checkers/syntax/autoload.el -*- lexical-binding: t; -*- - -;;;###autodef -(defun set-next-checker! (mode checker next &optional append) - "TODO" - (let ((fn (intern (format "+syntax--init-checkers-for-%s-h" mode)))) - (fset fn - (lambda () - (if (not (bound-and-true-p flycheck-mode)) - (add-hook 'flycheck-mode-hook fn 'append 'local) - (flycheck-add-next-checker checker next append) - (remove-hook 'flycheck-mode-hook fn 'local)))) - (add-hook (intern (format "%s-hook" mode)) fn))) - -;;;###autoload -(defun +syntax-init-popups-h () - "Activate `flycheck-posframe-mode' if available and in GUI Emacs. -Activate `flycheck-popup-tip-mode' otherwise. -Do nothing if `lsp-ui-mode' is active and `lsp-ui-sideline-enable' is non-nil." - (unless (and (bound-and-true-p lsp-ui-mode) - lsp-ui-sideline-enable) - (if (and (fboundp 'flycheck-posframe-mode) - (display-graphic-p)) - (flycheck-posframe-mode +1) - (flycheck-popup-tip-mode +1)))) diff --git a/.config/emacs/modules/checkers/syntax/config.el b/.config/emacs/modules/checkers/syntax/config.el deleted file mode 100644 index e535ab2..0000000 --- a/.config/emacs/modules/checkers/syntax/config.el +++ /dev/null @@ -1,83 +0,0 @@ -;;; checkers/syntax/config.el -*- lexical-binding: t; -*- - -;; -;;; Flycheck - -(use-package! flycheck - :commands flycheck-list-errors flycheck-buffer - :hook (doom-first-buffer . global-flycheck-mode) - :config - (setq flycheck-emacs-lisp-load-path 'inherit) - - ;; Rerunning checks on every newline is a mote excessive. - (delq 'new-line flycheck-check-syntax-automatically) - ;; And don't recheck on idle as often - (setq flycheck-idle-change-delay 1.0) - - ;; For the above functionality, check syntax in a buffer that you switched to - ;; only briefly. This allows "refreshing" the syntax check state for several - ;; buffers quickly after e.g. changing a config file. - (setq flycheck-buffer-switch-check-intermediate-buffers t) - - ;; Display errors a little quicker (default is 0.9s) - (setq flycheck-display-errors-delay 0.25) - - ;; Don't commandeer input focus if the error message pops up (happens when - ;; tooltips and childframes are disabled). - (set-popup-rules! - '(("^\\*Flycheck error messages\\*" :select nil) - ("^\\*Flycheck errors\\*" :size 0.25))) - - (add-hook! 'doom-escape-hook :append - (defun +syntax-check-buffer-h () - "Flycheck buffer on ESC in normal mode." - (when flycheck-mode - (ignore-errors (flycheck-buffer)) - nil))) - - (map! :map flycheck-error-list-mode-map - :n "C-n" #'flycheck-error-list-next-error - :n "C-p" #'flycheck-error-list-previous-error - :n "j" #'flycheck-error-list-next-error - :n "k" #'flycheck-error-list-previous-error - :n "RET" #'flycheck-error-list-goto-error - :n [return] #'flycheck-error-list-goto-error)) - - -(use-package! flycheck-popup-tip - :commands flycheck-popup-tip-show-popup flycheck-popup-tip-delete-popup - :hook (flycheck-mode . +syntax-init-popups-h) - :config - (setq flycheck-popup-tip-error-prefix "X ") - (after! evil - ;; Don't display popups while in insert or replace mode, as it can affect - ;; the cursor's position or cause disruptive input delays. - (add-hook! '(evil-insert-state-entry-hook evil-replace-state-entry-hook) - #'flycheck-popup-tip-delete-popup) - (defadvice! +syntax--disable-flycheck-popup-tip-maybe-a (&rest _) - :before-while #'flycheck-popup-tip-show-popup - (if evil-local-mode - (eq evil-state 'normal) - (not (bound-and-true-p company-backend)))))) - - -(use-package! flycheck-posframe - :when (featurep! +childframe) - :hook (flycheck-mode . +syntax-init-popups-h) - :config - (setq flycheck-posframe-warning-prefix "! " - flycheck-posframe-info-prefix "··· " - flycheck-posframe-error-prefix "X ") - (after! company - ;; Don't display popups if company is open - (add-hook 'flycheck-posframe-inhibit-functions #'company--active-p)) - (after! evil - ;; Don't display popups while in insert or replace mode, as it can affect - ;; the cursor's position or cause disruptive input delays. - (add-hook! 'flycheck-posframe-inhibit-functions - #'evil-insert-state-p - #'evil-replace-state-p))) - - -;; -;;; TODO Flymake diff --git a/.config/emacs/modules/checkers/syntax/packages.el b/.config/emacs/modules/checkers/syntax/packages.el deleted file mode 100644 index c75a306..0000000 --- a/.config/emacs/modules/checkers/syntax/packages.el +++ /dev/null @@ -1,9 +0,0 @@ -;; -*- no-byte-compile: t; -*- -;;; checkers/syntax/packages.el - -(package! flycheck :pin "784f184cdd9f9cb4e3dbb997c09d93e954142842") -(package! flycheck-popup-tip :pin "ef86aad907f27ca076859d8d9416f4f7727619c6") -(when (featurep! +childframe) - (package! flycheck-posframe :pin "8f60c9bf124ab9597d681504a73fdf116a0bde12")) - -;; TODO flymake? diff --git a/.config/emacs/modules/completion/company/README.org b/.config/emacs/modules/completion/company/README.org deleted file mode 100644 index 7e581ca..0000000 --- a/.config/emacs/modules/completion/company/README.org +++ /dev/null @@ -1,130 +0,0 @@ -#+TITLE: completion/company -#+DATE: February 19, 2017 -#+SINCE: v2.0 -#+STARTUP: inlineimages - -* Table of Contents :TOC_3:noexport: -- [[#description][Description]] - - [[#module-flags][Module Flags]] - - [[#plugins][Plugins]] -- [[#prerequisites][Prerequisites]] -- [[#features][Features]] - - [[#code-completion][Code completion]] - - [[#vim-esque-omni-completion-prefix-c-x][Vim-esque omni-completion prefix (C-x)]] -- [[#configuration][Configuration]] - - [[#enable-company-backends-in-certain-modes][Enable company backend(s) in certain modes]] -- [[#troubleshooting][Troubleshooting]] - - [[#x-mode-doesnt-have-code-completion-support-or-requires-extra-setup][X-mode doesn't have code completion support or requires extra setup.]] - - [[#no-backends-or-the-incorrect-ones-have-been-registered-for-x-mode][No backends (or the incorrect ones) have been registered for X-mode.]] - -* Description -This module provides code completion, powered by [[https://github.com/company-mode/company-mode][company-mode]]. It is required -for code completion in many of Doom's :lang modules. - -https://assets.doomemacs.org/completion/company/overlay.png - -** Module Flags -+ =+childframe= Enables displaying completion candidates in a child frame, - rather than an overlay or tooltip (among with other UI enhancements). *This - requires GUI Emacs 26.1+ and is incompatible with the =+tng= flag* -+ =+tng= Enables completion using only ~TAB~. Pressing ~TAB~ will select the - next completion suggestion, while ~S-TAB~ will select the previous one. *This - is incompatible with the =+childframe= flag* - -** Plugins -+ [[https://github.com/company-mode/company-mode][company-mode]] -+ [[https://github.com/hlissner/emacs-company-dict][company-dict]] -+ [[https://github.com/sebastiencs/company-box][company-box]]* (=+childframe=) - -* Prerequisites -This module has no direct prerequisites. - -However, some major modes may require additional setup for code completion to -work in them. Some major modes may have no completion support at all. Check that -major mode's module's documentation for details. - -* Features -** Code completion -By default, completion is triggered after a short idle period or with the -=C-SPC= key. While the popup is visible, the following keys are available: - -| Keybind | Description | -|---------+------------------------------------------| -| =C-n= | Go to next candidate | -| =C-p= | Go to previous candidate | -| =C-j= | (evil) Go to next candidate | -| =C-k= | (evil) Go to previous candidate | -| =C-h= | Display documentation (if available) | -| =C-u= | Move to previous page of candidates | -| =C-d= | Move to next page of candidates | -| =C-s= | Filter candidates | -| =C-S-s= | Search candidates with helm/ivy | -| =C-SPC= | Complete common | -| =TAB= | Complete common or select next candidate | -| =S-TAB= | Select previous candidate | - -** Vim-esque omni-completion prefix (C-x) -In the spirit of Vim's omni-completion, the following insert mode keybinds are -available to evil users to access specific company backends: - -| Keybind | Description | -|-----------+-----------------------------------| -| =C-x C-]= | Complete etags | -| =C-x C-f= | Complete file path | -| =C-x C-k= | Complete from dictionary/keyword | -| =C-x C-l= | Complete full line | -| =C-x C-o= | Invoke complete-at-point function | -| =C-x C-n= | Complete next symbol at point | -| =C-x C-p= | Complete previous symbol at point | -| =C-x C-s= | Complete snippet | -| =C-x s= | Complete spelling suggestions | - -* Configuration -** Enable company backend(s) in certain modes -The ~set-company-backend!~ function exists for setting ~company-backends~ -buffer-locally in MODES, which is either a major-mode symbol, a minor-mode -symbol, or a list of either. BACKENDS are prepended to ~company-backends~ for -those modes. - -#+BEGIN_SRC emacs-lisp -(after! js2-mode - (set-company-backend! 'js2-mode 'company-tide 'company-yasnippet)) - -(after! sh-script - (set-company-backend! 'sh-mode - '(company-shell :with company-yasnippet))) - -(after! cc-mode - (set-company-backend! 'c-mode - '(:separate company-irony-c-headers company-irony))) -#+END_SRC - -To unset the backends for a particular mode, pass ~nil~ to it: - -#+BEGIN_SRC emacs-lisp -(after! sh-script - (set-company-backend! 'sh-mode nil)) -#+END_SRC - -* Troubleshooting -If code completion isn't working for you, consider the following common causes -before you file a bug report: - -** X-mode doesn't have code completion support or requires extra setup. -There is no guarantee your language mode will have completion support. - -Some, like ~lua-mode~, don't have completion support in Emacs at all. Others may -requires additional setup to get code completion working. For instance, -~go-mode~ requires ~guru~ to be installed on your system, and ~ruby-mode~ -requires that you have a Robe server running (~M-x robe-start~). - -Check the relevant module's documentation for this kind of information. - -** No backends (or the incorrect ones) have been registered for X-mode. -Doom expects every mode to have an explicit list of company-backends (and as -short a list as possible). This may mean you aren't getting all the completion -you want or any at all. - -Check the value of ~company-backends~ (=SPC h v company-backends=) from that -mode to see what backends are available. Check the [[*Assigning company backend(s) to modes][Configuration section]] for -details on changing what backends are available for that mode. diff --git a/.config/emacs/modules/completion/company/autoload.el b/.config/emacs/modules/completion/company/autoload.el deleted file mode 100644 index f9c0fc0..0000000 --- a/.config/emacs/modules/completion/company/autoload.el +++ /dev/null @@ -1,157 +0,0 @@ -;;; completion/company/autoload.el -*- lexical-binding: t; -*- - -;;;###autoload -(defvar +company-backend-alist - '((text-mode (:separate company-dabbrev company-yasnippet company-ispell)) - (prog-mode company-capf company-yasnippet) - (conf-mode company-capf company-dabbrev-code company-yasnippet)) - "An alist matching modes to company backends. The backends for any mode is -built from this.") - -;;;###autodef -(defun set-company-backend! (modes &rest backends) - "Prepends BACKENDS (in order) to `company-backends' in MODES. - -MODES should be one symbol or a list of them, representing major or minor modes. -This will overwrite backends for MODES on consecutive uses. - -If the car of BACKENDS is nil, unset the backends for MODES. - -Examples: - - (set-company-backend! 'js2-mode - 'company-tide 'company-yasnippet) - - (set-company-backend! 'sh-mode - '(company-shell :with company-yasnippet)) - - (set-company-backend! '(c-mode c++-mode) - '(:separate company-irony-c-headers company-irony)) - - (set-company-backend! 'sh-mode nil) ; unsets backends for sh-mode" - (declare (indent defun)) - (dolist (mode (doom-enlist modes)) - (if (null (car backends)) - (setq +company-backend-alist - (delq (assq mode +company-backend-alist) - +company-backend-alist)) - (setf (alist-get mode +company-backend-alist) - backends)))) - - -;; -;;; Library - -(defun +company--backends () - (let (backends) - (let ((mode major-mode) - (modes (list major-mode))) - (while (setq mode (get mode 'derived-mode-parent)) - (push mode modes)) - (dolist (mode modes) - (dolist (backend (append (cdr (assq mode +company-backend-alist)) - (default-value 'company-backends))) - (push backend backends))) - (delete-dups - (append (cl-loop for (mode . backends) in +company-backend-alist - if (or (eq major-mode mode) ; major modes - (and (boundp mode) - (symbol-value mode))) ; minor modes - append backends) - (nreverse backends)))))) - - -;; -;;; Hooks - -;;;###autoload -(defun +company-init-backends-h () - "Set `company-backends' for the current buffer." - (or (memq major-mode '(fundamental-mode special-mode)) - buffer-read-only - (doom-temp-buffer-p (or (buffer-base-buffer) (current-buffer))) - (setq-local company-backends (+company--backends)))) - -(put '+company-init-backends-h 'permanent-local-hook t) - - -;; -;;; Commands - -;;;###autoload -(defun +company-has-completion-p () - "Return non-nil if a completion candidate exists at point." - (when company-mode - (unless company-candidates-length - (company-manual-begin)) - (= company-candidates-length 1))) - -;;;###autoload -(defun +company/toggle-auto-completion () - "Toggle as-you-type code completion." - (interactive) - (require 'company) - (setq company-idle-delay (unless company-idle-delay 0.2)) - (message "Auto completion %s" - (if company-idle-delay "enabled" "disabled"))) - -;;;###autoload -(defun +company/complete () - "Bring up the completion popup. If only one result, complete it." - (interactive) - (require 'company) - (when (ignore-errors - (/= (point) - (cdr (bounds-of-thing-at-point 'symbol)))) - (save-excursion (insert " "))) - (when (and (company-manual-begin) - (= company-candidates-length 1)) - (company-complete-common))) - -;;;###autoload -(defun +company/dabbrev () - "Invokes `company-dabbrev-code' in prog-mode buffers and `company-dabbrev' -everywhere else." - (interactive) - (call-interactively - (if (derived-mode-p 'prog-mode) - #'company-dabbrev-code - #'company-dabbrev))) - -;;;###autoload -(defun +company/whole-lines (command &optional arg &rest ignored) - "`company-mode' completion backend that completes whole-lines, akin to vim's -C-x C-l." - (interactive (list 'interactive)) - (require 'company) - (pcase command - (`interactive (company-begin-backend '+company/whole-lines)) - (`prefix (company-grab-line "^[\t\s]*\\(.+\\)" 1)) - (`candidates - (all-completions - arg - (delete-dups - (split-string - (replace-regexp-in-string - "^[\t\s]+" "" - (concat (buffer-substring-no-properties (point-min) (line-beginning-position)) - (buffer-substring-no-properties (line-end-position) (point-max)))) - "\\(\r\n\\|[\n\r]\\)" t)))))) - -;;;###autoload -(defun +company/dict-or-keywords () - "`company-mode' completion combining `company-dict' and `company-keywords'." - (interactive) - (require 'company-dict) - (require 'company-keywords) - (let ((company-backends '((company-keywords company-dict)))) - (call-interactively #'company-complete))) - -;;;###autoload -(defun +company/dabbrev-code-previous () - "TODO" - (interactive) - (require 'company-dabbrev) - (let ((company-selection-wrap-around t)) - (call-interactively #'+company/dabbrev) - (company-select-previous-or-abort))) diff --git a/.config/emacs/modules/completion/company/config.el b/.config/emacs/modules/completion/company/config.el deleted file mode 100644 index 64a25ae..0000000 --- a/.config/emacs/modules/completion/company/config.el +++ /dev/null @@ -1,189 +0,0 @@ -;;; completion/company/config.el -*- lexical-binding: t; -*- - -(use-package! company - :commands (company-complete-common - company-complete-common-or-cycle - company-manual-begin - company-grab-line) - :hook (doom-first-input . global-company-mode) - :init - (setq company-minimum-prefix-length 2 - company-tooltip-limit 14 - company-tooltip-align-annotations t - company-require-match 'never - company-global-modes - '(not erc-mode - circe-mode - message-mode - help-mode - gud-mode - vterm-mode) - company-frontends - '(company-pseudo-tooltip-frontend ; always show candidates in overlay tooltip - company-echo-metadata-frontend) ; show selected candidate docs in echo area - - ;; Buffer-local backends will be computed when loading a major mode, so - ;; only specify a global default here. - company-backends '(company-capf) - - ;; These auto-complete the current selection when - ;; `company-auto-commit-chars' is typed. This is too magical. We - ;; already have the much more explicit RET and TAB. - company-auto-commit nil - - ;; Only search the current buffer for `company-dabbrev' (a backend that - ;; suggests text your open buffers). This prevents Company from causing - ;; lag once you have a lot of buffers open. - company-dabbrev-other-buffers nil - ;; Make `company-dabbrev' fully case-sensitive, to improve UX with - ;; domain-specific words with particular casing. - company-dabbrev-ignore-case nil - company-dabbrev-downcase nil) - - (when (featurep! +tng) - (add-hook 'global-company-mode-hook #'company-tng-mode)) - - :config - (when (featurep! :editor evil) - (add-hook 'company-mode-hook #'evil-normalize-keymaps) - (unless (featurep! +childframe) - ;; Don't persist company popups when switching back to normal mode. - ;; `company-box' aborts on mode switch so it doesn't need this. - (add-hook! 'evil-normal-state-entry-hook - (defun +company-abort-h () - ;; HACK `company-abort' doesn't no-op if company isn't active; causing - ;; unwanted side-effects, like the suppression of messages in the - ;; echo-area. - ;; REVIEW Revisit this to refactor; shouldn't be necessary! - (when company-candidates - (company-abort))))) - ;; Allow users to switch between backends on the fly. E.g. C-x C-s followed - ;; by C-x C-n, will switch from `company-yasnippet' to - ;; `company-dabbrev-code'. - (defadvice! +company--abort-previous-a (&rest _) - :before #'company-begin-backend - (company-abort))) - - (add-hook 'after-change-major-mode-hook #'+company-init-backends-h 'append) - - - ;; NOTE Fix #1335: ensure `company-emulation-alist' is the first item of - ;; `emulation-mode-map-alists', thus higher priority than keymaps of - ;; evil-mode. We raise the priority of company-mode keymaps - ;; unconditionally even when completion is not activated. This should not - ;; cause problems, because when completion is activated, the value of - ;; `company-emulation-alist' is ((t . company-my-keymap)), when - ;; completion is not activated, the value is ((t . nil)). - (add-hook! 'evil-local-mode-hook - (when (memq 'company-emulation-alist emulation-mode-map-alists) - (company-ensure-emulation-alist))) - - ;; Fix #4355: allow eldoc to trigger after completions. - (after! eldoc - (eldoc-add-command 'company-complete-selection - 'company-complete-common - 'company-capf - 'company-abort))) - - -;; -;;; Packages - -(after! company-files - ;; Fix `company-files' completion for org file:* links - (add-to-list 'company-files--regexps "file:\\(\\(?:\\.\\{1,2\\}/\\|~/\\|/\\)[^\]\n]*\\)")) - - -(use-package! company-box - :when (featurep! +childframe) - :hook (company-mode . company-box-mode) - :config - (setq company-box-show-single-candidate t - company-box-backends-colors nil - company-box-max-candidates 50 - company-box-icons-alist 'company-box-icons-all-the-icons - ;; Move company-box-icons--elisp to the end, because it has a catch-all - ;; clause that ruins icons from other backends in elisp buffers. - company-box-icons-functions - (cons #'+company-box-icons--elisp-fn - (delq 'company-box-icons--elisp - company-box-icons-functions)) - company-box-icons-all-the-icons - (let ((all-the-icons-scale-factor 0.8)) - `((Unknown . ,(all-the-icons-material "find_in_page" :face 'all-the-icons-purple)) - (Text . ,(all-the-icons-material "text_fields" :face 'all-the-icons-green)) - (Method . ,(all-the-icons-material "functions" :face 'all-the-icons-red)) - (Function . ,(all-the-icons-material "functions" :face 'all-the-icons-red)) - (Constructor . ,(all-the-icons-material "functions" :face 'all-the-icons-red)) - (Field . ,(all-the-icons-material "functions" :face 'all-the-icons-red)) - (Variable . ,(all-the-icons-material "adjust" :face 'all-the-icons-blue)) - (Class . ,(all-the-icons-material "class" :face 'all-the-icons-red)) - (Interface . ,(all-the-icons-material "settings_input_component" :face 'all-the-icons-red)) - (Module . ,(all-the-icons-material "view_module" :face 'all-the-icons-red)) - (Property . ,(all-the-icons-material "settings" :face 'all-the-icons-red)) - (Unit . ,(all-the-icons-material "straighten" :face 'all-the-icons-red)) - (Value . ,(all-the-icons-material "filter_1" :face 'all-the-icons-red)) - (Enum . ,(all-the-icons-material "plus_one" :face 'all-the-icons-red)) - (Keyword . ,(all-the-icons-material "filter_center_focus" :face 'all-the-icons-red)) - (Snippet . ,(all-the-icons-material "short_text" :face 'all-the-icons-red)) - (Color . ,(all-the-icons-material "color_lens" :face 'all-the-icons-red)) - (File . ,(all-the-icons-material "insert_drive_file" :face 'all-the-icons-red)) - (Reference . ,(all-the-icons-material "collections_bookmark" :face 'all-the-icons-red)) - (Folder . ,(all-the-icons-material "folder" :face 'all-the-icons-red)) - (EnumMember . ,(all-the-icons-material "people" :face 'all-the-icons-red)) - (Constant . ,(all-the-icons-material "pause_circle_filled" :face 'all-the-icons-red)) - (Struct . ,(all-the-icons-material "streetview" :face 'all-the-icons-red)) - (Event . ,(all-the-icons-material "event" :face 'all-the-icons-red)) - (Operator . ,(all-the-icons-material "control_point" :face 'all-the-icons-red)) - (TypeParameter . ,(all-the-icons-material "class" :face 'all-the-icons-red)) - (Template . ,(all-the-icons-material "short_text" :face 'all-the-icons-green)) - (ElispFunction . ,(all-the-icons-material "functions" :face 'all-the-icons-red)) - (ElispVariable . ,(all-the-icons-material "check_circle" :face 'all-the-icons-blue)) - (ElispFeature . ,(all-the-icons-material "stars" :face 'all-the-icons-orange)) - (ElispFace . ,(all-the-icons-material "format_paint" :face 'all-the-icons-pink))))) - - ;; HACK Fix oversized scrollbar in some odd cases - ;; REVIEW `resize-mode' is deprecated and may stop working in the future. - ;; TODO PR me upstream? - (setq x-gtk-resize-child-frames 'resize-mode) - - ;; Disable tab-bar in company-box child frames - ;; TODO PR me upstream! - (add-to-list 'company-box-frame-parameters '(tab-bar-lines . 0)) - - ;; Don't show documentation in echo area, because company-box displays its own - ;; in a child frame. - (delq! 'company-echo-metadata-frontend company-frontends) - - (defun +company-box-icons--elisp-fn (candidate) - (when (derived-mode-p 'emacs-lisp-mode) - (let ((sym (intern candidate))) - (cond ((fboundp sym) 'ElispFunction) - ((boundp sym) 'ElispVariable) - ((featurep sym) 'ElispFeature) - ((facep sym) 'ElispFace))))) - - ;; `company-box' performs insufficient frame-live-p checks. Any command that - ;; "cleans up the session" will break company-box. - ;; TODO Fix this upstream. - (defadvice! +company-box-detect-deleted-frame-a (frame) - :filter-return #'company-box--get-frame - (if (frame-live-p frame) frame)) - (defadvice! +company-box-detect-deleted-doc-frame-a (_selection frame) - :before #'company-box-doc - (and company-box-doc-enable - (frame-local-getq company-box-doc-frame frame) - (not (frame-live-p (frame-local-getq company-box-doc-frame frame))) - (frame-local-setq company-box-doc-frame nil frame)))) - - -(use-package! company-dict - :defer t - :config - (setq company-dict-dir (expand-file-name "dicts" doom-private-dir)) - (add-hook! 'doom-project-hook - (defun +company-enable-project-dicts-h (mode &rest _) - "Enable per-project dictionaries." - (if (symbol-value mode) - (add-to-list 'company-dict-minor-mode-list mode nil #'eq) - (setq company-dict-minor-mode-list (delq mode company-dict-minor-mode-list)))))) diff --git a/.config/emacs/modules/completion/company/packages.el b/.config/emacs/modules/completion/company/packages.el deleted file mode 100644 index d5d7700..0000000 --- a/.config/emacs/modules/completion/company/packages.el +++ /dev/null @@ -1,7 +0,0 @@ -;; -*- no-byte-compile: t; -*- -;;; completion/company/packages.el - -(package! company :pin "8b58e5895c2eaf8686de0e25c807b00fdb205c7a") -(package! company-dict :pin "cd7b8394f6014c57897f65d335d6b2bd65dab1f4") -(when (featurep! +childframe) - (package! company-box :pin "f9cbbc7df8efbb56a8d31a5b422d158660d9109e")) diff --git a/.config/emacs/modules/completion/company/test/test-company.el b/.config/emacs/modules/completion/company/test/test-company.el deleted file mode 100644 index 9c6148d..0000000 --- a/.config/emacs/modules/completion/company/test/test-company.el +++ /dev/null @@ -1,75 +0,0 @@ -;; -*- lexical-binding: t; no-byte-compile: t; -*- -;;; completion/company/test/test-company.el - -(describe "completion/company" - (before-all - (load! "../autoload")) - - (describe ":company-backend" - :var (a +company-backend-alist backends) - (before-each - (setq-default company-backends '(t)) - (setq +company-backend-alist nil - a (get-buffer-create "x")) - (fset 'backends - (lambda (mode) - (let ((major-mode mode)) - (+company--backends)))) - (set-buffer a) - (spy-on 'require)) - (after-each - (kill-buffer a)) - - ;; - (it "sets backends for a major mode" - (set-company-backend! 'text-mode 'a) - (expect (backends 'text-mode) :to-equal '(a t))) - - (it "sets backends for a derived-mode" - (set-company-backend! 'prog-mode 'a) - (expect (backends 'prog-mode) :to-equal '(a t)) - (expect (backends 'emacs-lisp-mode) :to-equal '(a t))) - - (it "sets multiple backends for exact major modes" - (set-company-backend! '(text-mode emacs-lisp-mode) 'a 'b) - (expect (backends 'text-mode) :to-equal (backends 'emacs-lisp-mode))) - - (it "sets cumulative backends" - (set-company-backend! 'prog-mode '(a b c)) - (set-company-backend! 'emacs-lisp-mode 'd 'e) - (expect (backends 'emacs-lisp-mode) :to-equal '(d e (a b c) t))) - - (it "sets cumulative backends with a minor mode" - (set-company-backend! 'prog-mode '(a b c)) - (set-company-backend! 'emacs-lisp-mode 'd 'e) - (set-company-backend! 'some-minor-mode 'x 'y) - (setq-local some-minor-mode t) - (expect (backends 'emacs-lisp-mode) :to-equal '(x y d e (a b c) t))) - - (it "overwrites past backends" - (set-company-backend! 'text-mode 'old 'backends) - (set-company-backend! 'text-mode 'new 'backends) - (expect (backends 'text-mode) :to-equal '(new backends t))) - - (it "unsets past backends" - (set-company-backend! 'text-mode 'old) - (set-company-backend! 'text-mode nil) - (expect (backends 'text-mode) :to-equal (default-value 'company-backends))) - - (it "unsets past parent backends" - (set-company-backend! 'prog-mode 'old) - (set-company-backend! 'emacs-lisp-mode 'child) - (set-company-backend! 'prog-mode nil) - (expect (backends 'emacs-lisp-mode) :to-equal '(child t))) - - (it "overwrites past cumulative backends" - (set-company-backend! 'prog-mode 'base) - (set-company-backend! 'emacs-lisp-mode 'old) - (set-company-backend! 'emacs-lisp-mode 'new) - (expect (backends 'emacs-lisp-mode) :to-equal '(new base t))) - - (it "overwrites past parent backends" - (set-company-backend! 'prog-mode 'base) - (set-company-backend! 'emacs-lisp-mode 'child) - (set-company-backend! 'prog-mode 'new) - (expect (backends 'emacs-lisp-mode) :to-equal '(child new t))))) diff --git a/.config/emacs/modules/completion/helm/README.org b/.config/emacs/modules/completion/helm/README.org deleted file mode 100644 index 17ae807..0000000 --- a/.config/emacs/modules/completion/helm/README.org +++ /dev/null @@ -1,169 +0,0 @@ -#+TITLE: completion/helm -#+DATE: January 22, 2021 -#+SINCE: v2.0 -#+STARTUP: inlineimages - -* Table of Contents :TOC_3:noexport: -- [[#description][Description]] - - [[#module-flags][Module Flags]] - - [[#plugins][Plugins]] -- [[#prerequisites][Prerequisites]] -- [[#features][Features]] - - [[#jump-to-navigation][Jump-to navigation]] - - [[#project-search--replace][Project search & replace]] - - [[#search][Search]] - - [[#replace][Replace]] - - [[#in-buffer-searching][In-buffer searching]] - - [[#helm-integration-for-various-completing-commands][Helm integration for various completing commands]] - - [[#general][General]] - - [[#jump-to-files-buffers-or-projects][Jump to files, buffers or projects]] - - [[#search-1][Search]] -- [[#configuration][Configuration]] - - [[#icons][Icons]] - - [[#posframe][Posframe]] -- [[#troubleshooting][Troubleshooting]] - -* Description -This module provides Helm integration for a variety of Emacs commands, as well as -a unified interface for project search and replace, powered by ripgrep. - -#+begin_quote -I prefer ivy over ido for its flexibility. I prefer ivy over helm because it's -lighter, simpler and faster in many cases. -#+end_quote - -Ivy is considered a first-class citizen in Doom, however it is still possible to use Helm if you so desire. - -** Module Flags -+ =+fuzzy= Enables fuzzy completion for Helm searches. -+ =+childframe= Causes Helm to display in a floating child frame, above Emacs. -+ =+icons= Enables icons (supports both =all-the-icons= and =treemacs= icons) - -** Plugins -+ [[https://github.com/emacs-helm/helm][helm]] -+ [[https://github.com/microamp/helm-rg][helm-rg]] -+ [[https://github.com/emacs-jp/helm-c-yasnippet][helm-c-yasnippet]] -+ [[https://github.com/tuhdo/helm-company][helm-company]] -+ [[https://github.com/emacs-helm/helm-describe-modes][helm-describe-modes]] -+ [[https://github.com/bbatsov/helm-projectile][helm-projectile]] -+ [[https://github.com/abo-abo/swiper-helm][helm-swiper]] -+ [[https://github.com/emacs-helm/helm-descbinds][helm-descbinds]] -+ [[https://github.com/PythonNut/helm-flx][helm-flx]]* (=+fuzzy=) -+ [[https://github.com/tumashu/helm-posframe][helm-posframe]]* (=+childframe=) -+ [[https://github.com/emacs-helm/helm-org][helm-org]]* (=:lang org=) -+ [[https://github.com/yyoncho/helm-icons][helm-icons]]* (=+icons=) - -* Prerequisites -This module has no prerequisites. - -* Features -Much like Ivy, Helm is a /large/ framework and as such -covering everything is not in scope, however a number -of Doom-specific features are shown below: - -** Jump-to navigation -Similar to Ivy, this module provides an interface to -navigate within a project using =projectile=: - -| Keybind | Description | -|------------------+-------------------------------------| -| =SPC p f=, =SPC SPC= | Jump to file in project | -| =SPC f f=, =SPC .= | Jump to file from current directory | -| =SPC s i= | Jump to symbol in file | - -** Project search & replace -This module also provides interacetive text search and replace using ripgrep - -*** Search - -| Keybind | Description | -|---------+--------------------------| -| =SPC s p= | Search project | -| =SPC s P= | Search another project | -| =SPC s d= | Search this directory | -| =SPC s D= | Search another directory | -Prefixing these keys with the universal argument (=SPC u= for evil users; =C-u= -otherwise) changes the behavior of these commands, instructing the underlying -search engine to include ignored files. - -This module also provides Ex Commands for evil users: - -| Ex command | Description | -|------------------------+------------------------------------------------------------------| -| ~:pg[rep][!] [QUERY]~ | Search project (if ~!~, include hidden files) | -| ~:pg[rep]d[!] [QUERY]~ | Search from current directory (if ~!~, don't search recursively) | - -The optional `!` is equivalent to the universal argument for the previous -commands. - -*** Replace - -These keybindings are available while a search is active: - -| Keybind | Description | -|-----------+-----------------------------------------------| -| =C-c C-o= | Open a buffer with your search results | -| =C-c C-e= | Open a writable buffer of your search results | -| =C-SPC= | Preview the current candidate | -| =C-RET= | Open the selected candidate in other-window | - -Changes to the resulting wgrep buffer (opened by =C-c C-e=) can be committed -with =C-c C-c= and aborted with =C-c C-k= (alternatively =ZZ= and =ZQ=, for evil -users). - -** In-buffer searching -The =swiper= package provides an interactive buffer search powered by helm. It -can be invoked with: - -+ =SPC s s= (~swiper-isearch~) -+ =SPC s S= (~swiper-isearch-thing-at-point~) -+ =SPC s b= (~swiper~) -+ ~:sw[iper] [QUERY]~ - -A wgrep buffer can be opened from swiper with =C-c C-e=. -** Helm integration for various completing commands -Helm also has a number of overrides for built-in functionality: - -*** General -| Keybind | Description | -|------------+---------------------------| -| =M-x=, =SPC := | Smarter, smex-powered M-x | -| =SPC '= | Resume last ivy session | - -*** Jump to files, buffers or projects -| Keybind | Description | -|------------------+---------------------------------------| -| =SPC RET= | Find bookmark | -| =SPC f f=, =SPC .= | Browse from current directory | -| =SPC p f=, =SPC SPC= | Find file in project | -| =SPC f r= | Find recently opened file | -| =SPC p p= | Open another project | -| =SPC b b=, =SPC ,= | Switch to buffer in current workspace | -| =SPC b B=, =SPC <= | Switch to buffer | - -*** Search -| Keybind | Description | -|---------+-------------------------------------------| -| =SPC p t= | List all TODO/FIXMEs in project | -| =SPC s b= | Search the current buffer | -| =SPC s d= | Search this directory | -| =SPC s D= | Search another directory | -| =SPC s i= | Search for symbol in current buffer | -| =SPC s p= | Search project | -| =SPC s P= | Search another project | -| =SPC s s= | Search the current buffer (incrementally) | - -* Configuration -** Icons -Icons are now included, and support 2 providers ([[https://github.com/domtronn/all-the-icons.el][all-the-icons]] and [[https://github.com/Alexander-Miller/treemacs][treemacs]]). -By default, to maintain consistency we use =all-the-icons=; however if you wish -to modify this you can do so using the below snippet: - -#+begin_src emacs-lisp -(after! helm - (setq helm-icons-provider 'treemacs)) -#+end_src - -** Posframe - -* Troubleshooting diff --git a/.config/emacs/modules/completion/helm/autoload/evil.el b/.config/emacs/modules/completion/helm/autoload/evil.el deleted file mode 100644 index fbcf0a9..0000000 --- a/.config/emacs/modules/completion/helm/autoload/evil.el +++ /dev/null @@ -1,42 +0,0 @@ -;;; completion/helm/autoload/evil.el -*- lexical-binding: t; -*- -;;;###if (featurep! :editor evil) - -;;;###autoload (autoload '+helm:project-search "completion/helm/autoload/evil" nil t) -(evil-define-command +helm:project-search (all-files-p query) - "Ex interface for `+helm/grep'" - (interactive "") - (+helm/project-search all-files-p query)) - -;;;###autoload (autoload '+helm:project-search-from-cwd "completion/helm/autoload/evil" nil t) -(evil-define-command +helm:project-search-from-cwd (query &optional recurse-p) - "Ex interface for `+helm/grep-from-cwd'." - (interactive "") - (+helm/project-search-from-cwd (not recurse-p) query)) - -;;;###autoload -(defun +helm--set-prompt-display (pos) - "TODO" - (let (beg state region-active m) - (with-selected-window (minibuffer-window) - (setq beg (save-excursion (vertical-motion 0 (helm-window)) (point)) - state evil-state - region-active (region-active-p) - m (mark t))) - (when region-active - (setq m (- m beg)) - ;; Increment pos to handle the space before prompt (i.e `pref'). - (put-text-property (1+ (min m pos)) (+ 2 (max m pos)) - 'face - (list :background (face-background 'region)) - header-line-format)) - (put-text-property - ;; Increment pos to handle the space before prompt (i.e `pref'). - (+ 1 pos) (+ 2 pos) - 'face - (if (eq state 'insert) - 'underline - ;; Don't just use 'cursor, this can hide the current character. - (list :inverse-video t - :foreground (face-background 'cursor) - :background (face-background 'default))) - header-line-format))) diff --git a/.config/emacs/modules/completion/helm/autoload/helm.el b/.config/emacs/modules/completion/helm/autoload/helm.el deleted file mode 100644 index c7bfe98..0000000 --- a/.config/emacs/modules/completion/helm/autoload/helm.el +++ /dev/null @@ -1,100 +0,0 @@ -;;; completion/helm/autoload/helm.el -*- lexical-binding: t; -*- - -;;;###autoload -(defun +helm/projectile-find-file () - "Call `helm-find-files' if called from HOME, otherwise -`helm-projectile-find-file'." - (interactive) - (call-interactively - (if (or (file-equal-p default-directory "~") - (if-let* ((proot (doom-project-root))) - (file-equal-p proot "~") - t)) - #'helm-find-files - #'helm-projectile-find-file))) - -;;;###autoload -(defun +helm/workspace-buffer-list () - "A version of `helm-buffers-list' with its buffer list restricted to the -current workspace." - (interactive) - (unless (featurep! :ui workspaces) - (user-error "This command requires the :ui workspaces module")) - (with-no-warnings - (with-persp-buffer-list nil (helm-buffers-list)))) - -;;;###autoload -(defun +helm/workspace-mini () - "A version of `helm-mini' with its buffer list restricted to the current -workspace." - (interactive) - (unless (featurep! :ui workspaces) - (user-error "This command requires the :ui workspaces module")) - (with-no-warnings - (with-persp-buffer-list nil (helm-mini)))) - - -;; -;;; Project search - -;;;###autoload -(cl-defun +helm-file-search (&key query in all-files (recursive t) _prompt args) - "Conduct a file search using ripgrep. - -:query STRING - Determines the initial input to search for. -:in PATH - Sets what directory to base the search out of. Defaults to the current - project's root. -:recursive BOOL - Whether or not to search files recursively from the base directory." - (declare (indent defun)) - (unless (executable-find "rg") - (user-error "Couldn't find ripgrep in your PATH")) - (require 'helm-rg) - (let ((this-command 'helm-rg) - (helm-rg-default-directory (or in (doom-project-root) default-directory)) - (helm-rg-default-extra-args - (delq nil (append (list (when all-files "-z -uu") - (unless recursive "--maxdepth 1") - "--hidden" "-g" "!.git") - args)))) - (setq deactivate-mark t) - (helm-rg (or query - (when (use-region-p) - (let ((beg (or (bound-and-true-p evil-visual-beginning) (region-beginning))) - (end (or (bound-and-true-p evil-visual-end) (region-end)))) - (when (> (abs (- end beg)) 1) - (buffer-substring-no-properties beg end)))) - "")))) - -;;;###autoload -(defun +helm/project-search (&optional arg initial-query directory) - "Performs a project search from the project root with ripgrep. - -ARG (universal argument), include all files, even hidden or compressed ones, in -the search." - (interactive "P") - (+helm-file-search - :query initial-query - :in directory - :all-files (and (not (null arg)) - (listp arg)))) - -;;;###autoload -(defun +helm/project-search-from-cwd (&optional arg initial-query) - "Performs a project search recursively from the current directory. - -If ARG (universal argument), include all files, even hidden or compressed ones." - (interactive "P") - (+helm-file-search - :query initial-query - :in default-directory - :all-files (and (not (null arg)) - (listp arg)))) - -;;;###autoload -(defun +helm/jump-list () - "TODO" - (interactive) - (error "not implemented yet")) diff --git a/.config/emacs/modules/completion/helm/autoload/posframe.el b/.config/emacs/modules/completion/helm/autoload/posframe.el deleted file mode 100644 index da0e32d..0000000 --- a/.config/emacs/modules/completion/helm/autoload/posframe.el +++ /dev/null @@ -1,56 +0,0 @@ -;;; completion/helm/autoload/posframe.el -*- lexical-binding: t; -*- - -;;;###autoload -(defun +helm-poshandler-frame-center-near-bottom-fn (info) - "Display the child frame in the center of the frame, slightly closer to the -bottom, which is easier on the eyes on big displays." - (let ((parent-frame (plist-get info :parent-frame)) - (pos (posframe-poshandler-frame-center info))) - (cons (car pos) - (truncate (/ (frame-pixel-height parent-frame) - 2))))) - -(defvar +helm--posframe-buffer nil) -;;;###autoload -(defun +helm-posframe-display-fn (buffer &optional _resume) - "TODO" - (setq helm--buffer-in-new-frame-p t) - (let ((params (copy-sequence +helm-posframe-parameters))) - (let-alist params - (require 'posframe) - (posframe-show - (setq +helm--posframe-buffer buffer) - :position (point) - :poshandler +helm-posframe-handler - :respect-header-line helm-echo-input-in-header-line - :min-width - (max (cl-typecase .width - (integer .width) - (float (truncate (* (frame-width) .width))) - (function (funcall .width)) - (t 0)) - .min-width) - :min-height - (max (cl-typecase .height - (integer .height) - (float (truncate (* (frame-height) .height))) - (function (funcall .height)) - (t 0)) - .min-height) - :override-parameters - (dolist (p '(width height min-width min-height) params) - (setq params (delq (assq p params) params))))) - ;; - (unless (or (null +helm-posframe-text-scale) - (= +helm-posframe-text-scale 0)) - (with-current-buffer buffer - (text-scale-set +helm-posframe-text-scale))))) - -;;;###autoload -(defun +helm-posframe-cleanup-h () - "TODO" - ;; Ensure focus is properly returned to the underlying window. This gives the - ;; modeline a chance to refresh. - (switch-to-buffer +helm--posframe-buffer t)) - -(add-hook 'helm-cleanup-hook #'+helm-posframe-cleanup-h) diff --git a/.config/emacs/modules/completion/helm/config.el b/.config/emacs/modules/completion/helm/config.el deleted file mode 100644 index cf15e3d..0000000 --- a/.config/emacs/modules/completion/helm/config.el +++ /dev/null @@ -1,195 +0,0 @@ -;;; completion/helm/config.el -*- lexical-binding: t; -*- - -;; Posframe (requires +childframe) -(defvar +helm-posframe-handler #'posframe-poshandler-frame-center - "The function that determines the location of the childframe. -It should return a cons cell representing the X and Y coordinates. See -`posframe-poshandler-frame-center' as a reference.") - -(defvar +helm-posframe-text-scale 1 - "The text-scale to use in the helm childframe. Set to nil for no scaling. -Can be negative.") - -(defvar +helm-posframe-parameters - '((internal-border-width . 8) - (width . 0.65) - (height . 0.35) - (min-width . 80) - (min-height . 16)) - "Default parameters for the helm childframe.") - -;; -;;; Packages - -(use-package! helm-mode - :hook (doom-first-input . helm-mode) - :init - (map! [remap apropos] #'helm-apropos - [remap find-library] #'helm-locate-library - [remap bookmark-jump] #'helm-bookmarks - [remap execute-extended-command] #'helm-M-x - [remap find-file] #'helm-find-files - [remap locate] #'helm-locate - [remap imenu] #'helm-semantic-or-imenu - [remap noop-show-kill-ring] #'helm-show-kill-ring - [remap persp-switch-to-buffer] #'+helm/workspace-mini - [remap switch-to-buffer] #'helm-buffers-list - [remap projectile-find-file] #'+helm/projectile-find-file - [remap projectile-recentf] #'helm-projectile-recentf - [remap projectile-switch-project] #'helm-projectile-switch-project - [remap projectile-switch-to-buffer] #'helm-projectile-switch-to-buffer - [remap recentf-open-files] #'helm-recentf - [remap yank-pop] #'helm-show-kill-ring) - :config - ;; helm is too heavy for `find-file-at-point' - (add-to-list 'helm-completing-read-handlers-alist (cons #'find-file-at-point nil))) - - -(use-package! helm - :after helm-mode - :preface - (setq helm-candidate-number-limit 50 - ;; Remove extraineous helm UI elements - helm-display-header-line nil - helm-mode-line-string nil - helm-ff-auto-update-initial-value nil - helm-find-files-doc-header nil - ;; Default helm window sizes - helm-display-buffer-default-width nil - helm-display-buffer-default-height 0.25 - ;; When calling `helm-semantic-or-imenu', don't immediately jump to - ;; symbol at point - helm-imenu-execute-action-at-once-if-one nil - ;; disable special behavior for left/right, M-left/right keys. - helm-ff-lynx-style-map nil) - - (when (featurep! :editor evil +everywhere) - (setq helm-default-prompt-display-function #'+helm--set-prompt-display)) - - :init - (when (featurep! +childframe) - ;; If this is set to 'iconify-top-level then Emacs will be minimized upon - ;; helm completion. - (setq iconify-child-frame 'make-invisible) - (setq helm-display-function #'+helm-posframe-display-fn)) - - (let ((fuzzy (featurep! +fuzzy))) - (setq helm-apropos-fuzzy-match fuzzy - helm-bookmark-show-location fuzzy - helm-buffers-fuzzy-matching fuzzy - helm-ff-fuzzy-matching fuzzy - helm-file-cache-fuzzy-match fuzzy - helm-flx-for-helm-locate fuzzy - helm-imenu-fuzzy-match fuzzy - helm-lisp-fuzzy-completion fuzzy - helm-locate-fuzzy-match fuzzy - helm-projectile-fuzzy-match fuzzy - helm-recentf-fuzzy-match fuzzy - helm-semantic-fuzzy-match fuzzy) - ;; Make sure that we have helm-multi-matching or fuzzy matching, - ;; (as prescribed by the fuzzy flag) also in the following cases: - ;; - ;; - helmized commands that use `completion-at-point' and similar functions - ;; - native commands that fall back to `completion-styles' like `helm-M-x' - ;; - ;; However, do not add helm completion styles to the front of - ;; `completion-styles', since that would be overly intrusive. E.g., it - ;; results in `company-capf' returning far to many completion candidates. - ;; Instead, append those styles so that they act as a fallback. - (add-to-list 'completion-styles (if fuzzy 'flex 'helm) t)) - :config - (set-popup-rule! "^\\*helm" :vslot -100 :size 0.22 :ttl nil) - - ;; Hide the modeline in helm windows as it serves little purpose. - (defun +helm--hide-mode-line (&rest _) - (with-current-buffer (helm-buffer-get) - (unless helm-mode-line-string - (hide-mode-line-mode +1)))) - (add-hook 'helm-after-initialize-hook #'+helm--hide-mode-line) - (advice-add #'helm-display-mode-line :override #'+helm--hide-mode-line) - (advice-add #'helm-ag-show-status-default-mode-line :override #'ignore) - - ;; Hide minibuffer if `helm-echo-input-in-header-line' - (add-hook 'helm-minibuffer-set-up-hook #'helm-hide-minibuffer-maybe) - - ;; Use helpful instead of describe-* to display documentation - (dolist (fn '(helm-describe-variable helm-describe-function)) - (advice-add fn :around #'doom-use-helpful-a))) - -(use-package! helm-flx - :when (featurep! +fuzzy) - :hook (helm-mode . helm-flx-mode) - :config (helm-flx-mode +1)) - - -(after! helm-rg - (setq helm-rg-display-buffer-normal-method #'pop-to-buffer) - (set-popup-rule! "^helm-rg-" :ttl nil :select t :size 0.45) - (map! :map helm-rg-map - "C-c C-e" #'helm-rg--bounce) - (map! :map helm-rg--bounce-mode-map - "q" #'kill-current-buffer - "C-c C-c" (cmd! (helm-rg--bounce-dump) (kill-current-buffer)) - "C-x C-c" #'helm-rg--bounce-dump-current-file - "C-c C-k" #'kill-current-buffer)) - - -;;;###package helm-bookmark -(setq helm-bookmark-show-location t) - - -(after! helm-files - (setq helm-boring-file-regexp-list - (append (list "\\.projects$" "\\.DS_Store$") - helm-boring-file-regexp-list))) - - -(defvar helm-generic-files-map (make-sparse-keymap)) -(after! helm-locate - (when (and IS-MAC - (null helm-locate-command) - (executable-find "mdfind")) - (setq helm-locate-command "mdfind -name %s")) - (set-keymap-parent helm-generic-files-map helm-map)) - - -(use-package! helm-org - :when (featurep! :lang org) - :defer t - :init - (after! helm-mode - (pushnew! helm-completing-read-handlers-alist - '(org-capture . helm-org-completing-read-tags) - '(org-set-tags . helm-org-completing-read-tags)))) - - -(use-package! helm-projectile - :commands (helm-projectile-find-file - helm-projectile-recentf - helm-projectile-switch-project - helm-projectile-switch-to-buffer) - :init - (defvar helm-projectile-find-file-map (make-sparse-keymap)) - :config - (set-keymap-parent helm-projectile-find-file-map helm-map)) - - -(setq ivy-height 20) ; for `swiper-isearch' -(after! swiper-helm - (setq swiper-helm-display-function - (lambda (buf &optional _resume) (pop-to-buffer buf))) - (global-set-key [remap swiper] #'swiper-helm) - (add-to-list 'swiper-font-lock-exclude #'+doom-dashboard-mode nil #'eq)) - - -(use-package! helm-descbinds - :hook (helm-mode . helm-descbinds-mode)) - - -(use-package! helm-icons - :after helm - :when (featurep! +icons) - :init - (setq helm-icons-provider 'all-the-icons) - :config - (helm-icons-enable)) diff --git a/.config/emacs/modules/completion/helm/packages.el b/.config/emacs/modules/completion/helm/packages.el deleted file mode 100644 index 94676df..0000000 --- a/.config/emacs/modules/completion/helm/packages.el +++ /dev/null @@ -1,21 +0,0 @@ -;; -*- no-byte-compile: t; -*- -;;; completion/helm/packages.el - -(package! helm :pin "a246a9b278fb973d38d13ade7417f55e0a57eae4") -(package! helm-rg :pin "ee0a3c09da0c843715344919400ab0a0190cc9dc") -(package! helm-c-yasnippet :pin "e214eec8b2875d8a7cd09006dfb6a8e15e9e4079") -(package! helm-company :pin "6eb5c2d730a60e394e005b47c1db018697094dde") -(package! helm-describe-modes - :recipe (:host github :repo "emacs-helm/helm-describe-modes") - :pin "11fb36af119b784539d31c6160002de1957408aa") -(package! helm-projectile :pin "58123f14c392021714fc5d23b9f95c7f95ce07f1") -(package! swiper-helm :pin "93fb6db87bc6a5967898b5fd3286954cc72a0008") -(when (featurep! +fuzzy) - (package! helm-flx :pin "6640fac5cb16bee73c95b8ed1248a4e5e113690e")) -(when (featurep! +childframe) - (package! posframe :pin "3b1dc400d286b0a4bd42e518bf3e7eedb49fd1e6")) -(when (featurep! :lang org) - (package! helm-org :pin "d67186d3a64e610c03a5f3d583488f018fb032e4")) -(when (featurep! +icons) - (package! helm-icons :pin "8d2f5e705c8b78a390677cf242024739c932fc95")) -(package! helm-descbinds :pin "b72515982396b6e336ad7beb6767e95a80fca192") diff --git a/.config/emacs/modules/completion/ido/config.el b/.config/emacs/modules/completion/ido/config.el deleted file mode 100644 index bced27e..0000000 --- a/.config/emacs/modules/completion/ido/config.el +++ /dev/null @@ -1,62 +0,0 @@ -;;; completion/ido/config.el -*- lexical-binding: t; -*- - -(defvar ido-mode-hook nil - "List of hooks to run when `ido-mode' is activated.") - - -;; -;;; Packages - -(use-package! ido - :hook (doom-first-input . ido-mode) - :hook (ido-mode . ido-everywhere) - :hook (ido-mode . ido-ubiquitous-mode) - :preface - ;; HACK `ido' is a really old package. It defines `ido-mode' manually and - ;; doesn't define a hook, so we define one for it, so we can use it! - (defadvice! +ido-run-hooks-a (&rest _) - :after #'ido-mode - (run-hooks 'ido-mode-hook)) - :init - (setq ido-save-directory-list-file (concat doom-cache-dir "ido.last")) - :config - (pushnew! ido-ignore-files "\\`.DS_Store$" "Icon\\?$") - (setq ido-ignore-buffers - '("\\` " "^\\*ESS\\*" "^\\*Messages\\*" "^\\*[Hh]elp" "^\\*Buffer" - "^\\*.*Completions\\*$" "^\\*Ediff" "^\\*tramp" "^\\*cvs-" "_region_" - " output\\*$" "^TAGS$" "^\*Ido") - ido-auto-merge-work-directories-length -1 - ido-confirm-unique-completion t - ido-case-fold t - ido-create-new-buffer 'always - ido-enable-flex-matching t) - - (map! :map (ido-common-completion-map ido-file-completion-map) - "C-w" #'ido-delete-backward-word-updir - :map (ido-common-completion-map ido-file-dir-completion-map) - "C-n" #'ido-next-match - "C-p" #'ido-prev-match - [down] #'ido-next-match - [up] #'ido-prev-match - :map ido-file-completion-map - ;; Go to $HOME with ~ - "~" (cmd! (if (looking-back "/" (point-min)) - (insert "~/") - (call-interactively #'self-insert-command))))) - - -(use-package! ido-vertical-mode - :hook (ido-mode . ido-vertical-mode) - :config (setq ido-vertical-show-count t)) - - -(use-package! ido-sort-mtime - :hook (ido-mode . ido-sort-mtime-mode)) - - -(use-package! crm-custom - :hook (ido-mode . crm-custom-mode)) - - -(use-package! flx-ido - :hook (ido-mode . flx-ido-mode)) diff --git a/.config/emacs/modules/completion/ido/packages.el b/.config/emacs/modules/completion/ido/packages.el deleted file mode 100644 index 2e43056..0000000 --- a/.config/emacs/modules/completion/ido/packages.el +++ /dev/null @@ -1,8 +0,0 @@ -;; -*- no-byte-compile: t; -*- -;;; completion/ido/packages.el - -(package! flx-ido :pin "e3b3f0533e44c5250ce73d728b59a7e96c692b5d") -(package! ido-completing-read+ :pin "49e7967ea8c0ab0a206b40d70fc19be115083fa1") -(package! ido-sort-mtime :pin "f638ff0c922af862f5211779f2311a27fde428eb") -(package! ido-vertical-mode :pin "b1659e967da0687abceca733b389ace24004fa66") -(package! crm-custom :pin "f1aaccf64306a5f99d9bf7ba815d7ea41c15518d") diff --git a/.config/emacs/modules/completion/ivy/README.org b/.config/emacs/modules/completion/ivy/README.org deleted file mode 100644 index 878070e..0000000 --- a/.config/emacs/modules/completion/ivy/README.org +++ /dev/null @@ -1,172 +0,0 @@ -#+TITLE: completion/ivy -#+DATE: February 13, 2017 -#+SINCE: v2.0 -#+STARTUP: inlineimages - -* Table of Contents :TOC_3:noexport: -- [[#description][Description]] - - [[#module-flags][Module Flags]] - - [[#plugins][Plugins]] - - [[#hacks][Hacks]] -- [[#prerequisites][Prerequisites]] -- [[#features][Features]] - - [[#jump-to-navigation][Jump-to navigation]] - - [[#project-search--replace][Project search & replace]] - - [[#in-buffer-searching][In-buffer searching]] - - [[#ivy-integration-for-various-completing-commands][Ivy integration for various completing commands]] - - [[#general][General]] - - [[#jump-to-files-buffers-or-projects][Jump to files, buffers or projects]] - - [[#search][Search]] -- [[#configuration][Configuration]] - - [[#enable-fuzzynon-fuzzy-search-for-specific-commands][Enable fuzzy/non-fuzzy search for specific commands]] - - [[#change-the-position-of-the-ivy-childframe][Change the position of the ivy childframe]] -- [[#troubleshooting][Troubleshooting]] - -* Description -This module provides Ivy integration for a variety of Emacs commands, as well as -a unified interface for project search and replace, powered by [[https://github.com/BurntSushi/ripgrep/][ripgrep]]. - -#+begin_quote -I prefer ivy over ido for its flexibility. I prefer ivy over helm because it's -lighter, simpler and faster in many cases. -#+end_quote - -** Module Flags -+ =+fuzzy= Enables fuzzy completion for Ivy searches. -+ =+prescient= Enables prescient filtering and sorting for Ivy searches. -+ =+childframe= Causes Ivy to display in a floating child frame, above Emacs. -+ =+icons= Enables file icons for switch-{buffer,project}/find-file counsel - commands. - -** Plugins -+ [[https://github.com/abo-abo/swiper][ivy]] -+ [[https://github.com/abo-abo/swiper][counsel]] -+ [[https://github.com/ericdanan/counsel-projectile][counsel-projectile]] -+ [[https://github.com/abo-abo/swiper][swiper]] -+ [[https://github.com/abo-abo/swiper][ivy-hydra]] -+ [[https://github.com/yevgnen/ivy-rich][ivy-rich]] -+ [[https://github.com/mhayashi1120/Emacs-wgrep][wgrep]] -+ [[https://github.com/DarwinAwardWinner/amx][amx]] -+ [[https://github.com/lewang/flx][flx]]* (=+fuzzy=) -+ [[https://github.com/raxod502/prescient.el][prescient]]* (=+prescient=) -+ [[https://github.com/tumashu/ivy-posframe][ivy-posframe]]* (=+childframe=) -+ [[https://github.com/asok/all-the-icons-ivy][all-the-icons-ivy]]* (=+icons=) - -** Hacks -+ Functions with ivy/counsel equivalents have been globally remapped (like - ~find-file~ => ~counsel-find-file~). So a keybinding to ~find-file~ will - invoke ~counsel-find-file~ instead. -+ ~counsel-[arp]g~'s 3-character limit was reduced to 1 (mainly for the ex - command) - -* Prerequisites -This module has no prerequisites. - -* Features -Ivy and its ilk are large plugins. Covering everything about them is outside of -this documentation's scope, so only Doom-specific Ivy features are listed here: - -** Jump-to navigation -Inspired by Sublime Text's jump-to-anywhere, CtrlP/Unite in Vim, and Textmate's -Command-T, this module provides similar functionality by bringing ~projectile~ -and ~ivy~ together. - -https://assets.doomemacs.org/completion/ivy/projectile.png - -| Keybind | Description | -|----------------------+-------------------------------------| -| =SPC p f=, =SPC SPC= | Jump to file in project | -| =SPC f f=, =SPC .= | Jump to file from current directory | -| =SPC s i= | Jump to symbol in file | - -** Project search & replace -This module provides interactive text search and replace using ripgrep. - -| Keybind | Description | -|-----------+--------------------------| -| =SPC s p= | Search project | -| =SPC s P= | Search another project | -| =SPC s d= | Search this directory | -| =SPC s D= | Search another directory | - -https://assets.doomemacs.org/completion/ivy/search.png - -Prefixing these keys with the universal argument (=SPC u= for evil users; =C-u= -otherwise) changes the behavior of these commands, instructing the underlying -search engine to include ignored files. - -This module also provides Ex Commands for evil users: - -| Ex command | Description | -|------------------------+------------------------------------------------------------------| -| ~:pg[rep][!] [QUERY]~ | Search project (if ~!~, include hidden files) | -| ~:pg[rep]d[!] [QUERY]~ | Search from current directory (if ~!~, don't search recursively) | - -The optional `!` is equivalent to the universal argument for the previous -commands. - ------ - -These keybindings are available while a search is active: - -| Keybind | Description | -|-----------+-----------------------------------------------| -| =C-c C-o= | Open a buffer with your search results | -| =C-c C-e= | Open a writable buffer of your search results | -| =C-SPC= | Preview the current candidate | -| =C-RET= | Open the selected candidate in other-window | - -Changes to the resulting wgrep buffer (opened by =C-c C-e=) can be committed -with =C-c C-c= and aborted with =C-c C-k= (alternatively =ZZ= and =ZQ=, for evil -users). - -https://assets.doomemacs.org/completion/ivy/search-replace.png - -** In-buffer searching -The =swiper= package provides an interactive buffer search powered by ivy. It -can be invoked with: - -+ =SPC s s= (~swiper-isearch~) -+ =SPC s S= (~swiper-isearch-thing-at-point~) -+ =SPC s b= (~swiper~) -+ ~:sw[iper] [QUERY]~ - -https://assets.doomemacs.org/completion/ivy/swiper.png - -A wgrep buffer can be opened from swiper with =C-c C-e=. - -** Ivy integration for various completing commands -*** General -| Keybind | Description | -|----------------+---------------------------| -| =M-x=, =SPC := | Smarter, smex-powered M-x | -| =SPC '= | Resume last ivy session | - -*** Jump to files, buffers or projects -| Keybind | Description | -|----------------------+---------------------------------------| -| =SPC RET= | Find bookmark | -| =SPC f f=, =SPC .= | Browse from current directory | -| =SPC p f=, =SPC SPC= | Find file in project | -| =SPC f r= | Find recently opened file | -| =SPC p p= | Open another project | -| =SPC b b=, =SPC ,= | Switch to buffer in current workspace | -| =SPC b B=, =SPC <= | Switch to buffer | - -*** Search -| Keybind | Description | -|-----------+-------------------------------------------| -| =SPC p t= | List all TODO/FIXMEs in project | -| =SPC s b= | Search the current buffer | -| =SPC s d= | Search this directory | -| =SPC s D= | Search another directory | -| =SPC s i= | Search for symbol in current buffer | -| =SPC s p= | Search project | -| =SPC s P= | Search another project | -| =SPC s s= | Search the current buffer (incrementally) | - -* Configuration -** TODO Enable fuzzy/non-fuzzy search for specific commands -** TODO Change the position of the ivy childframe - -* TODO Troubleshooting diff --git a/.config/emacs/modules/completion/ivy/autoload/evil.el b/.config/emacs/modules/completion/ivy/autoload/evil.el deleted file mode 100644 index 8a81255..0000000 --- a/.config/emacs/modules/completion/ivy/autoload/evil.el +++ /dev/null @@ -1,14 +0,0 @@ -;; completion/ivy/autoload/evil.el -*- lexical-binding: t; -*- -;;;###if (featurep! :editor evil) - -;;;###autoload (autoload '+ivy:project-search "completion/ivy/autoload/evil" nil t) -(evil-define-command +ivy:project-search (query &optional all-files-p) - "Ex interface for `+ivy/project-search'." - (interactive "") - (+ivy/project-search all-files-p query)) - -;;;###autoload (autoload '+ivy:project-search-from-cwd "completion/ivy/autoload/evil" nil t) -(evil-define-command +ivy:project-search-from-cwd (query &optional recurse-p) - "Ex interface for `+ivy/project-search-from-cwd'." - (interactive "") - (+ivy/project-search-from-cwd (not recurse-p) query)) diff --git a/.config/emacs/modules/completion/ivy/autoload/hydras.el b/.config/emacs/modules/completion/ivy/autoload/hydras.el deleted file mode 100644 index b879c23..0000000 --- a/.config/emacs/modules/completion/ivy/autoload/hydras.el +++ /dev/null @@ -1,32 +0,0 @@ -;;; completion/ivy/autoload/hydras.el -*- lexical-binding: t; -*- -;;;###if (featurep! :ui hydra) - -;;;###autoload -(after! ivy-hydra - (defhydra+ hydra-ivy (:hint nil :color pink) - " - Move ^^^^^^^^^^ | Call ^^^^ | Cancel^^ | Options^^ | Action _w_/_s_/_a_: %s(ivy-action-name) -----------^^^^^^^^^^-+--------------^^^^-+-------^^-+--------^^-+--------------------------------- - _g_ ^ ^ _k_ ^ ^ _u_ | _f_orward _o_ccur | _i_nsert | _c_alling: %-7s(if ivy-calling \"on\" \"off\") _C_ase-fold: %-10`ivy-case-fold-search - ^↨^ _h_ ^+^ _l_ ^↕^ | _RET_ done ^^ | _q_uit | _m_atcher: %-7s(ivy--matcher-desc) _t_runcate: %-11`truncate-lines - _G_ ^ ^ _j_ ^ ^ _d_ | _TAB_ alt-done ^^ | ^ ^ | _<_/_>_: shrink/grow -" - ;; arrows - ("l" ivy-alt-done) - ("h" ivy-backward-delete-char) - ("g" ivy-beginning-of-buffer) - ("G" ivy-end-of-buffer) - ("d" ivy-scroll-up-command) - ("u" ivy-scroll-down-command) - ("e" ivy-scroll-down-command) - ;; actions - ("q" keyboard-escape-quit :exit t) - ("" keyboard-escape-quit :exit t) - ("TAB" ivy-alt-done :exit nil) - ("RET" ivy-done :exit t) - ("C-SPC" ivy-call-and-recenter :exit nil) - ("f" ivy-call) - ("c" ivy-toggle-calling) - ("m" ivy-toggle-fuzzy) - ("t" (setq truncate-lines (not truncate-lines))) - ("o" ivy-occur :exit t))) diff --git a/.config/emacs/modules/completion/ivy/autoload/ivy.el b/.config/emacs/modules/completion/ivy/autoload/ivy.el deleted file mode 100644 index 12308e8..0000000 --- a/.config/emacs/modules/completion/ivy/autoload/ivy.el +++ /dev/null @@ -1,384 +0,0 @@ -;;; completion/ivy/autoload/ivy.el -*- lexical-binding: t; -*- - -(defun +ivy--is-workspace-buffer-p (buffer) - (let ((buffer (car buffer))) - (when (stringp buffer) - (setq buffer (get-buffer buffer))) - (+workspace-contains-buffer-p buffer))) - -(defun +ivy--is-workspace-other-buffer-p (buffer) - (let ((buffer (car buffer))) - (when (stringp buffer) - (setq buffer (get-buffer buffer))) - (and (not (eq buffer (current-buffer))) - (+workspace-contains-buffer-p buffer)))) - -;;;###autoload -(defun +ivy-rich-buffer-name (candidate) - "Display the buffer name. - -Buffers that are considered unreal (see `doom-real-buffer-p') are dimmed with -`+ivy-buffer-unreal-face'." - (let ((b (get-buffer candidate))) - (when (null uniquify-buffer-name-style) - (setq candidate (replace-regexp-in-string "<[0-9]+>$" "" candidate))) - (cond ((ignore-errors - (file-remote-p - (buffer-local-value 'default-directory b))) - (ivy-append-face candidate 'ivy-remote)) - ((doom-unreal-buffer-p b) - (ivy-append-face candidate +ivy-buffer-unreal-face)) - ((not (buffer-file-name b)) - (ivy-append-face candidate 'ivy-subdir)) - ((buffer-modified-p b) - (ivy-append-face candidate 'ivy-modified-buffer)) - (candidate)))) - -;;;###autoload -(defun +ivy-rich-buffer-icon (candidate) - "Display the icon for CANDIDATE buffer." - ;; NOTE This is inspired by `all-the-icons-ivy-buffer-transformer', minus the - ;; buffer name and extra padding as those are handled by `ivy-rich'. - (propertize "\t" 'display - (if-let* ((buffer (get-buffer candidate)) - (mode (buffer-local-value 'major-mode buffer))) - (or - (all-the-icons-ivy--icon-for-mode mode) - (all-the-icons-ivy--icon-for-mode (get mode 'derived-mode-parent)) - (funcall - all-the-icons-ivy-family-fallback-for-buffer - all-the-icons-ivy-name-fallback-for-buffer)) - (all-the-icons-icon-for-file candidate)))) - -;;;###autoload -(defun +ivy-rich-describe-variable-transformer (cand) - "Previews the value of the variable in the minibuffer" - (let* ((sym (intern cand)) - (val (and (boundp sym) (symbol-value sym))) - (print-level 3)) - (replace-regexp-in-string - "[\n\t\^[\^M\^@\^G]" " " - (cond ((booleanp val) - (propertize (format "%s" val) 'face - (if (null val) - 'font-lock-comment-face - 'success))) - ((symbolp val) - (propertize (format "'%s" val) - 'face 'highlight-quoted-symbol)) - ((keymapp val) - (propertize "" 'face 'font-lock-constant-face)) - ((listp val) - (prin1-to-string val)) - ((stringp val) - (propertize (format "%S" val) 'face 'font-lock-string-face)) - ((numberp val) - (propertize (format "%s" val) 'face 'highlight-numbers-number)) - ((format "%s" val))) - t))) - -;;;###autoload -(defun +ivy-format-function-line-or-arrow (cands) - "Transform CANDS into a string for minibuffer. - -If in terminal, prefix candidates with a chevron to make it more obvious which -one you're selecting, especially in themes that can't set a good background for -`ivy-current-match'. This is a combination of `ivy-format-function-line' and -`ivy-format-function-arrow'. - -In the GUI, this is the same as `ivy-format-function-line'." - (if (display-graphic-p) - (ivy-format-function-line cands) - (ivy--format-function-generic - (lambda (str) - (ivy--add-face (concat "> " str "\n") 'ivy-current-match)) - (lambda (str) - (concat " " str "\n")) - cands - ""))) - - -;; -;; Library - -(defun +ivy--switch-buffer-preview () - (let (ivy-use-virtual-buffers ivy--virtual-buffers) - (counsel--switch-buffer-update-fn))) - -(defalias '+ivy--switch-buffer-preview-all #'counsel--switch-buffer-update-fn) -(defalias '+ivy--switch-buffer-unwind #'counsel--switch-buffer-unwind) - -(defun +ivy--switch-buffer (workspace other) - (let ((current (not other)) - prompt action filter update unwind) - (cond ((and workspace current) - (setq prompt "Switch to workspace buffer: " - action #'ivy--switch-buffer-action - filter #'+ivy--is-workspace-other-buffer-p)) - (workspace - (setq prompt "Switch to workspace buffer in other window: " - action #'ivy--switch-buffer-other-window-action - filter #'+ivy--is-workspace-buffer-p)) - (current - (setq prompt "Switch to buffer: " - action #'ivy--switch-buffer-action)) - ((setq prompt "Switch to buffer in other window: " - action #'ivy--switch-buffer-other-window-action))) - (when +ivy-buffer-preview - (cond ((not (and ivy-use-virtual-buffers - (eq +ivy-buffer-preview 'everything))) - (setq update #'+ivy--switch-buffer-preview - unwind #'+ivy--switch-buffer-unwind)) - ((setq update #'+ivy--switch-buffer-preview-all - unwind #'+ivy--switch-buffer-unwind)))) - (ivy-read prompt 'internal-complete-buffer - :action action - :predicate filter - :update-fn update - :unwind unwind - :preselect (buffer-name (other-buffer (current-buffer))) - :matcher #'ivy--switch-buffer-matcher - :keymap ivy-switch-buffer-map - ;; NOTE A clever disguise, needed for virtual buffers. - :caller #'ivy-switch-buffer))) - -;;;###autoload -(defun +ivy/switch-workspace-buffer (&optional arg) - "Switch to another buffer within the current workspace. - -If ARG (universal argument), open selection in other-window." - (interactive "P") - (+ivy--switch-buffer t arg)) - -;;;###autoload -(defun +ivy/switch-workspace-buffer-other-window () - "Switch another window to a buffer within the current workspace." - (interactive) - (+ivy--switch-buffer t t)) - -;;;###autoload -(defun +ivy/switch-buffer () - "Switch to another buffer." - (interactive) - (+ivy--switch-buffer nil nil)) - -;;;###autoload -(defun +ivy/switch-buffer-other-window () - "Switch to another buffer in another window." - (interactive) - (+ivy--switch-buffer nil t)) - -;;;###autoload -(defun +ivy/woccur () - "Invoke a wgrep buffer on the current ivy results, if supported." - (interactive) - (unless (window-minibuffer-p) - (user-error "No completion session is active")) - (require 'wgrep) - (let ((caller (ivy-state-caller ivy-last))) - (if-let (occur-fn (plist-get +ivy-edit-functions caller)) - (ivy-exit-with-action - (lambda (_) (funcall occur-fn))) - (if-let (occur-fn (plist-get ivy--occurs-list caller)) - (let ((buffer (generate-new-buffer - (format "*ivy-occur%s \"%s\"*" - (if caller (concat " " (prin1-to-string caller)) "") - ivy-text)))) - (with-current-buffer buffer - (let ((inhibit-read-only t)) - (erase-buffer) - (funcall occur-fn)) - (setf (ivy-state-text ivy-last) ivy-text) - (setq ivy-occur-last ivy-last) - (setq-local ivy--directory ivy--directory)) - (ivy-exit-with-action - `(lambda (_) - (pop-to-buffer ,buffer) - (ivy-wgrep-change-to-wgrep-mode)))) - (user-error "%S doesn't support wgrep" caller))))) - -;;;###autoload -(defun +ivy-yas-prompt-fn (prompt choices &optional display-fn) - (yas-completing-prompt prompt choices display-fn #'ivy-completing-read)) - -;;;###autoload -(defun +ivy-git-grep-other-window-action (x) - "Opens the current candidate in another window." - (when (string-match "\\`\\(.*?\\):\\([0-9]+\\):\\(.*\\)\\'" x) - (select-window - (with-ivy-window - (let ((file-name (match-string-no-properties 1 x)) - (line-number (match-string-no-properties 2 x))) - (find-file-other-window (expand-file-name file-name (ivy-state-directory ivy-last))) - (goto-char (point-min)) - (forward-line (1- (string-to-number line-number))) - (re-search-forward (ivy--regex ivy-text t) (line-end-position) t) - (run-hooks 'counsel-grep-post-action-hook) - (selected-window)))))) - -;;;###autoload -(defun +ivy-confirm-delete-file (x) - (dired-delete-file x 'confirm-each-subdirectory)) - - -;; -;;; File searching - -;;;###autoload -(defun +ivy/projectile-find-file () - "A more sensible `counsel-projectile-find-file', which will revert to -`counsel-find-file' if invoked from $HOME or /, `counsel-file-jump' if invoked -from a non-project, `projectile-find-file' if in a big project (more than -`ivy-sort-max-size' files), or `counsel-projectile-find-file' otherwise. - -The point of this is to avoid Emacs locking up indexing massive file trees." - (interactive) - ;; Spoof the command so that ivy/counsel will display the (well fleshed-out) - ;; actions list for `counsel-find-file' on C-o. The actions list for the other - ;; commands aren't as well configured or are empty. - (let ((this-command 'counsel-find-file)) - (call-interactively - (cond ((or (file-equal-p default-directory "~") - (file-equal-p default-directory "/") - (when-let (proot (doom-project-root)) - (file-equal-p proot "~"))) - #'counsel-find-file) - - ((doom-project-p) - (let ((files (projectile-current-project-files))) - (if (<= (length files) ivy-sort-max-size) - #'counsel-projectile-find-file - #'projectile-find-file))) - - (#'counsel-file-jump))))) - -;;;###autoload -(cl-defun +ivy-file-search (&key query in all-files (recursive t) prompt args) - "Conduct a file search using ripgrep. - -:query STRING - Determines the initial input to search for. -:in PATH - Sets what directory to base the search out of. Defaults to the current - project's root. -:recursive BOOL - Whether or not to search files recursively from the base directory." - (declare (indent defun)) - (unless (executable-find "rg") - (user-error "Couldn't find ripgrep in your PATH")) - (require 'counsel) - (let* ((this-command 'counsel-rg) - (project-root (or (doom-project-root) default-directory)) - (directory (or in project-root)) - (args (concat (if all-files " -uu") - (unless recursive " --maxdepth 1") - " --hidden -g!.git " - (mapconcat #'shell-quote-argument args " ")))) - (setq deactivate-mark t) - (counsel-rg - (or query - (when (doom-region-active-p) - (replace-regexp-in-string - "[! |]" (lambda (substr) - (cond ((and (string= substr " ") - (not (featurep! +fuzzy))) - " ") - ((string= substr "|") - "\\\\\\\\|") - ((concat "\\\\" substr)))) - (rxt-quote-pcre (doom-thing-at-point-or-region))))) - directory args - (or prompt - (format "Search project [%s]: " - (cond ((equal directory default-directory) - "./") - ((equal directory project-root) - (projectile-project-name)) - ((file-relative-name directory project-root))) - (string-trim args)))))) - -;;;###autoload -(defun +ivy/project-search (&optional arg initial-query directory) - "Performs a live project search from the project root using ripgrep. - -If ARG (universal argument), include all files, even hidden or compressed ones, -in the search." - (interactive "P") - (+ivy-file-search :query initial-query :in directory :all-files arg)) - -;;;###autoload -(defun +ivy/project-search-from-cwd (&optional arg initial-query) - "Performs a project search recursively from the current directory. - -If ARG (universal argument), include all files, even hidden or compressed ones." - (interactive "P") - (+ivy/project-search arg initial-query default-directory)) - - -;; -;;; Wrappers around `counsel-compile' - -;;;###autoload -(defun +ivy/compile () - "Execute a compile command from the current buffer's directory." - (interactive) - ;; Fix unhelpful 'Couldn't find project root' error - (letf! (defun counsel--compile-root () - (ignore-errors - (funcall counsel--compile-root))) - (counsel-compile default-directory))) - -;;;###autoload -(defun +ivy/project-compile () - "Execute a compile command from the current project's root." - (interactive) - (counsel-compile (projectile-project-root))) - -;;;###autoload -(defun +ivy/jump-list () - "Go to an entry in evil's (or better-jumper's) jumplist." - (interactive) - ;; REVIEW Refactor me - (let (buffers) - (unwind-protect - (ivy-read "jumplist: " - (nreverse - (delete-dups - (delq - nil - (mapcar (lambda (mark) - (when mark - (cl-destructuring-bind (path pt _id) mark - (let ((buf (get-file-buffer path))) - (unless buf - (push (setq buf (find-file-noselect path t)) - buffers)) - (with-current-buffer buf - (goto-char pt) - (font-lock-fontify-region (line-beginning-position) (line-end-position)) - (cons (format "%s:%d: %s" - (buffer-name) - (line-number-at-pos) - (string-trim-right (or (thing-at-point 'line) ""))) - (point-marker))))))) - (cddr (better-jumper-jump-list-struct-ring - (better-jumper-get-jumps (better-jumper--get-current-context)))))))) - :sort nil - :require-match t - :action (lambda (cand) - (let ((mark (cdr cand))) - (delq! (marker-buffer mark) buffers) - (mapc #'kill-buffer buffers) - (setq buffers nil) - (with-current-buffer (switch-to-buffer (marker-buffer mark)) - (goto-char (marker-position mark))))) - :caller '+ivy/jump-list) - (mapc #'kill-buffer buffers)))) - -;;;###autoload -(defun +ivy/git-grep-other-window-action () - "Open the current counsel-{ag,rg,git-grep} candidate in other-window." - (interactive) - (ivy-set-action #'+ivy-git-grep-other-window-action) - (setq ivy-exit 'done) - (exit-minibuffer)) diff --git a/.config/emacs/modules/completion/ivy/autoload/posframe.el b/.config/emacs/modules/completion/ivy/autoload/posframe.el deleted file mode 100644 index eb080af..0000000 --- a/.config/emacs/modules/completion/ivy/autoload/posframe.el +++ /dev/null @@ -1,16 +0,0 @@ -;;; completion/ivy/autoload/posframe.el -*- lexical-binding: t; -*- -;;;###if (featurep! +childframe) - -;;;###autoload -(defun +ivy-display-at-frame-center-near-bottom-fn (str) - "TODO" - (ivy-posframe--display str #'+ivy-poshandler-frame-center-near-bottom-fn)) - -;;;###autoload -(defun +ivy-poshandler-frame-center-near-bottom-fn (info) - "TODO" - (let ((parent-frame (plist-get info :parent-frame)) - (pos (posframe-poshandler-frame-center info))) - (cons (car pos) - (truncate (/ (frame-pixel-height parent-frame) 2))))) - diff --git a/.config/emacs/modules/completion/ivy/config.el b/.config/emacs/modules/completion/ivy/config.el deleted file mode 100644 index 2999e5c..0000000 --- a/.config/emacs/modules/completion/ivy/config.el +++ /dev/null @@ -1,410 +0,0 @@ -;;; completion/ivy/config.el -*- lexical-binding: t; -*- - -(defvar +ivy-buffer-preview nil - "If non-nil, preview buffers while switching, à la `counsel-switch-buffer'. - -When nil, don't preview anything. -When non-nil, preview non-virtual buffers. -When 'everything, also preview virtual buffers") - -(defvar +ivy-buffer-unreal-face 'font-lock-comment-face - "The face for unreal buffers in `ivy-switch-to-buffer'.") - -(defvar +ivy-edit-functions nil - "A plist mapping ivy/counsel commands to commands that generate an editable -results buffer.") - - -;; -;;; Packages - -(use-package! ivy - :hook (doom-first-input . ivy-mode) - :init - (let ((standard-search-fn - (if (featurep! +prescient) - #'+ivy-prescient-non-fuzzy - #'ivy--regex-plus)) - (alt-search-fn - (if (featurep! +fuzzy) - #'ivy--regex-fuzzy - ;; Ignore order for non-fuzzy searches by default - #'ivy--regex-ignore-order))) - (setq ivy-re-builders-alist - `((counsel-rg . ,standard-search-fn) - (swiper . ,standard-search-fn) - (swiper-isearch . ,standard-search-fn) - (t . ,alt-search-fn)) - ivy-more-chars-alist - '((counsel-rg . 1) - (counsel-search . 2) - (t . 3)))) - - (define-key! - [remap switch-to-buffer] #'+ivy/switch-buffer - [remap switch-to-buffer-other-window] #'+ivy/switch-buffer-other-window - [remap persp-switch-to-buffer] #'+ivy/switch-workspace-buffer - [remap evil-show-jumps] #'+ivy/jump-list) - - ;; Fix #4886: otherwise our remaps are overwritten - (setq ivy-mode-map (make-sparse-keymap)) - :config - ;; The default sorter is much to slow and the default for `ivy-sort-max-size' - ;; is way too big (30,000). Turn it down so big repos affect project - ;; navigation less. - (setq ivy-sort-max-size 7500) - - ;; Counsel changes a lot of ivy's state at startup; to control for that, we - ;; need to load it as early as possible. Some packages (like `ivy-prescient') - ;; require this. - (require 'counsel nil t) - - (setq ivy-height 17 - ivy-wrap t - ivy-fixed-height-minibuffer t - ivy-read-action-function #'ivy-hydra-read-action - ivy-read-action-format-function #'ivy-read-action-format-columns - ;; don't show recent files in switch-buffer - ivy-use-virtual-buffers nil - ;; ...but if that ever changes, show their full path - ivy-virtual-abbreviate 'full - ;; don't quit minibuffer on delete-error - ivy-on-del-error-function #'ignore - ;; enable ability to select prompt (alternative to `ivy-immediate-done') - ivy-use-selectable-prompt t) - - ;; Highlight each ivy candidate including the following newline, so that it - ;; extends to the right edge of the window - (setf (alist-get 't ivy-format-functions-alist) - #'+ivy-format-function-line-or-arrow) - - ;; Integrate `ivy' with `better-jumper'; ensure a jump point is registered - ;; before jumping to new locations with ivy - (setf (alist-get 't ivy-hooks-alist) - (lambda () - (with-ivy-window - (setq +ivy--origin (point-marker))))) - - (add-hook! 'minibuffer-exit-hook - (defun +ivy--set-jump-point-maybe-h () - (when (markerp (bound-and-true-p +ivy--origin)) - (unless (equal (ignore-errors (with-ivy-window (point-marker))) - +ivy--origin) - (with-current-buffer (marker-buffer +ivy--origin) - (better-jumper-set-jump +ivy--origin))) - (set-marker +ivy--origin nil)) - (setq +ivy--origin nil))) - - (after! yasnippet - (add-hook 'yas-prompt-functions #'+ivy-yas-prompt-fn)) - - (after! ivy-hydra - ;; Ensure `ivy-dispatching-done' and `hydra-ivy/body' hydras can be - ;; exited / toggled by the same key binding they were opened - (add-to-list 'ivy-dispatching-done-hydra-exit-keys '("C-o" nil)) - (defhydra+ hydra-ivy () ("M-o" nil))) - - (define-key! ivy-minibuffer-map - [remap doom/delete-backward-word] #'ivy-backward-kill-word - "C-c C-e" #'+ivy/woccur - "C-o" #'ivy-dispatching-done - "M-o" #'hydra-ivy/body)) - - -(use-package! ivy-rich - :after ivy - :config - (setq ivy-rich-parse-remote-buffer nil) - - (when (featurep! +icons) - (cl-pushnew '(+ivy-rich-buffer-icon) - (cadr (plist-get ivy-rich-display-transformers-list - 'ivy-switch-buffer)) - :test #'equal)) - - (defun ivy-rich-bookmark-filename-or-empty (candidate) - (let ((filename (ivy-rich-bookmark-filename candidate))) - (if (not filename) "" filename))) - - ;; Enahnce the appearance of a couple counsel commands - (plist-put! ivy-rich-display-transformers-list - 'counsel-describe-variable - '(:columns - ((counsel-describe-variable-transformer (:width 40)) ; the original transformer - (+ivy-rich-describe-variable-transformer (:width 50)) ; display variable value - (ivy-rich-counsel-variable-docstring (:face font-lock-doc-face)))) - 'counsel-M-x - '(:columns - ((counsel-M-x-transformer (:width 60)) - (ivy-rich-counsel-function-docstring (:face font-lock-doc-face)))) - ;; Apply switch buffer transformers to `counsel-projectile-switch-to-buffer' as well - 'counsel-projectile-switch-to-buffer - (plist-get ivy-rich-display-transformers-list 'ivy-switch-buffer) - 'counsel-bookmark - '(:columns - ((ivy-rich-candidate (:width 0.5)) - (ivy-rich-bookmark-filename-or-empty (:width 60))))) - - ;; Remove built-in coloring of buffer list; we do our own - (setq ivy-switch-buffer-faces-alist nil) - (ivy-set-display-transformer 'internal-complete-buffer nil) - - ;; Highlight buffers differently based on whether they're in the same project - ;; as the current project or not. - (when-let* ((plist (plist-get ivy-rich-display-transformers-list 'ivy-switch-buffer)) - (switch-buffer-alist (assq 'ivy-rich-candidate (plist-get plist :columns)))) - (setcar switch-buffer-alist '+ivy-rich-buffer-name)) - - (ivy-rich-mode +1) - (ivy-rich-project-root-cache-mode +1)) - - -(use-package! all-the-icons-ivy - :when (featurep! +icons) - :after ivy - :config - ;; `all-the-icons-ivy' is incompatible with ivy-rich's switch-buffer - ;; modifications, so we disable them and merge them ourselves - (setq all-the-icons-ivy-buffer-commands nil) - - (all-the-icons-ivy-setup) - (after! counsel-projectile - (let ((all-the-icons-ivy-file-commands - '(counsel-projectile - counsel-projectile-find-file - counsel-projectile-find-dir))) - (all-the-icons-ivy-setup)))) - - -(use-package! counsel - :defer t - :init - (define-key! - [remap apropos] #'counsel-apropos - [remap bookmark-jump] #'counsel-bookmark - [remap compile] #'+ivy/compile - [remap describe-bindings] #'counsel-descbinds - [remap describe-face] #'counsel-faces - [remap describe-function] #'counsel-describe-function - [remap describe-variable] #'counsel-describe-variable - [remap describe-symbol] #'counsel-describe-symbol - [remap evil-show-registers] #'counsel-evil-registers - [remap evil-show-marks] #'counsel-mark-ring - [remap execute-extended-command] #'counsel-M-x - [remap find-file] #'counsel-find-file - [remap find-library] #'counsel-find-library - [remap imenu] #'counsel-imenu - [remap info-lookup-symbol] #'counsel-info-lookup-symbol - [remap load-theme] #'counsel-load-theme - [remap locate] #'counsel-locate - [remap org-goto] #'counsel-org-goto - [remap org-set-tags-command] #'counsel-org-tag - [remap projectile-compile-project] #'+ivy/project-compile - [remap recentf-open-files] #'counsel-recentf - [remap set-variable] #'counsel-set-variable - [remap swiper] #'counsel-grep-or-swiper - [remap insert-char] #'counsel-unicode-char - [remap yank-pop] #'counsel-yank-pop) - :config - (set-popup-rule! "^\\*ivy-occur" :size 0.35 :ttl 0 :quit nil) - - ;; HACK Fix an issue where `counsel-projectile-find-file-action' would try to - ;; open a candidate in an occur buffer relative to the wrong buffer, - ;; causing it to fail to find the file we want. - (defadvice! +ivy--run-from-ivy-directory-a (fn &rest args) - :around #'counsel-projectile-find-file-action - (let ((default-directory (ivy-state-directory ivy-last))) - (apply fn args))) - - ;; Don't use ^ as initial input. Set this here because `counsel' defines more - ;; of its own, on top of the defaults. - (setq ivy-initial-inputs-alist nil) - - ;; REVIEW Counsel allows `counsel-rg-base-command' to be a string or list. - ;; This backwards compatibility complicates things for Doom. Simpler to - ;; just force it to always be a list. - (when (stringp counsel-rg-base-command) - (setq counsel-rg-base-command (split-string counsel-rg-base-command))) - - ;; Integrate with `helpful' - (setq counsel-describe-function-function #'helpful-callable - counsel-describe-variable-function #'helpful-variable) - - ;; Decorate `doom/help-custom-variable' results the same way as - ;; `counsel-describe-variable' (adds value and docstring columns). - (ivy-configure 'doom/help-custom-variable :parent 'counsel-describe-variable) - - ;; Record in jumplist when opening files via counsel-{ag,rg,pt,git-grep} - (add-hook 'counsel-grep-post-action-hook #'better-jumper-set-jump) - (add-hook 'counsel-grep-post-action-hook #'recenter) - (ivy-add-actions - 'counsel-rg ; also applies to `counsel-rg' - '(("O" +ivy-git-grep-other-window-action "open in other window"))) - - ;; Make `counsel-compile' projectile-aware (if you prefer it over - ;; `+ivy/compile' and `+ivy/project-compile') - (add-to-list 'counsel-compile-root-functions #'projectile-project-root) - (after! savehist - ;; Persist `counsel-compile' history - (add-to-list 'savehist-additional-variables 'counsel-compile-history)) - - ;; `counsel-imenu' -- no sorting for imenu. Sort it by appearance in page. - (add-to-list 'ivy-sort-functions-alist '(counsel-imenu)) - - ;; `counsel-locate' - (when IS-MAC - ;; Use spotlight on mac by default since it doesn't need any additional setup - (setq counsel-locate-cmd #'counsel-locate-cmd-mdfind)) - - ;; `swiper' - ;; Don't mess with font-locking on the dashboard; it causes breakages - (add-to-list 'swiper-font-lock-exclude #'+doom-dashboard-mode) - - ;; `counsel-find-file' - (setq counsel-find-file-ignore-regexp "\\(?:^[#.]\\)\\|\\(?:[#~]$\\)\\|\\(?:^Icon?\\)") - (dolist (fn '(counsel-rg counsel-find-file)) - (ivy-add-actions - fn '(("p" (lambda (path) (with-ivy-window (insert (file-relative-name path default-directory)))) - "insert relative path") - ("P" (lambda (path) (with-ivy-window (insert path))) - "insert absolute path") - ("l" (lambda (path) (with-ivy-window (insert (format "[[./%s]]" (file-relative-name path default-directory))))) - "insert relative org-link") - ("L" (lambda (path) (with-ivy-window (insert (format "[[%s]]" path)))) - "Insert absolute org-link")))) - - (ivy-add-actions 'counsel-file-jump (plist-get ivy--actions-list 'counsel-find-file)) - - ;; `counsel-search': use normal page for displaying results, so that we see - ;; custom ddg themes (if one is set). - (setf (nth 1 (alist-get 'ddg counsel-search-engines-alist)) - "https://duckduckgo.com/?q=") - - ;; REVIEW Move this somewhere else and perhaps generalize this so both - ;; ivy/helm users can enjoy it. - (defadvice! +ivy--counsel-file-jump-use-fd-rg-a (args) - "Change `counsel-file-jump' to use fd or ripgrep, if they are available." - :override #'counsel--find-return-list - (cl-destructuring-bind (find-program . args) - (cond ((when-let (fd (executable-find (or doom-projectile-fd-binary "fd") t)) - (append (list fd "-H" "--color=never" "--type" "file" "--type" "symlink" "--follow") - (if IS-WINDOWS '("--path-separator=/"))))) - ((executable-find "rg" t) - (append (list "rg" "--files" "--follow" "--color=never" "--hidden" "-g!.git" "--no-messages") - (cl-loop for dir in projectile-globally-ignored-directories - collect "--glob" - collect (concat "!" dir)) - (if IS-WINDOWS '("--path-separator=/")))) - ((cons find-program args))) - (unless (listp args) - (user-error "`counsel-file-jump-args' is a list now, please customize accordingly.")) - (counsel--call - (cons find-program args) - (lambda () - (goto-char (point-min)) - (let (files) - (while (< (point) (point-max)) - (push (buffer-substring (line-beginning-position) (line-end-position)) - files) - (forward-line 1)) - (nreverse files))))))) - - -(use-package! counsel-projectile - :defer t - :init - (define-key! - [remap projectile-find-file] #'+ivy/projectile-find-file - [remap projectile-find-dir] #'counsel-projectile-find-dir - [remap projectile-switch-to-buffer] #'counsel-projectile-switch-to-buffer - [remap projectile-grep] #'counsel-projectile-grep - [remap projectile-ag] #'counsel-projectile-ag - [remap projectile-switch-project] #'counsel-projectile-switch-project) - :config - ;; A more sensible `counsel-projectile-find-file' that reverts to - ;; `counsel-find-file' if invoked from $HOME, `counsel-file-jump' if invoked - ;; from a non-project, `projectile-find-file' if in a big project (more than - ;; `ivy-sort-max-size' files), or `counsel-projectile-find-file' otherwise. - (setf (alist-get 'projectile-find-file counsel-projectile-key-bindings) - #'+ivy/projectile-find-file) - - ;; no highlighting visited files; slows down the filtering - (ivy-set-display-transformer #'counsel-projectile-find-file nil) - - (when (featurep! +prescient) - (setq counsel-projectile-sort-files t))) - - -(use-package! wgrep - :commands wgrep-change-to-wgrep-mode - :config (setq wgrep-auto-save-buffer t)) - - -(use-package! ivy-posframe - :when (featurep! +childframe) - :hook (ivy-mode . ivy-posframe-mode) - :config - (setq ivy-fixed-height-minibuffer nil - ivy-posframe-border-width 10 - ivy-posframe-parameters - `((min-width . 90) - (min-height . ,ivy-height))) - - ;; default to posframe display function - (setf (alist-get t ivy-posframe-display-functions-alist) - #'+ivy-display-at-frame-center-near-bottom-fn) - - ;; posframe doesn't work well with async sources (the posframe will - ;; occasionally stop responding/redrawing), and causes violent resizing of the - ;; posframe. - (dolist (fn '(swiper counsel-rg counsel-grep counsel-git-grep)) - (setf (alist-get fn ivy-posframe-display-functions-alist) - #'ivy-display-function-fallback)) - - (add-hook 'doom-after-reload-hook #'posframe-delete-all)) - - -(use-package! flx - :when (featurep! +fuzzy) - :unless (featurep! +prescient) - :defer t ; is loaded by ivy - :preface (setq ivy--flx-featurep (featurep! +fuzzy)) - :init (setq ivy-flx-limit 10000)) - -(use-package! ivy-avy - :after ivy) - -(use-package! ivy-prescient - :when (featurep! +prescient) - :hook (ivy-mode . ivy-prescient-mode) - :hook (ivy-prescient-mode . prescient-persist-mode) - :commands +ivy-prescient-non-fuzzy - :init - (setq prescient-filter-method - (if (featurep! +fuzzy) - '(literal regexp initialism fuzzy) - '(literal regexp initialism))) - :config - ;; REVIEW Remove when raxod502/prescient.el#102 is resolved - (add-to-list 'ivy-sort-functions-alist '(ivy-resume)) - (setq ivy-prescient-sort-commands - '(:not swiper swiper-isearch ivy-switch-buffer lsp-ivy-workspace-symbol - ivy-resume ivy--restore-session counsel-grep counsel-git-grep - counsel-rg counsel-ag counsel-ack counsel-fzf counsel-pt counsel-imenu - counsel-yank-pop counsel-recentf counsel-buffer-or-recentf - counsel-outline counsel-org-goto counsel-jq) - ivy-prescient-retain-classic-highlighting t) - (defun +ivy-prescient-non-fuzzy (str) - (let ((prescient-filter-method '(literal regexp))) - (ivy-prescient-re-builder str))) - - ;; NOTE prescient config duplicated with `company' - (setq prescient-save-file (concat doom-cache-dir "prescient-save.el"))) - - -;;;###package swiper -(setq swiper-action-recenter t) - - -;;;###package amx -(setq amx-save-file (concat doom-cache-dir "amx-items")) ; used by `counsel-M-x' diff --git a/.config/emacs/modules/completion/ivy/doctor.el b/.config/emacs/modules/completion/ivy/doctor.el deleted file mode 100644 index a79d37c..0000000 --- a/.config/emacs/modules/completion/ivy/doctor.el +++ /dev/null @@ -1,3 +0,0 @@ -;; -*- lexical-binding: t; no-byte-compile: t; -*- -;;; completion/ivy/doctor.el - diff --git a/.config/emacs/modules/completion/ivy/packages.el b/.config/emacs/modules/completion/ivy/packages.el deleted file mode 100644 index f2ab2ae..0000000 --- a/.config/emacs/modules/completion/ivy/packages.el +++ /dev/null @@ -1,24 +0,0 @@ -;; -*- no-byte-compile: t; -*- -;;; completion/ivy/packages.el - -(package! swiper :pin "1c6b3da377a840e898b14020133f59fca9ceea1c") -(package! ivy) -(package! ivy-hydra) -(package! ivy-avy) -(package! counsel) - -(package! amx :pin "37f9c7ae55eb0331b27200fb745206fc58ceffc0") -(package! counsel-projectile :pin "e30150792a96968f55f34638cbfe63eaa30839cc") -(package! ivy-rich :pin "600b8183ed0be8668dcc548cc2c8cb94b001363b") -(package! wgrep :pin "f9687c28bbc2e84f87a479b6ce04407bb97cfb23") - -(if (featurep! +prescient) - (package! ivy-prescient :pin "292ac9fe351d469f44765d487f6b9a1c1a68ad1e") - (when (featurep! +fuzzy) - (package! flx :pin "e3b3f0533e44c5250ce73d728b59a7e96c692b5d"))) - -(when (featurep! +childframe) - (package! ivy-posframe :pin "5d9420252ca855d6d206f1f8ef5993a6be3c618f")) - -(when (featurep! +icons) - (package! all-the-icons-ivy :pin "a70cbfa1effe36efc946a823a580cec686d5e88d")) diff --git a/.config/emacs/modules/completion/vertico/README.org b/.config/emacs/modules/completion/vertico/README.org deleted file mode 100644 index 31fa9f6..0000000 --- a/.config/emacs/modules/completion/vertico/README.org +++ /dev/null @@ -1,284 +0,0 @@ -#+TITLE: completion/vertico -#+DATE: July 25, 2021 -#+SINCE: v3.0.0 -#+STARTUP: inlineimages - -* Table of Contents :TOC_3:noexport: -- [[#description][Description]] - - [[#maintainers][Maintainers]] - - [[#module-flags][Module Flags]] - - [[#plugins][Plugins]] -- [[#prerequisites][Prerequisites]] -- [[#features][Features]] - - [[#vertico-keybindings][Vertico keybindings]] - - [[#jump-to-navigation][Jump-to navigation]] - - [[#project-search--replace][Project search & replace]] - - [[#in-buffer-searching][In-buffer searching]] - - [[#vertico-integration-for-various-completing-commands][Vertico integration for various completing commands]] - - [[#general][General]] - - [[#jump-to-files-buffers-or-projects][Jump to files, buffers or projects]] - - [[#search][Search]] - - [[#file-path-completion][File Path Completion]] - - [[#consult][Consult]] - - [[#multiple-candidate-search][Multiple candidate search]] - - [[#async-search-commands][Async search commands]] - - [[#marginalia][Marginalia]] - - [[#orderless-filtering][Orderless filtering]] -- [[#configuration][Configuration]] - - [[#vertico][Vertico]] - - [[#consult-1][Consult]] - - [[#marginalia-1][Marginalia]] - - [[#embark][Embark]] - -* Description -This module enhances the Emacs search and completion experience, and also -provides a united interface for project search and replace, powered by [[https://github.com/BurntSushi/ripgrep/][ripgrep]]. - -It does this with several modular packages focused on enhancing the built-in -~completing-read~ interface, rather than replacing it with a parallel ecosystem -like =ivy= and =helm= do. The primary packages are: - -+ Vertico, which provides the vertical completion user interface -+ Consult, which provides a suite of useful commands using ~completing-read~ -+ Embark, which provides a set of minibuffer actions -+ Marginalia, which provides annotations to completion candidates -+ Orderless, which provides better filtering methods - -** Maintainers -+ @iyefrat - -** Module Flags -+ =+icons= Adds icons to =file= and =buffer= category completion selections. - -** Plugins -+ [[https://github.com/minad/vertico][vertico]] -+ [[https://github.com/minad/consult][consult]] -+ [[https://github.com/oantolin/embark/][embark]] -+ [[https://github.com/oantolin/embark/][embark-consult]] -+ [[https://github.com/minad/marginalia][marginalia]] -+ [[https://github.com/oantolin/orderless][orderless]] -+ [[https://github.com/mhayashi1120/Emacs-wgrep][wgrep]] -+ [[https://github.com/minad/consult/][consult-flycheck]] (=:checkers syntax=) -+ [[https://github.com/iyefrat/all-the-icons-completion][all-the-icons-completion]] (=+icons=) - -* Prerequisites -Some of the advanced filtering features in async =consult= commands require -=grep= and =ripgrep= to be built with support for [[https://www.pcre.org/][PCRE]] lookahead, see [[#async-search-commands][Async -search commands]] for more information. You can check if this is true for your -machine by running ~doom doctor~. - -* Features - -The packages in this module modify and use the built-in ~completing-read~ -function, which is used by any function that requires completion. Due to this -the full scope of these packages is too large to cover here and you are -encouraged to go and read their excellent documentation. We will detail -Doom-specific additions: - -** Vertico keybindings -When in an active Vertico completion session, the following doom added -keybindings are available: - -| Keybind | Description | -|-----------------------+----------------------------------------------------| -| =C-k= | (evil) Go to previous candidate | -| =C-j= | (evil) Go to next candidate | -| =C-M-k= | (evil) Go to previous group | -| =C-M-j= | (evil) Go to next group | -| =C-;= or = a= | Open an ~embark-act~ menu to chose a useful action | -| =C-c C-;= | export the current candidate list to a buffer | -| =C-SPC= | Preview the current candidate | - -~embark-act~ will prompt you with a =which-key= menu with useful commands on the -selected candidate or candidate list, depending on the completion category. Note -that you can press =C-h= instead of choosing a command to filter through the -options with a Vertico buffer, that also has slightly more detailed descriptions -due to Marginalia annotations. - -** Jump-to navigation -This module provides an interface to navigate within a project using -=projectile=: - -https://assets.doomemacs.org/completion/vertico/projectile.png - -| Keybind | Description | -|----------------------+-------------------------------------| -| =SPC p f=, =SPC SPC= | Jump to file in project | -| =SPC f f=, =SPC .= | Jump to file from current directory | -| =SPC s i= | Jump to symbol in file | - -** Project search & replace -This module provides interactive text search and replace using ripgrep. - -| Keybind | Description | -|-----------+--------------------------| -| =SPC s p= | Search project | -| =SPC s P= | Search another project | -| =SPC s d= | Search this directory | -| =SPC s D= | Search another directory | - -https://assets.doomemacs.org/completion/vertico/search.png - -Prefixing these keys with the universal argument (=SPC u= for evil users; =C-u= -otherwise) changes the behavior of these commands, instructing the underlying -search engine to include ignored files. - -This module also provides Ex Commands for evil users: - -| Ex command | Description | -|------------------------+------------------------------------------------------------------| -| ~:pg[rep][!] [QUERY]~ | Search project (if ~!~, include hidden files) | -| ~:pg[rep]d[!] [QUERY]~ | Search from current directory (if ~!~, don't search recursively) | - -The optional `!` is equivalent to the universal argument for the previous -commands. - ------ - -On top of the usual Vertico keybindings, search commands also offer support for -exporting the current candidate list to an editable buffer =C-c C-e=. After -editing the changes can be committed with =C-c C-c= and aborted with =C-c C-k= -(alternatively =ZZ= and =ZQ=, for evil users). It uses =wgrep= for grep -searches, =wdired= for file searches, and =occur= for buffer searches. - -https://assets.doomemacs.org/completion/vertico/search-replace.png - -** In-buffer searching -This module provides some in buffer searching bindings: - -+ =SPC s s= (~isearch~) -+ =SPC s S= (~+vertico/search-symbol-at-point~ via ~consult-line~) -+ =SPC s b= (~consult-line~) - -https://assets.doomemacs.org/completion/vertico/buffer-search.png - -An ~occur-edit~ buffer can be opened from ~consult-line~ with =C-c C-e=. - -** Vertico integration for various completing commands -*** General -| Keybind | Description | -|----------------+-----------------------------| -| =M-x=, =SPC := | Enhanced M-x | -| =SPC '= | Resume last Vertico session | - -*** Jump to files, buffers or projects -| Keybind | Description | -|----------------------+---------------------------------------| -| =SPC RET= | Find bookmark | -| =SPC f f=, =SPC .= | Browse from current directory | -| =SPC p f=, =SPC SPC= | Find file in project | -| =SPC f r= | Find recently opened file | -| =SPC p p= | Open another project | -| =SPC b b=, =SPC ,= | Switch to buffer in current workspace | -| =SPC b B=, =SPC <= | Switch to buffer | - -=SPC b b= and =SPC ,= support changing the workspace you're selecting a buffer from -via [[https://github.com/minad/consult#narrowing-and-grouping][Consult narrowing]], e.g. if you're on the first workspace, you can switch to -selecting a buffer from the third workspace by typing =3 SPC= into the prompt, -or the last workspace by typing =0 SPC=. - -=SPC f f= and =SPC .= support exporting to a =wdired= buffer using =C-c C-e=. - -*** Search -| Keybind | Description | -|-----------+-------------------------------------------| -| =SPC p t= | List all TODO/FIXMEs in project | -| =SPC s b= | Search the current buffer | -| =SPC s d= | Search this directory | -| =SPC s D= | Search another directory | -| =SPC s i= | Search for symbol in current buffer | -| =SPC s p= | Search project | -| =SPC s P= | Search another project | -| =SPC s s= | Search the current buffer (incrementally) | - -*** File Path Completion -Note that Emacs allows you to switch directories with shadow paths, for example -starting at =/foo/bar/baz=, typing =/foo/bar/baz/~/= will switch the searched -path to the home directory. For more information see ~substitute-in-file-name~ -and ~file-name-shadow-mode~. This module will erase the "shadowed" portion of -the path from the minibuffer, so in the previous example the path will be reset -to =~/=. - -** Consult -*** Multiple candidate search -This module modifies the default keybindings used in -~consult-completing-read-multiple~: -| Keybind | Description | -|---------+-------------------------------------------------------------| -| =TAB= | Select or deselect current candidate | -| =RET= | Enters selected candidates (also toggles current candidate) | - -*** Async search commands -Consult async commands (e.g. ~consult-ripgrep~) will have a preceding separator -character (usually =#=) before the search input. This is known as the =perl= -splitting style. Input typed after the separator will be fed to the async -command until you type a second seperator, afterwhich the candidate list will be -filtered with Emacs instead (and can be filtered using =orderless=, for -example). The specific seperator character can be changed by editing it, and -might be different if the initial input already contains =#=. - -Note that grep-like async commands translate the input (between the first and -second =#=) to an Orderless-light expression: space separated inputs are all -matched in any order. If the grep backend does not support PCRE lookahead, it'll -only accept 3 space separated inputs to prevent long lookup times, and further -filtering should be done after a second =#=. - -For more information [[https://github.com/minad/consult#asynchronous-search][see here]]. - -** Marginalia -| Keybind | Description | -|---------+---------------------------------| -| =M-A= | Cycle between annotation levels | - -Marginalia annotations for symbols (e.g. =SPC h f= and =SPC h v=) come with -extra information the nature of the symbol. For the meaning of the annotations -see ~marginalia--symbol-class~. - -** Orderless filtering -When using orderless to filter through candidates, the default behaviour is for -each space separated input to match the candidate as a regular expression or -literally. - -Note that due to this style of matching, pressing tab does not expand the input -to the longest matching prefix (like shell completion), but rather uses the -first matched candidate as input. Filtering further is instead achieved by -pressing space and entering another input. In essence, when trying to match -=foobar.org=, instead of option 1., use option 2.: - -1. (BAD) Enter =foo TAB=, completes to =foobar.=, enter =org RET= -2. (GOOD) Enter =foo SPC org RET= - -Doom has some builtin [[https://github.com/oantolin/orderless#style-dispatchers][style dispatchers]] for more finegrained filtering, which -you can use to further specify each space separated input in the following ways: -| Input | Description | -|------------------+----------------------------------------------| -| =!foo= | match without literal input =foo= | -| =%foo= or =foo%= | perform ~char-fold-to-regexp~ on input =foo= | -| =`foo= or =foo`= | match input =foo= as an initialism | -| ==foo= or =foo== | match only with literal input =foo= | -| =~foo= or =foo~= | match input =foo= with fuzzy/flex matching | - -* Configuration -If you want to further configure this module, here are some good places to start: -** Vertico - Vertico provides several [[https://github.com/minad/vertico#extensions][extentions]] that can be used to extend it's interface -** Consult -Much of the behaviour of Consult commands can be changed with -~consult-customize~. The =vertico= module already does this, if you want to -override the module's modifications, do: -#+begin_src emacs-lisp -(setq consult--read-config nil) -(consult-customize -;... -) -#+end_src -If you are changing the preview key (set to =C-SPC=), remember to change the -binding on ~vertico-map~ as well, as the binding there gets previews to work to -an extent on non-consult commands as well. -** Marginalia -You can add more Marginalia annotation levels and change the existing ones by - editing ~marginalia-annotator-registry~ -** Embark -You can change the available commands in Embark for category ~$cat~ by editing - ~embark-$cat-map~, and even add new categories. Note that you add categories - by defining them [[https://github.com/minad/marginalia/#adding-custom-annotators-or-classifiers][through marginalia]], and embark picks up on them. diff --git a/.config/emacs/modules/completion/vertico/autoload/evil.el b/.config/emacs/modules/completion/vertico/autoload/evil.el deleted file mode 100644 index 85e10ce..0000000 --- a/.config/emacs/modules/completion/vertico/autoload/evil.el +++ /dev/null @@ -1,14 +0,0 @@ -;; completion/vertico/autoload/evil.el -*- lexical-binding: t; -*- -;;;###if (featurep! :editor evil) - -;;;###autoload (autoload '+vertico:project-search "completion/vertico/autoload/evil" nil t) -(evil-define-command +vertico:project-search (query &optional all-files-p) - "Ex interface for `+vertico/project-search'." - (interactive "") - (+vertico/project-search all-files-p query)) - -;;;###autoload (autoload '+vertico:project-search-from-cwd "completion/vertico/autoload/evil" nil t) -(evil-define-command +vertico:project-search-from-cwd (query &optional recurse-p) - "Ex interface for `+vertico/project-search-from-cwd'." - (interactive "") - (+vertico/project-search-from-cwd (not recurse-p) query)) diff --git a/.config/emacs/modules/completion/vertico/autoload/magit.el b/.config/emacs/modules/completion/vertico/autoload/magit.el deleted file mode 100644 index f3cbc9d..0000000 --- a/.config/emacs/modules/completion/vertico/autoload/magit.el +++ /dev/null @@ -1,8 +0,0 @@ -;;; completion/vertico/autoload/magit.el -*- lexical-binding: t; -*- -;;;###if (featurep! :tools magit) - -;;;###autoload -(defun +vertico/embark-magit-status (file) - "Run `magit-status` on repo containing the embark target." - (interactive "GFile: ") - (magit-status (locate-dominating-file file ".git"))) diff --git a/.config/emacs/modules/completion/vertico/autoload/vertico.el b/.config/emacs/modules/completion/vertico/autoload/vertico.el deleted file mode 100644 index ba7bbe6..0000000 --- a/.config/emacs/modules/completion/vertico/autoload/vertico.el +++ /dev/null @@ -1,256 +0,0 @@ -;;; completion/vertico/autoload/vertico.el -*- lexical-binding: t; -*- - -;; To prevent "Defining as dynamic an already lexical var" from +vertico/embark-preview -;;;###autoload -(defvar embark-quit-after-action) - -;;;###autoload -(cl-defun +vertico-file-search (&key query in all-files (recursive t) prompt args) - "Conduct a file search using ripgrep. - -:query STRING - Determines the initial input to search for. -:in PATH - Sets what directory to base the search out of. Defaults to the current project's root. -:recursive BOOL - Whether or not to search files recursively from the base directory." - (declare (indent defun)) - (unless (executable-find "rg") - (user-error "Couldn't find ripgrep in your PATH")) - (require 'consult) - (setq deactivate-mark t) - (let* ((project-root (or (doom-project-root) default-directory)) - (directory (or in project-root)) - (consult-ripgrep-args - (concat "rg " - (if all-files "-uu ") - (unless recursive "--maxdepth 1 ") - "--null --line-buffered --color=never --max-columns=1000 " - "--path-separator / --smart-case --no-heading --line-number " - "--hidden -g !.git " - (mapconcat #'shell-quote-argument args " ") - " .")) - (prompt (if (stringp prompt) (string-trim prompt) "Search")) - (query (or query - (when (doom-region-active-p) - (regexp-quote (doom-thing-at-point-or-region))))) - (consult-async-split-style consult-async-split-style) - (consult-async-split-styles-alist consult-async-split-styles-alist)) - ;; Change the split style if the initial query contains the separator. - (when query - (cl-destructuring-bind (&key type separator initial) - (consult--async-split-style) - (pcase type - (`separator - (replace-regexp-in-string (regexp-quote (char-to-string separator)) - (concat "\\" (char-to-string separator)) - query t t)) - (`perl - (when (string-match-p initial query) - (setf (alist-get 'perlalt consult-async-split-styles-alist) - `(:initial ,(or (cl-loop for char in (list "%" "@" "!" "&" "/" ";") - unless (string-match-p char query) - return char) - "%") - :type perl) - consult-async-split-style 'perlalt)))))) - (consult--grep prompt #'consult--ripgrep-builder directory query))) - -;;;###autoload -(defun +vertico/project-search (&optional arg initial-query directory) - "Peforms a live project search from the project root using ripgrep. -If ARG (universal argument), include all files, even hidden or compressed ones, -in the search." - (interactive "P") - (+vertico-file-search :query initial-query :in directory :all-files arg)) - -;;;###autoload -(defun +vertico/project-search-from-cwd (&optional arg initial-query) - "Performs a live project search from the current directory. -If ARG (universal argument), include all files, even hidden or compressed ones." - (interactive "P") - (+vertico/project-search arg initial-query default-directory)) - -;;;###autoload -(defun +vertico/search-symbol-at-point () - (interactive) - (consult-line (thing-at-point 'symbol))) - -;;;###autoload -(defun +vertico-embark-target-package-fn () - "Targets Doom's package! statements and returns the package name" - (when (or (derived-mode-p 'emacs-lisp-mode) (derived-mode-p 'org-mode)) - (save-excursion - (when (and (search-backward "(" nil t) - (looking-at "(\\s-*package!\\s-*\\(\\(\\sw\\|\\s_\\)+\\)\\s-*")) - (let ((pkg (match-string 1))) - (set-text-properties 0 (length pkg) nil pkg) - `(package . ,pkg)))))) - -;;;###autoload -(defun +vertico/embark-export-write () - "Export the current vertico results to a writable buffer if possible. - -Supports exporting consult-grep to wgrep, file to wdeired, and consult-location to occur-edit" - (interactive) - (require 'embark) - (require 'wgrep) - (pcase-let ((`(,type . ,candidates) - (run-hook-with-args-until-success 'embark-candidate-collectors))) - (pcase type - ('consult-grep (let ((embark-after-export-hook #'wgrep-change-to-wgrep-mode)) - (embark-export))) - ('file (let ((embark-after-export-hook #'wdired-change-to-wdired-mode)) - (embark-export))) - ('consult-location (let ((embark-after-export-hook #'occur-edit-mode)) - (embark-export))) - (x (user-error "embark category %S doesn't support writable export" x))))) - -;;;###autoload -(defun +vertico/embark-preview () - "Previews candidate in vertico buffer, unless it's a consult command" - (interactive) - (unless (bound-and-true-p consult--preview-function) - (save-selected-window - (let ((embark-quit-after-action nil)) - (embark-dwim))))) - -(defvar +vertico/find-file-in--history nil) -;;;###autoload -(defun +vertico/find-file-in (&optional dir initial) - "Jump to file under DIR (recursive). -If INITIAL is non-nil, use as initial input." - (interactive) - (require 'consult) - (let* ((default-directory (or dir default-directory)) - (prompt-dir (consult--directory-prompt "Find" default-directory)) - (cmd (split-string-and-unquote +vertico-consult-fd-args " "))) - (find-file - (consult--read - (split-string (cdr (apply #'doom-call-process cmd)) "\n" t) - :prompt default-directory - :sort nil - :initial (if initial (shell-quote-argument initial)) - :add-history (thing-at-point 'filename) - :category 'file - :history '(:input +vertico/find-file-in--history))))) - -;;;###autoload -(defun +vertico/jump-list (jump) - "Go to an entry in evil's (or better-jumper's) jumplist." - (interactive - (let (buffers) - (require 'consult) - (unwind-protect - (list - (consult--read - ;; REVIEW Refactor me - (nreverse - (delete-dups - (delq - nil (mapcar - (lambda (mark) - (when mark - (cl-destructuring-bind (path pt _id) mark - (let* ((visiting (find-buffer-visiting path)) - (buf (or visiting (find-file-noselect path t))) - (dir default-directory)) - (unless visiting - (push buf buffers)) - (with-current-buffer buf - (goto-char pt) - (font-lock-fontify-region - (line-beginning-position) (line-end-position)) - (format "%s:%d: %s" - (car (cl-sort (list (abbreviate-file-name (buffer-file-name buf)) - (file-relative-name (buffer-file-name buf) dir)) - #'< :key #'length)) - (line-number-at-pos) - (string-trim-right (or (thing-at-point 'line) "")))))))) - (cddr (better-jumper-jump-list-struct-ring - (better-jumper-get-jumps (better-jumper--get-current-context)))))))) - :prompt "jumplist: " - :sort nil - :require-match t - :category 'jump-list)) - (mapc #'kill-buffer buffers)))) - (if (not (string-match "^\\([^:]+\\):\\([0-9]+\\): " jump)) - (user-error "No match") - (let ((file (match-string-no-properties 1 jump)) - (line (match-string-no-properties 2 jump))) - (find-file file) - (goto-char (point-min)) - (forward-line (string-to-number line))))) - -;;;###autoload -(defun +vertico-embark-which-key-indicator () - "An embark indicator that displays keymaps using which-key. -The which-key help message will show the type and value of the -current target followed by an ellipsis if there are further -targets." - (lambda (&optional keymap targets prefix) - (if (null keymap) - (which-key--hide-popup-ignore-command) - (which-key--show-keymap - (if (eq (plist-get (car targets) :type) 'embark-become) - "Become" - (format "Act on %s '%s'%s" - (plist-get (car targets) :type) - (embark--truncate-target (plist-get (car targets) :target)) - (if (cdr targets) "…" ""))) - (if prefix - (pcase (lookup-key keymap prefix 'accept-default) - ((and (pred keymapp) km) km) - (_ (key-binding prefix 'accept-default))) - keymap) - nil nil t (lambda (binding) - (not (string-suffix-p "-argument" (cdr binding)))))))) - -;;;###autoload -(defun +vertico/crm-select () - "Enter candidate in `consult-completing-read-multiple'" - (interactive) - (let ((idx vertico--index)) - (unless (get-text-property 0 'consult--crm-selected (nth vertico--index vertico--candidates)) - (setq idx (1+ idx))) - (run-at-time 0 nil (cmd! (vertico--goto idx) (vertico--exhibit)))) - (vertico-exit)) - -;;;###autoload -(defun +vertico/crm-exit () - "Enter candidate in `consult-completing-read-multiple'" - (interactive) - (run-at-time 0 nil #'vertico-exit) - (vertico-exit)) - -;;;###autoload -(defun +vertico--consult--fd-builder (input) - (pcase-let* ((cmd (split-string-and-unquote +vertico-consult-fd-args)) - (`(,arg . ,opts) (consult--command-split input)) - (`(,re . ,hl) (funcall consult--regexp-compiler - arg 'extended))) - (when re - (list :command (append cmd - (list (consult--join-regexps re 'extended)) - opts) - :highlight hl)))) - -(autoload #'consult--directory-prompt "consult") -;;;###autoload -(defun +vertico/consult-fd (&optional dir initial) - (interactive "P") - (if doom-projectile-fd-binary - (let* ((prompt-dir (consult--directory-prompt "Fd" dir)) - (default-directory (cdr prompt-dir))) - (find-file (consult--find (car prompt-dir) #'+vertico--consult--fd-builder initial))) - (consult-find dir initial))) - -;;;###autoload -(defun +vertico-basic-remote-try-completion (string table pred point) - (and (vertico--remote-p string) - (completion-basic-try-completion string table pred point))) - -;;;###autoload -(defun +vertico-basic-remote-all-completions (string table pred point) - (and (vertico--remote-p string) - (completion-basic-all-completions string table pred point))) diff --git a/.config/emacs/modules/completion/vertico/autoload/workspaces.el b/.config/emacs/modules/completion/vertico/autoload/workspaces.el deleted file mode 100644 index a5f194f..0000000 --- a/.config/emacs/modules/completion/vertico/autoload/workspaces.el +++ /dev/null @@ -1,68 +0,0 @@ -;;; completion/vertico/autoload/workspaces.el -*- lexical-binding: t; -*- -;;;###if (featurep! :ui workspaces) - -;;;###autoload -(defun +vertico--workspace-nth-source (n) - "Generate a consult buffer source for buffers in the NTH workspace" - (cond ((numberp n) - `(:name ,(nth n (+workspace-list-names)) - :hidden ,(not (string= (+workspace-current-name) (nth n (+workspace-list-names)))) - :narrow ,(string-to-char (number-to-string (1+ n))) - :category buffer - :state ,#'consult--buffer-state - :items ,(lambda () - (consult--buffer-query - :sort 'visibility - :as #'buffer-name - :predicate (lambda (buf) - (+workspace-contains-buffer-p - buf - (nth n (+workspace-list)))))))) - ((eq n 'final) - `(:name ,(car (last (+workspace-list-names))) - :hidden t - :narrow ?0 - :category buffer - :state ,#'consult--buffer-state - :items ,(lambda () - (consult--buffer-query - :sort 'visibility - :as #'buffer-name - :predicate (lambda (buf) - (+workspace-contains-buffer-p - buf - (car (last (+workspace-list))))))))) - (t - (user-error "invalid workspace source %s" n)))) - -;;;###autoload -(defun +vertico--workspace-generate-sources () - "Generate list of consult buffer sources for all workspaces" - (mapcar #'+vertico--workspace-nth-source '(0 1 2 3 4 5 6 7 8 final))) - -(autoload 'consult--multi "consult") -;;;###autoload -(defun +vertico/switch-workspace-buffer () - "Switch to another buffer in the same workspace. - -Use consult narrowing with another workspace number to open a buffer from that workspace - BUG but it opens it in the current workspace (ivy also does this, but who cares)" - (interactive) - (when-let (buffer (consult--multi (+vertico--workspace-generate-sources) - :require-match - (confirm-nonexistent-file-or-buffer) - :prompt (format "Switch to buffer (%s): " - (+workspace-current-name)) - :history 'consult--buffer-history - :sort nil)) - ;; When the buffer does not belong to a source, - ;; create a new buffer with the name. - (unless (cdr buffer) - (funcall consult--buffer-display (car buffer))))) - -;;;###autoload -(defun +vertico/embark-open-in-new-workspace (x) - "Open X (a file) in a new workspace." - (interactive) - (+workspace/new) - (find-file x)) diff --git a/.config/emacs/modules/completion/vertico/config.el b/.config/emacs/modules/completion/vertico/config.el deleted file mode 100644 index 4d64e47..0000000 --- a/.config/emacs/modules/completion/vertico/config.el +++ /dev/null @@ -1,244 +0,0 @@ -;;; completion/vertico/config.el -*- lexical-binding: t; -*- - -(defvar +vertico-company-completion-styles '(basic partial-completion orderless) - "Completion styles for company to use. - -The completion/vertico module uses the orderless completion style by default, -but this returns too broad a candidate set for company completion. This variable -overrides `completion-styles' during company completion sessions.") - -(defvar +vertico-consult-fd-args nil - "Shell command and arguments the vertico module uses for fd.") - -;; -;;; Packages - -(use-package! vertico - :hook (doom-first-input . vertico-mode) - :config - (setq vertico-resize nil - vertico-count 17 - vertico-cycle t - completion-in-region-function - (lambda (&rest args) - (apply (if vertico-mode - #'consult-completion-in-region - #'completion--in-region) - args))) - ;; Cleans up path when moving directories with shadowed paths syntax, e.g. - ;; cleans ~/foo/bar/// to /, and ~/foo/bar/~/ to ~/. - (add-hook 'rfn-eshadow-update-overlay-hook #'vertico-directory-tidy) - (add-hook 'minibuffer-setup-hook #'vertico-repeat-save) - (map! :map vertico-map [backspace] #'vertico-directory-delete-char)) - - -(use-package! orderless - :after-call doom-first-input-hook - :config - (defadvice! +vertico--company-capf--candidates-a (fn &rest args) - "Highlight company matches correctly, and try default completion styles before -orderless." - :around #'company-capf--candidates - (let ((orderless-match-faces [completions-common-part]) - (completion-styles +vertico-company-completion-styles)) - (apply fn args))) - - (defun +vertico-orderless-dispatch (pattern _index _total) - (cond - ;; Ensure $ works with Consult commands, which add disambiguation suffixes - ((string-suffix-p "$" pattern) - `(orderless-regexp . ,(concat (substring pattern 0 -1) "[\x100000-\x10FFFD]*$"))) - ;; Ignore single ! - ((string= "!" pattern) `(orderless-literal . "")) - ;; Without literal - ((string-prefix-p "!" pattern) `(orderless-without-literal . ,(substring pattern 1))) - ;; Character folding - ((string-prefix-p "%" pattern) `(char-fold-to-regexp . ,(substring pattern 1))) - ((string-suffix-p "%" pattern) `(char-fold-to-regexp . ,(substring pattern 0 -1))) - ;; Initialism matching - ((string-prefix-p "`" pattern) `(orderless-initialism . ,(substring pattern 1))) - ((string-suffix-p "`" pattern) `(orderless-initialism . ,(substring pattern 0 -1))) - ;; Literal matching - ((string-prefix-p "=" pattern) `(orderless-literal . ,(substring pattern 1))) - ((string-suffix-p "=" pattern) `(orderless-literal . ,(substring pattern 0 -1))) - ;; Flex matching - ((string-prefix-p "~" pattern) `(orderless-flex . ,(substring pattern 1))) - ((string-suffix-p "~" pattern) `(orderless-flex . ,(substring pattern 0 -1))))) - (add-to-list - 'completion-styles-alist - '(+vertico-basic-remote - +vertico-basic-remote-try-completion - +vertico-basic-remote-all-completions - "Use basic completion on remote files only")) - (setq completion-styles '(orderless) - completion-category-defaults nil - ;; note that despite override in the name orderless can still be used in - ;; find-file etc. - completion-category-overrides '((file (styles +vertico-basic-remote orderless partial-completion))) - orderless-style-dispatchers '(+vertico-orderless-dispatch) - orderless-component-separator "[ &]") - ;; ...otherwise find-file gets different highlighting than other commands - (set-face-attribute 'completions-first-difference nil :inherit nil)) - - -(use-package! consult - :defer t - :init - (define-key! - [remap apropos] #'consult-apropos - [remap bookmark-jump] #'consult-bookmark - [remap evil-show-marks] #'consult-mark - [remap evil-show-jumps] #'+vertico/jump-list - [remap evil-show-registers] #'consult-register - [remap goto-line] #'consult-goto-line - [remap imenu] #'consult-imenu - [remap locate] #'consult-locate - [remap load-theme] #'consult-theme - [remap man] #'consult-man - [remap recentf-open-files] #'consult-recent-file - [remap switch-to-buffer] #'consult-buffer - [remap switch-to-buffer-other-window] #'consult-buffer-other-window - [remap switch-to-buffer-other-frame] #'consult-buffer-other-frame - [remap yank-pop] #'consult-yank-pop - [remap persp-switch-to-buffer] #'+vertico/switch-workspace-buffer) - (advice-add #'completing-read-multiple :override #'consult-completing-read-multiple) - (advice-add #'multi-occur :override #'consult-multi-occur) - :config - (defadvice! +vertico--consult-recent-file-a (&rest _args) - "`consult-recent-file' needs to have `recentf-mode' on to work correctly" - :before #'consult-recent-file - (recentf-mode +1)) - - (setq consult-project-root-function #'doom-project-root - consult-narrow-key "<" - consult-line-numbers-widen t - consult-async-min-input 2 - consult-async-refresh-delay 0.15 - consult-async-input-throttle 0.2 - consult-async-input-debounce 0.1) - (unless +vertico-consult-fd-args - (setq +vertico-consult-fd-args - (if doom-projectile-fd-binary - (format "%s --color=never -i -H -E .git --regex %s" - doom-projectile-fd-binary - (if IS-WINDOWS "--path-separator=/" "")) - consult-find-args))) - - (consult-customize - consult-ripgrep consult-git-grep consult-grep - consult-bookmark consult-recent-file - +default/search-project +default/search-other-project - +default/search-project-for-symbol-at-point - +default/search-cwd +default/search-other-cwd - +default/search-notes-for-symbol-at-point - consult--source-file consult--source-project-file consult--source-bookmark - :preview-key (kbd "C-SPC")) - (consult-customize - consult-theme - :preview-key (list (kbd "C-SPC") :debounce 0.5 'any)) - (after! org - (defvar +vertico--consult-org-source - `(:name "Org" - :narrow ?o - :hidden t - :category buffer - :state ,#'consult--buffer-state - :items ,(lambda () (mapcar #'buffer-name (org-buffer-list))))) - (add-to-list 'consult-buffer-sources '+vertico--consult-org-source 'append)) - (map! :map consult-crm-map - :desc "Select candidate" "TAB" #'+vertico/crm-select - :desc "Enter candidates" "RET" #'+vertico/crm-exit)) - - -(use-package! consult-dir - :bind (([remap list-directory] . consult-dir) - :map vertico-map - ("C-x C-d" . consult-dir) - ("C-x C-j" . consult-dir-jump-file))) - -(use-package! consult-flycheck - :when (featurep! :checkers syntax) - :after (consult flycheck)) - - -(use-package! embark - :defer t - :init - (setq which-key-use-C-h-commands nil - prefix-help-command #'embark-prefix-help-command) - (map! [remap describe-bindings] #'embark-bindings - "C-;" #'embark-act ; to be moved to :config default if accepted - (:map minibuffer-local-map - "C-;" #'embark-act - "C-c C-;" #'embark-export - :desc "Export to writable buffer" "C-c C-e" #'+vertico/embark-export-write) - (:leader - :desc "Actions" "a" #'embark-act)) ; to be moved to :config default if accepted - :config - (set-popup-rule! "^\\*Embark Export Grep" :size 0.35 :ttl 0 :quit nil) - - (defadvice! +vertico--embark-which-key-prompt-a (fn &rest args) - "Hide the which-key indicator immediately when using the completing-read prompter." - :around #'embark-completing-read-prompter - (which-key--hide-popup-ignore-command) - (let ((embark-indicators - (remq #'embark-which-key-indicator embark-indicators))) - (apply fn args))) - (cl-nsubstitute #'+vertico-embark-which-key-indicator #'embark-mixed-indicator embark-indicators) - ;; add the package! target finder before the file target finder, - ;; so we don't get a false positive match. - (let ((pos (or (cl-position - 'embark-target-file-at-point - embark-target-finders) - (length embark-target-finders)))) - (cl-callf2 - cons - '+vertico-embark-target-package-fn - (nthcdr pos embark-target-finders))) - (embark-define-keymap +vertico/embark-doom-package-map - "Keymap for Embark package actions for packages installed by Doom." - ("h" doom/help-packages) - ("b" doom/bump-package) - ("c" doom/help-package-config) - ("u" doom/help-package-homepage)) - (setf (alist-get 'package embark-keymap-alist) #'+vertico/embark-doom-package-map) - (map! (:map embark-file-map - :desc "Open target with sudo" "s" #'doom/sudo-find-file - (:when (featurep! :tools magit) - :desc "Open magit-status of target" "g" #'+vertico/embark-magit-status) - (:when (featurep! :ui workspaces) - :desc "Open in new workspace" "TAB" #'+vertico/embark-open-in-new-workspace)))) - - -(use-package! marginalia - :hook (doom-first-input . marginalia-mode) - :init - (map! :map minibuffer-local-map - :desc "Cycle marginalia views" "M-A" #'marginalia-cycle) - :config - (when (featurep! +icons) - (add-hook 'marginalia-mode-hook #'all-the-icons-completion-marginalia-setup)) - (advice-add #'marginalia--project-root :override #'doom-project-root) - (pushnew! marginalia-command-categories - '(+default/find-file-under-here. file) - '(doom/find-file-in-emacsd . project-file) - '(doom/find-file-in-other-project . project-file) - '(doom/find-file-in-private-config . file) - '(doom/describe-active-minor-mode . minor-mode) - '(flycheck-error-list-set-filter . builtin) - '(persp-switch-to-buffer . buffer) - '(projectile-find-file . project-file) - '(projectile-recentf . project-file) - '(projectile-switch-to-buffer . buffer) - '(projectile-switch-project . project-file))) - - -(use-package! embark-consult - :after (embark consult) - :config - (add-hook 'embark-collect-mode-hook #'consult-preview-at-point-mode)) - - -(use-package! wgrep - :commands wgrep-change-to-wgrep-mode - :config (setq wgrep-auto-save-buffer t)) diff --git a/.config/emacs/modules/completion/vertico/doctor.el b/.config/emacs/modules/completion/vertico/doctor.el deleted file mode 100644 index 06806a3..0000000 --- a/.config/emacs/modules/completion/vertico/doctor.el +++ /dev/null @@ -1,11 +0,0 @@ -;;; completion/vertico/doctor.el -*- lexical-binding: t; -*- - -(require 'consult) - -(unless (consult--grep-lookahead-p "grep" "-P") - (warn! "The installed grep binary was not built with support for PCRE lookaheads. - Some advanced consult filtering features will not work as a result, see the module readme.")) - -(unless (consult--grep-lookahead-p "rg" "-P") - (warn! "The installed ripgrep binary was not built with support for PCRE lookaheads. - Some advanced consult filtering features will not work as a result, see the module readme.")) diff --git a/.config/emacs/modules/completion/vertico/packages.el b/.config/emacs/modules/completion/vertico/packages.el deleted file mode 100644 index 37b89b7..0000000 --- a/.config/emacs/modules/completion/vertico/packages.el +++ /dev/null @@ -1,24 +0,0 @@ -;; -*- no-byte-compile: t; -*- -;;; completion/vertico/packages.el - -(package! vertico - :recipe (:host github :repo "minad/vertico" - :files ("*.el" "extensions/*.el")) - :pin "eedcb847869226701acaf9a36dce0a51d1b60862") - -(package! orderless :pin "1ccf74ffdbb0dd34caa63022e92f947c09c49c86") - -(package! consult :pin "cc8eff9578f5d089735e8b7dd7a08732890ed648") -(package! consult-dir :pin "08f543ae6acbfc1ffe579ba1d00a5414012d5c0b") -(when (featurep! :checkers syntax) - (package! consult-flycheck :pin "0ad7e8ff15683a4d64b79c29b3fcf847edfe244b")) - -(package! embark :pin "e08899ef2e7fb9c1ed4b4b21e44cd368561f91f9") -(package! embark-consult :pin "e08899ef2e7fb9c1ed4b4b21e44cd368561f91f9") - -(package! marginalia :pin "2fb2787bc302a5533e09bc558c76eb914e98543b") - -(package! wgrep :pin "f9687c28bbc2e84f87a479b6ce04407bb97cfb23") - -(when (featurep! +icons) - (package! all-the-icons-completion :pin "a0f34d68cc12330ab3992a7521f9caa1de3b8470")) diff --git a/.config/emacs/modules/config/default/+emacs-bindings.el b/.config/emacs/modules/config/default/+emacs-bindings.el deleted file mode 100644 index e2298b0..0000000 --- a/.config/emacs/modules/config/default/+emacs-bindings.el +++ /dev/null @@ -1,641 +0,0 @@ -;;; config/default/+emacs-bindings.el -*- lexical-binding: t; -*- - -;; Sensible default key bindings for non-evil users -(setq doom-leader-alt-key "C-c" - doom-localleader-alt-key "C-c l") - -;; persp-mode and projectile in different prefixes -(setq! persp-keymap-prefix (kbd "C-c w")) -(after! projectile - (define-key projectile-mode-map (kbd "C-c p") 'projectile-command-map)) - - -;; -;;; Autoloads - -(autoload 'org-capture-goto-target "org-capture" nil t) - - -;; -;;; Leader keys - -(map! :leader - :desc "Evaluate line/region" "e" #'+eval/line-or-region - - (:prefix ("l" . "")) ; bound locally - (:prefix ("!" . "checkers")) ; bound by flycheck - - ;;; c --- code - (:prefix-map ("c" . "code") - :desc "Compile" "c" #'compile - :desc "Recompile" "C" #'recompile - :desc "Jump to definition" "d" #'+lookup/definition - :desc "Jump to references" "D" #'+lookup/references - :desc "Evaluate buffer/region" "e" #'+eval/buffer-or-region - :desc "Evaluate & replace region" "E" #'+eval/region-and-replace - :desc "Format buffer/region" "f" #'+format/region-or-buffer - :desc "Find implementations" "i" #'+lookup/implementations - :desc "Jump to documentation" "k" #'+lookup/documentation - :desc "Send to repl" "s" #'+eval/send-region-to-repl - :desc "Find type definition" "t" #'+lookup/type-definition - :desc "Delete trailing whitespace" "w" #'delete-trailing-whitespace - :desc "Delete trailing newlines" "W" #'doom/delete-trailing-newlines - :desc "List errors" "x" #'+default/diagnostics - (:when (and (featurep! :tools lsp) (not (featurep! :tools lsp +eglot))) - :desc "LSP Code actions" "a" #'lsp-execute-code-action - :desc "LSP Organize imports" "o" #'lsp-organize-imports - :desc "LSP Rename" "r" #'lsp-rename - :desc "LSP" "l" #'+default/lsp-command-map - (:when (featurep! :completion ivy) - :desc "Jump to symbol in current workspace" "j" #'lsp-ivy-workspace-symbol - :desc "Jump to symbol in any workspace" "J" #'lsp-ivy-global-workspace-symbol) - (:when (featurep! :completion helm) - :desc "Jump to symbol in current workspace" "j" #'helm-lsp-workspace-symbol - :desc "Jump to symbol in any workspace" "J" #'helm-lsp-global-workspace-symbol) - (:when (featurep! :completion vertico) - :desc "Jump to symbol in current workspace" "j" #'consult-lsp-symbols - :desc "Jump to symbol in any workspace" "J" (cmd!! #'consult-lsp-symbols 'all-workspaces)) - (:when (featurep! :ui treemacs +lsp) - :desc "Errors list" "X" #'lsp-treemacs-errors-list - :desc "Incoming call hierarchy" "y" #'lsp-treemacs-call-hierarchy - :desc "Outgoing call hierarchy" "Y" (cmd!! #'lsp-treemacs-call-hierarchy t) - :desc "References tree" "R" (cmd!! #'lsp-treemacs-references t) - :desc "Symbols" "S" #'lsp-treemacs-symbols)) - (:when (featurep! :tools lsp +eglot) - :desc "LSP Execute code action" "a" #'eglot-code-actions - :desc "LSP Rename" "r" #'eglot-rename - :desc "LSP Find declaration" "j" #'eglot-find-declaration - (:when (featurep! :completion vertico) - :desc "Jump to symbol in current workspace" "j" #'consult-eglot-symbols))) - - ;;; f --- file - (:prefix-map ("f" . "file") - (:when (featurep! :tools editorconfig) - :desc "Open project editorconfig" "c" #'editorconfig-find-current-editorconfig) - :desc "Copy this file" "C" #'doom/copy-this-file - :desc "Find directory" "d" #'dired - :desc "Delete this file" "D" #'doom/delete-this-file - :desc "Find file in emacs.d" "e" #'doom/find-file-in-emacsd - :desc "Browse emacs.d" "E" #'doom/browse-in-emacsd - :desc "Find file" "f" #'find-file - :desc "Find file from here" "F" #'+default/find-file-under-here - :desc "Locate file" "l" #'locate - :desc "Rename/move this file" "m" #'doom/move-this-file - :desc "Find file in private config" "p" #'doom/find-file-in-private-config - :desc "Browse private config" "P" #'doom/open-private-config - :desc "Recent files" "r" #'recentf-open-files - :desc "Recent project files" "R" #'projectile-recentf - :desc "Sudo this file" "u" #'doom/sudo-this-file - :desc "Sudo find file" "U" #'doom/sudo-find-file - :desc "Yank file path" "y" #'+default/yank-buffer-path - :desc "Yank file path from project" "Y" #'+default/yank-buffer-path-relative-to-project - :desc "Open scratch buffer" "x" #'doom/open-scratch-buffer - :desc "Switch to scratch buffer" "X" #'doom/switch-to-scratch-buffer) - - ;;; r --- remote - (:when (featurep! :tools upload) - (:prefix-map ("r" . "remote") - :desc "Browse remote" "b" #'ssh-deploy-browse-remote-base-handler - :desc "Browse relative" "B" #'ssh-deploy-browse-remote-handler - :desc "Download remote" "d" #'ssh-deploy-download-handler - :desc "Delete local & remote" "D" #'ssh-deploy-delete-handler - :desc "Eshell base terminal" "e" #'ssh-deploy-remote-terminal-eshell-base-handler - :desc "Eshell relative terminal" "E" #'ssh-deploy-remote-terminal-eshell-handler - :desc "Move/rename local & remote" "m" #'ssh-deploy-rename-handler - :desc "Open this file on remote" "o" #'ssh-deploy-open-remote-file-handler - :desc "Run deploy script" "s" #'ssh-deploy-run-deploy-script-handler - :desc "Upload local" "u" #'ssh-deploy-upload-handler - :desc "Upload local (force)" "U" #'ssh-deploy-upload-handler-forced - :desc "Diff local & remote" "x" #'ssh-deploy-diff-handler - :desc "Browse remote files" "." #'ssh-deploy-browse-remote-handler - :desc "Detect remote changes" ">" #'ssh-deploy-remote-changes-handler)) - - ;;; s --- search - (:prefix-map ("s" . "search") - :desc "Search project for symbol" "." #'+default/search-project-for-symbol-at-point - :desc "Search buffer" "b" - (cond ((featurep! :completion vertico) #'consult-line) - ((featurep! :completion ivy) #'swiper) - ((featurep! :completion helm) #'swiper)) - :desc "Search all open buffers" "B" - (cond ((featurep! :completion vertico) (cmd!! #'consult-line-multi 'all-buffers)) - ((featurep! :completion ivy) #'swiper-all) - ((featurep! :completion helm) #'swiper-all)) - :desc "Search current directory" "d" #'+default/search-cwd - :desc "Search other directory" "D" #'+default/search-other-cwd - :desc "Search .emacs.d" "e" #'+default/search-emacsd - :desc "Locate file" "f" #'+lookup/file - :desc "Jump to symbol" "i" #'imenu - :desc "Jump to visible link" "l" #'link-hint-open-link - :desc "Jump to link" "L" #'ffap-menu - :desc "Jump to bookmark" "m" #'bookmark-jump - :desc "Look up online" "o" #'+lookup/online - :desc "Look up online (w/ prompt)" "O" #'+lookup/online-select - :desc "Look up in local docsets" "k" #'+lookup/in-docsets - :desc "Look up in all docsets" "K" #'+lookup/in-all-docsets - :desc "Search project" "p" #'+default/search-project - :desc "Search other project" "P" #'+default/search-other-project - :desc "Search buffer" "s" #'+default/search-buffer - :desc "Search buffer for thing at point" "S" - (cond ((featurep! :completion vertico) #'+vertico/search-symbol-at-point) - ((featurep! :completion ivy) #'swiper-isearch-thing-at-point) - ((featurep! :completion helm) #'swiper-isearch-thing-at-point)) - :desc "Dictionary" "t" #'+lookup/dictionary-definition - :desc "Thesaurus" "T" #'+lookup/synonyms) - - ;;; i --- insert - (:prefix-map ("i" . "insert") - :desc "Emoji" "e" #'emojify-insert-emoji - :desc "Current file name" "f" #'+default/insert-file-path - :desc "Current file path" "F" (cmd!! #'+default/insert-file-path t) - :desc "Snippet" "s" #'yas-insert-snippet - :desc "Unicode" "u" #'insert-char - :desc "From clipboard" "y" #'+default/yank-pop) - - ;;; n --- notes - (:prefix-map ("n" . "notes") - :desc "Search notes for symbol" "." #'+default/search-notes-for-symbol-at-point - :desc "Org agenda" "a" #'org-agenda - (:when (featurep! :tools biblio) - :desc "Bibliographic entries" "b" - (cond ((featurep! :completion vertico) #'citar-open-entry) - ((featurep! :completion ivy) #'ivy-bibtex) - ((featurep! :completion helm) #'helm-bibtex))) - - :desc "Toggle last org-clock" "c" #'+org/toggle-last-clock - :desc "Cancel current org-clock" "C" #'org-clock-cancel - :desc "Open deft" "d" #'deft - (:when (featurep! :lang org +noter) - :desc "Org noter" "e" #'org-noter) - - :desc "Find file in notes" "f" #'+default/find-in-notes - :desc "Browse notes" "F" #'+default/browse-notes - :desc "Org store link" "l" #'org-store-link - :desc "Tags search" "m" #'org-tags-view - :desc "Org capture" "n" #'org-capture - :desc "Goto capture" "N" #'org-capture-goto-target - :desc "Active org-clock" "o" #'org-clock-goto - :desc "Todo list" "t" #'org-todo-list - :desc "Search notes" "s" #'+default/org-notes-search - :desc "Search org agenda headlines" "S" #'+default/org-notes-headlines - :desc "View search" "v" #'org-search-view - :desc "Org export to clipboard" "y" #'+org/export-to-clipboard - :desc "Org export to clipboard as RTF" "Y" #'+org/export-to-clipboard-as-rich-text - (:when (featurep! :lang org +journal) - (:prefix ("j" . "journal") - :desc "New Entry" "j" #'org-journal-new-entry - :desc "New Scheduled Entry" "J" #'org-journal-new-scheduled-entry - :desc "Search Forever" "s" #'org-journal-search-forever)) - (:when (featurep! :lang org +roam) - (:prefix ("r" . "roam") - :desc "Switch to buffer" "b" #'org-roam-switch-to-buffer - :desc "Org Roam Capture" "c" #'org-roam-capture - :desc "Find file" "f" #'org-roam-find-file - :desc "Show graph" "g" #'org-roam-graph - :desc "Insert" "i" #'org-roam-insert - :desc "Insert (skipping org-capture)" "I" #'org-roam-insert-immediate - :desc "Org Roam" "r" #'org-roam - :desc "Tag" "t" #'org-roam-tag-add - :desc "Un-tag" "T" #'org-roam-tag-delete - (:prefix ("d" . "by date") - :desc "Arbitrary date" "d" #'org-roam-dailies-find-date - :desc "Today" "t" #'org-roam-dailies-find-today - :desc "Tomorrow" "m" #'org-roam-dailies-find-tomorrow - :desc "Yesterday" "y" #'org-roam-dailies-find-yesterday))) - (:when (featurep! :lang org +roam2) - (:prefix ("r" . "roam") - :desc "Open random node" "a" #'org-roam-node-random - :desc "Find node" "f" #'org-roam-node-find - :desc "Find ref" "F" #'org-roam-ref-find - :desc "Show graph" "g" #'org-roam-graph - :desc "Insert node" "i" #'org-roam-node-insert - :desc "Capture to node" "n" #'org-roam-capture - :desc "Toggle roam buffer" "r" #'org-roam-buffer-toggle - :desc "Launch roam buffer" "R" #'org-roam-buffer-display-dedicated - :desc "Sync database" "s" #'org-roam-db-sync - (:prefix ("d" . "by date") - :desc "Goto previous note" "b" #'org-roam-dailies-goto-previous-note - :desc "Goto date" "d" #'org-roam-dailies-goto-date - :desc "Capture date" "D" #'org-roam-dailies-capture-date - :desc "Goto next note" "f" #'org-roam-dailies-goto-next-note - :desc "Goto tomorrow" "m" #'org-roam-dailies-goto-tomorrow - :desc "Capture tomorrow" "M" #'org-roam-dailies-capture-tomorrow - :desc "Capture today" "n" #'org-roam-dailies-capture-today - :desc "Goto today" "t" #'org-roam-dailies-goto-today - :desc "Capture today" "T" #'org-roam-dailies-capture-today - :desc "Goto yesterday" "y" #'org-roam-dailies-goto-yesterday - :desc "Capture yesterday" "Y" #'org-roam-dailies-capture-yesterday - :desc "Find directory" "-" #'org-roam-dailies-find-directory)))) - - ;;; o --- open - "o" nil ; we need to unbind it first as Org claims this prefix - (:prefix-map ("o" . "open") - :desc "Browser" "b" #'browse-url-of-file - :desc "Debugger" "d" #'+debugger/start - :desc "New frame" "f" #'make-frame - :desc "REPL" "r" #'+eval/open-repl-other-window - :desc "REPL (same window)" "R" #'+eval/open-repl-same-window - :desc "Dired" "-" #'dired-jump - (:when (featurep! :ui neotree) - :desc "Project sidebar" "p" #'+neotree/open - :desc "Find file in project sidebar" "P" #'+neotree/find-this-file) - (:when (featurep! :ui treemacs) - :desc "Project sidebar" "p" #'+treemacs/toggle - :desc "Find file in project rsidebar" "P" #'treemacs-find-file) - (:when (featurep! :term shell) - :desc "Toggle shell popup" "t" #'+shell/toggle - :desc "Open shell here" "T" #'+shell/here) - (:when (featurep! :term term) - :desc "Toggle terminal popup" "t" #'+term/toggle - :desc "Open terminal here" "T" #'+term/here) - (:when (featurep! :term vterm) - :desc "Toggle vterm popup" "t" #'+vterm/toggle - :desc "Open vterm here" "T" #'+vterm/here) - (:when (featurep! :term eshell) - :desc "Toggle eshell popup" "e" #'+eshell/toggle - :desc "Open eshell here" "E" #'+eshell/here) - (:when (featurep! :os macos) - :desc "Reveal in Finder" "o" #'+macos/reveal-in-finder - :desc "Reveal project in Finder" "O" #'+macos/reveal-project-in-finder - :desc "Send to Transmit" "u" #'+macos/send-to-transmit - :desc "Send project to Transmit" "U" #'+macos/send-project-to-transmit - :desc "Send to Launchbar" "l" #'+macos/send-to-launchbar - :desc "Send project to Launchbar" "L" #'+macos/send-project-to-launchbar - :desc "Open in iTerm" "i" #'+macos/open-in-iterm) - (:when (featurep! :tools docker) - :desc "Docker" "D" #'docker) - (:when (featurep! :email mu4e) - :desc "mu4e" "m" #'=mu4e) - (:when (featurep! :email notmuch) - :desc "notmuch" "m" #'=notmuch) - (:when (featurep! :email wanderlust) - :desc "wanderlust" "m" #'=wanderlust)) - - - ;;; p --- project - (:prefix ("p" . "project") - :desc "Search project for symbol" "." #'+default/search-project-for-symbol-at-point - :desc "Find file in other project" "F" #'doom/find-file-in-other-project - :desc "Search project" "s" #'+default/search-project - :desc "List project todos" "t" #'magit-todos-list - :desc "Open project scratch buffer" "x" #'doom/open-project-scratch-buffer - :desc "Switch to project scratch buffer" "X" #'doom/switch-to-project-scratch-buffer - (:when (and (featurep! :tools taskrunner) - (or (featurep! :completion ivy) - (featurep! :completion helm))) - :desc "List project tasks" "z" #'+taskrunner/project-tasks) - ;; later expanded by projectile - (:prefix ("4" . "in other window")) - (:prefix ("5" . "in other frame"))) - - ;;; q --- quit/restart - (:prefix-map ("q" . "quit/restart") - :desc "Restart emacs server" "d" #'+default/restart-server - :desc "Delete frame" "f" #'delete-frame - :desc "Clear current frame" "F" #'doom/kill-all-buffers - :desc "Kill Emacs (and daemon)" "K" #'save-buffers-kill-emacs - :desc "Quit Emacs" "q" #'kill-emacs - :desc "Save and quit Emacs" "Q" #'save-buffers-kill-terminal - :desc "Quick save current session" "s" #'doom/quicksave-session - :desc "Restore last session" "l" #'doom/quickload-session - :desc "Save session to file" "S" #'doom/save-session - :desc "Restore session from file" "L" #'doom/load-session - :desc "Restart & restore Emacs" "r" #'doom/restart-and-restore - :desc "Restart Emacs" "R" #'doom/restart) - - ;;; & --- snippets - (:prefix-map ("&" . "snippets") - :desc "New snippet" "n" #'yas-new-snippet - :desc "Insert snippet" "i" #'yas-insert-snippet - :desc "Find global snippet" "/" #'yas-visit-snippet-file - :desc "Reload snippets" "r" #'yas-reload-all - :desc "Create Temp Template" "c" #'aya-create - :desc "Use Temp Template" "e" #'aya-expand) - - ;;; t --- toggle - (:prefix-map ("t" . "toggle") - :desc "Big mode" "b" #'doom-big-font-mode - :desc "Fill Column Indicator" "c" #'global-display-fill-column-indicator-mode - :desc "Flymake" "f" #'flymake-mode - :desc "Frame fullscreen" "F" #'toggle-frame-fullscreen - :desc "Indent style" "I" #'doom/toggle-indent-style - :desc "Line numbers" "l" #'doom/toggle-line-numbers - :desc "Soft line wrapping" "w" #'visual-line-mode - (:when (featurep! :editor word-wrap) - :desc "Soft line wrapping" "w" #'+word-wrap-mode) - (:when (featurep! :checkers syntax) - :desc "Flycheck" "f" #'flycheck-mode) - (:when (featurep! :ui indent-guides) - :desc "Indent guides" "i" #'highlight-indent-guides-mode) - (:when (featurep! :ui minimap) - :desc "Minimap mode" "m" #'minimap-mode) - (:when (featurep! :lang org +present) - :desc "org-tree-slide mode" "p" #'org-tree-slide-mode) - :desc "Read-only mode" "r" #'read-only-mode - (:when (and (featurep! :checkers spell) (not (featurep! :checkers spell +flyspell))) - :desc "Spell checker" "s" #'spell-fu-mode) - (:when (featurep! :checkers spell +flyspell) - :desc "Spell checker" "s" #'flyspell-mode) - (:when (featurep! :lang org +pomodoro) - :desc "Pomodoro timer" "t" #'org-pomodoro) - (:when (featurep! :ui zen) - :desc "Zen mode" "z" #'+zen/toggle - :desc "Zen mode (fullscreen)" "Z" #'+zen/toggle-fullscreen)) - - ;;; v --- versioning - (:prefix-map ("v" . "versioning") - :desc "Git revert file" "R" #'vc-revert - :desc "Kill link to remote" "y" #'+vc/browse-at-remote-kill - :desc "Kill link to homepage" "Y" #'+vc/browse-at-remote-kill-homepage - (:when (featurep! :ui vc-gutter) - :desc "Git revert hunk" "r" #'git-gutter:revert-hunk - :desc "Git stage hunk" "s" #'git-gutter:stage-hunk - :desc "Git time machine" "t" #'git-timemachine-toggle - :desc "Jump to next hunk" "n" #'git-gutter:next-hunk - :desc "Jump to previous hunk" "p" #'git-gutter:previous-hunk) - (:when (featurep! :tools magit) - :desc "Magit dispatch" "/" #'magit-dispatch - :desc "Magit file dispatch" "." #'magit-file-dispatch - :desc "Forge dispatch" "'" #'forge-dispatch - :desc "Magit status" "g" #'magit-status - :desc "Magit status here" "G" #'magit-status-here - :desc "Magit file delete" "x" #'magit-file-delete - :desc "Magit blame" "B" #'magit-blame-addition - :desc "Magit clone" "C" #'magit-clone - :desc "Magit fetch" "F" #'magit-fetch - :desc "Magit buffer log" "L" #'magit-log-buffer-file - :desc "Git stage file" "S" #'magit-stage-file - :desc "Git unstage file" "U" #'magit-unstage-file - (:prefix ("f" . "find") - :desc "Find file" "f" #'magit-find-file - :desc "Find gitconfig file" "g" #'magit-find-git-config-file - :desc "Find commit" "c" #'magit-show-commit - :desc "Find issue" "i" #'forge-visit-issue - :desc "Find pull request" "p" #'forge-visit-pullreq) - (:prefix ("o" . "open in browser") - :desc "Browse file or region" "." #'+vc/browse-at-remote - :desc "Browse homepage" "h" #'+vc/browse-at-remote-homepage - :desc "Browse remote" "r" #'forge-browse-remote - :desc "Browse commit" "c" #'forge-browse-commit - :desc "Browse an issue" "i" #'forge-browse-issue - :desc "Browse a pull request" "p" #'forge-browse-pullreq - :desc "Browse issues" "I" #'forge-browse-issues - :desc "Browse pull requests" "P" #'forge-browse-pullreqs) - (:prefix ("l" . "list") - (:when (featurep! :tools gist) - :desc "List gists" "g" #'gist-list) - :desc "List repositories" "r" #'magit-list-repositories - :desc "List submodules" "s" #'magit-list-submodules - :desc "List issues" "i" #'forge-list-issues - :desc "List pull requests" "p" #'forge-list-pullreqs - :desc "List notifications" "n" #'forge-list-notifications) - (:prefix ("c" . "create") - :desc "Initialize repo" "r" #'magit-init - :desc "Clone repo" "R" #'magit-clone - :desc "Commit" "c" #'magit-commit-create - :desc "Fixup" "f" #'magit-commit-fixup - :desc "Issue" "i" #'forge-create-issue - :desc "Pull request" "p" #'forge-create-pullreq))) - - ;;; w --- workspaces/windows - (:prefix-map ("w" . "workspaces/windows") - (:when (featurep! :ui workspaces) - :desc "Display workspaces" "d" #'+workspace/display - :desc "Rename workspace" "r" #'+workspace/rename - :desc "Create workspace" "c" #'+workspace/new - :desc "Create named workspace" "C" #'+workspace/new-named - :desc "Delete workspace" "k" #'+workspace/delete - :desc "Save workspace" "S" #'+workspace/save - :desc "Switch to other workspace" "o" #'+workspace/other - :desc "Switch to left workspace" "p" #'+workspace/switch-left - :desc "Switch to right workspace" "n" #'+workspace/switch-right - :desc "Switch to" "w" #'+workspace/switch-to - :desc "Switch to workspace 1" "1" #'+workspace/switch-to-0 - :desc "Switch to workspace 2" "2" #'+workspace/switch-to-1 - :desc "Switch to workspace 3" "3" #'+workspace/switch-to-2 - :desc "Switch to workspace 4" "4" #'+workspace/switch-to-3 - :desc "Switch to workspace 5" "5" #'+workspace/switch-to-4 - :desc "Switch to workspace 6" "6" #'+workspace/switch-to-5 - :desc "Switch to workspace 7" "7" #'+workspace/switch-to-6 - :desc "Switch to workspace 8" "8" #'+workspace/switch-to-7 - :desc "Switch to workspace 9" "9" #'+workspace/switch-to-8 - :desc "Switch to last workspace" "0" #'+workspace/switch-to-final) - :desc "Autosave session" "a" #'doom/quicksave-session - :desc "Save session" "s" #'doom/save-session - :desc "Load session" "l" #'doom/load-session - :desc "Load last autosaved session" "L" #'doom/quickload-session - :desc "Undo window config" "u" #'winner-undo - :desc "Redo window config" "U" #'winner-redo) - - ;;; m --- multiple cursors - (:when (featurep! :editor multiple-cursors) - (:prefix-map ("m" . "multiple-cursors") - :desc "Edit lines" "l" #'mc/edit-lines - :desc "Mark next" "n" #'mc/mark-next-like-this - :desc "Unmark next" "N" #'mc/unmark-next-like-this - :desc "Mark previous" "p" #'mc/mark-previous-like-this - :desc "Unmark previous" "P" #'mc/unmark-previous-like-this - :desc "Mark all" "t" #'mc/mark-all-like-this - :desc "Mark all DWIM" "m" #'mc/mark-all-like-this-dwim - :desc "Edit line endings" "e" #'mc/edit-ends-of-lines - :desc "Edit line starts" "a" #'mc/edit-beginnings-of-lines - :desc "Mark tag" "s" #'mc/mark-sgml-tag-pair - :desc "Mark in defun" "d" #'mc/mark-all-like-this-in-defun - :desc "Add cursor w/mouse" "" #'mc/add-cursor-on-click)) - - ;; APPs - ;;; M --- mu4e - (:when (featurep! :email mu4e) - (:prefix-map ("M" . "mu4e") - :desc "Open email app" "M" #'=mu4e - :desc "Compose email" "c" #'+mu4e/compose)) - - ;;; I --- IRC - (:when (featurep! :app irc) - (:prefix-map ("I" . "irc") - :desc "Open irc app" "I" #'=irc - :desc "Next unread buffer" "a" #'tracking-next-buffer - :desc "Quit irc" "q" #'+irc/quit - :desc "Reconnect all" "r" #'circe-reconnect-all - :desc "Send message" "s" #'+irc/send-message - (:when (featurep! :completion ivy) - :desc "Jump to channel" "j" #'+irc/ivy-jump-to-channel) - (:when (featurep! :completion vertico) - :desc "Jump to channel" "j" #'+irc/vertico-jump-to-channel))) - - ;;; T --- twitter - (:when (featurep! :app twitter) - (:prefix-map ("T" . "twitter") - :desc "Open twitter app" "T" #'=twitter - :desc "Quit twitter" "q" #'+twitter/quit - :desc "Rerender twits" "r" #'+twitter/rerender-all - :desc "Ace link" "l" #'+twitter/ace-link))) - - -;; -;;; Global & plugin keybinds - -(map! "C-'" #'imenu - - ;;; Text scaling - "M-+" #'doom/reset-font-size - "M-=" #'doom/increase-font-size - "M--" #'doom/decrease-font-size - - ;;; search - (:when (featurep! :completion ivy) - "C-S-s" #'swiper - "C-S-r" #'ivy-resume) - (:when (featurep! :completion helm) - "C-S-s" #'swiper-helm - "C-S-r" #'helm-resume) - (:when (featurep! :completion vertico) - "C-S-r" #'vertico-repeat) - - ;;; objed - (:when (featurep! :editor objed +manual) - "M-SPC" #'objed-activate) - - ;;; buffer management - "C-x b" #'switch-to-buffer - "C-x 4 b" #'switch-to-buffer-other-window - (:when (featurep! :ui workspaces) - "C-x b" #'persp-switch-to-buffer - "C-x B" #'switch-to-buffer - "C-x 4 B" #'switch-to-buffer-other-window - (:when (featurep! :completion ivy) - "C-x 4 b" #'+ivy/switch-workspace-buffer-other-window)) - "C-x C-b" #'ibuffer - "C-x K" #'doom/kill-this-buffer-in-all-windows - - ;;; company-mode - "C-;" #'+company/complete - (:after company - :map company-active-map - "C-o" #'company-search-kill-others - "C-n" #'company-select-next - "C-p" #'company-select-previous - "C-h" #'company-quickhelp-manual-begin - "C-S-h" #'company-show-doc-buffer - "C-s" #'company-search-candidates - "M-s" #'company-filter-candidates - [C-tab] #'company-complete-common-or-cycle - [tab] #'company-complete-common-or-cycle - [backtab] #'company-select-previous - "C-RET" (cond ((featurep! :completion vertico) #'completion-at-point) - ((featurep! :completion ivy) #'counsel-company) - ((featurep! :completion helm) #'helm-company)) - "C-" (cond ((featurep! :completion vertico) #'completion-at-point) - ((featurep! :completion ivy) #'counsel-company) - ((featurep! :completion helm) #'helm-company)) - :map company-search-map - "C-n" #'company-search-repeat-forward - "C-p" #'company-search-repeat-backward - "C-s" (cmd! (company-search-abort) (company-filter-candidates))) - - ;;; ein notebooks - (:after ein:notebook-multilang - :map ein:notebook-multilang-mode-map - "C-c h" #'+ein/hydra/body) - - ;;; expand-region - "C-=" #'er/expand-region - "C--" #'er/contract-region - - ;;; flycheck - (:after flycheck - :map flycheck-error-list-mode-map - "C-n" #'flycheck-error-list-next-error - "C-p" #'flycheck-error-list-previous-error - "RET" #'flycheck-error-list-goto-error) - - ;;; help and info - (:after help-mode - :map help-mode-map - "o" #'link-hint-open-link - ">" #'help-go-forward - "<" #'help-go-back - "n" #'forward-button - "p" #'backward-button) - (:after helpful - :map helpful-mode-map - "o" #'link-hint-open-link) - (:after apropos - :map apropos-mode-map - "o" #'link-hint-open-link - "n" #'forward-button - "p" #'backward-button) - (:after info - :map Info-mode-map - "o" #'link-hint-open-link) - - ;;; ivy & counsel - (:when (featurep! :completion ivy) - (:after ivy - :map ivy-minibuffer-map - "TAB" #'ivy-alt-done - "C-g" #'keyboard-escape-quit) - (:after counsel - :map counsel-ag-map - "C-SPC" #'ivy-call-and-recenter ; preview - "M-RET" #'+ivy/git-grep-other-window-action) - "C-M-y" #'counsel-yank-pop) - - ;;; neotree - (:when (featurep! :ui neotree) - "" #'+neotree/open - "" #'+neotree/find-this-file - (:after neotree - :map neotree-mode-map - "q" #'neotree-hide - "RET" #'neotree-enter - "SPC" #'neotree-quick-look - "v" #'neotree-enter-vertical-split - "s" #'neotree-enter-horizontal-split - "c" #'neotree-create-node - "D" #'neotree-delete-node - "g" #'neotree-refresh - "r" #'neotree-rename-node - "R" #'neotree-refresh - "h" #'+neotree/collapse-or-up - "l" #'+neotree/expand-or-open - "n" #'neotree-next-line - "p" #'neotree-previous-line - "N" #'neotree-select-next-sibling-node - "P" #'neotree-select-previous-sibling-node)) - - ;;; popups - (:when (featurep! :ui popup) - "C-x p" #'+popup/other - "C-`" #'+popup/toggle - "C-~" #'+popup/raise) - - ;;; smartparens - (:after smartparens - :map smartparens-mode-map - "C-M-a" #'sp-beginning-of-sexp - "C-M-e" #'sp-end-of-sexp - "C-M-f" #'sp-forward-sexp - "C-M-b" #'sp-backward-sexp - "C-M-n" #'sp-next-sexp - "C-M-p" #'sp-previous-sexp - "C-M-u" #'sp-up-sexp - "C-M-d" #'sp-down-sexp - "C-M-k" #'sp-kill-sexp - "C-M-t" #'sp-transpose-sexp - "C-M-" #'sp-splice-sexp) - - ;;; treemacs - (:when (featurep! :ui treemacs) - "" #'+treemacs/toggle - "" #'treemacs-find-file)) - -(map! :leader - (:when (featurep! :editor fold) - (:prefix ("C-f" . "fold") - "C-d" #'vimish-fold-delete - "C-a C-d" #'vimish-fold-delete-all - "C-f" #'+fold/toggle - "C-a C-f" #'+fold/close-all - "C-u" #'+fold/open - "C-a C-u" #'+fold/open-all))) diff --git a/.config/emacs/modules/config/default/+emacs.el b/.config/emacs/modules/config/default/+emacs.el deleted file mode 100644 index 5510fda..0000000 --- a/.config/emacs/modules/config/default/+emacs.el +++ /dev/null @@ -1,26 +0,0 @@ -;;; config/default/+emacs.el -*- lexical-binding: t; -*- - -(require 'projectile) ; we need its keybinds immediately - - -;; -;;; Reasonable defaults - -(setq shift-select-mode t) -(delete-selection-mode +1) - -(use-package! expand-region - :commands (er/contract-region er/mark-symbol er/mark-word) - :config - (defadvice! doom--quit-expand-region-a (&rest _) - "Properly abort an expand-region region." - :before '(evil-escape doom/escape) - (when (memq last-command '(er/expand-region er/contract-region)) - (er/contract-region 0)))) - - -;; -;;; Keybinds - -(when (featurep! +bindings) - (load! "+emacs-bindings")) diff --git a/.config/emacs/modules/config/default/+evil-bindings.el b/.config/emacs/modules/config/default/+evil-bindings.el deleted file mode 100644 index 45cc4f2..0000000 --- a/.config/emacs/modules/config/default/+evil-bindings.el +++ /dev/null @@ -1,770 +0,0 @@ -;;; config/default/+bindings.el -*- lexical-binding: t; -*- - -(when (featurep! :editor evil +everywhere) - ;; NOTE SPC u replaces C-u as the universal argument. - - ;; Minibuffer - (map! :map (evil-ex-completion-map evil-ex-search-keymap) - "C-a" #'evil-beginning-of-line - "C-b" #'evil-backward-char - "C-f" #'evil-forward-char - :gi "C-j" #'next-complete-history-element - :gi "C-k" #'previous-complete-history-element) - - (define-key! :keymaps +default-minibuffer-maps - [escape] #'abort-recursive-edit - "C-a" #'move-beginning-of-line - "C-r" #'evil-paste-from-register - "C-u" #'evil-delete-back-to-indentation - "C-v" #'yank - "C-w" #'doom/delete-backward-word - "C-z" (cmd! (ignore-errors (call-interactively #'undo)))) - - (define-key! :keymaps +default-minibuffer-maps - "C-j" #'next-line - "C-k" #'previous-line - "C-S-j" #'scroll-up-command - "C-S-k" #'scroll-down-command) - ;; For folks with `evil-collection-setup-minibuffer' enabled - (define-key! :states 'insert :keymaps +default-minibuffer-maps - "C-j" #'next-line - "C-k" #'previous-line) - (define-key! read-expression-map - "C-j" #'next-line-or-history-element - "C-k" #'previous-line-or-history-element)) - - -;; -;;; Global keybindings - -;; Smart tab, these will only work in GUI Emacs -(map! :i [tab] (cmds! (and (featurep! :editor snippets) - (yas-maybe-expand-abbrev-key-filter 'yas-expand)) - #'yas-expand - (and (bound-and-true-p company-mode) - (featurep! :completion company +tng)) - #'company-indent-or-complete-common) - :m [tab] (cmds! (and (featurep! :editor snippets) - (evil-visual-state-p) - (or (eq evil-visual-selection 'line) - (not (memq (char-after) (list ?\( ?\[ ?\{ ?\} ?\] ?\)))))) - #'yas-insert-snippet - (and (featurep! :editor fold) - (save-excursion (end-of-line) (invisible-p (point)))) - #'+fold/toggle - ;; Fixes #4548: without this, this tab keybind overrides - ;; mode-local ones for modes that don't have an evil - ;; keybinding scheme or users who don't have :editor (evil - ;; +everywhere) enabled. - (or (doom-lookup-key - [tab] - (list (evil-get-auxiliary-keymap (current-local-map) evil-state) - (current-local-map))) - (doom-lookup-key - (kbd "TAB") - (list (evil-get-auxiliary-keymap (current-local-map) evil-state))) - (doom-lookup-key (kbd "TAB") (list (current-local-map)))) - it - (fboundp 'evil-jump-item) - #'evil-jump-item) - - (:after help :map help-mode-map - :n "o" #'link-hint-open-link) - (:after helpful :map helpful-mode-map - :n "o" #'link-hint-open-link) - (:after info :map Info-mode-map - :n "o" #'link-hint-open-link) - (:after apropos :map apropos-mode-map - :n "o" #'link-hint-open-link - :n "TAB" #'forward-button - :n [tab] #'forward-button - :n [backtab] #'backward-button) - (:after view :map view-mode-map - [escape] #'View-quit-all) - (:after man :map Man-mode-map - :n "q" #'kill-current-buffer) - (:after geiser-doc :map geiser-doc-mode-map - :n "o" #'link-hint-open-link) - - (:unless (featurep! :input layout +bepo) - (:after (evil-org evil-easymotion) - :map evil-org-mode-map - :m "gsh" #'+org/goto-visible)) - - (:when (featurep! :editor multiple-cursors) - :prefix "gz" - :nv "d" #'evil-mc-make-and-goto-next-match - :nv "D" #'evil-mc-make-and-goto-prev-match - :nv "j" #'evil-mc-make-cursor-move-next-line - :nv "k" #'evil-mc-make-cursor-move-prev-line - :nv "m" #'evil-mc-make-all-cursors - :nv "n" #'evil-mc-make-and-goto-next-cursor - :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" #'+multiple-cursors/evil-mc-undo-cursor - :nv "z" #'+multiple-cursors/evil-mc-toggle-cursor-here - :v "I" #'evil-mc-make-cursor-in-visual-selection-beg - :v "A" #'evil-mc-make-cursor-in-visual-selection-end) - - ;; misc - :n "C-S-f" #'toggle-frame-fullscreen - :n "C-+" #'doom/reset-font-size - ;; Buffer-local font resizing - :n "C-=" #'text-scale-increase - :n "C--" #'text-scale-decrease - ;; Frame-local font resizing - :n "M-C-=" #'doom/increase-font-size - :n "M-C--" #'doom/decrease-font-size) - - -;; -;;; Module keybinds - -;;; :completion -(map! (:when (featurep! :completion company) - :i "C-@" (cmds! (not (minibufferp)) #'company-complete-common) - :i "C-SPC" (cmds! (not (minibufferp)) #'company-complete-common) - (:after company - (:map company-active-map - "C-w" nil ; don't interfere with `evil-delete-backward-word' - "C-n" #'company-select-next - "C-p" #'company-select-previous - "C-j" #'company-select-next - "C-k" #'company-select-previous - "C-h" #'company-show-doc-buffer - "C-u" #'company-previous-page - "C-d" #'company-next-page - "C-s" #'company-filter-candidates - "C-S-s" (cond ((featurep! :completion vertico) #'completion-at-point) - ((featurep! :completion ivy) #'counsel-company) - ((featurep! :completion helm) #'helm-company)) - "C-SPC" #'company-complete-common - "TAB" #'company-complete-common-or-cycle - [tab] #'company-complete-common-or-cycle - [backtab] #'company-select-previous - [f1] nil) - (:map company-search-map ; applies to `company-filter-map' too - "C-n" #'company-select-next-or-abort - "C-p" #'company-select-previous-or-abort - "C-j" #'company-select-next-or-abort - "C-k" #'company-select-previous-or-abort - "C-s" #'company-filter-candidates - [escape] #'company-search-abort))) - - (:when (featurep! :completion ivy) - (:after ivy - :map ivy-minibuffer-map - "C-SPC" #'ivy-call-and-recenter ; preview file - "C-l" #'ivy-alt-done - "C-v" #'yank) - (:after counsel - :map counsel-ag-map - "C-SPC" #'ivy-call-and-recenter ; preview - "C-l" #'ivy-done - [C-return] #'+ivy/git-grep-other-window-action)) - - (:when (featurep! :completion helm) - (:after helm :map helm-map - [remap next-line] #'helm-next-line - [remap previous-line] #'helm-previous-line - [left] #'left-char - [right] #'right-char - "C-S-f" #'helm-previous-page - "C-S-n" #'helm-next-source - "C-S-p" #'helm-previous-source - (:when (featurep! :editor evil +everywhere) - "C-j" #'helm-next-line - "C-k" #'helm-previous-line - "C-S-j" #'helm-next-source - "C-S-k" #'helm-previous-source) - "C-u" #'helm-delete-minibuffer-contents - "C-s" #'helm-minibuffer-history - ;; Swap TAB and C-z - "TAB" #'helm-execute-persistent-action - [tab] #'helm-execute-persistent-action - "C-z" #'helm-select-action) - (:after helm-ag :map helm-ag-map - "C--" #'+helm-do-ag-decrease-context - "C-=" #'+helm-do-ag-increase-context - [left] nil - [right] nil) - (:after helm-files :map (helm-find-files-map helm-read-file-map) - [C-return] #'helm-ff-run-switch-other-window - "C-w" #'helm-find-files-up-one-level) - (:after helm-locate :map helm-generic-files-map - [C-return] #'helm-ff-run-switch-other-window) - (:after helm-buffers :map helm-buffer-map - [C-return] #'helm-buffer-switch-other-window) - (:after helm-occur :map helm-occur-map - [C-return] #'helm-occur-run-goto-line-ow) - (:after helm-grep :map helm-grep-map - [C-return] #'helm-grep-run-other-window-action)) - - (:when (featurep! :completion vertico) - (:after vertico - :map vertico-map - "M-RET" #'vertico-exit-input - "C-SPC" #'+vertico/embark-preview - "C-j" #'vertico-next - "C-M-j" #'vertico-next-group - "C-k" #'vertico-previous - "C-M-k" #'vertico-previous-group))) - - -;;; :ui -(map! (:when (featurep! :ui popup) - "C-`" #'+popup/toggle - "C-~" #'+popup/raise - "C-x p" #'+popup/other) - - (:when (featurep! :ui workspaces) - :n "C-t" #'+workspace/new - :n "C-S-t" #'+workspace/display - :g "M-1" #'+workspace/switch-to-0 - :g "M-2" #'+workspace/switch-to-1 - :g "M-3" #'+workspace/switch-to-2 - :g "M-4" #'+workspace/switch-to-3 - :g "M-5" #'+workspace/switch-to-4 - :g "M-6" #'+workspace/switch-to-5 - :g "M-7" #'+workspace/switch-to-6 - :g "M-8" #'+workspace/switch-to-7 - :g "M-9" #'+workspace/switch-to-8 - :g "M-0" #'+workspace/switch-to-final - (:when IS-MAC - :g "s-t" #'+workspace/new - :g "s-T" #'+workspace/display - :n "s-1" #'+workspace/switch-to-0 - :n "s-2" #'+workspace/switch-to-1 - :n "s-3" #'+workspace/switch-to-2 - :n "s-4" #'+workspace/switch-to-3 - :n "s-5" #'+workspace/switch-to-4 - :n "s-6" #'+workspace/switch-to-5 - :n "s-7" #'+workspace/switch-to-6 - :n "s-8" #'+workspace/switch-to-7 - :n "s-9" #'+workspace/switch-to-8 - :n "s-0" #'+workspace/switch-to-final))) - -;;; :editor -(map! (:when (featurep! :editor format) - :n "gQ" #'+format:region) - - (:when (featurep! :editor rotate-text) - :n "]r" #'rotate-text - :n "[r" #'rotate-text-backward) - - (:when (featurep! :editor multiple-cursors) - ;; evil-multiedit - :v "R" #'evil-multiedit-match-all - :n "M-d" #'evil-multiedit-match-symbol-and-next - :n "M-D" #'evil-multiedit-match-symbol-and-prev - :v "M-d" #'evil-multiedit-match-and-next - :v "M-D" #'evil-multiedit-match-and-prev - :nv "C-M-d" #'evil-multiedit-restore - (:after evil-multiedit - (:map evil-multiedit-mode-map - :nv "M-d" #'evil-multiedit-match-and-next - :nv "M-D" #'evil-multiedit-match-and-prev - [return] #'evil-multiedit-toggle-or-restrict-region))) - - (:when (featurep! :editor snippets) - ;; auto-yasnippet - :i [C-tab] #'aya-expand - :nv [C-tab] #'aya-create)) - -;;; :tools -(when (featurep! :tools eval) - (map! "M-r" #'+eval/buffer)) - - -;; -;;; - -(map! :leader - :desc "Eval expression" ";" #'pp-eval-expression - :desc "M-x" ":" #'execute-extended-command - :desc "Pop up scratch buffer" "x" #'doom/open-scratch-buffer - :desc "Org Capture" "X" #'org-capture - ;; C-u is used by evil - :desc "Universal argument" "u" #'universal-argument - :desc "window" "w" evil-window-map - :desc "help" "h" help-map - - (:when (featurep! :ui popup) - :desc "Toggle last popup" "~" #'+popup/toggle) - :desc "Find file" "." #'find-file - :desc "Switch buffer" "," #'switch-to-buffer - (:when (featurep! :ui workspaces) - :desc "Switch workspace buffer" "," #'persp-switch-to-buffer - :desc "Switch buffer" "<" #'switch-to-buffer) - :desc "Switch to last buffer" "`" #'evil-switch-to-windows-last-buffer - :desc "Resume last search" "'" - (cond ((featurep! :completion vertico) #'vertico-repeat) - ((featurep! :completion ivy) #'ivy-resume) - ((featurep! :completion helm) #'helm-resume)) - - :desc "Search for symbol in project" "*" #'+default/search-project-for-symbol-at-point - :desc "Search project" "/" #'+default/search-project - - :desc "Find file in project" "SPC" #'projectile-find-file - :desc "Jump to bookmark" "RET" #'bookmark-jump - - ;;; TAB --- workspace - (:when (featurep! :ui workspaces) - (:prefix-map ("TAB" . "workspace") - :desc "Display tab bar" "TAB" #'+workspace/display - :desc "Switch workspace" "." #'+workspace/switch-to - :desc "Switch to last workspace" "`" #'+workspace/other - :desc "New workspace" "n" #'+workspace/new - :desc "New named workspace" "N" #'+workspace/new-named - :desc "Load workspace from file" "l" #'+workspace/load - :desc "Save workspace to file" "s" #'+workspace/save - :desc "Delete session" "x" #'+workspace/kill-session - :desc "Delete this workspace" "d" #'+workspace/delete - :desc "Rename workspace" "r" #'+workspace/rename - :desc "Restore last session" "R" #'+workspace/restore-last-session - :desc "Next workspace" "]" #'+workspace/switch-right - :desc "Previous workspace" "[" #'+workspace/switch-left - :desc "Switch to 1st workspace" "1" #'+workspace/switch-to-0 - :desc "Switch to 2nd workspace" "2" #'+workspace/switch-to-1 - :desc "Switch to 3rd workspace" "3" #'+workspace/switch-to-2 - :desc "Switch to 4th workspace" "4" #'+workspace/switch-to-3 - :desc "Switch to 5th workspace" "5" #'+workspace/switch-to-4 - :desc "Switch to 6th workspace" "6" #'+workspace/switch-to-5 - :desc "Switch to 7th workspace" "7" #'+workspace/switch-to-6 - :desc "Switch to 8th workspace" "8" #'+workspace/switch-to-7 - :desc "Switch to 9th workspace" "9" #'+workspace/switch-to-8 - :desc "Switch to final workspace" "0" #'+workspace/switch-to-final)) - - ;;; b --- buffer - (:prefix-map ("b" . "buffer") - :desc "Toggle narrowing" "-" #'doom/toggle-narrow-buffer - :desc "Previous buffer" "[" #'previous-buffer - :desc "Next buffer" "]" #'next-buffer - (:when (featurep! :ui workspaces) - :desc "Switch workspace buffer" "b" #'persp-switch-to-buffer - :desc "Switch buffer" "B" #'switch-to-buffer) - (:unless (featurep! :ui workspaces) - :desc "Switch buffer" "b" #'switch-to-buffer) - :desc "Clone buffer" "c" #'clone-indirect-buffer - :desc "Clone buffer other window" "C" #'clone-indirect-buffer-other-window - :desc "Kill buffer" "d" #'kill-current-buffer - :desc "ibuffer" "i" #'ibuffer - :desc "Kill buffer" "k" #'kill-current-buffer - :desc "Kill all buffers" "K" #'doom/kill-all-buffers - :desc "Switch to last buffer" "l" #'evil-switch-to-windows-last-buffer - :desc "Set bookmark" "m" #'bookmark-set - :desc "Delete bookmark" "M" #'bookmark-delete - :desc "Next buffer" "n" #'next-buffer - :desc "New empty buffer" "N" #'evil-buffer-new - :desc "Kill other buffers" "O" #'doom/kill-other-buffers - :desc "Previous buffer" "p" #'previous-buffer - :desc "Revert buffer" "r" #'revert-buffer - :desc "Save buffer" "s" #'basic-save-buffer - :desc "Save all buffers" "S" #'evil-write-all - :desc "Save buffer as root" "u" #'doom/sudo-save-buffer - :desc "Pop up scratch buffer" "x" #'doom/open-scratch-buffer - :desc "Switch to scratch buffer" "X" #'doom/switch-to-scratch-buffer - :desc "Bury buffer" "z" #'bury-buffer - :desc "Kill buried buffers" "Z" #'doom/kill-buried-buffers) - - ;;; c --- code - (:prefix-map ("c" . "code") - (:when (and (featurep! :tools lsp) (not (featurep! :tools lsp +eglot))) - :desc "LSP Execute code action" "a" #'lsp-execute-code-action - :desc "LSP Organize imports" "o" #'lsp-organize-imports - (:when (featurep! :completion ivy) - :desc "Jump to symbol in current workspace" "j" #'lsp-ivy-workspace-symbol - :desc "Jump to symbol in any workspace" "J" #'lsp-ivy-global-workspace-symbol) - (:when (featurep! :completion helm) - :desc "Jump to symbol in current workspace" "j" #'helm-lsp-workspace-symbol - :desc "Jump to symbol in any workspace" "J" #'helm-lsp-global-workspace-symbol) - (:when (featurep! :completion vertico) - :desc "Jump to symbol in current workspace" "j" #'consult-lsp-symbols - :desc "Jump to symbol in any workspace" "J" (cmd!! #'consult-lsp-symbols 'all-workspaces)) - (:when (featurep! :ui treemacs +lsp) - :desc "Errors list" "X" #'lsp-treemacs-errors-list - :desc "Incoming call hierarchy" "y" #'lsp-treemacs-call-hierarchy - :desc "Outgoing call hierarchy" "Y" (cmd!! #'lsp-treemacs-call-hierarchy t) - :desc "References tree" "R" (cmd!! #'lsp-treemacs-references t) - :desc "Symbols" "S" #'lsp-treemacs-symbols) - :desc "LSP" "l" #'+default/lsp-command-map - :desc "LSP Rename" "r" #'lsp-rename) - (:when (featurep! :tools lsp +eglot) - :desc "LSP Execute code action" "a" #'eglot-code-actions - :desc "LSP Rename" "r" #'eglot-rename - :desc "LSP Find declaration" "j" #'eglot-find-declaration - (:when (featurep! :completion vertico) - :desc "Jump to symbol in current workspace" "j" #'consult-eglot-symbols)) - :desc "Compile" "c" #'compile - :desc "Recompile" "C" #'recompile - :desc "Jump to definition" "d" #'+lookup/definition - :desc "Jump to references" "D" #'+lookup/references - :desc "Evaluate buffer/region" "e" #'+eval/buffer-or-region - :desc "Evaluate & replace region" "E" #'+eval:replace-region - :desc "Format buffer/region" "f" #'+format/region-or-buffer - :desc "Find implementations" "i" #'+lookup/implementations - :desc "Jump to documentation" "k" #'+lookup/documentation - :desc "Send to repl" "s" #'+eval/send-region-to-repl - :desc "Find type definition" "t" #'+lookup/type-definition - :desc "Delete trailing whitespace" "w" #'delete-trailing-whitespace - :desc "Delete trailing newlines" "W" #'doom/delete-trailing-newlines - :desc "List errors" "x" #'+default/diagnostics) - - ;;; f --- file - (:prefix-map ("f" . "file") - :desc "Open project editorconfig" "c" #'editorconfig-find-current-editorconfig - :desc "Copy this file" "C" #'doom/copy-this-file - :desc "Find directory" "d" #'+default/dired - :desc "Delete this file" "D" #'doom/delete-this-file - :desc "Find file in emacs.d" "e" #'doom/find-file-in-emacsd - :desc "Browse emacs.d" "E" #'doom/browse-in-emacsd - :desc "Find file" "f" #'find-file - :desc "Find file from here" "F" #'+default/find-file-under-here - :desc "Locate file" "l" #'locate - :desc "Find file in private config" "p" #'doom/find-file-in-private-config - :desc "Browse private config" "P" #'doom/open-private-config - :desc "Recent files" "r" #'recentf-open-files - :desc "Rename/move file" "R" #'doom/move-this-file - :desc "Save file" "s" #'save-buffer - :desc "Save file as..." "S" #'write-file - :desc "Sudo find file" "u" #'doom/sudo-find-file - :desc "Sudo this file" "U" #'doom/sudo-this-file - :desc "Yank file path" "y" #'+default/yank-buffer-path - :desc "Yank file path from project" "Y" #'+default/yank-buffer-path-relative-to-project) - - ;;; g --- git/version control - (:prefix-map ("g" . "git") - :desc "Revert file" "R" #'vc-revert - :desc "Copy link to remote" "y" #'+vc/browse-at-remote-kill - :desc "Copy link to homepage" "Y" #'+vc/browse-at-remote-kill-homepage - (:when (featurep! :ui hydra) - :desc "SMerge" "m" #'+vc/smerge-hydra/body) - (:when (featurep! :ui vc-gutter) - (:when (featurep! :ui hydra) - :desc "VCGutter" "." #'+vc/gutter-hydra/body) - :desc "Revert hunk" "r" #'git-gutter:revert-hunk - :desc "Git stage hunk" "s" #'git-gutter:stage-hunk - :desc "Git time machine" "t" #'git-timemachine-toggle - :desc "Jump to next hunk" "]" #'git-gutter:next-hunk - :desc "Jump to previous hunk" "[" #'git-gutter:previous-hunk) - (:when (featurep! :tools magit) - :desc "Magit dispatch" "/" #'magit-dispatch - :desc "Magit file dispatch" "." #'magit-file-dispatch - :desc "Forge dispatch" "'" #'forge-dispatch - :desc "Magit switch branch" "b" #'magit-branch-checkout - :desc "Magit status" "g" #'magit-status - :desc "Magit status here" "G" #'magit-status-here - :desc "Magit file delete" "D" #'magit-file-delete - :desc "Magit blame" "B" #'magit-blame-addition - :desc "Magit clone" "C" #'magit-clone - :desc "Magit fetch" "F" #'magit-fetch - :desc "Magit buffer log" "L" #'magit-log-buffer-file - :desc "Git stage file" "S" #'magit-stage-file - :desc "Git unstage file" "U" #'magit-unstage-file - (:prefix ("f" . "find") - :desc "Find file" "f" #'magit-find-file - :desc "Find gitconfig file" "g" #'magit-find-git-config-file - :desc "Find commit" "c" #'magit-show-commit - :desc "Find issue" "i" #'forge-visit-issue - :desc "Find pull request" "p" #'forge-visit-pullreq) - (:prefix ("o" . "open in browser") - :desc "Browse file or region" "o" #'+vc/browse-at-remote - :desc "Browse homepage" "h" #'+vc/browse-at-remote-homepage - :desc "Browse remote" "r" #'forge-browse-remote - :desc "Browse commit" "c" #'forge-browse-commit - :desc "Browse an issue" "i" #'forge-browse-issue - :desc "Browse a pull request" "p" #'forge-browse-pullreq - :desc "Browse issues" "I" #'forge-browse-issues - :desc "Browse pull requests" "P" #'forge-browse-pullreqs) - (:prefix ("l" . "list") - (:when (featurep! :tools gist) - :desc "List gists" "g" #'+gist:list) - :desc "List repositories" "r" #'magit-list-repositories - :desc "List submodules" "s" #'magit-list-submodules - :desc "List issues" "i" #'forge-list-issues - :desc "List pull requests" "p" #'forge-list-pullreqs - :desc "List notifications" "n" #'forge-list-notifications) - (:prefix ("c" . "create") - :desc "Initialize repo" "r" #'magit-init - :desc "Clone repo" "R" #'magit-clone - :desc "Commit" "c" #'magit-commit-create - :desc "Fixup" "f" #'magit-commit-fixup - :desc "Branch" "b" #'magit-branch-and-checkout - :desc "Issue" "i" #'forge-create-issue - :desc "Pull request" "p" #'forge-create-pullreq))) - - ;;; i --- insert - (:prefix-map ("i" . "insert") - :desc "Emoji" "e" #'emojify-insert-emoji - :desc "Current file name" "f" #'+default/insert-file-path - :desc "Current file path" "F" (cmd!! #'+default/insert-file-path t) - :desc "Evil ex path" "p" (cmd! (evil-ex "R!echo ")) - :desc "From evil register" "r" #'evil-show-registers - :desc "Snippet" "s" #'yas-insert-snippet - :desc "Unicode" "u" #'insert-char - :desc "From clipboard" "y" #'+default/yank-pop) - - ;;; n --- notes - (:prefix-map ("n" . "notes") - :desc "Search notes for symbol" "*" #'+default/search-notes-for-symbol-at-point - :desc "Org agenda" "a" #'org-agenda - (:when (featurep! :tools biblio) - :desc "Bibliographic entries" "b" - (cond ((featurep! :completion vertico) #'citar-open-entry) - ((featurep! :completion ivy) #'ivy-bibtex) - ((featurep! :completion helm) #'helm-bibtex))) - - :desc "Toggle last org-clock" "c" #'+org/toggle-last-clock - :desc "Cancel current org-clock" "C" #'org-clock-cancel - :desc "Open deft" "d" #'deft - (:when (featurep! :lang org +noter) - :desc "Org noter" "e" #'org-noter) - - :desc "Find file in notes" "f" #'+default/find-in-notes - :desc "Browse notes" "F" #'+default/browse-notes - :desc "Org store link" "l" #'org-store-link - :desc "Tags search" "m" #'org-tags-view - :desc "Org capture" "n" #'org-capture - :desc "Goto capture" "N" #'org-capture-goto-target - :desc "Active org-clock" "o" #'org-clock-goto - :desc "Todo list" "t" #'org-todo-list - :desc "Search notes" "s" #'+default/org-notes-search - :desc "Search org agenda headlines" "S" #'+default/org-notes-headlines - :desc "View search" "v" #'org-search-view - :desc "Org export to clipboard" "y" #'+org/export-to-clipboard - :desc "Org export to clipboard as RTF" "Y" #'+org/export-to-clipboard-as-rich-text - - (:when (featurep! :lang org +roam) - (:prefix ("r" . "roam") - :desc "Switch to buffer" "b" #'org-roam-switch-to-buffer - :desc "Org Roam Capture" "c" #'org-roam-capture - :desc "Find file" "f" #'org-roam-find-file - :desc "Show graph" "g" #'org-roam-graph - :desc "Insert" "i" #'org-roam-insert - :desc "Insert (skipping org-capture)" "I" #'org-roam-insert-immediate - :desc "Org Roam" "r" #'org-roam - (:prefix ("d" . "by date") - :desc "Arbitrary date" "d" #'org-roam-dailies-find-date - :desc "Today" "t" #'org-roam-dailies-find-today - :desc "Tomorrow" "m" #'org-roam-dailies-find-tomorrow - :desc "Yesterday" "y" #'org-roam-dailies-find-yesterday))) - - (:when (featurep! :lang org +roam2) - (:prefix ("r" . "roam") - :desc "Open random node" "a" #'org-roam-node-random - :desc "Find node" "f" #'org-roam-node-find - :desc "Find ref" "F" #'org-roam-ref-find - :desc "Show graph" "g" #'org-roam-graph - :desc "Insert node" "i" #'org-roam-node-insert - :desc "Capture to node" "n" #'org-roam-capture - :desc "Toggle roam buffer" "r" #'org-roam-buffer-toggle - :desc "Launch roam buffer" "R" #'org-roam-buffer-display-dedicated - :desc "Sync database" "s" #'org-roam-db-sync - (:prefix ("d" . "by date") - :desc "Goto previous note" "b" #'org-roam-dailies-goto-previous-note - :desc "Goto date" "d" #'org-roam-dailies-goto-date - :desc "Capture date" "D" #'org-roam-dailies-capture-date - :desc "Goto next note" "f" #'org-roam-dailies-goto-next-note - :desc "Goto tomorrow" "m" #'org-roam-dailies-goto-tomorrow - :desc "Capture tomorrow" "M" #'org-roam-dailies-capture-tomorrow - :desc "Capture today" "n" #'org-roam-dailies-capture-today - :desc "Goto today" "t" #'org-roam-dailies-goto-today - :desc "Capture today" "T" #'org-roam-dailies-capture-today - :desc "Goto yesterday" "y" #'org-roam-dailies-goto-yesterday - :desc "Capture yesterday" "Y" #'org-roam-dailies-capture-yesterday - :desc "Find directory" "-" #'org-roam-dailies-find-directory))) - - (:when (featurep! :lang org +journal) - (:prefix ("j" . "journal") - :desc "New Entry" "j" #'org-journal-new-entry - :desc "New Scheduled Entry" "J" #'org-journal-new-scheduled-entry - :desc "Search Forever" "s" #'org-journal-search-forever))) - - ;;; o --- open - (:prefix-map ("o" . "open") - :desc "Org agenda" "A" #'org-agenda - (:prefix ("a" . "org agenda") - :desc "Agenda" "a" #'org-agenda - :desc "Todo list" "t" #'org-todo-list - :desc "Tags search" "m" #'org-tags-view - :desc "View search" "v" #'org-search-view) - :desc "Default browser" "b" #'browse-url-of-file - :desc "Start debugger" "d" #'+debugger/start - :desc "New frame" "f" #'make-frame - :desc "Select frame" "F" #'select-frame-by-name - :desc "REPL" "r" #'+eval/open-repl-other-window - :desc "REPL (same window)" "R" #'+eval/open-repl-same-window - :desc "Dired" "-" #'dired-jump - (:when (featurep! :ui neotree) - :desc "Project sidebar" "p" #'+neotree/open - :desc "Find file in project sidebar" "P" #'+neotree/find-this-file) - (:when (featurep! :ui treemacs) - :desc "Project sidebar" "p" #'+treemacs/toggle - :desc "Find file in project sidebar" "P" #'treemacs-find-file) - (:when (featurep! :term shell) - :desc "Toggle shell popup" "t" #'+shell/toggle - :desc "Open shell here" "T" #'+shell/here) - (:when (featurep! :term term) - :desc "Toggle terminal popup" "t" #'+term/toggle - :desc "Open terminal here" "T" #'+term/here) - (:when (featurep! :term vterm) - :desc "Toggle vterm popup" "t" #'+vterm/toggle - :desc "Open vterm here" "T" #'+vterm/here) - (:when (featurep! :term eshell) - :desc "Toggle eshell popup" "e" #'+eshell/toggle - :desc "Open eshell here" "E" #'+eshell/here) - (:when (featurep! :os macos) - :desc "Reveal in Finder" "o" #'+macos/reveal-in-finder - :desc "Reveal project in Finder" "O" #'+macos/reveal-project-in-finder - :desc "Send to Transmit" "u" #'+macos/send-to-transmit - :desc "Send project to Transmit" "U" #'+macos/send-project-to-transmit - :desc "Send to Launchbar" "l" #'+macos/send-to-launchbar - :desc "Send project to Launchbar" "L" #'+macos/send-project-to-launchbar - :desc "Open in iTerm" "i" #'+macos/open-in-iterm) - (:when (featurep! :tools docker) - :desc "Docker" "D" #'docker) - (:when (featurep! :email mu4e) - :desc "mu4e" "m" #'=mu4e) - (:when (featurep! :email notmuch) - :desc "notmuch" "m" #'=notmuch) - (:when (featurep! :email wanderlust) - :desc "wanderlust" "m" #'=wanderlust)) - - ;;; p --- project - (:prefix-map ("p" . "project") - :desc "Browse project" "." #'+default/browse-project - :desc "Browse other project" ">" #'doom/browse-in-other-project - :desc "Run cmd in project root" "!" #'projectile-run-shell-command-in-root - :desc "Async cmd in project root" "&" #'projectile-run-async-shell-command-in-root - :desc "Add new project" "a" #'projectile-add-known-project - :desc "Switch to project buffer" "b" #'projectile-switch-to-buffer - :desc "Compile in project" "c" #'projectile-compile-project - :desc "Repeat last command" "C" #'projectile-repeat-last-command - :desc "Remove known project" "d" #'projectile-remove-known-project - :desc "Discover projects in folder" "D" #'+default/discover-projects - :desc "Edit project .dir-locals" "e" #'projectile-edit-dir-locals - :desc "Find file in project" "f" #'projectile-find-file - :desc "Find file in other project" "F" #'doom/find-file-in-other-project - :desc "Configure project" "g" #'projectile-configure-project - :desc "Invalidate project cache" "i" #'projectile-invalidate-cache - :desc "Kill project buffers" "k" #'projectile-kill-buffers - :desc "Find other file" "o" #'projectile-find-other-file - :desc "Switch project" "p" #'projectile-switch-project - :desc "Find recent project files" "r" #'projectile-recentf - :desc "Run project" "R" #'projectile-run-project - :desc "Save project files" "s" #'projectile-save-project-buffers - :desc "List project todos" "t" #'magit-todos-list - :desc "Test project" "T" #'projectile-test-project - :desc "Pop up scratch buffer" "x" #'doom/open-project-scratch-buffer - :desc "Switch to scratch buffer" "X" #'doom/switch-to-project-scratch-buffer - (:when (and (featurep! :tools taskrunner) - (or (featurep! :completion ivy) - (featurep! :completion helm))) - :desc "List project tasks" "z" #'+taskrunner/project-tasks)) - - ;;; q --- quit/session - (:prefix-map ("q" . "quit/session") - :desc "Restart emacs server" "d" #'+default/restart-server - :desc "Delete frame" "f" #'delete-frame - :desc "Clear current frame" "F" #'doom/kill-all-buffers - :desc "Kill Emacs (and daemon)" "K" #'save-buffers-kill-emacs - :desc "Quit Emacs" "q" #'save-buffers-kill-terminal - :desc "Quit Emacs without saving" "Q" #'evil-quit-all-with-error-code - :desc "Quick save current session" "s" #'doom/quicksave-session - :desc "Restore last session" "l" #'doom/quickload-session - :desc "Save session to file" "S" #'doom/save-session - :desc "Restore session from file" "L" #'doom/load-session - :desc "Restart & restore Emacs" "r" #'doom/restart-and-restore - :desc "Restart Emacs" "R" #'doom/restart) - - ;;; r --- remote - (:when (featurep! :tools upload) - (:prefix-map ("r" . "remote") - :desc "Browse remote" "b" #'ssh-deploy-browse-remote-base-handler - :desc "Browse relative" "B" #'ssh-deploy-browse-remote-handler - :desc "Download remote" "d" #'ssh-deploy-download-handler - :desc "Delete local & remote" "D" #'ssh-deploy-delete-handler - :desc "Eshell base terminal" "e" #'ssh-deploy-remote-terminal-eshell-base-handler - :desc "Eshell relative terminal" "E" #'ssh-deploy-remote-terminal-eshell-handler - :desc "Move/rename local & remote" "m" #'ssh-deploy-rename-handler - :desc "Open this file on remote" "o" #'ssh-deploy-open-remote-file-handler - :desc "Run deploy script" "s" #'ssh-deploy-run-deploy-script-handler - :desc "Upload local" "u" #'ssh-deploy-upload-handler - :desc "Upload local (force)" "U" #'ssh-deploy-upload-handler-forced - :desc "Diff local & remote" "x" #'ssh-deploy-diff-handler - :desc "Browse remote files" "." #'ssh-deploy-browse-remote-handler - :desc "Detect remote changes" ">" #'ssh-deploy-remote-changes-handler)) - - ;;; s --- search - (:prefix-map ("s" . "search") - :desc "Search buffer" "b" - (cond ((featurep! :completion vertico) #'+default/search-buffer) - ((featurep! :completion ivy) #'swiper) - ((featurep! :completion helm) #'swiper)) - :desc "Search all open buffers" "B" - (cond ((featurep! :completion vertico) (cmd!! #'consult-line-multi 'all-buffers)) - ((featurep! :completion ivy) #'swiper-all) - ((featurep! :completion helm) #'swiper-all)) - :desc "Search current directory" "d" #'+default/search-cwd - :desc "Search other directory" "D" #'+default/search-other-cwd - :desc "Search .emacs.d" "e" #'+default/search-emacsd - :desc "Locate file" "f" #'locate - :desc "Jump to symbol" "i" #'imenu - :desc "Jump to visible link" "l" #'link-hint-open-link - :desc "Jump to link" "L" #'ffap-menu - :desc "Jump list" "j" #'evil-show-jumps - :desc "Jump to bookmark" "m" #'bookmark-jump - :desc "Look up online" "o" #'+lookup/online - :desc "Look up online (w/ prompt)" "O" #'+lookup/online-select - :desc "Look up in local docsets" "k" #'+lookup/in-docsets - :desc "Look up in all docsets" "K" #'+lookup/in-all-docsets - :desc "Search project" "p" #'+default/search-project - :desc "Search other project" "P" #'+default/search-other-project - :desc "Jump to mark" "r" #'evil-show-marks - :desc "Search buffer" "s" #'+default/search-buffer - :desc "Search buffer for thing at point" "S" - (cond ((featurep! :completion vertico) #'+vertico/search-symbol-at-point) - ((featurep! :completion ivy) #'swiper-isearch-thing-at-point) - ((featurep! :completion helm) #'swiper-isearch-thing-at-point)) - :desc "Dictionary" "t" #'+lookup/dictionary-definition - :desc "Thesaurus" "T" #'+lookup/synonyms) - - ;;; t --- toggle - (:prefix-map ("t" . "toggle") - :desc "Big mode" "b" #'doom-big-font-mode - :desc "Fill Column Indicator" "c" #'global-display-fill-column-indicator-mode - :desc "Flymake" "f" #'flymake-mode - (:when (featurep! :checkers syntax) - :desc "Flycheck" "f" #'flycheck-mode) - :desc "Frame fullscreen" "F" #'toggle-frame-fullscreen - :desc "Evil goggles" "g" #'evil-goggles-mode - (:when (featurep! :ui indent-guides) - :desc "Indent guides" "i" #'highlight-indent-guides-mode) - :desc "Indent style" "I" #'doom/toggle-indent-style - :desc "Line numbers" "l" #'doom/toggle-line-numbers - (:when (featurep! :ui minimap) - :desc "Minimap" "m" #'minimap-mode) - (:when (featurep! :lang org +present) - :desc "org-tree-slide mode" "p" #'org-tree-slide-mode) - :desc "Read-only mode" "r" #'read-only-mode - (:when (and (featurep! :checkers spell) (not (featurep! :checkers spell +flyspell))) - :desc "Spell checker" "s" #'spell-fu-mode) - (:when (featurep! :checkers spell +flyspell) - :desc "Spell checker" "s" #'flyspell-mode) - (:when (featurep! :lang org +pomodoro) - :desc "Pomodoro timer" "t" #'org-pomodoro) - :desc "Soft line wrapping" "w" #'visual-line-mode - (:when (featurep! :editor word-wrap) - :desc "Soft line wrapping" "w" #'+word-wrap-mode) - (:when (featurep! :ui zen) - :desc "Zen mode" "z" #'+zen/toggle - :desc "Zen mode (fullscreen)" "Z" #'+zen/toggle-fullscreen))) - -(after! which-key - (let ((prefix-re (regexp-opt (list doom-leader-key doom-leader-alt-key)))) - (cl-pushnew `((,(format "\\`\\(?:C-w\\|%s w\\) m\\'" prefix-re)) - nil . "maximize") - which-key-replacement-alist))) diff --git a/.config/emacs/modules/config/default/+evil.el b/.config/emacs/modules/config/default/+evil.el deleted file mode 100644 index afb6745..0000000 --- a/.config/emacs/modules/config/default/+evil.el +++ /dev/null @@ -1,21 +0,0 @@ -;;; config/default/+evil.el -*- lexical-binding: t; -*- - -(defun +default-disable-delete-selection-mode-h () - (delete-selection-mode -1)) -(add-hook 'evil-insert-state-entry-hook #'delete-selection-mode) -(add-hook 'evil-insert-state-exit-hook #'+default-disable-delete-selection-mode-h) - - -;; -;;; Keybindings - -;; This section is dedicated to "fixing" certain keys so that they behave -;; sensibly (and consistently with similar contexts). - -;; Make SPC u SPC u [...] possible (#747) -(map! :map universal-argument-map - :prefix doom-leader-key "u" #'universal-argument-more - :prefix doom-leader-alt-key "u" #'universal-argument-more) - -(when (featurep! +bindings) - (load! "+evil-bindings")) diff --git a/.config/emacs/modules/config/default/README.org b/.config/emacs/modules/config/default/README.org deleted file mode 100644 index 3a431c0..0000000 --- a/.config/emacs/modules/config/default/README.org +++ /dev/null @@ -1,44 +0,0 @@ -#+TITLE: :config default - -This module provides a set of reasonable defaults, including: - -+ A Spacemacs-esque keybinding scheme -+ Extra Ex commands for evil-mode users -+ A yasnippet snippets library tailored to Doom emacs -+ A configuration for (almost) universally repeating searches with =;= and =,= - -#+begin_quote -The defaults module is intended as a "reasonable-defaults" module, but also as a -reference for your own private modules. You'll find [[https://github.com/hlissner/doom-emacs-private][my private module in a -separate repo]]. - -Refer to the [[https://github.com/hlissner/doom-emacs/wiki/Customization][Customization page]] on the wiki for details on starting your own -private module. -#+end_quote - -* Table of Contents :TOC: -- [[#install][Install]] -- [[#configuration][Configuration]] - - [[#im-not-an-evil-user][I'm not an evil user...]] -- [[#appendix][Appendix]] - - [[#commands][Commands]] - - [[#hacks][Hacks]] - -* Install -This module has no external dependencies. - -* Configuration -** I'm not an evil user... -That's fine. All evil configuration is ignored if =:editor evil= is disabled. - -* Appendix -** Commands -+ ~+default/browse-project~ -+ ~+default/browse-templates~ -+ ~+default/find-in-templates~ -+ ~+default/browse-notes~ -+ ~+default/find-in-notes~ -+ ~+default/find-in-snippets~ -** Hacks -+ ~epa-pinentry-mode~ is set to ~'loopback~, forcing gpg-agent to use the Emacs - minibuffer when prompting for your passphrase. *Only works with GPG 2.1+!* diff --git a/.config/emacs/modules/config/default/autoload/default.el b/.config/emacs/modules/config/default/autoload/default.el deleted file mode 100644 index 1f9d70c..0000000 --- a/.config/emacs/modules/config/default/autoload/default.el +++ /dev/null @@ -1,68 +0,0 @@ -;; config/default/autoload/default.el -*- lexical-binding: t; -*- - -;;;###autoload -(defun +default/compile (arg) - "Runs `compile' from the root of the current project. - -If a compilation window is already open, recompile that instead. - -If ARG (universal argument), runs `compile' from the current directory." - (interactive "P") - (if (and (bound-and-true-p compilation-in-progress) - (buffer-live-p compilation-last-buffer)) - (recompile) - (call-interactively - (if arg - #'projectile-compile-project - #'compile)))) - -;;;###autoload -(defun +default/man-or-woman () - "Invoke `man' if man is installed and the platform is not MacOS, otherwise use `woman'. - -`man -k \"^\"` is very slow on MacOS, which is what `Man-completion-table' uses to -generate `completing-read' candidates." - (interactive) - (call-interactively - (if (and (not IS-MAC) (executable-find "man")) - #'man - #'woman))) - -;;;###autoload -(defun +default/new-buffer () - "TODO" - (interactive) - (if (featurep! 'evil) - (call-interactively #'evil-buffer-new) - (let ((buffer (generate-new-buffer "*new*"))) - (set-window-buffer nil buffer) - (with-current-buffer buffer - (funcall (default-value 'major-mode)))))) - -;;;###autoload -(defun +default/restart-server () - "Restart the Emacs server." - (interactive) - (server-force-delete) - (while (server-running-p) - (sleep-for 1)) - (server-start)) - -;;;###autoload -(defun +default/diagnostics (&rest arg) - "List diagnostics for the current buffer/project. -If the the vertico and lsp modules are active, list lsp diagnostics for the -current project. Otherwise list them for the current buffer" - (interactive) - (cond ((and (featurep! :completion vertico) - (featurep! :tools lsp) - (bound-and-true-p lsp-mode)) - (consult-lsp-diagnostics arg)) - ((and (featurep! :checkers syntax) - (bound-and-true-p flycheck-mode)) - (flycheck-list-errors)) - ((bound-and-true-p flymake-mode) - (flymake-show-diagnostics-buffer)) - (t - (user-error "No diagnostics backend detected. Enable flycheck or \ -flymake, or set up lsp-mode if applicable (see :lang lsp)")))) diff --git a/.config/emacs/modules/config/default/autoload/deferred.el b/.config/emacs/modules/config/default/autoload/deferred.el deleted file mode 100644 index 4ecfb67..0000000 --- a/.config/emacs/modules/config/default/autoload/deferred.el +++ /dev/null @@ -1,20 +0,0 @@ -;;; config/default/autoload/deferred.el -*- lexical-binding: t; -*- - -;; TODO generalize this -;;;###autoload -(defun +default/lsp-command-map () - "Lazily invoke `lsp-command-map'." - (interactive) - (require 'lsp-mode) - (map! :leader "c l" lsp-command-map) - (dolist (leader-key (list doom-leader-key doom-leader-alt-key)) - (let ((lsp-keymap-prefix (concat leader-key " c l"))) - (lsp-enable-which-key-integration))) - (setq prefix-arg current-prefix-arg - unread-command-events - (mapcar (lambda (e) (cons t e)) - (vconcat (when (bound-and-true-p evil-this-operator) - (where-is-internal evil-this-operator - evil-normal-state-map - t)) - (this-command-keys))))) diff --git a/.config/emacs/modules/config/default/autoload/files.el b/.config/emacs/modules/config/default/autoload/files.el deleted file mode 100644 index 37752eb..0000000 --- a/.config/emacs/modules/config/default/autoload/files.el +++ /dev/null @@ -1,66 +0,0 @@ -;;; config/default/autoload/files.el -*- lexical-binding: t; -*- - -;;;###autoload -(defun +default/browse-project () - "Browse files from the current project's root." - (interactive) (doom-project-browse (doom-project-root))) -;; NOTE No need for find-in-project, use `projectile-find-file' - -;;;###autoload -(defun +default/browse-templates () - "Browse files from `+file-templates-dir'." - (interactive) (doom-project-browse +file-templates-dir)) -;;;###autoload -(defun +default/find-in-templates () - "Find a file under `+file-templates-dir', recursively." - (interactive) (doom-project-find-file +file-templates-dir)) - -;;;###autoload -(defun +default/browse-notes () - "Browse files from `org-directory'." - (interactive) - (unless (bound-and-true-p org-directory) - (require 'org)) - (doom-project-browse org-directory)) -;;;###autoload -(defun +default/find-in-notes () - "Find a file under `org-directory', recursively." - (interactive) - (unless (bound-and-true-p org-directory) - (require 'org)) - (doom-project-find-file org-directory)) - -;;;###autoload -(defun +default/find-file-under-here () - "Perform a recursive file search from the current directory." - (interactive) - (doom-project-find-file default-directory)) - -;;;###autoload -(defun +default/discover-projects (arg) - "Discover projects in `projectile-project-search-path'. -If prefix ARG is non-nil, prompt for the search path." - (interactive "P") - (if arg - (call-interactively #'projectile-discover-projects-in-directory) - (if (not projectile-project-search-path) - (user-error "`projectile-project-search-path' is empty; don't know where to search") - (letf! (defun projectile-add-known-project (project-root) - (unless (projectile-ignored-project-p project-root) - (funcall projectile-add-known-project project-root) - (message "Added %S to known project roots" project-root))) - (dolist (dir projectile-project-search-path) - (cl-destructuring-bind (dir . depth) (if (consp dir) dir (cons dir nil)) - (if (not (file-accessible-directory-p dir)) - (message "%S was inaccessible and couldn't be searched" dir) - (projectile-discover-projects-in-directory dir depth)))))))) - -;;;###autoload -(defun +default/dired (arg) - "Open a directory in dired. -If prefix ARG is non-nil, prompt for a known project to open in dired." - (interactive "P") - (apply #'dired - (if arg - (list (completing-read "Open dired in project: " projectile-known-projects)) - (dired-read-dir-and-switches "")))) diff --git a/.config/emacs/modules/config/default/autoload/search.el b/.config/emacs/modules/config/default/autoload/search.el deleted file mode 100644 index 624490d..0000000 --- a/.config/emacs/modules/config/default/autoload/search.el +++ /dev/null @@ -1,144 +0,0 @@ -;;; config/default/autoload/search.el -*- lexical-binding: t; -*- - -;;;###autoload -(defun +default/search-cwd (&optional arg) - "Conduct a text search in files under the current folder. -If prefix ARG is set, prompt for a directory to search from." - (interactive "P") - (let ((default-directory - (if arg - (read-directory-name "Search directory: ") - default-directory))) - (call-interactively - (cond ((featurep! :completion ivy) #'+ivy/project-search-from-cwd) - ((featurep! :completion helm) #'+helm/project-search-from-cwd) - ((featurep! :completion vertico) #'+vertico/project-search-from-cwd) - (#'rgrep))))) - -;;;###autoload -(defun +default/search-other-cwd () - "Conduct a text search in another directory." - (interactive) - (+default/search-cwd 'other)) - -;;;###autoload -(defun +default/search-emacsd () - "Conduct a text search in files under `user-emacs-directory'." - (interactive) - (let ((default-directory user-emacs-directory)) - (call-interactively - (cond ((featurep! :completion ivy) #'+ivy/project-search-from-cwd) - ((featurep! :completion helm) #'+helm/project-search-from-cwd) - ((featurep! :completion vertico) #'+vertico/project-search-from-cwd) - (#'rgrep))))) - -;;;###autoload -(defun +default/search-buffer () - "Conduct a text search on the current buffer. - -If a selection is active and multi-line, perform a search restricted to that -region. - -If a selection is active and not multi-line, use the selection as the initial -input and search the whole buffer for it." - (interactive) - (let (start end multiline-p) - (save-restriction - (when (region-active-p) - (setq start (region-beginning) - end (region-end) - multiline-p (/= (line-number-at-pos start) - (line-number-at-pos end))) - (deactivate-mark) - (when multiline-p - (narrow-to-region start end))) - (cond ((or (featurep! :completion helm) - (featurep! :completion ivy)) - (call-interactively - (if (and start end (not multiline-p)) - #'swiper-isearch-thing-at-point - #'swiper-isearch))) - ((featurep! :completion vertico) - (if (and start end (not multiline-p)) - (consult-line - (replace-regexp-in-string - " " "\\\\ " - (rxt-quote-pcre - (buffer-substring-no-properties start end)))) - (call-interactively #'consult-line))))))) - -;;;###autoload -(defun +default/search-project (&optional arg) - "Conduct a text search in the current project root. -If prefix ARG is set, include ignored/hidden files." - (interactive "P") - (let* ((projectile-project-root nil) - (disabled-command-function nil) - (current-prefix-arg (unless (eq arg 'other) arg)) - (default-directory - (if (eq arg 'other) - (if-let (projects (projectile-relevant-known-projects)) - (completing-read "Search project: " projects nil t) - (user-error "There are no known projects")) - default-directory))) - (call-interactively - (cond ((featurep! :completion ivy) #'+ivy/project-search) - ((featurep! :completion helm) #'+helm/project-search) - ((featurep! :completion vertico) #'+vertico/project-search) - (#'projectile-ripgrep))))) - -;;;###autoload -(defun +default/search-other-project () - "Conduct a text search in a known project." - (interactive) - (+default/search-project 'other)) - -;;;###autoload -(defun +default/search-project-for-symbol-at-point (symbol dir) - "Search current project for symbol at point. -If prefix ARG is set, prompt for a known project to search from." - (interactive - (list (rxt-quote-pcre (or (doom-thing-at-point-or-region) "")) - (let ((projectile-project-root nil)) - (if current-prefix-arg - (if-let (projects (projectile-relevant-known-projects)) - (completing-read "Search project: " projects nil t) - (user-error "There are no known projects")) - (doom-project-root default-directory))))) - (cond ((featurep! :completion ivy) - (+ivy/project-search nil symbol dir)) - ((featurep! :completion helm) - (+helm/project-search nil symbol dir)) - ((featurep! :completion vertico) - (+vertico/project-search nil symbol dir)) - ((rgrep (regexp-quote symbol))))) - -;;;###autoload -(defun +default/search-notes-for-symbol-at-point (symbol) - "Conduct a text search in the current project for symbol at point. If prefix -ARG is set, prompt for a known project to search from." - (interactive - (list (rxt-quote-pcre (or (doom-thing-at-point-or-region) "")))) - (require 'org) - (+default/search-project-for-symbol-at-point - symbol org-directory)) - -;;;###autoload -(defun +default/org-notes-search (query) - "Perform a text search on `org-directory'." - (interactive - (list (if (doom-region-active-p) - (buffer-substring-no-properties - (doom-region-beginning) - (doom-region-end)) - ""))) - (require 'org) - (+default/search-project-for-symbol-at-point - query org-directory)) - -;;;###autoload -(defun +default/org-notes-headlines () - "Jump to an Org headline in `org-agenda-files'." - (interactive) - (doom-completing-read-org-headings - "Jump to org headline: " org-agenda-files 3 t)) diff --git a/.config/emacs/modules/config/default/autoload/text.el b/.config/emacs/modules/config/default/autoload/text.el deleted file mode 100644 index 9d3eb12..0000000 --- a/.config/emacs/modules/config/default/autoload/text.el +++ /dev/null @@ -1,166 +0,0 @@ -;;; config/default/autoload/text.el -*- lexical-binding: t; -*- - -;;;###autoload -(defalias '+default/newline #'electric-indent-just-newline) - -;;;###autoload -(defun +default/newline-above () - "Insert an indented new line before the current one." - (interactive) - (if (featurep 'evil) - (call-interactively 'evil-open-above) - (beginning-of-line) - (save-excursion (newline)) - (indent-according-to-mode))) - -;;;###autoload -(defun +default/newline-below () - "Insert an indented new line after the current one." - (interactive) - (if (featurep 'evil) - (call-interactively 'evil-open-below) - (end-of-line) - (newline-and-indent))) - -;;;###autoload -(defun +default/yank-pop () - "Interactively select what text to insert from the kill ring." - (interactive) - (call-interactively - (cond ((fboundp 'consult-yank-pop) #'consult-yank-pop) ;HACK see @ymarco's comment on #5013 and TODO.org in the selecturm module. - ((fboundp 'counsel-yank-pop) #'counsel-yank-pop) - ((fboundp 'helm-show-kill-ring) #'helm-show-kill-ring) - ((error "No kill-ring search backend available. Enable ivy, helm or vertico!"))))) - -;;;###autoload -(defun +default/yank-buffer-path (&optional root) - "Copy the current buffer's path to the kill ring." - (interactive) - (if-let (filename (or (buffer-file-name (buffer-base-buffer)) - (bound-and-true-p list-buffers-directory))) - (message "Copied path to clipboard: %s" - (kill-new (abbreviate-file-name - (if root - (file-relative-name filename root) - filename)))) - (error "Couldn't find filename in current buffer"))) - -;;;###autoload -(defun +default/yank-buffer-path-relative-to-project (&optional include-root) - "Copy the current buffer's path to the kill ring. -With non-nil prefix INCLUDE-ROOT, also include the project's root." - (interactive "P") - (+default/yank-buffer-path - (if include-root - (file-name-directory (directory-file-name (doom-project-root))) - (doom-project-root)))) - -;;;###autoload -(defun +default/insert-file-path (arg) - "Insert the file name (absolute path if prefix ARG). -If `buffer-file-name' isn't set, uses `default-directory'." - (interactive "P") - (let ((path (or buffer-file-name default-directory))) - (insert - (if arg - (abbreviate-file-name path) - (file-name-nondirectory path))))) - -;;;###autoload -(defun doom/backward-delete-whitespace-to-column () - "Delete back to the previous column of whitespace, or as much whitespace as -possible, or just one char if that's not possible." - (interactive) - (let* ((context - (if (bound-and-true-p smartparens-mode) - (ignore-errors (sp-get-thing)))) - (op (plist-get context :op)) - (cl (plist-get context :cl)) - open-len close-len current-column) - (cond ;; When in strings (sp acts weird with quotes; this is the fix) - ;; Also, skip closing delimiters - ((and op cl - (string= op cl) - (and (string= (char-to-string (or (char-before) 0)) op) - (setq open-len (length op))) - (and (string= (char-to-string (or (char-after) 0)) cl) - (setq close-len (length cl)))) - (delete-char (- open-len)) - (delete-char close-len)) - - ;; Delete up to the nearest tab column IF only whitespace between - ;; point and bol. - ((and (not indent-tabs-mode) - (> tab-width 1) - (not (bolp)) - (not (doom-point-in-string-p)) - (>= (abs (save-excursion (skip-chars-backward " \t"))) - (setq current-column (current-column)))) - (delete-char (- (1+ (% (1- current-column) tab-width))))) - - ;; Otherwise do a regular delete - ((delete-char -1))))) - -;;;###autoload -(defun +default--delete-backward-char-a (n &optional killflag) - "Same as `delete-backward-char', but preforms these additional checks: - -+ If point is surrounded by (balanced) whitespace and a brace delimiter ({} [] - ()), delete a space on either side of the cursor. -+ If point is at BOL and surrounded by braces on adjacent lines, collapse - newlines: - { - | - } => {|} -+ Otherwise, resort to `doom/backward-delete-whitespace-to-column'. -+ Resorts to `delete-char' if n > 1" - (interactive "p\nP") - (or (integerp n) - (signal 'wrong-type-argument (list 'integerp n))) - (cond ((and (use-region-p) - delete-active-region - (= n 1)) - ;; If a region is active, kill or delete it. - (if (eq delete-active-region 'kill) - (kill-region (region-beginning) (region-end) 'region) - (funcall region-extract-function 'delete-only))) - ;; In Overwrite mode, maybe untabify while deleting - ((null (or (null overwrite-mode) - (<= n 0) - (memq (char-before) '(?\t ?\n)) - (eobp) - (eq (char-after) ?\n))) - (let ((ocol (current-column))) - (delete-char (- n) killflag) - (save-excursion - (insert-char ?\s (- ocol (current-column)) nil)))) - ;; - ((= n 1) - (cond ((or (not (featurep! +smartparens)) - (not (bound-and-true-p smartparens-mode)) - (and (memq (char-before) (list ?\ ?\t)) - (save-excursion - (and (/= (skip-chars-backward " \t" (line-beginning-position)) 0) - (bolp))))) - (doom/backward-delete-whitespace-to-column)) - ((let* ((pair (ignore-errors (sp-get-thing))) - (op (plist-get pair :op)) - (cl (plist-get pair :cl)) - (beg (plist-get pair :beg)) - (end (plist-get pair :end))) - (cond ((and end beg (= end (+ beg (length op) (length cl)))) - (delete-char (- (length op)))) - ((doom-surrounded-p pair 'inline 'balanced) - (delete-char -1 killflag) - (delete-char 1) - (when (= (point) (+ (length cl) beg)) - (sp-backward-delete-char 1) - (sp-insert-pair op))) - ((and (bolp) (doom-surrounded-p pair nil 'balanced)) - (delete-region beg end) - (sp-insert-pair op) - t) - ((run-hook-with-args-until-success 'doom-delete-backward-functions)) - ((doom/backward-delete-whitespace-to-column))))))) - ;; Otherwise, do simple deletion. - ((delete-char (- n) killflag)))) diff --git a/.config/emacs/modules/config/default/config.el b/.config/emacs/modules/config/default/config.el deleted file mode 100644 index cb29aac..0000000 --- a/.config/emacs/modules/config/default/config.el +++ /dev/null @@ -1,479 +0,0 @@ -;;; config/default/config.el -*- lexical-binding: t; -*- - -(defvar +default-want-RET-continue-comments t - "If non-nil, RET will continue commented lines.") - -(defvar +default-minibuffer-maps - (append '(minibuffer-local-map - minibuffer-local-ns-map - minibuffer-local-completion-map - minibuffer-local-must-match-map - minibuffer-local-isearch-map - read-expression-map) - (cond ((featurep! :completion ivy) - '(ivy-minibuffer-map - ivy-switch-buffer-map)) - ((featurep! :completion helm) - '(helm-map - helm-rg-map - helm-read-file-map)))) - "A list of all the keymaps used for the minibuffer.") - - -;; -;;; Reasonable defaults - -;;;###package avy -(setq avy-all-windows nil - avy-all-windows-alt t - avy-background t - ;; the unpredictability of this (when enabled) makes it a poor default - avy-single-candidate-jump nil) - - -(after! epa - ;; With GPG 2.1+, this forces gpg-agent to use the Emacs minibuffer to prompt - ;; for the key passphrase. - (set 'epg-pinentry-mode 'loopback) - ;; Default to the first secret key available in your keyring. - (setq-default - epa-file-encrypt-to - (or (default-value 'epa-file-encrypt-to) - (unless (string-empty-p user-full-name) - (cl-loop for key in (ignore-errors (epg-list-keys (epg-make-context) user-full-name)) - collect (epg-sub-key-id (car (epg-key-sub-key-list key))))) - user-mail-address)) - ;; And suppress prompts if epa-file-encrypt-to has a default value (without - ;; overwriting file-local values). - (defadvice! +default--dont-prompt-for-keys-a (&rest _) - :before #'epa-file-write-region - (unless (local-variable-p 'epa-file-encrypt-to) - (setq-local epa-file-encrypt-to (default-value 'epa-file-encrypt-to))))) - - -(after! woman - ;; The woman-manpath default value does not necessarily match man. If we have - ;; man available but aren't using it for performance reasons, we can extract - ;; it's manpath. - (when (executable-find "man") - (setq woman-manpath - (split-string (cdr (doom-call-process "man" "--path")) - path-separator t)))) - - -(use-package! drag-stuff - :defer t - :init - (map! "" #'drag-stuff-up - "" #'drag-stuff-down - "" #'drag-stuff-left - "" #'drag-stuff-right)) - - -;;;###package tramp -(unless IS-WINDOWS - (setq tramp-default-method "ssh")) ; faster than the default scp - - -;; -;;; Smartparens config - -(when (featurep! +smartparens) - ;; You can disable :unless predicates with (sp-pair "'" nil :unless nil) - ;; And disable :post-handlers with (sp-pair "{" nil :post-handlers nil) - ;; or specific :post-handlers with: - ;; (sp-pair "{" nil :post-handlers '(:rem ("| " "SPC"))) - (after! smartparens - ;; Smartparens' navigation feature is neat, but does not justify how - ;; expensive it is. It's also less useful for evil users. This may need to - ;; be reactivated for non-evil users though. Needs more testing! - (add-hook! 'after-change-major-mode-hook - (defun doom-disable-smartparens-navigate-skip-match-h () - (setq sp-navigate-skip-match nil - sp-navigate-consider-sgml-tags nil))) - - ;; Autopair quotes more conservatively; if I'm next to a word/before another - ;; quote, I don't want to open a new pair or it would unbalance them. - (let ((unless-list '(sp-point-before-word-p - sp-point-after-word-p - sp-point-before-same-p))) - (sp-pair "'" nil :unless unless-list) - (sp-pair "\"" nil :unless unless-list)) - - ;; Expand {|} => { | } - ;; Expand {|} => { - ;; | - ;; } - (dolist (brace '("(" "{" "[")) - (sp-pair brace nil - :post-handlers '(("||\n[i]" "RET") ("| " "SPC")) - ;; Don't autopair opening braces if before a word character or - ;; other opening brace. The rationale: it interferes with manual - ;; balancing of braces, and is odd form to have s-exps with no - ;; whitespace in between, e.g. ()()(). Insert whitespace if - ;; genuinely want to start a new form in the middle of a word. - :unless '(sp-point-before-word-p sp-point-before-same-p))) - - ;; In lisps ( should open a new form if before another parenthesis - (sp-local-pair sp-lisp-modes "(" ")" :unless '(:rem sp-point-before-same-p)) - - ;; Major-mode specific fixes - (sp-local-pair 'ruby-mode "{" "}" - :pre-handlers '(:rem sp-ruby-pre-handler) - :post-handlers '(:rem sp-ruby-post-handler)) - - ;; Don't eagerly escape Swift style string interpolation - (sp-local-pair 'swift-mode "\\(" ")" :when '(sp-in-string-p)) - - ;; Don't do square-bracket space-expansion where it doesn't make sense to - (sp-local-pair '(emacs-lisp-mode org-mode markdown-mode gfm-mode) - "[" nil :post-handlers '(:rem ("| " "SPC"))) - - ;; Reasonable default pairs for HTML-style comments - (sp-local-pair (append sp--html-modes '(markdown-mode gfm-mode)) - "" - :unless '(sp-point-before-word-p sp-point-before-same-p) - :actions '(insert) :post-handlers '(("| " "SPC"))) - - ;; Disable electric keys in C modes because it interferes with smartparens - ;; and custom bindings. We'll do it ourselves (mostly). - (after! cc-mode - (setq-default c-electric-flag nil) - (dolist (key '("#" "{" "}" "/" "*" ";" "," ":" "(" ")" "\177")) - (define-key c-mode-base-map key nil)) - - ;; Smartparens and cc-mode both try to autoclose angle-brackets - ;; intelligently. The result isn't very intelligent (causes redundant - ;; characters), so just do it ourselves. - (define-key! c++-mode-map "<" nil ">" nil) - - (defun +default-cc-sp-point-is-template-p (id action context) - "Return t if point is in the right place for C++ angle-brackets." - (and (sp-in-code-p id action context) - (cond ((eq action 'insert) - (sp-point-after-word-p id action context)) - ((eq action 'autoskip) - (/= (char-before) 32))))) - - (defun +default-cc-sp-point-after-include-p (id action context) - "Return t if point is in an #include." - (and (sp-in-code-p id action context) - (save-excursion - (goto-char (line-beginning-position)) - (looking-at-p "[ ]*#include[^<]+")))) - - ;; ...and leave it to smartparens - (sp-local-pair '(c++-mode objc-mode) - "<" ">" - :when '(+default-cc-sp-point-is-template-p - +default-cc-sp-point-after-include-p) - :post-handlers '(("| " "SPC"))) - - (sp-local-pair '(c-mode c++-mode objc-mode java-mode) - "/*!" "*/" - :post-handlers '(("||\n[i]" "RET") ("[d-1]< | " "SPC")))) - - ;; Expand C-style comment blocks. - (defun +default-open-doc-comments-block (&rest _ignored) - (save-excursion - (newline) - (indent-according-to-mode))) - (sp-local-pair - '(js2-mode typescript-mode rjsx-mode rust-mode c-mode c++-mode objc-mode - csharp-mode java-mode php-mode css-mode scss-mode less-css-mode - stylus-mode scala-mode) - "/*" "*/" - :actions '(insert) - :post-handlers '(("| " "SPC") - (" | " "*") - ("|[i]\n[i]" "RET"))) - - (after! smartparens-ml - (sp-with-modes '(tuareg-mode fsharp-mode) - (sp-local-pair "(*" "*)" :actions nil) - (sp-local-pair "(*" "*" - :actions '(insert) - :post-handlers '(("| " "SPC") ("|[i]*)[d-2]" "RET"))))) - - (after! smartparens-markdown - (sp-with-modes '(markdown-mode gfm-mode) - (sp-local-pair "```" "```" :post-handlers '(:add ("||\n[i]" "RET"))) - - ;; The original rules for smartparens had an odd quirk: inserting two - ;; asterixex would replace nearby quotes with asterixes. These two rules - ;; set out to fix this. - (sp-local-pair "**" nil :actions :rem) - (sp-local-pair "*" "*" - :actions '(insert skip) - :unless '(:rem sp-point-at-bol-p) - ;; * then SPC will delete the second asterix and assume - ;; you wanted a bullet point. * followed by another * - ;; will produce an extra, assuming you wanted **|**. - :post-handlers '(("[d1]" "SPC") ("|*" "*")))) - - ;; This keybind allows * to skip over **. - (map! :map markdown-mode-map - :ig "*" (general-predicate-dispatch nil - (looking-at-p "\\*\\* *") - (cmd! (forward-char 2))))) - - ;; Removes haskell-mode trailing braces - (after! smartparens-haskell - (sp-with-modes '(haskell-mode haskell-interactive-mode) - (sp-local-pair "{-" "-}" :actions :rem) - (sp-local-pair "{-#" "#-}" :actions :rem) - (sp-local-pair "{-@" "@-}" :actions :rem) - (sp-local-pair "{-" "-") - (sp-local-pair "{-#" "#-") - (sp-local-pair "{-@" "@-"))))) - - -;; -;;; Keybinding fixes - -;; Highjacks backspace to delete up to nearest column multiple of `tab-width' at -;; a time. If you have smartparens enabled, it will also: -;; a) balance spaces inside brackets/parentheses ( | ) -> (|) -;; b) close empty multiline brace blocks in one step: -;; { -;; | -;; } -;; becomes {|} -;; c) refresh smartparens' :post-handlers, so SPC and RET expansions work even -;; after a backspace. -;; d) properly delete smartparen pairs when they are encountered, without the -;; need for strict mode. -;; e) do none of this when inside a string -(advice-add #'delete-backward-char :override #'+default--delete-backward-char-a) - -;; HACK Makes `newline-and-indent' continue comments (and more reliably). -;; Consults `doom-point-in-comment-functions' to detect a commented region -;; and uses that mode's `comment-line-break-function' to continue comments. -;; If neither exists, it will fall back to the normal behavior of -;; `newline-and-indent'. -;; -;; We use an advice here instead of a remapping because many modes define -;; and remap to their own newline-and-indent commands, and tackling all -;; those cases was judged to be more work than dealing with the edge cases -;; on a case by case basis. -(defadvice! +default--newline-indent-and-continue-comments-a (&rest _) - "A replacement for `newline-and-indent'. - -Continues comments if executed from a commented line. Consults -`doom-point-in-comment-functions' to determine if in a comment." - :before-until #'newline-and-indent - (interactive "*") - (when (and +default-want-RET-continue-comments - (doom-point-in-comment-p) - (functionp comment-line-break-function)) - (funcall comment-line-break-function nil) - t)) - -;; This section is dedicated to "fixing" certain keys so that they behave -;; sensibly (and consistently with similar contexts). - -;; Consistently use q to quit windows -(after! tabulated-list - (define-key tabulated-list-mode-map "q" #'quit-window)) - -;; OS specific fixes -(when IS-MAC - ;; Fix MacOS shift+tab - (define-key key-translation-map [S-iso-lefttab] [backtab]) - ;; Fix conventional OS keys in Emacs - (map! "s-`" #'other-frame ; fix frame-switching - ;; fix OS window/frame navigation/manipulation keys - "s-w" #'delete-window - "s-W" #'delete-frame - "s-n" #'+default/new-buffer - "s-N" #'make-frame - "s-q" (if (daemonp) #'delete-frame #'save-buffers-kill-terminal) - "C-s-f" #'toggle-frame-fullscreen - ;; Restore somewhat common navigation - "s-l" #'goto-line - ;; Restore OS undo, save, copy, & paste keys (without cua-mode, because - ;; it imposes some other functionality and overhead we don't need) - "s-f" (if (featurep! :completion vertico) #'consult-line #'swiper) - "s-z" #'undo - "s-Z" #'redo - "s-c" (if (featurep 'evil) #'evil-yank #'copy-region-as-kill) - "s-v" #'yank - "s-s" #'save-buffer - "s-x" #'execute-extended-command - :v "s-x" #'kill-region - ;; Buffer-local font scaling - "s-+" #'doom/reset-font-size - "s-=" #'doom/increase-font-size - "s--" #'doom/decrease-font-size - ;; Conventional text-editing keys & motions - "s-a" #'mark-whole-buffer - "s-/" (cmd! (save-excursion (comment-line 1))) - :n "s-/" #'evilnc-comment-or-uncomment-lines - :v "s-/" #'evilnc-comment-operator - :gi [s-backspace] #'doom/backward-kill-to-bol-and-indent - :gi [s-left] #'doom/backward-to-bol-or-indent - :gi [s-right] #'doom/forward-to-last-non-comment-or-eol - :gi [M-backspace] #'backward-kill-word - :gi [M-left] #'backward-word - :gi [M-right] #'forward-word)) - - -;; -;;; Keybind schemes - -;; Custom help keys -- these aren't under `+bindings' because they ought to be -;; universal. -(define-key! help-map - ;; new keybinds - "'" #'describe-char - "u" #'doom/help-autodefs - "E" #'doom/sandbox - "M" #'doom/describe-active-minor-mode - "O" #'+lookup/online - "T" #'doom/toggle-profiler - "V" #'doom/help-custom-variable - "W" #'+default/man-or-woman - "C-k" #'describe-key-briefly - "C-l" #'describe-language-environment - "C-m" #'info-emacs-manual - - ;; Unbind `help-for-help'. Conflicts with which-key's help command for the - ;; h prefix. It's already on ? and F1 anyway. - "C-h" nil - - ;; replacement keybinds - ;; replaces `info-emacs-manual' b/c it's on C-m now - "r" nil - "rr" #'doom/reload - "rt" #'doom/reload-theme - "rp" #'doom/reload-packages - "rf" #'doom/reload-font - "re" #'doom/reload-env - - ;; make `describe-bindings' available under the b prefix which it previously - ;; occupied. Add more binding related commands under that prefix as well - "b" nil - "bb" #'describe-bindings - "bi" #'which-key-show-minor-mode-keymap - "bm" #'which-key-show-major-mode - "bt" #'which-key-show-top-level - "bf" #'which-key-show-full-keymap - "bk" #'which-key-show-keymap - - ;; replaces `apropos-documentation' b/c `apropos' covers this - "d" nil - "db" #'doom/report-bug - "dc" #'doom/goto-private-config-file - "dC" #'doom/goto-private-init-file - "dd" #'doom-debug-mode - "df" #'doom/help-faq - "dh" #'doom/help - "dl" #'doom/help-search-load-path - "dL" #'doom/help-search-loaded-files - "dm" #'doom/help-modules - "dn" #'doom/help-news - "dN" #'doom/help-search-news - "dpc" #'doom/help-package-config - "dpd" #'doom/goto-private-packages-file - "dph" #'doom/help-package-homepage - "dpp" #'doom/help-packages - "ds" #'doom/help-search-headings - "dS" #'doom/help-search - "dt" #'doom/toggle-profiler - "du" #'doom/help-autodefs - "dv" #'doom/version - "dx" #'doom/sandbox - - ;; replaces `apropos-command' - "a" #'apropos - "A" #'apropos-documentation - ;; replaces `describe-copying' b/c not useful - "C-c" #'describe-coding-system - ;; replaces `Info-got-emacs-command-node' b/c redundant w/ `Info-goto-node' - "F" #'describe-face - ;; replaces `view-hello-file' b/c annoying - "h" nil - ;; replaces `view-emacs-news' b/c it's on C-n too - "n" #'doom/help-news - ;; replaces `help-with-tutorial', b/c it's less useful than `load-theme' - "t" #'load-theme - ;; replaces `finder-by-keyword' b/c not useful - "p" #'doom/help-packages - ;; replaces `describe-package' b/c redundant w/ `doom/help-packages' - "P" #'find-library) - -(after! which-key - (let ((prefix-re (regexp-opt (list doom-leader-key doom-leader-alt-key)))) - (cl-pushnew `((,(format "\\`\\(?:<\\(?:\\(?:f1\\|help\\)>\\)\\|C-h\\|%s h\\) d\\'" prefix-re)) - nil . "doom") - which-key-replacement-alist) - (cl-pushnew `((,(format "\\`\\(?:<\\(?:\\(?:f1\\|help\\)>\\)\\|C-h\\|%s h\\) r\\'" prefix-re)) - nil . "reload") - which-key-replacement-alist) - (cl-pushnew `((,(format "\\`\\(?:<\\(?:\\(?:f1\\|help\\)>\\)\\|C-h\\|%s h\\) b\\'" prefix-re)) - nil . "bindings") - which-key-replacement-alist))) - - -(when (featurep! +bindings) - ;; Make M-x harder to miss - (define-key! 'override - "M-x" #'execute-extended-command - "A-x" #'execute-extended-command) - - ;; A Doom convention where C-s on popups and interactive searches will invoke - ;; ivy/helm/vertico for their superior filtering. - (when-let (command (cond ((featurep! :completion ivy) - #'counsel-minibuffer-history) - ((featurep! :completion helm) - #'helm-minibuffer-history) - ((featurep! :completion vertico) - #'consult-history))) - (define-key! - :keymaps (append +default-minibuffer-maps - (when (featurep! :editor evil +everywhere) - '(evil-ex-completion-map))) - "C-s" command)) - - ;; Smarter C-a/C-e for both Emacs and Evil. C-a will jump to indentation. - ;; Pressing it again will send you to the true bol. Same goes for C-e, except - ;; it will ignore comments+trailing whitespace before jumping to eol. - (map! :gi "C-a" #'doom/backward-to-bol-or-indent - :gi "C-e" #'doom/forward-to-last-non-comment-or-eol - ;; Standardizes the behavior of modified RET to match the behavior of - ;; other editors, particularly Atom, textedit, textmate, and vscode, in - ;; which ctrl+RET will add a new "item" below the current one and - ;; cmd+RET (Mac) / meta+RET (elsewhere) will add a new, blank line below - ;; the current one. - - ;; C- = text scale increase - ;; C- = text scale decrease - [C-down-mouse-2] (cmd! (text-scale-set 0)) - - ;; auto-indent on newline by default - :gi [remap newline] #'newline-and-indent - ;; insert literal newline - :i "S-RET" #'+default/newline - :i [S-return] #'+default/newline - :i "C-j" #'+default/newline - - ;; Add new item below current (without splitting current line). - :gi "C-RET" #'+default/newline-below - :gn [C-return] #'+default/newline-below - ;; Add new item above current (without splitting current line) - :gi "C-S-RET" #'+default/newline-above - :gn [C-S-return] #'+default/newline-above - - (:when IS-MAC - :gn "s-RET" #'+default/newline-below - :gn [s-return] #'+default/newline-below - :gn "S-s-RET" #'+default/newline-above - :gn [S-s-return] #'+default/newline-above))) - - -;; -;;; Bootstrap configs - -(if (featurep 'evil) - (load! "+evil") - (load! "+emacs")) diff --git a/.config/emacs/modules/config/default/packages.el b/.config/emacs/modules/config/default/packages.el deleted file mode 100644 index 7a84434..0000000 --- a/.config/emacs/modules/config/default/packages.el +++ /dev/null @@ -1,9 +0,0 @@ -;; -*- no-byte-compile: t; -*- -;;; config/default/packages.el - -(package! avy :pin "e92cb37457b43336b765630dbfbea8ba4be601fa") -(package! drag-stuff :pin "6d06d846cd37c052d79acd0f372c13006aa7e7c8") -(package! link-hint :pin "3be270f3a732dc4acae6a20ff449eef0c4f9a966") - -(unless (featurep! :editor evil) - (package! expand-region :pin "95a773bd8f557cbd43d3b2dab2fa4417ec5927ab")) diff --git a/.config/emacs/modules/config/literate/README.org b/.config/emacs/modules/config/literate/README.org deleted file mode 100644 index 59421fb..0000000 --- a/.config/emacs/modules/config/literate/README.org +++ /dev/null @@ -1,106 +0,0 @@ -#+TITLE: config/literate -#+DATE: May 4, 2020 -#+SINCE: v2.0.9 -#+STARTUP: inlineimages nofold - -* Table of Contents :TOC_3:noexport: -- [[#description][Description]] - - [[#maintainers][Maintainers]] - - [[#module-flags][Module Flags]] - - [[#plugins][Plugins]] -- [[#prerequisites][Prerequisites]] -- [[#features][Features]] -- [[#configuration][Configuration]] - - [[#change-the-location-of-configorg][Change the location of config.org]] - - [[#change-where-src-blocks-are-tangled-or-prevent-it-entirely][Change where src blocks are tangled or prevent it entirely]] -- [[#troubleshooting][Troubleshooting]] - - [[#how-to-tangle-to-doomdirinitel][How to tangle to =DOOMDIR/init.el=]] - - [[#how-to-disable-tangle-on-save][How to disable tangle-on-save]] - -* Description -This module enables support for a literate config. - -A literate config consists of a =DOOMDIR/config.org=. All src blocks within are -tangled =DOOMDIR/config.el=, by default, when ~doom sync~ is executed. - -** Maintainers -This module has no dedicated maintainers. - -** Module Flags -This module provides no flags. - -** Plugins -This module installs no plugins. - -* Prerequisites -This module has no prerequisites. - -* Features -+ Automatically tangles ~config.org~ to ~config.el~ when saving. See - Troubleshooting section belong on how to disable it. - -* Configuration -** Change the location of config.org -The ~+literate-config-file~ variable controls where to look for your config.org. -To change this it must be modified early -- in =DOOMDIR/init.el= or -=DOOMDIR/cli.el=. - -Source blocks needs to be in some language to be automatically tangled, for -example ~#+BEGIN_SRC elisp~, but it doesn't matter what language is used. All -blocks are tangled to ~config.el~, but ~elisp~ gives correct syntax -highlighting. If you don't want to specify language in block you can also -enforce tangling by adding ~#+BEGIN_SRC :tangle yes~ - -** Change where src blocks are tangled or prevent it entirely -By default, this module tangles all src emacs-lisp blocks to config.el unless -otherwise specified. - -To specify otherwise use the =:tangle= parameter to: - -- Specify a destination other than config.el: ~:tangle packages.el~ -- Disable tangling of the block altogether with ~:tangle no~ -- Or force non-elisp src blocks to tangle somewhere - -For example: -#+BEGIN_SRC org -,#+BEGIN_SRC elisp :tangle no -(message "Don't tangle me") -,#+END_SRC - -,#+BEGIN_SRC elisp :tangle packages.el -(package! my-package) -(package! other-package) -,#+END_SRC - -,#+BEGIN_SRC sh :tangle ~/.dotfiles/bin/script.sh :tangle-mode (identity #o755) -#!/usr/bin/env bash -echo Hello world -,#+END_SRC - -,#+BEGIN_SRC sh :tangle ~/.dotfiles/bin/script.sh :shebang "#!/usr/bin/env bash" -echo Hello world -,#+END_SRC -#+END_SRC - -You'll find more information about babel src blocks and what parameters they -support [[https://orgmode.org/manual/Working-with-Source-Code.html][in the manual]]. - -* Troubleshooting -** How to tangle to =DOOMDIR/init.el= -If your literate needs are more complex (e.g. you want to make your init.el -literate), this module won't cut it. =init.el= is loaded long before -=config.org= is tangled in the ~doom sync~ process. - -However, Doom comes with a [[file:../../../bin/org-tangle][bin/org-tangle]] script which can be used to tangle -arbitrary org files from the command line. Use it to create your own compilation -workflows. This is /much/ faster than using ~org-babel-load-file~ directly to -load your literate config every time Doom is started. - -** How to disable tangle-on-save -There are occasions where tangling on save may be undesirable. Maybe it's too -slow, produces too much noise, or happens too often (on unrelated org files in -your =DOOMDIR=). This behavior can be disabled with: -#+BEGIN_SRC elisp -;; add to DOOMDIR/config.el -(remove-hook 'org-mode-hook #'+literate-enable-recompile-h) -#+END_SRC diff --git a/.config/emacs/modules/config/literate/autoload.el b/.config/emacs/modules/config/literate/autoload.el deleted file mode 100644 index 72a0043..0000000 --- a/.config/emacs/modules/config/literate/autoload.el +++ /dev/null @@ -1,75 +0,0 @@ -;;; config/literate/autoload.el -*- lexical-binding: t; -*- - -(defvar +literate-config-file - (concat doom-private-dir "config.org") - "The file path of your literate config file.") - -(defvar +literate-config-cache-file - (concat doom-cache-dir "literate-last-compile") - "The file path that `+literate-config-file' will be tangled to, then -byte-compiled from.") - -(defvar org-mode-hook) -(defvar org-inhibit-startup) - -;;;###autoload (add-hook 'org-mode-hook #'+literate-enable-recompile-h) - -;;;###autoload -(defun +literate-tangle-h () - "Tangles `+literate-config-file' if it has changed." - (and (not (getenv "__NOTANGLE")) - (require 'ox nil t) - (require 'ob-tangle nil t) - (letf! ((default-directory doom-private-dir) - (target +literate-config-file) - (cache +literate-config-cache-file) - (dest (expand-file-name (concat doom-module-config-file ".el"))) - ;; Ensure output conforms to the formatting of all doom CLIs - (defun message (msg &rest args) - (when msg - (print! (info "%s") (apply #'format msg args))))) - (print! (start "Compiling your literate config...")) - (print-group! - (let (;; Do as little unnecessary work as possible in these org files. - (org-startup-indented nil) - (org-startup-folded nil) - (vc-handled-backends nil) - ;; Prevent unwanted entries in recentf, or formatters, or - ;; anything that could be on these hooks, really. Nothing else - ;; should be touching these files (particularly in interactive - ;; sessions). - (write-file-functions nil) - (before-save-hook nil) - (after-save-hook nil) - ;; Prevent infinite recursion due to recompile-on-save hooks - ;; later, and speed up `org-mode' init. - (org-mode-hook nil) - (org-inhibit-startup t) - ;; Allow evaluation of src blocks at tangle-time (would abort - ;; them otherwise). This is a security hazard, but Doom will - ;; trust that you know what you're doing! - (org-confirm-babel-evaluate nil)) - (org-babel-tangle-file target dest)) - ;; Write an empty file to serve as our mtime cache - (with-temp-file cache) - (if doom-interactive-p t - (message "Restarting..." ) - (throw 'exit "__DOOMRESTART=1 __NOTANGLE=1 $@")))))) - -;;;###autoload -(defalias '+literate/reload #'doom/reload) - -;;;###autoload -(defun +literate-enable-recompile-h () - "Enable literate-compiling-on-save in the current buffer." - (add-hook 'after-save-hook #'+literate-recompile-maybe-h nil 'local)) - -;;;###autoload -(defun +literate-recompile-maybe-h () - "Recompile literate config to `doom-private-dir'. - -We assume any org file in `doom-private-dir' is connected to your literate -config, and should trigger a recompile if changed." - (and (file-in-directory-p - buffer-file-name (file-name-directory +literate-config-file)) - (+literate-tangle-h))) diff --git a/.config/emacs/modules/config/literate/cli.el b/.config/emacs/modules/config/literate/cli.el deleted file mode 100644 index c1ba44c..0000000 --- a/.config/emacs/modules/config/literate/cli.el +++ /dev/null @@ -1,6 +0,0 @@ -;;; config/literate/cli.el -*- lexical-binding: t; -*- - -(load! "autoload") - -;; Tangle the user's config.org before 'doom sync' runs -(add-hook 'doom-sync-pre-hook #'+literate-tangle-h) diff --git a/.config/emacs/modules/editor/evil/+commands.el b/.config/emacs/modules/editor/evil/+commands.el deleted file mode 100644 index 633da6a..0000000 --- a/.config/emacs/modules/editor/evil/+commands.el +++ /dev/null @@ -1,108 +0,0 @@ -;;; editor/evil/+commands.el -*- lexical-binding: t; -*- - -;; -;;; Custom commands -;; Editing -(evil-ex-define-cmd "@" #'+evil:macro-on-all-lines) ; TODO Test me -(evil-ex-define-cmd "R[ead]" #'+evil:read) -(evil-ex-define-cmd "al[ign]" #'+evil:align) -(evil-ex-define-cmd "ral[ign]" #'+evil:align-right) -(evil-ex-define-cmd "enhtml" #'+web:encode-html-entities) -(evil-ex-define-cmd "dehtml" #'+web:decode-html-entities) -(evil-ex-define-cmd "mc" #'+multiple-cursors:evil-mc) -(evil-ex-define-cmd "iedit" #'evil-multiedit-ex-match) -(evil-ex-define-cmd "na[rrow]" #'+evil:narrow-buffer) -(evil-ex-define-cmd "retab" #'+evil:retab) -(evil-ex-define-cmd "rev[erse]" #'+evil:reverse-lines) -(evil-ex-define-cmd "l[ine]diff" #'evil-quick-diff) - -;;; External resources -;; TODO (evil-ex-define-cmd "db" #'doom:db) -;; TODO (evil-ex-define-cmd "dbu[se]" #'doom:db-select) -;; TODO (evil-ex-define-cmd "go[ogle]" #'doom:google-search) -(evil-ex-define-cmd "lo[okup]" #'+lookup:online) -(evil-ex-define-cmd "dash" #'+lookup:dash) -(evil-ex-define-cmd "http" #'httpd-start) ; start http server -(evil-ex-define-cmd "repl" #'+eval:repl) ; invoke or send to repl -(evil-ex-define-cmd "h[elp]" #'+evil:help) - -;; TODO (evil-ex-define-cmd "rx" 'doom:regex) ; open re-builder -(evil-ex-define-cmd "sh[ell]" #'+eshell:run) -(evil-ex-define-cmd "pad" #'+evil:open-scratch-buffer) - -;;; GIT -(evil-ex-define-cmd "gist" #'+gist:send) ; send current buffer/region to gist -(evil-ex-define-cmd "gistl" #'+gist:list) ; list gists by user -(evil-ex-define-cmd "gbrowse" #'+vc/browse-at-remote) ; show file/region in github/gitlab -(evil-ex-define-cmd "gissues" #'forge-browse-issues) ; show github issues -(evil-ex-define-cmd "git" #'magit-status) ; open magit status window -(evil-ex-define-cmd "gstage" #'magit-stage) -(evil-ex-define-cmd "gunstage" #'magit-unstage) -(evil-ex-define-cmd "gblame" #'magit-blame) -(evil-ex-define-cmd "grevert" #'git-gutter:revert-hunk) - -;;; Dealing with buffers -(evil-ex-define-cmd "k[ill]" #'doom/kill-current-buffer) -(evil-ex-define-cmd "k[ill]all" #'+evil:kill-all-buffers) -(evil-ex-define-cmd "k[ill]m" #'+evil:kill-matching-buffers) -(evil-ex-define-cmd "k[ill]o" #'doom/kill-other-buffers) -(evil-ex-define-cmd "k[ill]b" #'doom/kill-buried-buffers) -(evil-ex-define-cmd "l[ast]" #'+popup/restore) -(evil-ex-define-cmd "messages" #'view-echo-area-messages) -(evil-ex-define-cmd "pop[up]" #'+popup/buffer) - -;;; Project navigation -(evil-ex-define-cmd "a" #'projectile-find-other-file) -(evil-ex-define-cmd "cd" #'+evil:cd) -(evil-ex-define-cmd "pwd" #'+evil:pwd) - -(evil-define-command +evil:swiper (&optional search) - "Invoke `swiper' with SEARCH, otherwise with the symbol at point." - (interactive "") - (swiper-isearch search)) -(evil-ex-define-cmd "sw[iper]" #'+evil:swiper) - -(cond ((featurep! :completion ivy) - (evil-ex-define-cmd "pg[rep]" #'+ivy:project-search) - (evil-ex-define-cmd "pg[grep]d" #'+ivy:project-search-from-cwd)) - - ((featurep! :completion helm) - (evil-ex-define-cmd "pg[rep]" #'+helm:project-search) - (evil-ex-define-cmd "pg[grep]d" #'+helm:project-search-from-cwd)) - ((featurep! :completion vertico) - (evil-ex-define-cmd "pg[rep]" #'+vertico:project-search) - (evil-ex-define-cmd "pg[grep]d" #'+vertico:project-search-from-cwd))) - -;;; Project tools -(evil-ex-define-cmd "com[pile]" #'+evil:compile) -(evil-ex-define-cmd "make" #'+evil:make) -(evil-ex-define-cmd "mk" #'+evil:make) ; convenience alias -(evil-ex-define-cmd "debug" #'+debugger/start) -(evil-ex-define-cmd "er[rors]" #'+default/diagnostics) - -;;; File operations -(evil-ex-define-cmd "cp" #'+evil:copy-this-file) -(evil-ex-define-cmd "mv" #'+evil:move-this-file) -(evil-ex-define-cmd "rm" #'+evil:delete-this-file) - -;;; Sessions/tabs -(evil-ex-define-cmd "sclear" #'+workspace/kill-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) -(evil-ex-define-cmd "tabload" #'+workspace:load) -(evil-ex-define-cmd "tabn[ew]" #'+workspace:new) -(evil-ex-define-cmd "tabnext" #'+workspace:switch-next) -(evil-ex-define-cmd "tabprev" #'+workspace:switch-previous) -(evil-ex-define-cmd "tabr[ename]" #'+workspace:rename) -(evil-ex-define-cmd "tabs" #'+workspace/display) -(evil-ex-define-cmd "tabsave" #'+workspace:save) - -;;; Org-mode -(evil-ex-define-cmd "cap[ture]" #'org-capture) - -;;; ibuffer -(when (featurep! :emacs ibuffer) - (evil-ex-define-cmd "buffers" #'ibuffer)) diff --git a/.config/emacs/modules/editor/evil/README.org b/.config/emacs/modules/editor/evil/README.org deleted file mode 100644 index 4247028..0000000 --- a/.config/emacs/modules/editor/evil/README.org +++ /dev/null @@ -1,200 +0,0 @@ -#+TITLE: editor/evil -#+DATE: February 2, 2017 -#+SINCE: v2.0 -#+STARTUP: inlineimages nofold - -* 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]] -- [[#configuration][Configuration]] - - [[#removing-evil-mode][Removing evil-mode]] - - [[#restoring-old-substitution-behavior-on-ss][Restoring old substitution behavior on s/S]] - - [[#restoring-old-y-behavior-yank-the-whole-line][Restoring old Y behavior (yank the whole line)]] - - [[#disabling-cursor-movement-when-exiting-insert-mode][Disabling cursor movement when exiting insert mode]] - -* Description -This holy module brings the vim experience to Emacs. - -** Module Flags -+ =+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]] -+ [[https://github.com/wcsmith/evil-args][evil-args]] -+ [[https://github.com/PythonNut/evil-easymotion][evil-easymotion]] -+ [[https://github.com/cute-jumper/evil-embrace.el][evil-embrace]] -+ [[https://github.com/syl20bnr/evil-escape][evil-escape]] -+ [[https://github.com/Dewdrops/evil-exchange][evil-exchange]] -+ [[https://github.com/TheBB/evil-indent-plus][evil-indent-plus]] -+ [[https://github.com/edkolev/evil-lion][evil-lion]] -+ [[https://github.com/redguardtoo/evil-nerd-commenter][evil-nerd-commentary]] -+ [[https://github.com/cofi/evil-numbers][evil-numbers]] -+ [[https://github.com/noctuid/evil-textobj-anyblock][evil-textobj-anyblock]] -+ [[https://github.com/hlissner/evil-snipe][evil-snipe]] -+ [[https://github.com/emacs-evil/evil-surround][evil-surround]] -+ [[https://github.com/alexmurray/evil-vimish-fold][evil-vimish-fold]] -+ [[https://github.com/bling/evil-visualstar][evil-visualstar]] -+ [[https://github.com/ninrod/exato][exato]] -+ [[https://github.com/emacs-evil/evil-collection][evil-collection]]* -+ [[https://www.github.com/rgrinberg/evil-quick-diff][evil-quick-diff]] - -** Hacks -+ The o/O keys will respect and continue commented lines (can be disabled by - setting ~+evil-want-o/O-to-continue-comments~ to ~nil~). -+ 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. -+ 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 - project root (throws an error if not in a project). - -* Prerequisites -This module has no external prerequisites. - -* Features -** Ported vim plugins -The following vim plugins have been ported to evil: - -| Vim Plugin | Emacs Plugin | Keybind(s) | -|-----------------------+--------------------------------+--------------------------------------------| -| vim-commentary | evil-nerd-commenter | omap =gc= | -| vim-easymotion | evil-easymotion | omap =gs= | -| vim-lion | evil-lion | omap =gl= / =gL= | -| 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= | -| vim-unimpaired | (provided by Doom) | [[https://github.com/hlissner/doom-emacs/blob/develop/modules/editor/evil/config.el#L413-L460][see the list]] | - -This module has also ported vim-unimpaired keybinds to Emacs. - -In other modules: -+ 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 -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: - -+ =a= C-style function arguments (provided by ~evil-args~) -+ =B= any block delimited by braces, parentheses or brackets (provided by - ~evil-textobj-anyblock~) -+ =c= Comments -+ =f= For functions (but relies on the major mode to have sane definitions for - ~beginning-of-defun-function~ and ~end-of-defun-function~) -+ =g= The entire buffer -+ =i j k= by indentation (=k= includes one line above; =j= includes one line - above and below) (provided by ~evil-indent-plus~) -+ =q= For quotes (any kind) -+ =u= For URLs -+ =x= XML attributes (provided by ~exato~) - -** Custom Ex Commands -| Ex Command | Description | -|-----------------------+--------------------------------------------------------------------------------------| -| ~:@~ | Apply macro on selected lines | -| ~: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 | -| ~: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 | -| ~:ral[ign][!] REGEXP~ | Right-Align text that matches REGEXP. If BANG, align all matches on each line | -| ~: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 | -| ~: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 =:editor evil= from =~/.doom.d/init.el=, -2. Run ~doom sync~ to clean up lingering dependencies and regenerate your - autoloads files. -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 - -Evil-specific configuration and keybindings (defined with ~map!~) will be -ignored without =:editor evil= present (and omitted when byte-compiling). - -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 ~(remove-hook 'doom-first-input-hook - #'evil-snipe-mode)~ 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. -3. Or use =cl= and =cc=, respectively; they do the same thing. -** Restoring old Y behavior (yank the whole line) -Doom changes the behavior of the =Y= key in normal mode to yank-to-EOL -(equivalent to =y$=). This was to make it consistent with the =C= and =D= -capital operators, and because it was redundant with =yy=, which is easier to -type than =y$=. - -If you prefer the old behavior, it can be reversed with: - -#+BEGIN_SRC elisp -;; add to ~/.doom.d/config.el -(setq! evil-want-Y-yank-to-eol nil) -#+END_SRC -** Disabling cursor movement when exiting insert mode -Vim (and evil) move the cursor one character back when exiting insert mode. If -you prefer that it didn't, set: - -#+BEGIN_SRC elisp -;; add to ~/.doom.d/config.el -(setq evil-move-cursor-back nil) -#+END_SRC diff --git a/.config/emacs/modules/editor/evil/autoload/advice.el b/.config/emacs/modules/editor/evil/autoload/advice.el deleted file mode 100644 index 3c4769f..0000000 --- a/.config/emacs/modules/editor/evil/autoload/advice.el +++ /dev/null @@ -1,233 +0,0 @@ -;;; editor/evil/autoload/advice.el -*- lexical-binding: t; -*- - -;;;###autoload -(defun +evil-escape-a (&rest _) - "Call `doom/escape' if `evil-force-normal-state' is called interactively." - (when (called-interactively-p 'any) - (call-interactively #'doom/escape))) - -;;;###autoload -(defun +evil-replace-filename-modifiers-a (file-name) - "Take a path and resolve any vim-like filename modifiers in it. This adds -support for most vim file modifiers, as well as: - - %:P Resolves to `doom-project-root'. - -See http://vimdoc.sourceforge.net/htmldoc/cmdline.html#filename-modifiers for -more information on modifiers." - (let ((origin-buffer (current-buffer)) - case-fold-search) - (with-temp-buffer - (let ((buffer-file-name (buffer-file-name origin-buffer))) - (save-excursion (insert file-name)) - (while (re-search-forward "\\(^\\|[^\\\\]\\)\\(\\([%#]\\)\\(:\\([PphtreS~.]\\|g?s\\)\\)*\\)" nil t) - (if (null buffer-file-name) - (replace-match (match-string 1) t t nil 2) - (let ((beg (match-beginning 2)) - (end (match-end 3)) - (path (pcase (match-string 3) - ("%" (file-relative-name buffer-file-name default-directory)) - ("#" (and (other-buffer origin-buffer) - (buffer-file-name (other-buffer origin-buffer))))))) - (save-match-data - (goto-char beg) - (while (re-search-forward ":\\([PphtreS~.]\\|g?s\\)" (+ (point) 3) t) - (let* ((modifier (match-string 1)) - (global (string-prefix-p "gs" modifier))) - (when global - (setq modifier (substring modifier 1))) - (setq end (match-end 1) - path - (pcase (and path (substring modifier 0 1)) - (`nil "") - ("p" (expand-file-name path)) - ("~" (concat "~/" (file-relative-name path "~"))) - ("." (file-relative-name path)) - ("t" (file-name-nondirectory (directory-file-name path))) - ("r" (file-name-sans-extension path)) - ("e" (file-name-extension path)) - ("S" (shell-quote-argument path)) - ("h" - (let ((parent (file-name-directory (expand-file-name path)))) - (unless (file-equal-p path parent) - (if (file-name-absolute-p path) - (directory-file-name parent) - (file-relative-name parent))))) - ("s" - (if (featurep 'evil) - (when-let (args (evil-delimited-arguments (substring modifier 1) 2)) - (let ((pattern (evil-transform-vim-style-regexp (car args))) - (replace (cadr args))) - (replace-regexp-in-string - (if global pattern (concat "\\(" pattern "\\).*\\'")) - (evil-transform-vim-style-regexp replace) path t t - (unless global 1)))) - path)) - ("P" - (let ((project-root (doom-project-root (file-name-directory (expand-file-name path))))) - (unless project-root - (user-error "Not in a project")) - (abbreviate-file-name project-root))))) - ;; strip trailing slash, if applicable - (or (string-empty-p path) - (not (equal (substring path -1) "/")) - (setq path (substring path 0 -1)))))) - (replace-match path t t nil 2)))) - (replace-regexp-in-string "\\\\\\([#%]\\)" "\\1" (buffer-string) t))))) - -(defun +evil--insert-newline (&optional above _noextranewline) - (let ((pos (save-excursion (beginning-of-line-text) (point))) - comment-auto-fill-only-comments) - (require 'smartparens) - (evil-narrow-to-field - (if above - (if (save-excursion (nth 4 (sp--syntax-ppss pos))) - (evil-save-goal-column - (setq evil-auto-indent nil) - (goto-char pos) - (let ((ws (abs (skip-chars-backward " \t")))) - ;; FIXME oh god why - (save-excursion - (if comment-line-break-function - (funcall comment-line-break-function nil) - (comment-indent-new-line)) - (when (and (derived-mode-p 'c-mode 'c++-mode 'objc-mode 'java-mode 'js2-mode) - (eq (char-after) ?/)) - (insert "*")) - (insert - (make-string (max 0 (+ ws (skip-chars-backward " \t"))) - 32))) - (insert (make-string (max 1 ws) 32)))) - (evil-move-beginning-of-line) - (insert (if use-hard-newlines hard-newline "\n")) - (forward-line -1) - (back-to-indentation)) - (evil-move-end-of-line) - (cond ((sp-point-in-comment pos) - (setq evil-auto-indent nil) - (if comment-line-break-function - (funcall comment-line-break-function nil) - (comment-indent-new-line))) - ;; TODO Find a better way to do this - ((and (eq major-mode 'haskell-mode) - (fboundp 'haskell-indentation-newline-and-indent)) - (setq evil-auto-indent nil) - (haskell-indentation-newline-and-indent)) - (t - (insert (if use-hard-newlines hard-newline "\n")) - (back-to-indentation))))))) - -;;;###autoload -(defun +evil--insert-newline-below-and-respect-comments-a (fn count) - (if (or (not +evil-want-o/O-to-continue-comments) - (not (eq this-command 'evil-open-below)) - (evil-insert-state-p) - (evil-emacs-state-p)) - (funcall fn count) - (letf! (defun evil-insert-newline-below () (+evil--insert-newline)) - (let ((evil-auto-indent evil-auto-indent)) - (funcall fn count))))) - -;;;###autoload -(defun +evil--insert-newline-above-and-respect-comments-a (fn count) - (if (or (not +evil-want-o/O-to-continue-comments) - (not (eq this-command 'evil-open-above)) - (evil-insert-state-p) - (evil-emacs-state-p)) - (funcall fn count) - (letf! (defun evil-insert-newline-above () (+evil--insert-newline 'above)) - (let ((evil-auto-indent evil-auto-indent)) - (funcall fn count))))) - -;;;###autoload (autoload '+evil-window-split-a "editor/evil/autoload/advice" nil t) -(evil-define-command +evil-window-split-a (&optional count file) - "Same as `evil-window-split', but correctly updates the window history." - :repeat nil - (interactive "P") - ;; HACK This ping-ponging between the destination and source windows is to - ;; update the window focus history, so that, if you close either split - ;; afterwards you won't be sent to some random window. - (let ((origwin (selected-window)) - window-selection-change-functions) - (select-window (split-window origwin count 'below)) - (unless evil-split-window-below - (select-window origwin))) - (run-hooks 'window-selection-change-functions) - (recenter) - (when (and (not count) evil-auto-balance-windows) - (balance-windows (window-parent))) - (if file (evil-edit file))) - -;;;###autoload (autoload '+evil-window-vsplit-a "editor/evil/autoload/advice" nil t) -(evil-define-command +evil-window-vsplit-a (&optional count file) - "Same as `evil-window-split', but correctly updates the window history." - :repeat nil - (interactive "P") - ;; HACK This ping-ponging between the destination and source windows is to - ;; update the window focus history, so that, if you close either split - ;; afterwards you won't be sent to some random window. - (let ((origwin (selected-window)) - window-selection-change-functions) - (select-window (split-window origwin count 'right)) - (unless evil-vsplit-window-right - (select-window origwin))) - (run-hooks 'window-selection-change-functions) - (recenter) - (when (and (not count) evil-auto-balance-windows) - (balance-windows (window-parent))) - (if file (evil-edit file))) - -;;;###autoload (autoload '+evil-join-a "editor/evil/autoload/advice" nil nil) -(defun +evil-join-a (fn beg end) - "Join the selected lines. - -This advice improves on `evil-join' by removing comment delimiters when joining -commented lines, without `fill-region-as-paragraph'. - -Adapted from https://github.com/emacs-evil/evil/issues/606" - (if-let* (((not (= (line-end-position) (point-max)))) - (cend (save-excursion (goto-char end) (line-end-position))) - (cbeg (save-excursion - (goto-char beg) - (and (doom-point-in-comment-p - (save-excursion - (goto-char (line-beginning-position 2)) - (skip-syntax-forward " \t") - (point))) - (or (comment-search-backward (line-beginning-position) t) - (comment-search-forward (line-end-position) t) - (and (doom-point-in-comment-p beg) - (stringp comment-continue) - (or (search-forward comment-continue (line-end-position) t) - beg))))))) - (let* ((count (count-lines beg end)) - (count (if (> count 1) (1- count) count)) - (fixup-mark (make-marker))) - (uncomment-region (line-beginning-position 2) - (save-excursion - (goto-char cend) - (line-end-position 0))) - (unwind-protect - (dotimes (_ count) - (join-line 1) - (save-match-data - (when (or (and comment-continue - (not (string-empty-p comment-continue)) - (looking-at (concat "\\(\\s-*" (regexp-quote comment-continue) "\\) "))) - (and comment-start-skip - (not (string-empty-p comment-start-skip)) - (looking-at (concat "\\(\\s-*" comment-start-skip "\\)")))) - (replace-match "" t nil nil 1) - (just-one-space)))) - (set-marker fixup-mark nil))) - ;; But revert to the default we're not in a comment, where - ;; `fill-region-as-paragraph' is too greedy. - (funcall fn beg end))) - -;;;###autoload -(defun +evil--fix-dabbrev-in-minibuffer-h () - "Make `try-expand-dabbrev' from `hippie-expand' work in minibuffer. See -`he-dabbrev-beg', so we need to redefine syntax for '/'." - (set-syntax-table (let* ((table (make-syntax-table))) - (modify-syntax-entry ?/ "." table) - table))) diff --git a/.config/emacs/modules/editor/evil/autoload/embrace.el b/.config/emacs/modules/editor/evil/autoload/embrace.el deleted file mode 100644 index 6090112..0000000 --- a/.config/emacs/modules/editor/evil/autoload/embrace.el +++ /dev/null @@ -1,40 +0,0 @@ -;;; editor/evil/autoload/embrace.el -*- lexical-binding: t; -*- - -;;;###autoload -(defun +evil--embrace-get-pair (char) - (if-let* ((pair (cdr-safe (assoc (string-to-char char) evil-surround-pairs-alist)))) - pair - (if-let* ((pair (assoc-default char embrace--pairs-list))) - (if-let* ((real-pair (and (functionp (embrace-pair-struct-read-function pair)) - (funcall (embrace-pair-struct-read-function pair))))) - real-pair - (cons (embrace-pair-struct-left pair) (embrace-pair-struct-right pair))) - (cons char char)))) - -;;;###autoload -(defun +evil--embrace-escaped () - "Backslash-escaped surround character support for embrace." - (let ((char (read-char "\\"))) - (if (eq char 27) - (cons "" "") - (let* ((pair (+evil--embrace-get-pair (string char))) - (escape (if (sp-point-in-string) "\\\\" "\\")) - (escape (format "\\1%s" (regexp-quote escape)))) - (cons (replace-regexp-in-string "^\\( *\\)" escape (car pair)) - (replace-regexp-in-string "^\\( *\\)" escape (cdr pair))))))) - -;;;###autoload -(defun +evil--embrace-latex () - "LaTeX command support for embrace." - (cons (format "\\%s{" (read-string "\\")) "}")) - -;;;###autoload -(defun +evil--embrace-elisp-fn () - "Elisp function support for embrace." - (cons (format "(%s " (or (read-string "(") "")) ")")) - -;;;###autoload -(defun +evil--embrace-angle-brackets () - "Type/generic angle brackets." - (cons (format "%s<" (or (read-string "") "")) - ">")) diff --git a/.config/emacs/modules/editor/evil/autoload/evil.el b/.config/emacs/modules/editor/evil/autoload/evil.el deleted file mode 100644 index e44f712..0000000 --- a/.config/emacs/modules/editor/evil/autoload/evil.el +++ /dev/null @@ -1,188 +0,0 @@ -;; editor/evil/autoload/evil.el -*- lexical-binding: t; -*- - -;;;###autodef -(defun set-evil-initial-state! (modes state) - "Set the initialize STATE of MODES using `evil-set-initial-state'." - (declare (indent defun)) - (after! evil - (if (listp modes) - (dolist (mode (doom-enlist modes)) - (evil-set-initial-state mode state)) - (evil-set-initial-state modes state)))) - - -;; -;;; Interactive commands - -;;;###autoload -(defun +evil/shift-right () - "vnoremap < >gv" - (interactive) - (call-interactively #'evil-shift-left) - (evil-normal-state) - (evil-visual-restore)) - -;;;###autoload -(defun +evil/alt-paste () - "Call `evil-paste-after' but invert `evil-kill-on-visual-paste'. -By default, this replaces the selection with what's in the clipboard without -replacing its contents." - (interactive) - (let ((evil-kill-on-visual-paste (not evil-kill-on-visual-paste))) - (call-interactively #'evil-paste-after))) - -(defun +evil--window-swap (direction) - "Move current window to the next window in DIRECTION. -If there are no windows there and there is only one window, split in that -direction and place this window there. If there are no windows and this isn't -the only window, use evil-window-move-* (e.g. `evil-window-move-far-left')." - (when (window-dedicated-p) - (user-error "Cannot swap a dedicated window")) - (let* ((this-window (selected-window)) - (this-buffer (current-buffer)) - (that-window (windmove-find-other-window direction nil this-window)) - (that-buffer (window-buffer that-window))) - (when (or (minibufferp that-buffer) - (window-dedicated-p this-window)) - (setq that-buffer nil that-window nil)) - (if (not (or that-window (one-window-p t))) - (funcall (pcase direction - ('left #'evil-window-move-far-left) - ('right #'evil-window-move-far-right) - ('up #'evil-window-move-very-top) - ('down #'evil-window-move-very-bottom))) - (unless that-window - (setq that-window - (split-window this-window nil - (pcase direction - ('up 'above) - ('down 'below) - (_ direction)))) - (with-selected-window that-window - (switch-to-buffer (doom-fallback-buffer))) - (setq that-buffer (window-buffer that-window))) - (with-selected-window this-window - (switch-to-buffer that-buffer)) - (with-selected-window that-window - (switch-to-buffer this-buffer)) - (select-window that-window)))) - -;;;###autoload -(defun +evil/window-move-left () - "Swap windows to the left." - (interactive) (+evil--window-swap 'left)) -;;;###autoload -(defun +evil/window-move-right () - "Swap windows to the right" - (interactive) (+evil--window-swap 'right)) -;;;###autoload -(defun +evil/window-move-up () - "Swap windows upward." - (interactive) (+evil--window-swap 'up)) -;;;###autoload -(defun +evil/window-move-down () - "Swap windows downward." - (interactive) (+evil--window-swap 'down)) - -;;;###autoload -(defun +evil/window-split-and-follow () - "Split current window horizontally, then focus new window. -If `evil-split-window-below' is non-nil, the new window isn't focused." - (interactive) - (let ((evil-split-window-below (not evil-split-window-below))) - (call-interactively #'evil-window-split))) - -;;;###autoload -(defun +evil/window-vsplit-and-follow () - "Split current window vertically, then focus new window. -If `evil-vsplit-window-right' is non-nil, the new window isn't focused." - (interactive) - (let ((evil-vsplit-window-right (not evil-vsplit-window-right))) - (call-interactively #'evil-window-vsplit))) - -;;;###autoload (autoload '+evil:apply-macro "editor/evil/autoload/evil" nil t) -(evil-define-operator +evil:apply-macro (beg end) - "Apply macro to each line." - :move-point nil - (interactive "") - (let ((register (or evil-this-register (read-char))) - macro) - (cond ((or (and (eq register ?@) (eq evil-last-register ?:)) - (eq register ?:)) - (setq macro (lambda () (evil-ex-repeat nil)) - evil-last-register ?:)) - ((eq register ?@) - (unless evil-last-register - (user-error "No previously executed keyboard macro.")) - (setq macro (evil-get-register evil-last-register t))) - ((setq macro (evil-get-register register t) - evil-last-register register))) - (unless macro - (user-error "No macro recorded in %c register" register)) - (evil-change-state 'normal) - (evil-with-single-undo - (let ((lines (count-lines beg end))) - (message "Applied macro in %c register %d times" register lines) - (apply-macro-to-region-lines beg end macro) - (message "Applied macro in %c register %d times...DONE" register lines))))) - -;;;###autoload (autoload '+evil:retab "editor/evil/autoload/evil" nil t) -(evil-define-operator +evil:retab (&optional beg end) - "Wrapper around `doom/retab'." - :motion nil :move-point nil :type line - (interactive "") - (doom/retab nil beg end)) - -;;;###autoload (autoload '+evil:narrow-buffer "editor/evil/autoload/evil" nil t) -(evil-define-operator +evil:narrow-buffer (beg end &optional bang) - "Narrow the buffer to region between BEG and END. - -Widens narrowed buffers first. If BANG, use indirect buffer clones instead." - :move-point nil - (interactive "") - (if (not bang) - (if (buffer-narrowed-p) - (widen) - (narrow-to-region beg end)) - (when (buffer-narrowed-p) - (doom/widen-indirectly-narrowed-buffer t)) - (doom/narrow-buffer-indirectly beg end))) - -;;;###autoload (autoload '+evil:yank-unindented "editor/evil/autoload/evil" nil t) -(evil-define-operator +evil:yank-unindented (beg end _type _register _yank-handler) - "Saves the (reindented) characters in motion into the kill-ring." - :move-point nil - :repeat nil - (interactive "") - (let ((indent (save-excursion (goto-char beg) (current-indentation))) - (text (buffer-substring beg end))) - (with-temp-buffer - (insert text) - (indent-rigidly (point-min) (point-max) (- indent)) - (evil-yank (point-min) (point-max))))) - - -;; -;;; wgrep - -;;;###autoload (autoload '+evil-delete "editor/evil/autoload/evil" nil t) -(evil-define-operator +evil-delete (beg end type register yank-handler) - "A wrapper around `evil-delete' for `wgrep' buffers that will invoke -`wgrep-mark-deletion' on lines you try to delete." - (interactive "") - (condition-case _ex - (evil-delete beg end type register yank-handler) - ('text-read-only - (evil-apply-on-block - (lambda (beg _) - (goto-char beg) - (call-interactively #'wgrep-mark-deletion)) - beg (1- end) nil)))) diff --git a/.config/emacs/modules/editor/evil/autoload/ex.el b/.config/emacs/modules/editor/evil/autoload/ex.el deleted file mode 100644 index bdcb5d6..0000000 --- a/.config/emacs/modules/editor/evil/autoload/ex.el +++ /dev/null @@ -1,192 +0,0 @@ -;;; editor/evil/autoload/ex.el -*- lexical-binding: t; -*- - -(defvar +evil--flag nil) - -(defun +evil--ex-match-init (name &optional face update-hook) - (with-current-buffer evil-ex-current-buffer - (cond - ((eq +evil--flag 'start) - (evil-ex-make-hl name - :face (or face 'evil-ex-lazy-highlight) - :update-hook (or update-hook #'evil-ex-pattern-update-ex-info)) - (setq +evil--flag 'update)) - - ((eq +evil--flag 'stop) - (evil-ex-delete-hl name))))) - -(defun +evil--ex-buffer-match (arg &optional hl-name flags beg end) - (when (and (eq +evil--flag 'update) - evil-ex-substitute-highlight-all - (not (zerop (length arg)))) - (condition-case lossage - (let* ((pattern (evil-ex-make-substitute-pattern - arg - (or flags (list)))) - (range (or (evil-copy-range evil-ex-range) - (evil-range (or beg (line-beginning-position)) - (or end (line-end-position)) - 'line - :expanded t)))) - (evil-expand-range range) - (evil-ex-hl-set-region hl-name - (max (evil-range-beginning range) (window-start)) - (min (evil-range-end range) (window-end))) - (evil-ex-hl-change hl-name pattern)) - (end-of-file - (evil-ex-pattern-update-ex-info nil "incomplete replacement")) - (user-error - (evil-ex-pattern-update-ex-info nil (format "?%s" lossage)))))) - -;;;###autoload -(defun +evil-ex-regexp-match (flag &optional arg invert) - (let ((hl-name 'evil-ex-buffer-match) - (+evil--flag flag)) - (with-selected-window (minibuffer-selected-window) - (+evil--ex-match-init hl-name) - (cl-destructuring-bind (&optional arg flags) - (evil-delimited-arguments arg 2) - (let ((evil-ex-substitute-global - (if invert - (not evil-ex-substitute-global) - evil-ex-substitute-global))) - (+evil--ex-buffer-match - arg hl-name (string-to-list flags))))))) - - -;; -;;; Ex Commands - -;;;###autoload (autoload '+evil:align "editor/evil/autoload/ex" nil t) -(evil-define-command +evil:align (beg end pattern &optional flags) - "Ex interface to `align-regexp'. - -PATTERN is a vim-style regexp. FLAGS is an optional string of characters. -Supports the following flags: - -g Repeat alignment on all matches in each line" - (interactive "") - (align-regexp - beg end - (concat "\\(\\s-*\\)" (evil-transform-vim-style-regexp pattern)) - 1 1 (memq ?g flags))) - -;;;###autoload (autoload '+evil:align-right "editor/evil/autoload/ex" nil t) -(evil-define-command +evil:align-right (beg end pattern &optional flags) - "Ex interface to `align-regexp' that right-aligns matches. - -PATTERN is a vim-style regexp. FLAGS is an optional string of characters. -Supports the following flags: - -g Repeat alignment on all matches in each line" - (interactive "") - (align-regexp - beg end - (concat "\\(" (evil-transform-vim-style-regexp pattern) "\\)") - -1 1 (memq ?g flags))) - -;; ;;;###autoload (autoload '+evil:sort "editor/evil/autoload/ex" nil nil) -;; (evil-define-command +evil:sort (beg end &optional pattern flags reverse) -;; (interactive "")) - -;;;###autoload (autoload '+evil:open-scratch-buffer "editor/evil/autoload/ex" nil t) -(evil-define-operator +evil:open-scratch-buffer (bang) - (interactive "") - (doom/open-scratch-buffer bang)) - -;;;###autoload (autoload '+evil:pwd "editor/evil/autoload/ex" nil t) -(evil-define-command +evil:pwd (bang) - "Display the current working directory. If BANG, copy it to your clipboard." - (interactive "") - (if (not bang) - (pwd) - (kill-new default-directory) - (message "Copied to clipboard"))) - -;;;###autoload (autoload '+evil:make "editor/evil/autoload/ex" nil t) -(evil-define-command +evil:make (arguments &optional bang) - "Run make with ARGUMENTS. -If BANG is non-nil, open compilation output in a comint buffer. - -If BANG, then run ARGUMENTS as a full command. This command understands vim file -modifiers (like %:p:h). See `+evil-replace-filename-modifiers-a' for details." - (interactive "") - (let ((compile-command "make")) - (+evil:compile (if (stringp arguments) - (evil-ex-replace-special-filenames arguments) - "") - bang))) - -;;;###autoload (autoload '+evil:compile "editor/evil/autoload/ex" nil t) -(evil-define-command +evil:compile (arguments &optional bang) - "Run `compile-command' with ARGUMENTS. -If BANG is non-nil, open compilation output in a comint buffer. - -This command understands vim file modifiers (like %:p:h). See -`+evil-replace-filename-modifiers-a' for details." - (interactive "") - (compile (evil-ex-replace-special-filenames - (format "%s %s" - (eval compile-command) - arguments)) - bang)) - -;;;###autoload (autoload '+evil:reverse-lines "editor/evil/autoload/ex" nil t) -(evil-define-command +evil:reverse-lines (beg end) - "Reverse lines between BEG and END." - (interactive "") - (reverse-region beg end)) - -;;;###autoload (autoload '+evil:cd "editor/evil/autoload/ex" nil t) -(evil-define-command +evil:cd (&optional path) - "Change `default-directory' with `cd'." - (interactive "") - (let ((path (or path "~"))) - (cd path) - (message "Changed directory to '%s'" (abbreviate-file-name (expand-file-name path))))) - -;;;###autoload (autoload '+evil:kill-all-buffers "editor/evil/autoload/ex" nil t) -(evil-define-command +evil:kill-all-buffers (&optional bang) - "Kill all buffers. If BANG, kill current session too." - (interactive "") - (if (and bang (fboundp '+workspace/kill-session)) - (+workspace/kill-session) - (call-interactively #'doom/kill-all-buffers))) - -;;;###autoload (autoload '+evil:kill-matching-buffers "editor/evil/autoload/ex" nil t) -(evil-define-command +evil:kill-matching-buffers (&optional bang pattern) - "Kill all buffers matching PATTERN regexp. If BANG, only match project -buffers." - (interactive "") - (doom/kill-matching-buffers - pattern (if bang (doom-project-buffer-list)))) - -;;;###autoload (autoload '+evil:help "editor/evil/autoload/ex" nil t) -(evil-define-command +evil:help (&optional bang query) - "Look up documentation for QUERY. - -If QUERY is in the format of an ex command, it will map it to the underlying -function and open its documentation with `helpful-function'. Otherwise, it will -search for it with `apropos'. - -If QUERY is empty, this runs the equivalent of 'M-x apropos'. If BANG is -non-nil, a search is preformed against Doom's manual (with -`doom/help-search-headings')." - (interactive "") - (if bang - (doom/help-search-headings query) - (save-match-data - (cond ((or (null query) (string-empty-p (string-trim query))) - (call-interactively - (or (command-remapping #'apropos) - #'apropos))) - ((string-match "^ *:\\([^ ]+\\)$" query) - (helpful-function - (evil-ex-completed-binding (match-string 1 query)))) - ((message "Searching for %S, this may take a while..." query) - (apropos query t)))))) - -;;;###autoload (autoload '+evil:read "editor/evil/autoload/ex" nil t) -(evil-define-command +evil:read (count file) - "Alternative version of `evil-read' that replaces filename modifiers in FILE." - (interactive "P") - (evil-read count (evil-ex-replace-special-filenames file))) diff --git a/.config/emacs/modules/editor/evil/autoload/files.el b/.config/emacs/modules/editor/evil/autoload/files.el deleted file mode 100644 index 93de229..0000000 --- a/.config/emacs/modules/editor/evil/autoload/files.el +++ /dev/null @@ -1,31 +0,0 @@ -;;; editor/evil/autoload/files.el -*- lexical-binding: t; -*- - -;;;###autoload (autoload '+evil:delete-this-file "editor/evil/autoload/files" nil t) -(evil-define-command +evil:delete-this-file (&optional filename force-p) - "Delete FILENAME (defaults to the file associated with current buffer) and -kills the buffer. If FORCE-P, force the deletion (don't ask for confirmation)." - :repeat nil - (interactive "") - (doom/delete-this-file filename force-p)) - -;;;###autoload (autoload '+evil:move-this-file "editor/evil/autoload/files" nil t) -(evil-define-command +evil:move-this-file (new-path &optional force-p) - "Move current buffer's file to NEW-PATH. Replaces %, # and other vim-esque -filename modifiers (see `+evil*ex-replace-special-filenames'). If FORCE-P, -overwrite the destination file if it exists, without confirmation." - :repeat nil - (interactive "") - (when (or (not new-path) (string-empty-p new-path)) - (user-error "No new path was specified")) - (doom/move-this-file new-path force-p)) - -;;;###autoload (autoload '+evil:copy-this-file "editor/evil/autoload/files" nil t) -(evil-define-command +evil:copy-this-file (new-path &optional force-p) - "Copy current buffer's file to NEW-PATH. Replaces %, # and other vim-esque -filename modifiers (see `+evil*ex-replace-special-filenames'). If FORCE-P, -overwrite the destination file if it exists, without confirmation." - :repeat nil - (interactive "") - (when (or (not new-path) (string-empty-p new-path)) - (user-error "No new path was specified")) - (doom/copy-this-file new-path force-p)) diff --git a/.config/emacs/modules/editor/evil/autoload/textobjects.el b/.config/emacs/modules/editor/evil/autoload/textobjects.el deleted file mode 100644 index 5237c57..0000000 --- a/.config/emacs/modules/editor/evil/autoload/textobjects.el +++ /dev/null @@ -1,68 +0,0 @@ -;;; editor/evil/autoload/textobjects.el -*- lexical-binding: t; -*- - -;;;###autoload (autoload '+evil:whole-buffer-txtobj "editor/evil/autoload/textobjects" nil nil) -(evil-define-text-object +evil:whole-buffer-txtobj (count &optional _beg _end type) - "Text object to select the whole buffer." - (evil-range (point-min) (point-max) type)) - -;;;###autoload (autoload '+evil:defun-txtobj "editor/evil/autoload/textobjects" nil nil) -(evil-define-text-object +evil:defun-txtobj (count &optional _beg _end type) - "Text object to select the top-level Lisp form or function definition at -point." - (cl-destructuring-bind (beg . end) - (bounds-of-thing-at-point 'defun) - (evil-range beg end type))) - -;;;###autoload (autoload '+evil:inner-url-txtobj "editor/evil/autoload/textobjects" nil nil) -(evil-define-text-object +evil:inner-url-txtobj (count &optional _beg _end type) - "Text object to select the inner url at point. - -This excludes the protocol and querystring." - (cl-destructuring-bind (beg . end) - (bounds-of-thing-at-point 'url) - (evil-range - (save-excursion - (goto-char beg) - (re-search-forward "://" end t)) - (save-excursion - (goto-char end) - (- (if-let (pos (re-search-backward "[?#]" beg t)) - pos - end) - (if (evil-visual-state-p) - 1 - 0))) - type))) - -;;;###autoload (autoload '+evil:outer-url-txtobj "editor/evil/autoload/textobjects" nil nil) -(evil-define-text-object +evil:outer-url-txtobj (count &optional _beg _end type) - "Text object to select the whole url at point." - (cl-destructuring-bind (beg . end) - (bounds-of-thing-at-point 'url) - (evil-range - beg (- end (if (evil-visual-state-p) 1 0)) - type))) - -;;;###autoload (autoload '+evil:inner-any-quote "editor/evil/autoload/textobjects" nil nil) -(evil-define-text-object +evil:inner-any-quote (count &optional beg end type) - "Select the closest inner quote." - (require 'evil-textobj-anyblock) - (let ((evil-textobj-anyblock-blocks - '(("'" . "'") - ("\"" . "\"") - ("`" . "`") - ("‘" . "’") - ("“" . "”")))) - (evil-textobj-anyblock-inner-block count beg end type))) - -;;;###autoload (autoload '+evil:outer-any-quote "editor/evil/autoload/textobjects" nil nil) -(evil-define-text-object +evil:outer-any-quote (count &optional beg end type) - "Select the closest outer quote." - (require 'evil-textobj-anyblock) - (let ((evil-textobj-anyblock-blocks - '(("'" . "'") - ("\"" . "\"") - ("`" . "`") - ("‘" . "’") - ("“" . "”")))) - (evil-textobj-anyblock-a-block count beg end type))) diff --git a/.config/emacs/modules/editor/evil/autoload/unimpaired.el b/.config/emacs/modules/editor/evil/autoload/unimpaired.el deleted file mode 100644 index 4104bc6..0000000 --- a/.config/emacs/modules/editor/evil/autoload/unimpaired.el +++ /dev/null @@ -1,200 +0,0 @@ -;;; editor/evil/autoload/unimpaired.el -*- lexical-binding: t; -*- - -;; These are ported from vim-unimpaired https://github.com/tpope/vim-unimpaired -;; and bound in the :config default module (in +evil-bindings.el). - -;; -;;; Next/Previous commands - -;;;###autoload -(defun +evil/next-beginning-of-method (count) - "Jump to the beginning of the COUNT-th method/function after point." - (interactive "p") - (beginning-of-defun (- count))) - -;;;###autoload -(defun +evil/previous-beginning-of-method (count) - "Jump to the beginning of the COUNT-th method/function before point." - (interactive "p") - (beginning-of-defun count)) - -;;;###autoload -(defalias #'+evil/next-end-of-method #'end-of-defun - "Jump to the end of the COUNT-th method/function after point.") - -;;;###autoload -(defun +evil/previous-end-of-method (count) - "Jump to the end of the COUNT-th method/function before point." - (interactive "p") - (end-of-defun (- count))) - -;;;###autoload -(defun +evil/next-preproc-directive (count) - "Jump to the COUNT-th preprocessor directive after point. - -By default, this only recognizes C preproc directives. To change this see -`+evil-preprocessor-regexp'." - (interactive "p") - ;; TODO More generalized search, to support directives in other languages? - (if (re-search-forward +evil-preprocessor-regexp nil t count) - (goto-char (match-beginning 0)) - (user-error "No preprocessor directives %s point" - (if (> count 0) "after" "before")))) - -;;;###autoload -(defun +evil/previous-preproc-directive (count) - "Jump to the COUNT-th preprocessor directive before point. - -See `+evil/next-preproc-directive' for details." - (interactive "p") - (+evil/next-preproc-statement (- count))) - -;;;###autoload -(defun +evil/next-comment (count) - "Jump to the beginning of the COUNT-th commented region after point." - (interactive "p") - (let ((orig-pt (point))) - (require 'newcomment) - (dotimes (_ (abs count)) - (cond ((> count 0) - (while (and (not (eobp)) (sp-point-in-comment)) - (forward-line 1)) - (unless (comment-search-forward (point-max) 'noerror) - (goto-char orig-pt) - (user-error "No comment after point"))) - (t - (while (and (not (bobp)) (sp-point-in-comment)) - (forward-line -1)) - (unless (comment-search-backward nil 'noerror) - (goto-char orig-pt) - (user-error "No comment before point"))))))) - -;;;###autoload -(defun +evil/previous-comment (count) - "Jump to the beginning of the COUNT-th commented region before point." - (interactive "p") - (+evil/next-comment (- count))) - -;;; ] SPC / [ SPC -;;;###autoload -(defun +evil/insert-newline-below (count) - "Insert COUNT blank line(s) below current line. Does not change modes." - (interactive "p") - (dotimes (_ count) - (save-excursion (evil-insert-newline-below)))) - -;;;###autoload -(defun +evil/insert-newline-above (count) - "Insert COUNT blank line(s) above current line. Does not change modes." - (interactive "p") - (dotimes (_ count) - (save-excursion (evil-insert-newline-above)))) - -;;; ]t / [t -;;;###autoload -(defun +evil/next-frame (count) - "Focus next frame." - (interactive "p") - (dotimes (_ (abs count)) - (let ((frame (if (> count 0) (next-frame) (previous-frame)))) - (if (eq frame (selected-frame)) - (user-error "No other frame") - (select-frame-set-input-focus frame))))) - -;;;###autoload -(defun +evil/previous-frame (count) - "Focus previous frame." - (interactive "p") - (+evil/next-frame (- count))) - -;;; ]f / [f -(defun +evil--next-file (n) - (unless buffer-file-name - (user-error "Must be called from a file-visiting buffer")) - (let* ((directory (file-name-directory buffer-file-name)) - (filename (file-name-nondirectory buffer-file-name)) - (files (doom-glob (file-name-directory buffer-file-name) "[!.]*")) - (index (cl-position filename files :test #'file-equal-p))) - (when (null index) - (user-error "Couldn't find this file in current directory")) - (let ((index (+ index n))) - (cond ((>= index (length files)) - (user-error "No files after this one")) - ((< index 0) - (user-error "No files before this one")) - ((expand-file-name (nth index files) directory)))))) - -;;;###autoload -(defun +evil/next-file (count) - "Open file following this one, alphabetically, in the same directory." - (interactive "p") - (find-file (+evil--next-file count))) - -;;;###autoload -(defun +evil/previous-file (count) - "Open file preceding this one, alphabetically, in the same directory." - (interactive "p") - (find-file (+evil--next-file (- count)))) - - -;; -;;; Encoding/Decoding - -;; NOTE For ]x / [x see :lang web -;; - `+web:encode-html-entities' -;; - `+web:decode-html-entities' - -(defun +evil--encode (beg end fn) - (save-excursion - (goto-char beg) - (let* ((end (if (eq evil-this-type 'line) (1- end) end)) - (text (buffer-substring-no-properties beg end))) - (delete-region beg end) - (insert (funcall fn text))))) - -;;; ]u / [u -;;;###autoload (autoload '+evil:url-encode "editor/evil/autoload/unimpaired" nil t) -(evil-define-operator +evil:url-encode (_count &optional beg end) - "TODO" - (interactive "") - (+evil--encode beg end #'url-encode-url)) - -;;;###autoload (autoload '+evil:url-decode "editor/evil/autoload/unimpaired" nil t) -(evil-define-operator +evil:url-decode (_count &optional beg end) - "TODO" - (interactive "") - (+evil--encode beg end #'url-unhex-string)) - -;;; ]y / [y -;;;###autoload (autoload '+evil:c-string-encode "editor/evil/autoload/unimpaired" nil t) -(evil-define-operator +evil:c-string-encode (_count &optional beg end) - "TODO" - (interactive "") - (+evil--encode - beg end - (lambda (text) - (replace-regexp-in-string "[\"\\]" (lambda (ch) (concat "\\" ch)) text)))) - -;;;###autoload (autoload '+evil:c-string-decode "editor/evil/autoload/unimpaired" nil t) -(evil-define-operator +evil:c-string-decode (_count &optional beg end) - "TODO" - (interactive "") - (+evil--encode - beg end - (lambda (text) - (replace-regexp-in-string "\\\\[\"\\]" (lambda (str) (substring str 1)) text)))) - - -;; -;;; Standalone - -;;; gp -;;;###autoload -(defun +evil/reselect-paste () - "Return to visual mode and reselect the last pasted region." - (interactive) - (cl-destructuring-bind (_ _ _ beg end &optional _) - evil-last-paste - (evil-visual-make-selection - (save-excursion (goto-char beg) (point-marker)) - end))) diff --git a/.config/emacs/modules/editor/evil/config.el b/.config/emacs/modules/editor/evil/config.el deleted file mode 100644 index 063f4fb..0000000 --- a/.config/emacs/modules/editor/evil/config.el +++ /dev/null @@ -1,622 +0,0 @@ -;;; editor/evil/config.el -*- lexical-binding: t; -*- - -(defvar +evil-repeat-keys (cons ";" ",") - "The keys to use for universal repeating motions. - -This is a cons cell whose CAR is the key for repeating a motion forward, and -whose CDR is for repeating backward. They should both be `kbd'-able strings. - -Set this to `nil' to disable universal-repeating on these keys.") - -(defvar +evil-want-o/O-to-continue-comments t - "If non-nil, the o/O keys will continue comment lines if the point is on a -line with a linewise comment.") - -(defvar +evil-preprocessor-regexp "^\\s-*#[a-zA-Z0-9_]" - "The regexp used by `+evil/next-preproc-directive' and -`+evil/previous-preproc-directive' on ]# and [#, to jump between preprocessor -directives. By default, this only recognizes C directives.") - -;; Set these defaults before `evil'; use `defvar' so they can be changed prior -;; to loading. -(defvar evil-want-C-g-bindings t) -(defvar evil-want-C-i-jump nil) ; we do this ourselves -(defvar evil-want-C-u-scroll t) ; moved the universal arg to u -(defvar evil-want-C-u-delete t) -(defvar evil-want-C-w-scroll t) -(defvar evil-want-C-w-delete t) -(defvar evil-want-Y-yank-to-eol t) -(defvar evil-want-abbrev-expand-on-insert-exit nil) -(defvar evil-respect-visual-line-mode nil) - -(use-package! evil - :hook (doom-init-modules . evil-mode) - :demand t - :preface - (setq evil-ex-search-vim-style-regexp t - evil-ex-visual-char-range t ; column range for ex commands - evil-mode-line-format 'nil - ;; more vim-like behavior - evil-symbol-word-search t - ;; if the current state is obvious from the cursor's color/shape, then - ;; we won't need superfluous indicators to do it instead. - evil-default-cursor '+evil-default-cursor-fn - evil-normal-state-cursor 'box - evil-emacs-state-cursor '(box +evil-emacs-cursor-fn) - evil-insert-state-cursor 'bar - evil-visual-state-cursor 'hollow - ;; Only do highlighting in selected window so that Emacs has less work - ;; to do highlighting them all. - evil-ex-interactive-search-highlight 'selected-window - ;; It's infuriating that innocuous "beginning of line" or "end of line" - ;; errors will abort macros, so suppress them: - evil-kbd-macro-suppress-motion-error t - evil-undo-system - (cond ((featurep! :emacs undo +tree) 'undo-tree) - ((featurep! :emacs undo) 'undo-fu) - (EMACS28+ 'undo-redo))) - - ;; Slow this down from 0.02 to prevent blocking in large or folded buffers - ;; like magit while incrementally highlighting matches. - (setq-hook! '(magit-mode-hook so-long-minor-mode-hook) - evil-ex-hl-update-delay 0.25) - - :config - (evil-select-search-module 'evil-search-module 'evil-search) - - ;; stop copying each visual state move to the clipboard: - ;; https://github.com/emacs-evil/evil/issues/336 - ;; grokked from: - ;; http://stackoverflow.com/questions/15873346/elisp-rename-macro - (advice-add #'evil-visual-update-x-selection :override #'ignore) - - ;; Start help-with-tutorial in emacs state - (advice-add #'help-with-tutorial :after (lambda (&rest _) (evil-emacs-state +1))) - - ;; Done in a hook to ensure the popup rules load as late as possible - (add-hook! 'doom-init-modules-hook - (defun +evil--init-popup-rules-h () - (set-popup-rules! - '(("^\\*evil-registers" :size 0.3) - ("^\\*Command Line" :size 8))))) - - ;; Change the cursor color in emacs state. We do it this roundabout way - ;; to ensure changes in theme doesn't break these colors. - (add-hook! '(doom-load-theme-hook doom-init-modules-hook) - (defun +evil-update-cursor-color-h () - (put 'cursor 'evil-emacs-color (face-foreground 'warning)) - (put 'cursor 'evil-normal-color (face-background 'cursor)))) - - (defun +evil-default-cursor-fn () - (evil-set-cursor-color (get 'cursor 'evil-normal-color))) - (defun +evil-emacs-cursor-fn () - (evil-set-cursor-color (get 'cursor 'evil-emacs-color))) - - ;; Ensure `evil-shift-width' always matches `tab-width'; evil does not police - ;; this itself, so we must. - (setq-hook! 'after-change-major-mode-hook evil-shift-width tab-width) - - - ;; --- keybind fixes ---------------------- - (after! wgrep - ;; A wrapper that invokes `wgrep-mark-deletion' across lines you use - ;; `evil-delete' in wgrep buffers. - (define-key wgrep-mode-map [remap evil-delete] #'+evil-delete)) - - (add-hook! 'doom-escape-hook - (defun +evil-disable-ex-highlights-h () - "Disable ex search buffer highlights." - (when (evil-ex-hl-active-p 'evil-ex-search) - (evil-ex-nohighlight) - t))) - - - ;; --- evil hacks ------------------------- - (after! eldoc - ;; Allow eldoc to trigger directly after changing modes - (eldoc-add-command 'evil-normal-state - 'evil-insert - 'evil-change - 'evil-delete - 'evil-replace)) - - (unless noninteractive - (setq save-silently t) - (add-hook! 'after-save-hook - (defun +evil-display-vimlike-save-message-h () - "Shorter, vim-esque save messages." - (message "\"%s\" %dL, %dC written" - (if buffer-file-name - (file-relative-name (file-truename buffer-file-name) (doom-project-root)) - (buffer-name)) - (count-lines (point-min) (point-max)) - (buffer-size))))) - - ;; HACK '=' moves the cursor to the beginning of selection. Disable this, - ;; since it's more disruptive than helpful. - (defadvice! +evil--dont-move-cursor-a (fn &rest args) - :around #'evil-indent - (save-excursion (apply fn args))) - - ;; REVIEW In evil, registers 2-9 are buffer-local. In vim, they're global, - ;; so... Perhaps this should be PRed upstream? - (defadvice! +evil--make-numbered-markers-global-a (char) - :after-until #'evil-global-marker-p - (and (>= char ?2) (<= char ?9))) - - ;; REVIEW Fix #2493: dir-locals cannot target fundamental-mode when evil-mode - ;; is active. See hlissner/doom-emacs#2493. Revert this if - ;; emacs-evil/evil#1268 is resolved upstream. - (defadvice! +evil--fix-local-vars-a (&rest _) - :before #'turn-on-evil-mode - (when (eq major-mode 'fundamental-mode) - (hack-local-variables))) - - ;; HACK Invoking helpful from evil-ex throws a "No recursive edit is in - ;; progress" error because, between evil-ex and helpful, - ;; `abort-recursive-edit' gets called one time too many. - (defadvice! +evil--fix-helpful-key-in-evil-ex-a (key-sequence) - :before #'helpful-key - (when (evil-ex-p) - (run-at-time 0.1 nil #'helpful-key key-sequence) - (abort-recursive-edit))) - - ;; Make J (evil-join) remove comment delimiters when joining lines. - (advice-add #'evil-join :around #'+evil-join-a) - - ;; Prevent gw (`evil-fill') and gq (`evil-fill-and-move') from squeezing - ;; spaces. It doesn't in vim, so it shouldn't in evil. - (defadvice! +evil--no-squeeze-on-fill-a (fn &rest args) - :around '(evil-fill evil-fill-and-move) - (letf! (defun fill-region (from to &optional justify nosqueeze to-eop) - (funcall fill-region from to justify t to-eop)) - (apply fn args))) - - ;; Make ESC (from normal mode) the universal escaper. See `doom-escape-hook'. - (advice-add #'evil-force-normal-state :after #'+evil-escape-a) - - ;; monkey patch `evil-ex-replace-special-filenames' to improve support for - ;; file modifiers like %:p:h. This adds support for most of vim's modifiers, - ;; and one custom one: %:P (expand to the project root). - (advice-add #'evil-ex-replace-special-filenames :override #'+evil-replace-filename-modifiers-a) - - ;; make `try-expand-dabbrev' (from `hippie-expand') work in minibuffer - (add-hook 'minibuffer-inactive-mode-hook #'+evil--fix-dabbrev-in-minibuffer-h) - - ;; Focus and recenter new splits - (advice-add #'evil-window-split :override #'+evil-window-split-a) - (advice-add #'evil-window-vsplit :override #'+evil-window-vsplit-a) - - ;; Make o/O continue comments (see `+evil-want-o/O-to-continue-comments' to disable) - (advice-add #'evil-open-above :around #'+evil--insert-newline-above-and-respect-comments-a) - (advice-add #'evil-open-below :around #'+evil--insert-newline-below-and-respect-comments-a) - - ;; --- custom interactive codes ----------- - ;; These arg types will highlight matches in the current buffer - (evil-ex-define-argument-type regexp-match - :runner (lambda (flag &optional arg) (+evil-ex-regexp-match flag arg 'inverted))) - (evil-ex-define-argument-type regexp-global-match - :runner +evil-ex-regexp-match) - - (defun +evil--regexp-match-args (arg) - (when (evil-ex-p) - (cl-destructuring-bind (&optional arg flags) - (evil-delimited-arguments arg 2) - (list arg (string-to-list flags))))) - - ;; Other commands can make use of this - (evil-define-interactive-code "" - :ex-arg regexp-match - (+evil--regexp-match-args evil-ex-argument)) - - (evil-define-interactive-code "" - :ex-arg regexp-global-match - (+evil--regexp-match-args evil-ex-argument)) - - ;; Forward declare these so that ex completion works, even if the autoloaded - ;; functions aren't loaded yet. - (evil-add-command-properties '+evil:align :ex-arg 'regexp-match) - (evil-add-command-properties '+evil:align-right :ex-arg 'regexp-match) - (evil-add-command-properties '+multiple-cursors:evil-mc :ex-arg 'regexp-global-match) - - ;; Lazy load evil ex commands - (delq! 'evil-ex features) - (add-transient-hook! 'evil-ex (provide 'evil-ex)) - (after! evil-ex (load! "+commands"))) - - -;; -;;; Packages - -(use-package! evil-easymotion - :after-call doom-first-input-hook - :commands evilem-create evilem-default-keybindings - :config - ;; Use evil-search backend, instead of isearch - (evilem-make-motion evilem-motion-search-next #'evil-ex-search-next - :bind ((evil-ex-search-highlight-all nil))) - (evilem-make-motion evilem-motion-search-previous #'evil-ex-search-previous - :bind ((evil-ex-search-highlight-all nil))) - (evilem-make-motion evilem-motion-search-word-forward #'evil-ex-search-word-forward - :bind ((evil-ex-search-highlight-all nil))) - (evilem-make-motion evilem-motion-search-word-backward #'evil-ex-search-word-backward - :bind ((evil-ex-search-highlight-all nil))) - - ;; Rebind scope of w/W/e/E/ge/gE evil-easymotion motions to the visible - ;; buffer, rather than just the current line. - (put 'visible 'bounds-of-thing-at-point (lambda () (cons (window-start) (window-end)))) - (evilem-make-motion evilem-motion-forward-word-begin #'evil-forward-word-begin :scope 'visible) - (evilem-make-motion evilem-motion-forward-WORD-begin #'evil-forward-WORD-begin :scope 'visible) - (evilem-make-motion evilem-motion-forward-word-end #'evil-forward-word-end :scope 'visible) - (evilem-make-motion evilem-motion-forward-WORD-end #'evil-forward-WORD-end :scope 'visible) - (evilem-make-motion evilem-motion-backward-word-begin #'evil-backward-word-begin :scope 'visible) - (evilem-make-motion evilem-motion-backward-WORD-begin #'evil-backward-WORD-begin :scope 'visible) - (evilem-make-motion evilem-motion-backward-word-end #'evil-backward-word-end :scope 'visible) - (evilem-make-motion evilem-motion-backward-WORD-end #'evil-backward-WORD-end :scope 'visible)) - - -(use-package! evil-embrace - :commands embrace-add-pair embrace-add-pair-regexp - :hook (LaTeX-mode . embrace-LaTeX-mode-hook) - :hook (LaTeX-mode . +evil-embrace-latex-mode-hook-h) - :hook (org-mode . embrace-org-mode-hook) - :hook (ruby-mode . embrace-ruby-mode-hook) - :hook (emacs-lisp-mode . embrace-emacs-lisp-mode-hook) - :hook ((lisp-mode emacs-lisp-mode clojure-mode racket-mode hy-mode) - . +evil-embrace-lisp-mode-hook-h) - :hook ((c++-mode rustic-mode csharp-mode java-mode swift-mode typescript-mode) - . +evil-embrace-angle-bracket-modes-hook-h) - :hook (scala-mode . +evil-embrace-scala-mode-hook-h) - :init - (after! evil-surround - (evil-embrace-enable-evil-surround-integration)) - :config - (setq evil-embrace-show-help-p nil) - - (defun +evil-embrace-scala-mode-hook-h () - (embrace-add-pair ?$ "${" "}")) - - (defun +evil-embrace-latex-mode-hook-h () - (dolist (pair '((?\' . ("`" . "\'")) - (?\" . ("``" . "\'\'")))) - (delete (car pair) evil-embrace-evil-surround-keys) - ;; Avoid `embrace-add-pair' because it would overwrite the default - ;; rules, which we want for other modes - (push (cons (car pair) (make-embrace-pair-struct - :key (car pair) - :left (cadr pair) - :right (cddr pair) - :left-regexp (regexp-quote (cadr pair)) - :right-regexp (regexp-quote (cddr pair)))) - embrace--pairs-list)) - (embrace-add-pair-regexp ?l "\\[a-z]+{" "}" #'+evil--embrace-latex)) - - (defun +evil-embrace-lisp-mode-hook-h () - ;; Avoid `embrace-add-pair-regexp' because it would overwrite the default - ;; `f' rule, which we want for other modes - (push (cons ?f (make-embrace-pair-struct - :key ?f - :read-function #'+evil--embrace-elisp-fn - :left-regexp "([^ ]+ " - :right-regexp ")")) - embrace--pairs-list)) - - (defun +evil-embrace-angle-bracket-modes-hook-h () - (let ((var (make-local-variable 'evil-embrace-evil-surround-keys))) - (set var (delq ?< evil-embrace-evil-surround-keys)) - (set var (delq ?> evil-embrace-evil-surround-keys))) - (embrace-add-pair-regexp ?< "\\_<[a-z0-9-_]+<" ">" #'+evil--embrace-angle-brackets) - (embrace-add-pair ?> "<" ">")) - - ;; Add escaped-sequence support to embrace - (setf (alist-get ?\\ (default-value 'embrace--pairs-list)) - (make-embrace-pair-struct - :key ?\\ - :read-function #'+evil--embrace-escaped - :left-regexp "\\[[{(]" - :right-regexp "\\[]})]"))) - - -(use-package! evil-escape - :commands evil-escape - :hook (doom-first-input . evil-escape-mode) - :init - (setq evil-escape-excluded-states '(normal visual multiedit emacs motion) - evil-escape-excluded-major-modes '(neotree-mode treemacs-mode vterm-mode) - evil-escape-key-sequence "jk" - evil-escape-delay 0.15) - (evil-define-key* '(insert replace visual operator) 'global "\C-g" #'evil-escape) - :config - ;; `evil-escape' in the minibuffer is more disruptive than helpful. That is, - ;; unless we have `evil-collection-setup-minibuffer' enabled, in which case we - ;; want the same behavior in insert mode as we do in normal buffers. - (add-hook! 'evil-escape-inhibit-functions - (defun +evil-inhibit-escape-in-minibuffer-fn () - (and (minibufferp) - (or (not (bound-and-true-p evil-collection-setup-minibuffer)) - (evil-normal-state-p)))))) - - -(use-package! evil-exchange - :commands evil-exchange - :config - (add-hook! 'doom-escape-hook - (defun +evil--escape-exchange-h () - (when evil-exchange--overlays - (evil-exchange-cancel) - t)))) - - -(use-package! evil-quick-diff - :commands (evil-quick-diff evil-quick-diff-cancel)) - - -(use-package! evil-nerd-commenter - :commands (evilnc-comment-operator - evilnc-inner-comment - evilnc-outer-commenter) - :general ([remap comment-line] #'evilnc-comment-or-uncomment-lines)) - - -(use-package! evil-snipe - :commands evil-snipe-local-mode evil-snipe-override-local-mode - :hook (doom-first-input . evil-snipe-override-mode) - :hook (doom-first-input . evil-snipe-mode) - :init - (setq evil-snipe-smart-case t - evil-snipe-scope 'line - evil-snipe-repeat-scope 'visible - evil-snipe-char-fold t) - :config - (pushnew! evil-snipe-disabled-modes 'Info-mode 'calc-mode 'treemacs-mode 'dired-mode)) - - -(use-package! evil-surround - :commands (global-evil-surround-mode - evil-surround-edit - evil-Surround-edit - evil-surround-region) - :config (global-evil-surround-mode 1)) - - -(use-package! evil-textobj-anyblock - :defer t - :config - (setq evil-textobj-anyblock-blocks - '(("(" . ")") - ("{" . "}") - ("\\[" . "\\]") - ("<" . ">")))) - - -(use-package! evil-traces - :after evil-ex - :config - (pushnew! evil-traces-argument-type-alist - '(+evil:align . evil-traces-global) - '(+evil:align-right . evil-traces-global)) - (evil-traces-mode)) - - -;; Allows you to use the selection for * and # -(use-package! evil-visualstar - :commands (evil-visualstar/begin-search - evil-visualstar/begin-search-forward - evil-visualstar/begin-search-backward) - :init - (evil-define-key* 'visual 'global - "*" #'evil-visualstar/begin-search-forward - "#" #'evil-visualstar/begin-search-backward)) - - -;; -;;; Text object plugins - -(use-package! exato - :commands evil-outer-xml-attr evil-inner-xml-attr) - - -;; -;;; Keybinds - -;; Keybinds that have no Emacs+evil analogues (i.e. don't exist): -;; zu{q,w} - undo last marking - -(map! :v "@" #'+evil:apply-macro - :m [C-i] #'evil-jump-forward - - ;; implement dictionary keybinds - ;; evil already defines 'z=' to `ispell-word' = correct word at point - (:when (featurep! :checkers spell) - :n "zg" #'+spell/add-word - :n "zw" #'+spell/remove-word - :m "[s" #'+spell/previous-error - :m "]s" #'+spell/next-error) - - ;; ported from vim-unimpaired - :n "] SPC" #'+evil/insert-newline-below - :n "[ SPC" #'+evil/insert-newline-above - :n "]b" #'next-buffer - :n "[b" #'previous-buffer - :n "]f" #'+evil/next-file - :n "[f" #'+evil/previous-file - :m "]u" #'+evil:url-encode - :m "[u" #'+evil:url-decode - :m "]y" #'+evil:c-string-encode - :m "[y" #'+evil:c-string-decode - (:when (featurep! :lang web) - :m "]x" #'+web:encode-html-entities - :m "[x" #'+web:decode-html-entities) - (:when (featurep! :ui vc-gutter) - :m "]d" #'git-gutter:next-hunk - :m "[d" #'git-gutter:previous-hunk) - (:when (featurep! :ui hl-todo) - :m "]t" #'hl-todo-next - :m "[t" #'hl-todo-previous) - (:when (featurep! :ui workspaces) - :n "gt" #'+workspace:switch-next - :n "gT" #'+workspace:switch-previous - :n "]w" #'+workspace/switch-right - :n "[w" #'+workspace/switch-left) - (:when (featurep! :ui tabs) - :n "gt" #'+tabs:next-or-goto - :n "gT" #'+tabs:previous-or-goto) - - ;; custom vim-unmpaired-esque keys - :m "]#" #'+evil/next-preproc-directive - :m "[#" #'+evil/previous-preproc-directive - :m "]a" #'evil-forward-arg - :m "[a" #'evil-backward-arg - :m "]c" #'+evil/next-comment - :m "[c" #'+evil/previous-comment - :m "]e" #'next-error - :m "[e" #'previous-error - :n "]F" #'+evil/next-frame - :n "[F" #'+evil/previous-frame - :m "]h" #'outline-next-visible-heading - :m "[h" #'outline-previous-visible-heading - :m "]m" #'+evil/next-beginning-of-method - :m "[m" #'+evil/previous-beginning-of-method - :m "]M" #'+evil/next-end-of-method - :m "[M" #'+evil/previous-end-of-method - :n "[o" #'+evil/insert-newline-above - :n "]o" #'+evil/insert-newline-below - :n "gp" #'+evil/reselect-paste - :v "gp" #'+evil/alt-paste - :nv "g@" #'+evil:apply-macro - :nv "gc" #'evilnc-comment-operator - :nv "gO" #'imenu - :nv "gx" #'evil-exchange - :nv "gy" #'+evil:yank-unindented - :n "g=" #'evil-numbers/inc-at-pt - :n "g-" #'evil-numbers/dec-at-pt - :v "g=" #'evil-numbers/inc-at-pt-incremental - :v "g-" #'evil-numbers/dec-at-pt-incremental - :v "g+" #'evil-numbers/inc-at-pt - (:when (featurep! :tools lookup) - :nv "K" #'+lookup/documentation - :nv "gd" #'+lookup/definition - :nv "gD" #'+lookup/references - :nv "gf" #'+lookup/file - :nv "gI" #'+lookup/implementations - :nv "gA" #'+lookup/assignments) - (:when (featurep! :tools eval) - :nv "gr" #'+eval:region - :n "gR" #'+eval/buffer - :v "gR" #'+eval:replace-region - ;; Restore these keybinds, since the blacklisted/overwritten gr/gR will - ;; undo them: - (:after helpful - :map helpful-mode-map - :n "gr" #'helpful-update) - (:after compile - :map (compilation-mode-map compilation-minor-mode-map) - :n "gr" #'recompile) - (:after dired - :map dired-mode-map - :n "gr" #'revert-buffer) - (:after notmuch - :map notmuch-common-keymap - :n "gr" #'notmuch-refresh-this-buffer - :n "gR" #'notmuch-poll-and-refresh-this-buffer) - (:after elfeed - :map elfeed-search-mode-map - :n "gr" #'elfeed-search-update--force - :n "gR" #'elfeed-search-fetch)) - - ;; custom evil keybinds - :nv "zn" #'+evil:narrow-buffer - :n "zN" #'doom/widen-indirectly-narrowed-buffer - :n "zx" #'kill-current-buffer - :n "ZX" #'doom/save-and-kill-buffer - ;; don't leave visual mode after shifting - :v "<" #'+evil/shift-left ; vnoremap < " #'+evil/shift-right ; vnoremap > >gv - - ;; window management (prefix "C-w") - (:map evil-window-map - ;; Navigation - "C-h" #'evil-window-left - "C-j" #'evil-window-down - "C-k" #'evil-window-up - "C-l" #'evil-window-right - "C-w" #'other-window - ;; Extra split commands - "S" #'+evil/window-split-and-follow - "V" #'+evil/window-vsplit-and-follow - ;; Swapping windows - "H" #'+evil/window-move-left - "J" #'+evil/window-move-down - "K" #'+evil/window-move-up - "L" #'+evil/window-move-right - "C-S-w" #'ace-swap-window - ;; Window undo/redo - (:prefix "m" - "m" #'doom/window-maximize-buffer - "v" #'doom/window-maximize-vertically - "s" #'doom/window-maximize-horizontally) - "u" #'winner-undo - "C-u" #'winner-undo - "C-r" #'winner-redo - "o" #'doom/window-enlargen - ;; Delete window - "d" #'evil-window-delete - "C-C" #'ace-delete-window - "T" #'tear-off-window) - - ;; text objects - :textobj "a" #'evil-inner-arg #'evil-outer-arg - :textobj "B" #'evil-textobj-anyblock-inner-block #'evil-textobj-anyblock-a-block - :textobj "c" #'evilnc-inner-comment #'evilnc-outer-commenter - :textobj "f" #'+evil:defun-txtobj #'+evil:defun-txtobj - :textobj "g" #'+evil:whole-buffer-txtobj #'+evil:whole-buffer-txtobj - :textobj "i" #'evil-indent-plus-i-indent #'evil-indent-plus-a-indent - :textobj "j" #'evil-indent-plus-i-indent-up-down #'evil-indent-plus-a-indent-up-down - :textobj "k" #'evil-indent-plus-i-indent-up #'evil-indent-plus-a-indent-up - :textobj "q" #'+evil:inner-any-quote #'+evil:outer-any-quote - :textobj "u" #'+evil:inner-url-txtobj #'+evil:outer-url-txtobj - :textobj "x" #'evil-inner-xml-attr #'evil-outer-xml-attr - - ;; evil-easymotion - (:after evil-easymotion - :m "gs" evilem-map - (:map evilem-map - "a" (evilem-create #'evil-forward-arg) - "A" (evilem-create #'evil-backward-arg) - "s" #'evil-avy-goto-char-2 - "SPC" (cmd! (let ((current-prefix-arg t)) (evil-avy-goto-char-timer))) - "/" #'evil-avy-goto-char-timer)) - - ;; evil-snipe - (:after evil-snipe - :map evil-snipe-parent-transient-map - "C-;" (cmd! (require 'evil-easymotion) - (call-interactively - (evilem-create #'evil-snipe-repeat - :bind ((evil-snipe-scope 'whole-buffer) - (evil-snipe-enable-highlight) - (evil-snipe-enable-incremental-highlight)))))) - - ;; evil-surround - :v "S" #'evil-surround-region - :o "s" #'evil-surround-edit - :o "S" #'evil-Surround-edit - - ;; evil-lion - :n "gl" #'evil-lion-left - :n "gL" #'evil-lion-right - :v "gl" #'evil-lion-left - :v "gL" #'evil-lion-right - - ;; Omni-completion - (:when (featurep! :completion company) - (:prefix "C-x" - :i "C-l" #'+company/whole-lines - :i "C-k" #'+company/dict-or-keywords - :i "C-f" #'company-files - :i "C-]" #'company-etags - :i "s" #'company-ispell - :i "C-s" #'company-yasnippet - :i "C-o" #'company-capf - :i "C-n" #'+company/dabbrev - :i "C-p" #'+company/dabbrev-code-previous))) diff --git a/.config/emacs/modules/editor/evil/init.el b/.config/emacs/modules/editor/evil/init.el deleted file mode 100644 index 329f5a9..0000000 --- a/.config/emacs/modules/editor/evil/init.el +++ /dev/null @@ -1,331 +0,0 @@ -;;; editor/evil/init.el -*- lexical-binding: t; -*- - -(defvar evil-collection-key-blacklist) - -;; We load evil-collection ourselves for these reasons: -;; -;; 1. To truly lazy load it. Some of its modules, like -;; evil-collection-{elisp-mode,buff-menu} are loaded immediately, because -;; Emacs loads their packages immediately, which pulls in all of -;; evil-collection (and other packages with it, sometimes). -;; 2. This ensures a predictable load order, versus lazy loading using :defer or -;; :after-call. This means users can use (after! org ...) and be sure that -;; their changes will override evil-collection's. -;; 3. Ideally, we'd do away with evil-collection entirely. It changes too often, -;; introduces breaking bugs too frequently, and I don't agree with all their -;; design choices. Regardless, it does more good than trouble, so it may be -;; here to stay. -;; 4. Adds `+evil-collection-disabled-list', to make it easier for users to -;; disable modules, and to reduce the effort required to maintain our copy of -;; `evil-collection-list' (now I can just copy it from time to time). - -(when (and doom-interactive-p - (not doom-reloading-p) - (featurep! +everywhere)) - - (setq evil-collection-company-use-tng (featurep! :completion company +tng) - ;; must be set before evil/evil-collection is loaded - evil-want-keybinding nil) - - (defvar +evil-collection-disabled-list - '(anaconda-mode - buff-menu - calc - comint - company - custom - eldoc - elisp-mode - ert - free-keys - helm - help - indent - image - kotlin-mode - occur - outline - simple - slime - lispy) - "A list of `evil-collection' modules to ignore. See the definition of this -variable for an explanation of the defaults (in comments). See -`evil-collection-mode-list' for a list of available options.") - - (defvar evil-collection-setup-minibuffer nil) - - ;; We do this ourselves, and better. - (defvar evil-collection-want-unimpaired-p nil) - ;; Doom binds goto-reference on gD and goto-assignments on gA ourselves - (defvar evil-collection-want-find-usages-bindings-p nil) - ;; Reduces keybind conflicts between outline-mode and org-mode (which is - ;; derived from outline-mode). - (defvar evil-collection-outline-enable-in-minor-mode-p nil) - - ;; We handle loading evil-collection ourselves - (defvar evil-collection--supported-modes nil) - - ;; This has to be defined here since evil-collection doesn't autoload its own. - ;; It must be updated whenever evil-collection updates theirs. Here's an easy - ;; way to update it: - ;; - ;; (with-current-buffer - ;; (url-retrieve-synchronously "https://raw.githubusercontent.com/emacs-evil/evil-collection/master/evil-collection.el" t t) - ;; (goto-char (point-min)) - ;; (when (re-search-forward "^(defvar evil-collection--supported-modes\n[^(]+") - ;; (let ((list (sexp-at-point))) - ;; ;; Fixes - ;; (when (assq 'pdf list) - ;; (setf (alist-get 'pdf list) '(pdf-tools))) - ;; (let ((diff (cl-set-difference evil-collection-mode-list list :test #'equal))) - ;; (list (- (length list) (length evil-collection-mode-list)) - ;; diff) - ;; (message "diff: %s" diff) - ;; (kill-new (prin1-to-string list)))))) - - (defvar evil-collection-mode-list - `(2048-game - ag - alchemist - anaconda-mode - apropos - arc-mode - auto-package-update - beginend - bm - bookmark - (buff-menu "buff-menu") - calc - calendar - cider - cmake-mode - comint - company - compile - consult - (custom cus-edit) - cus-theme - daemons - dashboard - deadgrep - debbugs - debug - devdocs - dictionary - diff-hl - diff-mode - dired - dired-sidebar - disk-usage - doc-view - docker - ebib - edbi - edebug - ediff - eglot - explain-pause-mode - elfeed - elisp-mode - elisp-refs - elisp-slime-nav - embark - emms - ,@(when EMACS29+ '(emoji)) - epa - ert - eshell - eval-sexp-fu - evil-mc - eww - fanyi - finder - flycheck - flymake - forge - free-keys - geiser - ggtags - git-timemachine - gnus - go-mode - grep - guix - hackernews - helm - help - helpful - hg-histedit - hungry-delete - ibuffer - image - image-dired - image+ - imenu - imenu-list - (indent "indent") - indium - info - ivy - js2-mode - leetcode - lispy - log-edit - log-view - lsp-ui-imenu - lua-mode - kotlin-mode - macrostep - man - magit - magit-todos - markdown-mode - monky - mu4e - mu4e-conversation - neotree - newsticker - notmuch - nov - (occur replace) - omnisharp - org - org-present - osx-dictionary - outline - p4 - (package-menu package) - pass - (pdf pdf-tools) - popup - proced - prodigy - profiler - python - quickrun - racer - racket-describe - realgud - reftex - restclient - rg - ripgrep - rjsx-mode - robe - rtags - ruby-mode - scheme - scroll-lock - selectrum - sh-script - ,@(when EMACS28+ '(shortdoc)) - simple - slime - sly - speedbar - tablist - tar-mode - telega - (term term ansi-term multi-term) - tetris - thread - tide - timer-list - transmission - trashed - tuareg - typescript-mode - vc-annotate - vc-dir - vc-git - vdiff - vertico - view - vlf - vterm - w3m - wdired - wgrep - which-key - woman - xref - xwidget - yaml-mode - youtube-dl - zmusic - (ztree ztree-diff))) - - (defun +evil-collection-init (module &optional disabled-list) - "Initialize evil-collection-MODULE. - -Unlike `evil-collection-init', this respects `+evil-collection-disabled-list', -and complains if a module is loaded too early (during startup)." - (unless (memq (or (car-safe module) module) disabled-list) - (doom-log "Initialized evil-collection-%s %s" - (or (car-safe module) module) - (if doom-init-time "" "(too early!)")) - (with-demoted-errors "evil-collection error: %s" - (evil-collection-init (list module))))) - - (defadvice! +evil-collection-disable-blacklist-a (fn) - :around #'evil-collection-vterm-toggle-send-escape ; allow binding to ESC - (let (evil-collection-key-blacklist) - (funcall-interactively fn))) - - ;; These modes belong to packages that Emacs always loads at startup, causing - ;; evil-collection and it's co-packages to all load immediately. We avoid this - ;; by loading them after evil-collection has first loaded... - (with-eval-after-load 'evil-collection - ;; Don't let evil-collection interfere with certain keys - (setq evil-collection-key-blacklist - (append (list doom-leader-key doom-localleader-key - doom-leader-alt-key) - (when (featurep! :tools lookup) - '("gd" "gf" "K")) - (when (featurep! :tools eval) - '("gr" "gR")) - '("[" "]" "gz" ""))) - - (evil-define-key* 'normal process-menu-mode-map - "q" #'kill-current-buffer - "d" #'process-menu-delete-process) - - (mapc #'+evil-collection-init '(comint custom))) - - ;; ...or on first invokation of their associated major/minor modes. - (after! evil - ;; Emacs loads these two packages immediately, at startup, which needlessly - ;; convolutes load order for evil-collection-help. - (add-transient-hook! 'help-mode - (+evil-collection-init 'help)) - (add-transient-hook! 'Buffer-menu-mode - (+evil-collection-init '(buff-menu "buff-menu"))) - (add-transient-hook! 'calc-mode - (+evil-collection-init 'calc)) - (add-transient-hook! 'image-mode - (+evil-collection-init 'image)) - (add-transient-hook! 'emacs-lisp-mode - (+evil-collection-init 'elisp-mode)) - (add-transient-hook! 'occur-mode - (+evil-collection-init '(occur replace))) - (add-transient-hook! 'indent-rigidly - (+evil-collection-init '(indent "indent"))) - (add-transient-hook! 'minibuffer-setup-hook - (when evil-collection-setup-minibuffer - (+evil-collection-init 'minibuffer) - (evil-collection-minibuffer-insert))) - (add-transient-hook! 'process-menu-mode - (+evil-collection-init '(process-menu simple))) - (add-transient-hook! 'tabulated-list-mode - (+evil-collection-init 'tabulated-list)) - (add-transient-hook! 'tab-bar-mode - (+evil-collection-init 'tab-bar)) - - ;; HACK Do this ourselves because evil-collection break's `eval-after-load' - ;; load order by loading their target plugin before applying keys. This - ;; makes it hard for end-users to overwrite these keybinds with a - ;; simple `after!' or `with-eval-after-load'. - (dolist (mode evil-collection-mode-list) - (dolist (req (or (cdr-safe mode) (list mode))) - (with-eval-after-load req - (+evil-collection-init mode +evil-collection-disabled-list)))))) diff --git a/.config/emacs/modules/editor/evil/packages.el b/.config/emacs/modules/editor/evil/packages.el deleted file mode 100644 index f92351e..0000000 --- a/.config/emacs/modules/editor/evil/packages.el +++ /dev/null @@ -1,38 +0,0 @@ -;; -*- no-byte-compile: t; -*- -;;; editor/evil/packages.el - -(package! evil :pin "a5fd96dadc44ab3a00c354aed33cb576f65a50de") -(package! evil-args :pin "758ad5ae54ad34202064fec192c88151c08cb387") -(package! evil-easymotion :pin "f96c2ed38ddc07908db7c3c11bcd6285a3e8c2e9") -(package! evil-embrace :pin "464e8ec52ff78edf3c9060143fc375f6ce5f275f") -(package! evil-escape - :recipe (:host github :repo "hlissner/evil-escape") - :pin "819f1ee1cf3f69a1ae920e6004f2c0baeebbe077") -(package! evil-exchange :pin "5f0a2d41434c17c6fb02e4f744043775de1c63a2") -(package! evil-indent-plus :pin "b4dacbfdb57f474f798bfbf5026d434d549eb65c") -(package! evil-lion :pin "6b03593f5dd6e7c9ca02207f9a73615cf94c93ab") -(package! evil-nerd-commenter :pin "42ba1a473b4f1df061baddd2f8b812a2f35e366e") -(package! evil-numbers :pin "08f0c1ee93b8a563770eaefaf21ab9087fca7bdb") -(package! evil-snipe :pin "a79177df406a79b4ffa25743c752f21363bba1cc") -(package! evil-surround :pin "282a975bda83310d20a2c536ac3cf95d2bf188a5") -(package! evil-textobj-anyblock - :recipe (:host github - :repo "willghatch/evil-textobj-anyblock" - :branch "fix-inner-block") - :pin "29280cd71a05429364cdceef2ff595ae8afade4d") -(package! evil-traces :pin "290b5323542c46af364ec485c8ec9000040acf90") -(package! evil-visualstar :pin "06c053d8f7381f91c53311b1234872ca96ced752") -(package! exato :pin "aee7af7b7a0e7551478f453d1de7d5b9cb2e06c4") -(package! evil-quick-diff - :recipe (:host github :repo "rgrinberg/evil-quick-diff") - :pin "69c883720b30a892c63bc89f49d4f0e8b8028908") - -;; -(when (featurep! +everywhere) - ;; `evil-collection-neotree' uses the `neotree-make-executor' macro, but this - ;; requires neotree be available during byte-compilation (while installing). - (when (featurep! :ui neotree) - (package! neotree) - (autoload 'neotree-make-executor "neotree" nil nil 'macro)) - - (package! evil-collection :pin "0ce1ea96b4d53bbe10b70274a3174d5ea2f31fef")) diff --git a/.config/emacs/modules/editor/evil/test/test-evil.el b/.config/emacs/modules/editor/evil/test/test-evil.el deleted file mode 100644 index 3b77c9c..0000000 --- a/.config/emacs/modules/editor/evil/test/test-evil.el +++ /dev/null @@ -1,69 +0,0 @@ -;; -*- no-byte-compile: t; -*- -;;; editor/evil/test/test-evil.el - -(describe "editor/evil" - :var (resv project-root) - - (require! :editor evil) - (require 'evil) - (load! "../autoload/evil") - - (before-each - (fset 'resv #'+evil-replace-filename-modifiers-a) - (spy-on 'doom-project-root :and-call-fake (lambda () project-root))) - - ;; `evil-ex-replace-special-filenames' / `+evil-replace-filename-modifiers-a' - (describe "file modifiers" - (it "supports basic vim file modifiers" - (let ((buffer-file-name "~/.emacs.d/test/modules/feature/test-evil.el") - (default-directory "~/.emacs.d/test/modules/") - (project-root "~/.emacs.d/")) - (expect (resv "%") :to-equal "feature/test-evil.el") - (expect (resv "%:r") :to-equal "feature/test-evil") - (expect (resv "%:r.elc") :to-equal "feature/test-evil.elc") - (expect (resv "%:e") :to-equal "el") - (expect (resv "%:p") :to-equal (expand-file-name buffer-file-name)) - (expect (resv "%:h") :to-equal "feature") - (expect (resv "%:t") :to-equal "test-evil.el") - (expect (resv "%:.") :to-equal "feature/test-evil.el") - (expect (resv "%:~") :to-equal "~/.emacs.d/test/modules/feature/test-evil.el") - (expect (file-truename (resv "%:p")) - :to-equal (file-truename buffer-file-name)))) - - (it "supports nested vim file modifiers" - (let ((buffer-file-name "~/vim/src/version.c") - (default-directory "~/vim/") - (project-root "~/vim/")) - (expect (resv "%:p") :to-equal (expand-file-name "~/vim/src/version.c")) - (expect (resv "%:p:.") :to-equal "src/version.c") - (expect (resv "%:p:~") :to-equal "~/vim/src/version.c") - (expect (resv "%:h") :to-equal "src") - (expect (resv "%:p:h") :to-equal (expand-file-name "~/vim/src")) - (expect (resv "%:p:h:h") :to-equal (expand-file-name "~/vim")) - (expect (resv "%:t") :to-equal "version.c") - (expect (resv "%:p:t") :to-equal "version.c") - (expect (resv "%:r") :to-equal "src/version") - (expect (resv "%:p:r") :to-equal (expand-file-name "~/vim/src/version")) - (expect (resv "%:t:r") :to-equal "version"))) - - (it "cleans up empty file modifiers" - (let (buffer-file-name default-directory) - (expect (resv "%") :to-equal "") - (expect (resv "%:r") :to-equal "") - (expect (resv "%:e") :to-equal "") - (expect (resv "%:h") :to-equal "") - (expect (resv "%:t") :to-equal "") - (expect (resv "%:.") :to-equal "") - (expect (resv "%:~") :to-equal "") - (expect (resv "%:P") :to-equal ""))) - - (it "supports substitution modifiers" - (let ((buffer-file-name "~/.emacs.d/test/modules/feature/test-evil.el") - (default-directory "~/.emacs.d/test/modules/")) - (expect (resv "%:s?e?x?") :to-equal "fxature/test-evil.el") - (expect (resv "%:gs?e?x?") :to-equal "fxaturx/txst-xvil.xl"))) - - (it "cleans up empty substitution modifiers" - (let (buffer-file-name default-directory) - (expect (resv "%:s?e?x?") :to-equal "") - (expect (resv "%:gs?e?x?") :to-equal ""))))) diff --git a/.config/emacs/modules/editor/file-templates/README.org b/.config/emacs/modules/editor/file-templates/README.org deleted file mode 100644 index 9a195f6..0000000 --- a/.config/emacs/modules/editor/file-templates/README.org +++ /dev/null @@ -1,83 +0,0 @@ -#+TITLE: editor/file-templates -#+DATE: February 11, 2017 -#+SINCE: v2.0 -#+STARTUP: inlineimages - -* Table of Contents :TOC_2:noexport: -- [[#description][Description]] - - [[#module-flags][Module Flags]] - - [[#plugins][Plugins]] -- [[#prerequisites][Prerequisites]] -- [[#usage][Usage]] - - [[#inserting-oss-licenses][Inserting OSS licenses]] -- [[#configuration][Configuration]] - - [[#registering-a-new-file-template][Registering a new file template]] - - [[#changing-existing-file-templates][Changing existing file templates]] - - [[#adding-new-oss-licenses][Adding new OSS licenses]] -- [[#troubleshooting][Troubleshooting]] -- [[#appendix][Appendix]] - - [[#api][API]] - - [[#commands][Commands]] - - [[#variables][Variables]] - -* Description -This module adds file templates for blank files, powered by yasnippet. - -** Module Flags -This module provides no flags. - -** Plugins -This module installs no plugins. - -* Prerequisites -This module has no prerequisites. - -* Usage -File templates are automatically expanded when opening empty files. - -They are also regular yasnippet snippets, which can be expanded by typing their -trigger and pressing =TAB=. By convention, the triggers for file templates are -prefixed with two underscores ~__~. - -** Inserting OSS licenses -A special command is available for inserting software licenses: ~M-x -+file-templates/insert-license~. - -#+begin_quote -Licenses with a ~-bp~ suffix are boilerplate templates; shorter versions meant -for comment headers in code. -#+end_quote - -* Configuration -** Registering a new file template -Look into the documentation of ~set-file-template!~ and ~set-file-templates!~. -** Changing existing file templates -Simply register a new template (using ~set-file-template!~) that matches the same -file. The new template would be pushed to the top of ~+file-template-alist~ and -thus would take priority while searching for a template to insert. -** Adding new OSS licenses -The ~+file-templates/insert-license~ command searches for snippets under -~text-mode~ that are named ~__license-ABC~, where ABC is the short name of the -license. e.g. ~__license-mit~. - -So long as these files exist, ~+file-templates/insert-license~ will recognize -them. - -* Troubleshooting -If a file template isn't expanding where you expect it to, run ~M-x -+file-templates/debug~. This will report to you what file template rule would -apply for the correct file. - -* Appendix -** API -+ ~set-file-template! PRED &rest PLIST~ -+ ~set-file-templates! &rest TEMPLATES~ - -** Commands -+ ~+file-templates/insert-license~ -+ ~+file-templates/debug~ - -** Variables -+ ~+file-templates-dir~ -+ ~+file-templates-default-trigger~ -+ ~+file-templates-alist~ diff --git a/.config/emacs/modules/editor/file-templates/autoload.el b/.config/emacs/modules/editor/file-templates/autoload.el deleted file mode 100644 index 114507c..0000000 --- a/.config/emacs/modules/editor/file-templates/autoload.el +++ /dev/null @@ -1,135 +0,0 @@ -;;; editor/file-templates/autoload.el -*- lexical-binding: t; -*- - -(defun +file-templates--set (pred plist) - (if (null (car-safe plist)) - (setq +file-templates-alist - (delq (assoc pred +file-templates-alist) - +file-templates-alist)) - (push `(,pred ,@plist) +file-templates-alist))) - -;;;###autodef -(defun set-file-template! (pred &rest plist) - "Register a file template. - -PRED can either be a regexp string or a major mode symbol. PLIST may contain -these properties: - - :when FUNCTION - Provides a secondary predicate. This function takes no arguments and is - executed from within the target buffer. If it returns nil, this rule will be - skipped over. - :trigger STRING|FUNCTION - If a string, this is the yasnippet trigger keyword used to trigger the - target snippet. - If a function, this function will be run in the context of the buffer to - insert a file template into. It is given no arguments and must insert text - into the current buffer manually. - If omitted, `+file-templates-default-trigger' is used. - :mode SYMBOL - What mode to get the yasnippet snippet from. If omitted, either PRED (if - it's a major-mode symbol) or the mode of the buffer is used. - :project BOOL - If non-nil, ignore this template if this buffer isn't in a project. - :ignore BOOL - If non-nil, don't expand any template for this file and don't test any other - file template rule against this buffer. - -\(fn PRED &key WHEN TRIGGER MODE PROJECT IGNORE)" - (declare (indent defun)) - (defer-until! (boundp '+file-templates-alist) - (+file-templates--set pred plist))) - -;;;###autodef -(defun set-file-templates! (&rest templates) - "Like `set-file-template!', but can register multiple file templates at once. - -\(fn &rest (PRED &key WHEN TRIGGER MODE PROJECT IGNORE))" - (defer-until! (boundp '+file-templates-alist) - (dolist (template templates) - (+file-templates--set (car template) (cdr template))))) - - -;; -;;; Library - -;;;###autoload -(cl-defun +file-templates--expand (pred &key project mode trigger ignore _when) - "Auto insert a yasnippet snippet into current file and enter insert mode (if -evil is loaded and enabled)." - (when (and pred (not ignore)) - (when (if project (doom-project-p) t) - (unless mode - (setq mode - (if (and (symbolp pred) (not (booleanp pred))) - pred - major-mode))) - (unless mode - (user-error "Couldn't determine mode for %s file template" pred)) - (unless trigger - (setq trigger +file-templates-default-trigger)) - (if (functionp trigger) - (funcall trigger) - (require 'yasnippet) - (unless yas-minor-mode - (yas-minor-mode-on)) - (when (and yas-minor-mode - (when-let - (template (cl-find trigger (yas--all-templates (yas--get-snippet-tables mode)) - :key #'yas--template-key :test #'equal)) - (yas-expand-snippet (yas--template-content template))) - (and (featurep 'evil) evil-local-mode) - (and yas--active-field-overlay - (overlay-buffer yas--active-field-overlay) - (overlay-get yas--active-field-overlay 'yas--field))) - (evil-initialize-state 'insert)))))) - -;;;###autoload -(defun +file-templates-get-short-path () - "Fetches a short file path for the header in Doom module templates." - (let ((path (file-truename (or buffer-file-name default-directory)))) - (save-match-data - (cond ((string-match "/modules/\\(.+\\)$" path) - (match-string 1 path)) - ((file-in-directory-p path doom-emacs-dir) - (file-relative-name path doom-emacs-dir)) - ((file-in-directory-p path doom-private-dir) - (file-relative-name path doom-private-dir)) - ((abbreviate-file-name path)))))) - - -;; -;;; Commands - -;;;###autoload -(defun +file-templates/insert-license () - "Insert a license file template into the current file." - (interactive) - (require 'yasnippet) - (unless (gethash 'text-mode yas--tables) - (yas-reload-all t)) - (let ((templates - (let (yas-choose-tables-first ; avoid prompts - yas-choose-keys-first) - (cl-loop for tpl in (yas--all-templates (yas--get-snippet-tables 'text-mode)) - for uuid = (yas--template-uuid tpl) - if (string-prefix-p "__license-" uuid) - collect (cons (string-remove-prefix "__license-" uuid) tpl))))) - (when-let (uuid (yas-choose-value (mapcar #'car templates))) - (yas-expand-snippet (cdr (assoc uuid templates)))))) - -;;;###autoload -(defun +file-templates/debug () - "Tests the current buffer and outputs the file template rule most appropriate -for it. This is used for testing." - (interactive) - (cl-destructuring-bind (pred &rest plist &key trigger mode &allow-other-keys) - (or (cl-find-if #'+file-template-p +file-templates-alist) - (user-error "Found no file template for this file")) - (if (or (functionp trigger) - (cl-find trigger - (yas--all-templates - (yas--get-snippet-tables - mode)) - :key #'yas--template-key :test #'equal)) - (message "Found %s" (cons pred plist)) - (message "Found rule, but can't find associated snippet: %s" (cons pred plist))))) diff --git a/.config/emacs/modules/editor/file-templates/config.el b/.config/emacs/modules/editor/file-templates/config.el deleted file mode 100644 index 3de046a..0000000 --- a/.config/emacs/modules/editor/file-templates/config.el +++ /dev/null @@ -1,169 +0,0 @@ -;;; editor/file-templates/config.el -*- lexical-binding: t; -*- - -(defvar +file-templates-dir - (expand-file-name "templates/" (file-name-directory load-file-name)) - "The path to a directory of yasnippet folders to use for file templates.") - -(defvar +file-templates-default-trigger "__" - "The default yasnippet trigger key (a string) for file template rules that -don't have a :trigger property in `+file-templates-alist'.") - -(defvar +file-templates-inhibit nil - "If non-nil, inhibit file template expansion.") - -(defvar +file-templates-alist - '(;; General - (gitignore-mode) - (dockerfile-mode) - ("/docker-compose\\.yml$" :mode yaml-mode) - ("/Makefile$" :mode makefile-gmake-mode) - ;; elisp - ("/.dir-locals.el$") - ("/packages\\.el$" :when +file-templates-in-emacs-dirs-p - :trigger "__doom-packages" - :mode emacs-lisp-mode) - ("/doctor\\.el$" :when +file-templates-in-emacs-dirs-p - :trigger "__doom-doctor" - :mode emacs-lisp-mode) - ("/test/.+\\.el$" :when +file-templates-in-emacs-dirs-p - :trigger "__doom-test" - :mode emacs-lisp-mode) - ("\\.el$" :when +file-templates-in-emacs-dirs-p - :trigger "__doom-module" - :mode emacs-lisp-mode) - ("-test\\.el$" :mode emacs-ert-mode) - (emacs-lisp-mode :trigger "__package") - (snippet-mode) - ;; C/C++ - ("/main\\.c\\(?:c\\|pp\\)$" :trigger "__main.cpp" :mode c++-mode) - ("/win32_\\.c\\(?:c\\|pp\\)$" :trigger "__winmain.cpp" :mode c++-mode) - ("\\.c\\(?:c\\|pp\\)$" :trigger "__cpp" :mode c++-mode) - ("\\.h\\(?:h\\|pp\\|xx\\)$" :trigger "__hpp" :mode c++-mode) - ("\\.h$" :trigger "__h" :mode c-mode) - (c-mode :trigger "__c") - ;; direnv - ("/\\.envrc$" :trigger "__envrc" :mode direnv-envrc-mode) - ;; go - ("/main\\.go$" :trigger "__main.go" :mode go-mode :project t) - (go-mode :trigger "__.go") - ;; web-mode - ("/normalize\\.scss$" :trigger "__normalize.scss" :mode scss-mode) - ("/master\\.scss$" :trigger "__master.scss" :mode scss-mode) - ("\\.html$" :trigger "__.html" :mode web-mode) - (scss-mode) - ;; java - ("/main\\.java$" :trigger "__main" :mode java-mode) - ("/build\\.gradle$" :trigger "__build.gradle" :mode android-mode) - ("/src/.+\\.java$" :mode java-mode) - ;; javascript - ("/package\\.json$" :trigger "__package.json" :mode json-mode) - ("/bower\\.json$" :trigger "__bower.json" :mode json-mode) - ("/gulpfile\\.js$" :trigger "__gulpfile.js" :mode js-mode) - ("/webpack\\.config\\.js$" :trigger "__webpack.config.js" :mode js-mode) - ("\\.js\\(?:on\\|hintrc\\)$" :mode json-mode) - ;; Lua - ("/main\\.lua$" :trigger "__main.lua" :mode love-mode) - ("/conf\\.lua$" :trigger "__conf.lua" :mode love-mode) - ;; Markdown - (markdown-mode) - ;; Markdown - (nxml-mode) - ;; Nix - ("/shell\\.nix$" :trigger "__shell.nix") - (nix-mode) - ;; Org - ("/README\\.org$" - :when +file-templates-in-emacs-dirs-p - :trigger "__doom-readme" - :mode org-mode) - (org-journal-mode :ignore t) - (org-mode) - ;; PHP - ("\\.class\\.php$" :trigger "__.class.php" :mode php-mode) - (php-mode) - ;; Python - ;; TODO ("tests?/test_.+\\.py$" :trigger "__" :mode nose-mode) - ;; TODO ("/setup\\.py$" :trigger "__setup.py" :mode python-mode) - (python-mode) - ;; Ruby - ("/lib/.+\\.rb$" :trigger "__module" :mode ruby-mode :project t) - ("/spec_helper\\.rb$" :trigger "__helper" :mode rspec-mode :project t) - ("_spec\\.rb$" :mode rspec-mode :project t) - ("/\\.rspec$" :trigger "__.rspec" :mode rspec-mode :project t) - ("\\.gemspec$" :trigger "__.gemspec" :mode ruby-mode :project t) - ("/Gemfile$" :trigger "__Gemfile" :mode ruby-mode :project t) - ("/Rakefile$" :trigger "__Rakefile" :mode ruby-mode :project t) - (ruby-mode) - ;; Rust - ("/Cargo.toml$" :trigger "__Cargo.toml" :mode rust-mode) - ("/main\\.rs$" :trigger "__main.rs" :mode rust-mode) - ;; Slim - ("/\\(?:index\\|main\\)\\.slim$" :mode slim-mode) - ;; Shell scripts - ("\\.zunit$" :trigger "__zunit" :mode sh-mode) - (fish-mode) - (sh-mode) - ;; Solidity - (solidity-mode :trigger "__sol")) - "An alist of file template rules. The CAR of each rule is either a major mode -symbol or regexp string. The CDR is a plist. See `set-file-template!' for more -information.") - - -;; -;;; Library - -(defun +file-templates-in-emacs-dirs-p (file) - "Returns t if FILE is in Doom or your private directory." - (or (file-in-directory-p file doom-private-dir) - (file-in-directory-p file doom-emacs-dir))) - -(defun +file-template-p (rule) - "Return t if RULE applies to the current buffer." - (let ((pred (car rule)) - (plist (cdr rule))) - (and (or (and (symbolp pred) - (eq major-mode pred)) - (and (stringp pred) - (stringp buffer-file-name) - (string-match-p pred buffer-file-name))) - (or (not (plist-member plist :when)) - (funcall (plist-get plist :when) - buffer-file-name)) - rule))) - -(defun +file-templates-check-h () - "Check if the current buffer is a candidate for file template expansion. It -must be non-read-only, empty, and there must be a rule in -`+file-templates-alist' that applies to it." - (and (not +file-templates-inhibit) - buffer-file-name - (not buffer-read-only) - (bobp) (eobp) - (not (member (substring (buffer-name) 0 1) '("*" " "))) - (not (file-exists-p buffer-file-name)) - (not (buffer-modified-p)) - (when-let (rule (cl-find-if #'+file-template-p +file-templates-alist)) - (apply #'+file-templates--expand rule)))) - -(defadvice! +file-templates-inhibit-in-org-capture-a (fn &rest args) - :around #'org-capture - (let ((+file-templates-inhibit t)) - (apply fn args))) - - -;; -;;; Bootstrap - -(after! yasnippet - (if (featurep! :editor snippets) - (add-to-list 'yas-snippet-dirs '+file-templates-dir 'append #'eq) - (setq yas-prompt-functions (delq #'yas-dropdown-prompt yas-prompt-functions) - yas-snippet-dirs '(+file-templates-dir)) - ;; Exit snippets on ESC from normal mode - (add-hook 'doom-escape-hook #'yas-abort-snippet) - ;; Ensure file templates in `+file-templates-dir' are visible - (yas-reload-all))) - -;; -(add-hook 'doom-switch-buffer-hook #'+file-templates-check-h) diff --git a/.config/emacs/modules/editor/file-templates/packages.el b/.config/emacs/modules/editor/file-templates/packages.el deleted file mode 100644 index 247da6b..0000000 --- a/.config/emacs/modules/editor/file-templates/packages.el +++ /dev/null @@ -1,4 +0,0 @@ -;; -*- no-byte-compile: t; -*- -;;; editor/file-templates/packages.el - -(package! yasnippet :pin "5cbdbf0d2015540c59ed8ee0fcf4788effdf75b6") diff --git a/.config/emacs/modules/editor/file-templates/templates/.editorconfig b/.config/emacs/modules/editor/file-templates/templates/.editorconfig deleted file mode 100644 index c6d4238..0000000 --- a/.config/emacs/modules/editor/file-templates/templates/.editorconfig +++ /dev/null @@ -1,7 +0,0 @@ -[*] -indent_style = space -indent_size = 4 -end_of_line = lf -charset = utf-8 -trim_trailing_whitespace = false -insert_final_newline = false diff --git a/.config/emacs/modules/editor/file-templates/templates/android-mode/__build.gradle b/.config/emacs/modules/editor/file-templates/templates/android-mode/__build.gradle deleted file mode 100644 index 68ab148..0000000 --- a/.config/emacs/modules/editor/file-templates/templates/android-mode/__build.gradle +++ /dev/null @@ -1,49 +0,0 @@ -# -*- mode: snippet -*- -# name: build.gradle template -# condition: (eq major-mode 'groovy-mode) -# -- -buildscript { - repositories { - mavenCentral() - } - dependencies { - classpath 'com.android.tools.build:gradle:1.2.3' - } -} - -apply plugin: 'android' - -android { - compileSdkVersion 22 - buildToolsVersion "22.0.1" - - sourceSets { - main { - manifest.srcFile 'AndroidManifest.xml' - java.srcDirs = ['java'] - resources.srcDirs = ['java'] - aidl.srcDirs = ['java'] - renderscript.srcDirs = ['java'] - res.srcDirs = ['res'] - assets.srcDirs = ['assets'] - } - - // Move the tests to tests/java, tests/res, etc... - androidTest.setRoot('../tests') - - // Move the build types to build-types/ - // For instance, build-types/debug/java, build-types/debug/AndroidManifest.xml, ... - // This moves them out of them default location under src//... which would - // conflict with src/ being used by the main source set. - // Adding new build types or product flavors should be accompanied - // by a similar customization. - debug.setRoot('build-types/debug') - release.setRoot('build-types/release') - } - - lintOptions { - abortOnError false - } -} - -$0 diff --git a/.config/emacs/modules/editor/file-templates/templates/c++-mode/__cpp b/.config/emacs/modules/editor/file-templates/templates/c++-mode/__cpp deleted file mode 100644 index 10f8293..0000000 --- a/.config/emacs/modules/editor/file-templates/templates/c++-mode/__cpp +++ /dev/null @@ -1,7 +0,0 @@ -# -*- mode: snippet -*- -# group: file templates -# contributor: Henrik Lissner -# -- -#include "`(file-name-nondirectory (file-name-sans-extension (buffer-file-name)))`.h" - -$0 diff --git a/.config/emacs/modules/editor/file-templates/templates/c++-mode/__hpp b/.config/emacs/modules/editor/file-templates/templates/c++-mode/__hpp deleted file mode 100644 index 3e4bc92..0000000 --- a/.config/emacs/modules/editor/file-templates/templates/c++-mode/__hpp +++ /dev/null @@ -1,10 +0,0 @@ -# -*- mode: snippet -*- -# group: file templates -# contributor: Henrik Lissner -# -- -#ifndef ${1:`(upcase (file-name-base buffer-file-name))`_H_$(upcase yas-text)} -#define $1 - -$0 - -#endif // $1 diff --git a/.config/emacs/modules/editor/file-templates/templates/c++-mode/__main.cpp b/.config/emacs/modules/editor/file-templates/templates/c++-mode/__main.cpp deleted file mode 100644 index b4a1557..0000000 --- a/.config/emacs/modules/editor/file-templates/templates/c++-mode/__main.cpp +++ /dev/null @@ -1,13 +0,0 @@ -# -*- mode: snippet -*- -# group: file templates -# contributor: Henrik Lissner -# -- -#include - -using namespace std; - -int main(int argc, char *argv[]) { - $0 - - return 0; -} diff --git a/.config/emacs/modules/editor/file-templates/templates/c++-mode/__winmain.cpp b/.config/emacs/modules/editor/file-templates/templates/c++-mode/__winmain.cpp deleted file mode 100644 index 67947be..0000000 --- a/.config/emacs/modules/editor/file-templates/templates/c++-mode/__winmain.cpp +++ /dev/null @@ -1,12 +0,0 @@ -# -*- mode: snippet -*- -# group: file templates -# contributor: Henrik Lissner -# -- -#include - -int CALLBACK WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow) -{ - $0 - - return 0; -} diff --git a/.config/emacs/modules/editor/file-templates/templates/c-mode/__c b/.config/emacs/modules/editor/file-templates/templates/c-mode/__c deleted file mode 100644 index 10f8293..0000000 --- a/.config/emacs/modules/editor/file-templates/templates/c-mode/__c +++ /dev/null @@ -1,7 +0,0 @@ -# -*- mode: snippet -*- -# group: file templates -# contributor: Henrik Lissner -# -- -#include "`(file-name-nondirectory (file-name-sans-extension (buffer-file-name)))`.h" - -$0 diff --git a/.config/emacs/modules/editor/file-templates/templates/c-mode/__h b/.config/emacs/modules/editor/file-templates/templates/c-mode/__h deleted file mode 100644 index 3e4bc92..0000000 --- a/.config/emacs/modules/editor/file-templates/templates/c-mode/__h +++ /dev/null @@ -1,10 +0,0 @@ -# -*- mode: snippet -*- -# group: file templates -# contributor: Henrik Lissner -# -- -#ifndef ${1:`(upcase (file-name-base buffer-file-name))`_H_$(upcase yas-text)} -#define $1 - -$0 - -#endif // $1 diff --git a/.config/emacs/modules/editor/file-templates/templates/direnv-envrc-mode/__envrc b/.config/emacs/modules/editor/file-templates/templates/direnv-envrc-mode/__envrc deleted file mode 100644 index 605f9c9..0000000 --- a/.config/emacs/modules/editor/file-templates/templates/direnv-envrc-mode/__envrc +++ /dev/null @@ -1,15 +0,0 @@ -# -*- mode: snippet -*- -# group: file templates -# contributor: Henrik Lissner -# condition: (executable-find "nix-env") -# -- -if type lorri &>/dev/null; then - echo "direnv: using lorri" - eval "$(lorri direnv)" -else - # fall back to using direnv's builtin nix support - # to prevent bootstrapping problems. - use nix -fi - -`%`$0 \ No newline at end of file diff --git a/.config/emacs/modules/editor/file-templates/templates/dockerfile-mode/__ b/.config/emacs/modules/editor/file-templates/templates/dockerfile-mode/__ deleted file mode 100644 index 9d1f81e..0000000 --- a/.config/emacs/modules/editor/file-templates/templates/dockerfile-mode/__ +++ /dev/null @@ -1,4 +0,0 @@ -FROM ${1:phusion/baseimage:latest} -MAINTAINER ${2:`user-full-name` <`user-mail-address`>} - -$0 \ No newline at end of file diff --git a/.config/emacs/modules/editor/file-templates/templates/emacs-ert-mode/__ b/.config/emacs/modules/editor/file-templates/templates/emacs-ert-mode/__ deleted file mode 100644 index 425b713..0000000 --- a/.config/emacs/modules/editor/file-templates/templates/emacs-ert-mode/__ +++ /dev/null @@ -1,3 +0,0 @@ -;;; `(file-name-nondirectory buffer-file-name)` - -$0 \ No newline at end of file diff --git a/.config/emacs/modules/editor/file-templates/templates/emacs-lisp-mode/__doom-doctor b/.config/emacs/modules/editor/file-templates/templates/emacs-lisp-mode/__doom-doctor deleted file mode 100644 index af30ef1..0000000 --- a/.config/emacs/modules/editor/file-templates/templates/emacs-lisp-mode/__doom-doctor +++ /dev/null @@ -1,3 +0,0 @@ -;;; `(+file-templates-get-short-path)` -*- lexical-binding: t; -*- - -$0 diff --git a/.config/emacs/modules/editor/file-templates/templates/emacs-lisp-mode/__doom-module b/.config/emacs/modules/editor/file-templates/templates/emacs-lisp-mode/__doom-module deleted file mode 100644 index af30ef1..0000000 --- a/.config/emacs/modules/editor/file-templates/templates/emacs-lisp-mode/__doom-module +++ /dev/null @@ -1,3 +0,0 @@ -;;; `(+file-templates-get-short-path)` -*- lexical-binding: t; -*- - -$0 diff --git a/.config/emacs/modules/editor/file-templates/templates/emacs-lisp-mode/__doom-packages b/.config/emacs/modules/editor/file-templates/templates/emacs-lisp-mode/__doom-packages deleted file mode 100644 index bf02a04..0000000 --- a/.config/emacs/modules/editor/file-templates/templates/emacs-lisp-mode/__doom-packages +++ /dev/null @@ -1,4 +0,0 @@ -;; -*- no-byte-compile: t; -*- -;;; `(+file-templates-get-short-path)` - -$0 diff --git a/.config/emacs/modules/editor/file-templates/templates/emacs-lisp-mode/__doom-test b/.config/emacs/modules/editor/file-templates/templates/emacs-lisp-mode/__doom-test deleted file mode 100644 index 0548197..0000000 --- a/.config/emacs/modules/editor/file-templates/templates/emacs-lisp-mode/__doom-test +++ /dev/null @@ -1,4 +0,0 @@ -;; -*- no-byte-compile: t; -*- -;;; `(+file-templates-get-short-path)` - -$0 \ No newline at end of file diff --git a/.config/emacs/modules/editor/file-templates/templates/emacs-lisp-mode/__package b/.config/emacs/modules/editor/file-templates/templates/emacs-lisp-mode/__package deleted file mode 100644 index 60e3c15..0000000 --- a/.config/emacs/modules/editor/file-templates/templates/emacs-lisp-mode/__package +++ /dev/null @@ -1,25 +0,0 @@ -;;; `(file-name-nondirectory buffer-file-name)`${1: --- ${2:Description}} -*- lexical-binding: t; -*- -;; -;; Copyright (C) `(format-time-string "%Y")` `user-full-name` -;; -;; Author: `user-full-name` -;; Maintainer: `user-full-name` <`user-mail-address`> -;; Created: `(format-time-string "%B %d, %Y")` -;; Modified: `(format-time-string "%B %d, %Y")` -;; Version: 0.0.1 -;; Keywords: `(mapconcat #'symbol-name (mapcar #'car finder-known-keywords) " ")` -;; Homepage: https://github.com/`(cl-find-if-not #'string-empty-p (list (cdr (doom-call-process "git" "config" "github.user")) user-login-name))`/`(file-name-base buffer-file-name)` -;; Package-Requires: ((emacs "24.3")) -;; -;; This file is not part of GNU Emacs. -;; -;;; Commentary: -;; -;; $2 -;; -;;; Code: - -`%`$0 - -(provide '`(file-name-base buffer-file-name)`) -;;; `(file-name-nondirectory buffer-file-name)` ends here diff --git a/.config/emacs/modules/editor/file-templates/templates/fish-mode/__ b/.config/emacs/modules/editor/file-templates/templates/fish-mode/__ deleted file mode 100644 index a4ef95d..0000000 --- a/.config/emacs/modules/editor/file-templates/templates/fish-mode/__ +++ /dev/null @@ -1,3 +0,0 @@ -#!/usr/bin/env fish - -$0 diff --git a/.config/emacs/modules/editor/file-templates/templates/gitignore-mode/__ b/.config/emacs/modules/editor/file-templates/templates/gitignore-mode/__ deleted file mode 100644 index 29dc5ed..0000000 --- a/.config/emacs/modules/editor/file-templates/templates/gitignore-mode/__ +++ /dev/null @@ -1,68 +0,0 @@ -.DS_Store -.idea -*.log -tmp/ - -`(let ((type-ignore (yas-choose-value '("(none)" "python" "ruby" "java" "js" "haskell" "clojure")))) - (string-join - (cond ((string= type-ignore "python") - '("*.py[cod]" - "*.egg" - "build" - "htmlcov")) - ((string= type-ignore "ruby") - '(".ruby-version" - ".bundle" - "vendor" - "Gemfile.lock" - "coverage")) - ((string= type-ignore "java") - '("*.class" - "build")) - ((string= type-ignore "js") - '("*.tern-port" - "node_modules/" - "npm-debug.log*" - "yarn-debug.log*" - "yarn-error.log*" - "*.tsbuildinfo" - ".npm" - ".eslintcache")) - ((string= type-ignore "haskell") - '("dist" - "dist-*" - "cabal-dev" - "*.o" - "*.hi" - "*.hie" - "*.chi" - "*.chs.h" - "*.dyn_o" - "*.dyn_hi" - ".hpc" - ".hsenv" - ".cabal-sandbox/" - "cabal.sandbox.config" - "*.prof" - "*.aux" - "*.hp" - "*.eventlog" - ".stack-work/" - "cabal.project.local" - "cabal.project.local~" - ".HTF/" - ".ghc.environment.*")) - ((string= type-ignore "clojure") - '("/target" - "/classes" - "/checkouts" - "profiles.clj" - "pom.xml" - "pom.xml.asc" - "*.jar" - "*.class" - "/.lein-*" - "/.nrepl-port" - "/.prepl-port" - "/.cpcache"))) - "\n"))` diff --git a/.config/emacs/modules/editor/file-templates/templates/go-mode/__.go b/.config/emacs/modules/editor/file-templates/templates/go-mode/__.go deleted file mode 100644 index c37b758..0000000 --- a/.config/emacs/modules/editor/file-templates/templates/go-mode/__.go +++ /dev/null @@ -1,7 +0,0 @@ -package ${1:main} - -import ( - "fmt" -) - -$0 \ No newline at end of file diff --git a/.config/emacs/modules/editor/file-templates/templates/go-mode/__main.go b/.config/emacs/modules/editor/file-templates/templates/go-mode/__main.go deleted file mode 100644 index 9aacb34..0000000 --- a/.config/emacs/modules/editor/file-templates/templates/go-mode/__main.go +++ /dev/null @@ -1,9 +0,0 @@ -package ${1:main} - -import ( - "fmt" -) - -func main() { - $0 -} \ No newline at end of file diff --git a/.config/emacs/modules/editor/file-templates/templates/java-mode/__annotation-type b/.config/emacs/modules/editor/file-templates/templates/java-mode/__annotation-type deleted file mode 100644 index 7316089..0000000 --- a/.config/emacs/modules/editor/file-templates/templates/java-mode/__annotation-type +++ /dev/null @@ -1,9 +0,0 @@ -# -*- mode: snippet -*- -# name: Java annotation type file template -# -- -package `(+java-current-package)`; - -public @interface `(+java-current-class)` -{ - $0 -} \ No newline at end of file diff --git a/.config/emacs/modules/editor/file-templates/templates/java-mode/__class b/.config/emacs/modules/editor/file-templates/templates/java-mode/__class deleted file mode 100644 index ce9a579..0000000 --- a/.config/emacs/modules/editor/file-templates/templates/java-mode/__class +++ /dev/null @@ -1,9 +0,0 @@ -# -*- mode: snippet -*- -# name: Java class file template -# -- -package `(+java-current-package)`; - -public class `(+java-current-class)` $1 -{ - $0 -} diff --git a/.config/emacs/modules/editor/file-templates/templates/java-mode/__enum b/.config/emacs/modules/editor/file-templates/templates/java-mode/__enum deleted file mode 100644 index e8d0f56..0000000 --- a/.config/emacs/modules/editor/file-templates/templates/java-mode/__enum +++ /dev/null @@ -1,9 +0,0 @@ -# -*- mode: snippet -*- -# name: Java enum file template -# -- -package `(+java-current-package)`; - -public enum `(+java-current-class)` -{ - $0 -} \ No newline at end of file diff --git a/.config/emacs/modules/editor/file-templates/templates/java-mode/__interface b/.config/emacs/modules/editor/file-templates/templates/java-mode/__interface deleted file mode 100644 index 7b0fe8c..0000000 --- a/.config/emacs/modules/editor/file-templates/templates/java-mode/__interface +++ /dev/null @@ -1,9 +0,0 @@ -# -*- mode: snippet -*- -# name: Java interface file template -# -- -package `(+java-current-package)`; - -public interface `(+java-current-class)` -{ - $0 -} \ No newline at end of file diff --git a/.config/emacs/modules/editor/file-templates/templates/java-mode/__main b/.config/emacs/modules/editor/file-templates/templates/java-mode/__main deleted file mode 100644 index 748a9d9..0000000 --- a/.config/emacs/modules/editor/file-templates/templates/java-mode/__main +++ /dev/null @@ -1,11 +0,0 @@ -# -*- mode: snippet -*- -# name: Java MAIN file template -# -- -package `(+java-current-package)`; - -public class `(+java-current-class)` $1 -{ - public static void main(String[] args) { - $0 - } -} diff --git a/.config/emacs/modules/editor/file-templates/templates/java-mode/__record b/.config/emacs/modules/editor/file-templates/templates/java-mode/__record deleted file mode 100644 index 3ea4020..0000000 --- a/.config/emacs/modules/editor/file-templates/templates/java-mode/__record +++ /dev/null @@ -1,8 +0,0 @@ -# -*- mode: snippet -*- -# name: Java record file template -# -- -package `(+java-current-package)`; - -public record `(+java-current-class)`($0) $1 -{ -} \ No newline at end of file diff --git a/.config/emacs/modules/editor/file-templates/templates/js-mode/__gulpfile.js b/.config/emacs/modules/editor/file-templates/templates/js-mode/__gulpfile.js deleted file mode 100644 index 8707798..0000000 --- a/.config/emacs/modules/editor/file-templates/templates/js-mode/__gulpfile.js +++ /dev/null @@ -1,4 +0,0 @@ -const gulp = require('gulp'); - -// Default task -gulp.task('default', [$1]); \ No newline at end of file diff --git a/.config/emacs/modules/editor/file-templates/templates/js-mode/__webpack.config.js b/.config/emacs/modules/editor/file-templates/templates/js-mode/__webpack.config.js deleted file mode 100644 index d7998e1..0000000 --- a/.config/emacs/modules/editor/file-templates/templates/js-mode/__webpack.config.js +++ /dev/null @@ -1,21 +0,0 @@ -module.exports = { - entry: [ - ${1:'./app/main.js'} - ], - output: { - path: __dirname + '/dist', - filename: "app.bundle.js" - }, - module: { - rules: [ - { - test: /\.js$/, - exclude: /node_modules/, - use: { - loader: "babel-loader" - } - } - ] - }, - // plugins: [] -}; diff --git a/.config/emacs/modules/editor/file-templates/templates/json-mode/__ b/.config/emacs/modules/editor/file-templates/templates/json-mode/__ deleted file mode 100644 index e959722..0000000 --- a/.config/emacs/modules/editor/file-templates/templates/json-mode/__ +++ /dev/null @@ -1,3 +0,0 @@ -[ - $0 -] diff --git a/.config/emacs/modules/editor/file-templates/templates/json-mode/__bower.json b/.config/emacs/modules/editor/file-templates/templates/json-mode/__bower.json deleted file mode 100644 index 6513f26..0000000 --- a/.config/emacs/modules/editor/file-templates/templates/json-mode/__bower.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "name": "${1:package-name}", - "description": "${2:description}", - "license": "MIT", - "authors": [ - "`user-full-name` <`user-mail-address`>" - ], - "main": "public/app.js", - "moduleType": [], - "homepage": "", - "dependencies": { - `%`$0 - } -} \ No newline at end of file diff --git a/.config/emacs/modules/editor/file-templates/templates/json-mode/__package.json b/.config/emacs/modules/editor/file-templates/templates/json-mode/__package.json deleted file mode 100644 index cff3553..0000000 --- a/.config/emacs/modules/editor/file-templates/templates/json-mode/__package.json +++ /dev/null @@ -1,13 +0,0 @@ -{ - "name": "${1:package-name}", - "description": "${2:description}", - "version": "1.0.0", - "author": "`user-full-name` <`user-mail-address`>", - "license": "MIT", - "main": "${3:app/${4:main.js}}", - "scripts": { - $0 - }, - "dependencies": {}, - "devDependencies": {} -} \ No newline at end of file diff --git a/.config/emacs/modules/editor/file-templates/templates/love-mode/__conf.lua b/.config/emacs/modules/editor/file-templates/templates/love-mode/__conf.lua deleted file mode 100644 index ee66815..0000000 --- a/.config/emacs/modules/editor/file-templates/templates/love-mode/__conf.lua +++ /dev/null @@ -1,40 +0,0 @@ -# -*- mode: snippet -*- -# name: love.conf -# condition: (eq major-mode 'lua-mode) -# -- -function love.conf(t) - t.identity = nil -- The name of the save directory (string) - t.version = "0.9.1" -- The LÖVE version this game was made for (string) - t.console = false -- Attach a console (boolean, Windows only) - - t.window.title = "${1:Untitled}" -- The window title (string) - t.window.icon = nil -- Filepath to an image to use as the window's icon (string) - t.window.width = 800 -- The window width (number) - t.window.height = 600 -- The window height (number) - t.window.borderless = false -- Remove all border visuals from the window (boolean) - t.window.resizable = false -- Let the window be user-resizable (boolean) - t.window.minwidth = 1 -- Minimum window width if the window is resizable (number) - t.window.minheight = 1 -- Minimum window height if the window is resizable (number) - t.window.fullscreen = false -- Enable fullscreen (boolean) - t.window.fullscreentype = "normal" -- Standard fullscreen or desktop fullscreen mode (string) - t.window.vsync = true -- Enable vertical sync (boolean) - t.window.fsaa = 0 -- The number of samples to use with multi-sampled antialiasing (number) - t.window.display = 1 -- Index of the monitor to show the window in (number) - t.window.highdpi = false -- Enable high-dpi mode for the window on a Retina display (boolean). Added in 0.9.1 - t.window.srgb = false -- Enable sRGB gamma correction when drawing to the screen (boolean). Added in 0.9.1 - - t.modules.audio = true -- Enable the audio module (boolean) - t.modules.event = true -- Enable the event module (boolean) - t.modules.graphics = true -- Enable the graphics module (boolean) - t.modules.image = true -- Enable the image module (boolean) - t.modules.joystick = true -- Enable the joystick module (boolean) - t.modules.keyboard = true -- Enable the keyboard module (boolean) - t.modules.math = true -- Enable the math module (boolean) - t.modules.mouse = true -- Enable the mouse module (boolean) - t.modules.physics = true -- Enable the physics module (boolean) - t.modules.sound = true -- Enable the sound module (boolean) - t.modules.system = true -- Enable the system module (boolean) - t.modules.timer = true -- Enable the timer module (boolean) - t.modules.window = true -- Enable the window module (boolean) - t.modules.thread = true -- Enable the thread module (boolean) -end diff --git a/.config/emacs/modules/editor/file-templates/templates/love-mode/__main.lua b/.config/emacs/modules/editor/file-templates/templates/love-mode/__main.lua deleted file mode 100644 index e69de29..0000000 diff --git a/.config/emacs/modules/editor/file-templates/templates/makefile-gmake-mode/__ b/.config/emacs/modules/editor/file-templates/templates/makefile-gmake-mode/__ deleted file mode 100644 index 466fab2..0000000 --- a/.config/emacs/modules/editor/file-templates/templates/makefile-gmake-mode/__ +++ /dev/null @@ -1,9 +0,0 @@ -## -# ${1:Project Title} -# -# @file -# @version 0.1 - -$0 - -# end diff --git a/.config/emacs/modules/editor/file-templates/templates/makefile-gmake-mode/__cpp b/.config/emacs/modules/editor/file-templates/templates/makefile-gmake-mode/__cpp deleted file mode 100644 index d589c26..0000000 --- a/.config/emacs/modules/editor/file-templates/templates/makefile-gmake-mode/__cpp +++ /dev/null @@ -1,46 +0,0 @@ -# -*- mode: snippet -*- -# contributor: Henrik Lissner -# -- -CC = clang++ -TAGS = ctags -e -x >TAGS -FLAGS = -std=c++11 -stdlib=libc++ -Iinclude -I/usr/local/include -L/usr/local/lib -CFLAGS = -pedantic -Wall -Wextra -ggdb3 -LIBS = # ... - -DEBUG_FLAGS = -O0 -D _DEBUG -RELEASE_FLAGS = -O2 -D NDEBUG -combile -fwhole-program - -RELEASE_DIR = ./build/release -DEBUG_DIR = ./build/debug - -TARGET = ${1:appname$(replace-regexp-in-string " " "" yas-text nil t)} -HEADERS = \$(shell echo include/*.h) -SOURCES = \$(shell echo src/*.cpp) \$(shell echo src/**/*.cpp) -OBJECTS = \$(SOURCES:.cpp=.o) - -### - -all: \$(TARGET) - -debug: FLAGS += \$(DEBUG_FLAGS) -debug: \$(TARGET) - -release: FLAGS += \$(RELEASE_FLAGS) -release: \$(TARGET) - -profile: CFLAGS += -pg -profile: \$(TARGET) - -\$(TARGET): \$(OBJECTS) - \$(CC) \$(FLAGS) \$(CFLAGS) -o \$(TARGET) \$(OBJECTS) - -%.o: %.cpp - \$(CC) \$(FLAGS) \$(CFLAGS) -c -o \$@ \$< - -tags: \$(SOURCES) - \$(CTAGS) \$(SOURCES) - -clean: - -rm -f \$(OBJECTS) \$(TARGET) - -.PHONY: all profile release debug clean \ No newline at end of file diff --git a/.config/emacs/modules/editor/file-templates/templates/markdown-mode/__ b/.config/emacs/modules/editor/file-templates/templates/markdown-mode/__ deleted file mode 100644 index 74c930c..0000000 --- a/.config/emacs/modules/editor/file-templates/templates/markdown-mode/__ +++ /dev/null @@ -1,6 +0,0 @@ -# -*- mode: snippet -*- -# group: file templates -# -- -# ${1:Document Title} - -$0 \ No newline at end of file diff --git a/.config/emacs/modules/editor/file-templates/templates/markdown-mode/__jekyll-post b/.config/emacs/modules/editor/file-templates/templates/markdown-mode/__jekyll-post deleted file mode 100644 index 42fd944..0000000 --- a/.config/emacs/modules/editor/file-templates/templates/markdown-mode/__jekyll-post +++ /dev/null @@ -1,7 +0,0 @@ -# -*- mode: snippet -*- -# group: file templates -# -- ---- -layout: ${1:default} ---- -$0 diff --git a/.config/emacs/modules/editor/file-templates/templates/nix-mode/__ b/.config/emacs/modules/editor/file-templates/templates/nix-mode/__ deleted file mode 100644 index 427a3dc..0000000 --- a/.config/emacs/modules/editor/file-templates/templates/nix-mode/__ +++ /dev/null @@ -1,9 +0,0 @@ -# -*- mode: snippet -*- -# group: file templates -# contributor: Henrik Lissner -# -- -{ config, lib, pkgs, ... }: - -{ - $0 -} \ No newline at end of file diff --git a/.config/emacs/modules/editor/file-templates/templates/nix-mode/__shell.nix b/.config/emacs/modules/editor/file-templates/templates/nix-mode/__shell.nix deleted file mode 100644 index f11f38d..0000000 --- a/.config/emacs/modules/editor/file-templates/templates/nix-mode/__shell.nix +++ /dev/null @@ -1,9 +0,0 @@ -{ pkgs ? import {} }: - -with pkgs; - -mkShell { - buildInputs = [ - ${0:`%`} - ]; -} \ No newline at end of file diff --git a/.config/emacs/modules/editor/file-templates/templates/nose-mode/__ b/.config/emacs/modules/editor/file-templates/templates/nose-mode/__ deleted file mode 100644 index e69de29..0000000 diff --git a/.config/emacs/modules/editor/file-templates/templates/nxml-mode/__ b/.config/emacs/modules/editor/file-templates/templates/nxml-mode/__ deleted file mode 100644 index 478d949..0000000 --- a/.config/emacs/modules/editor/file-templates/templates/nxml-mode/__ +++ /dev/null @@ -1,2 +0,0 @@ - -`%`$0 \ No newline at end of file diff --git a/.config/emacs/modules/editor/file-templates/templates/org-mode/__ b/.config/emacs/modules/editor/file-templates/templates/org-mode/__ deleted file mode 100644 index 08836b2..0000000 --- a/.config/emacs/modules/editor/file-templates/templates/org-mode/__ +++ /dev/null @@ -1,20 +0,0 @@ -# -*- mode: snippet -*- -# name: Org template -# -- -#+TITLE: ${1:` -(string-join - (mapcar #'capitalize - ;; Replace -,_... with space - (split-string - (let (case-fold-search) - ;; Seperating lower from upper: hello|World - (replace-regexp-in-string - "\\([[:lower:]]\\)\\([[:upper:]]\\)" "\\1 \\2" - ;; Separating upper from (upper and lower): HTTP|Server - (replace-regexp-in-string "\\([[:upper:]]\\)\\([[:upper:]][0-9[:lower:]]\\)" - "\\1 \\2" (file-name-base buffer-file-name)))) - "[^[:word:]0-9]+" - )) " " ) -`} - -$0 \ No newline at end of file diff --git a/.config/emacs/modules/editor/file-templates/templates/org-mode/__contact.org b/.config/emacs/modules/editor/file-templates/templates/org-mode/__contact.org deleted file mode 100644 index b346247..0000000 --- a/.config/emacs/modules/editor/file-templates/templates/org-mode/__contact.org +++ /dev/null @@ -1,17 +0,0 @@ -#+TITLE:${1:Contact Name} -#+DATE: `(format-time-string "%Y-%m-%d")` -#+EMAIL: ${2:email@address.com} -#+ADDRESS: $3 -#+CITY: $4 -#+COUNTRY: $5 - -${0:...} - -* Associates -+ Associate's name :: associates@email.com -* Projects [/] -** ACTIVE ... [/] -* Invoices [/] -** PENDING YYMM-0000 *1,000 USD* -* Notes -* Correspondence \ No newline at end of file diff --git a/.config/emacs/modules/editor/file-templates/templates/org-mode/__doom-readme b/.config/emacs/modules/editor/file-templates/templates/org-mode/__doom-readme deleted file mode 100644 index 6950674..0000000 --- a/.config/emacs/modules/editor/file-templates/templates/org-mode/__doom-readme +++ /dev/null @@ -1,70 +0,0 @@ -# -*- mode: snippet -*- -# name: Doom module readme -# -- -#+TITLE: ${1:`(if (string-match "modules/\\([^/]+\\)/\\([^/]+\\)/.+" buffer-file-name) - (format "%s/%s" - (match-string 1 buffer-file-name) - (match-string 2 buffer-file-name)) - "")`} -#+DATE: `(format (format-time-string "%B %%s, %Y") (string-to-number (format-time-string "%d")))` -#+SINCE: ${2:} -#+STARTUP: inlineimages nofold - -* Table of Contents :TOC_3:noexport: - -* Description -${3:# A summary of what this module does.} - -+ If possible, include a brief list of feature highlights here -+ Like code completion, syntax checking or available snippets -+ Include links to packages & external things where possible - -** Maintainers -+ @username_linked_to_gihub (Author) -+ @username_linked_to_gihub -+ @username_linked_to_gihub - -# If this module has no maintainers, then... -This module has no dedicated maintainers. - -** Module Flags -+ =+flag1= A short description of what this flag does and what it might need - when enabled. -+ =+flag2= A short description of what this flag does and what it might need - when enabled. -+ =+flag3= A short description of what this flag does and what it might need - when enabled. - -# If this module has no flags, then... -This module provides no flags. - -** Plugins -# A list of linked plugins -+ [[https://orgmode.org/][org-plus-contrib]] -+ [[https://github.com/sabof/org-bullets][org-bullets]] -+ [[https://github.com/TobiasZawada/org-yt][org-yt]] -+ [[https://github.com/sebastiencs/company-box][company-box]]* (=+childframe=) -+ =:lang crystal= - + [[https://github.com/brantou/ob-crystal][ob-crystal]] -+ =:lang go= - + [[https://github.com/pope/ob-go][ob-go]] -+ =+present= - + [[https://github.com/anler/centered-window-mode][centered-window]] - + [[https://github.com/takaxp/org-tree-slide][org-tree-slide]] - + [[https://gitlab.com/oer/org-re-reveal][org-re-reveal]] - -** Hacks -# A list of internal modifications to included packages; omit if unneeded - -* Prerequisites -This module has no prerequisites. - -* Features -# An in-depth list of features, how to use them, and their dependencies. - -* Configuration -# How to configure this module, including common problems and how to address them. - -* Troubleshooting -# Common issues and their solution, or places to look for help. -$0 \ No newline at end of file diff --git a/.config/emacs/modules/editor/file-templates/templates/org-mode/__invoice.org b/.config/emacs/modules/editor/file-templates/templates/org-mode/__invoice.org deleted file mode 100644 index f0241c6..0000000 --- a/.config/emacs/modules/editor/file-templates/templates/org-mode/__invoice.org +++ /dev/null @@ -1,21 +0,0 @@ -#+TITLE:${1:1234-5678} -#+DATE: `(format-time-string "%Y-%m-%d")` -#+ISSUED: ${2:`(format-time-string "%Y-%m-%d")`} -#+PAID: ${3:`(format-time-string "%Y-%m-%d")`} -#+CURRENCY: ${4:CAD|USD|DKK|GBP} -#+CONTACT: ${5:Contact ID} -#+PROJECT: ${6:Project ID} - -| *Description* | *qty* | *rate* | *total* | -|----------------------------------------------+-----+--------+-------| -| $0 [1] | | | | -|----------------------------------------------+-----+--------+-------| -| | | | | -#+TBLFM: $4=$2+$3::@>$4=vsum(@2..@-1) - -[1] ... - -* Comments -... -* Notes -** Attachments [0/0] \ No newline at end of file diff --git a/.config/emacs/modules/editor/file-templates/templates/org-mode/__project.org b/.config/emacs/modules/editor/file-templates/templates/org-mode/__project.org deleted file mode 100644 index 4546410..0000000 --- a/.config/emacs/modules/editor/file-templates/templates/org-mode/__project.org +++ /dev/null @@ -1,9 +0,0 @@ -#+TITLE:${1:Project Name} -#+DATE: `(format-time-string "%Y-%m-%d")` -#+CONTACT: ${2:Contact name} - -$0 - -* Tasks [/] -* Timeframe -* Notes \ No newline at end of file diff --git a/.config/emacs/modules/editor/file-templates/templates/php-mode/__ b/.config/emacs/modules/editor/file-templates/templates/php-mode/__ deleted file mode 100644 index 14ae8ba..0000000 --- a/.config/emacs/modules/editor/file-templates/templates/php-mode/__ +++ /dev/null @@ -1,3 +0,0 @@ -" ] -$0 diff --git a/.config/emacs/modules/editor/file-templates/templates/rust-mode/__main.rs b/.config/emacs/modules/editor/file-templates/templates/rust-mode/__main.rs deleted file mode 100644 index aa70177..0000000 --- a/.config/emacs/modules/editor/file-templates/templates/rust-mode/__main.rs +++ /dev/null @@ -1,3 +0,0 @@ -fn main() { - ${0:println!("Hello, world!");} -} diff --git a/.config/emacs/modules/editor/file-templates/templates/scss-mode/__ b/.config/emacs/modules/editor/file-templates/templates/scss-mode/__ deleted file mode 100644 index e69de29..0000000 diff --git a/.config/emacs/modules/editor/file-templates/templates/scss-mode/__master.scss b/.config/emacs/modules/editor/file-templates/templates/scss-mode/__master.scss deleted file mode 100644 index e69de29..0000000 diff --git a/.config/emacs/modules/editor/file-templates/templates/scss-mode/__normalize.scss b/.config/emacs/modules/editor/file-templates/templates/scss-mode/__normalize.scss deleted file mode 100644 index e69de29..0000000 diff --git a/.config/emacs/modules/editor/file-templates/templates/sh-mode/__ b/.config/emacs/modules/editor/file-templates/templates/sh-mode/__ deleted file mode 100644 index 3bb86a6..0000000 --- a/.config/emacs/modules/editor/file-templates/templates/sh-mode/__ +++ /dev/null @@ -1,3 +0,0 @@ -#!/usr/bin/env `(if (equal (file-name-extension buffer-file-name) "zsh") "zsh" "bash")` - -$0 diff --git a/.config/emacs/modules/editor/file-templates/templates/sh-mode/__zunit b/.config/emacs/modules/editor/file-templates/templates/sh-mode/__zunit deleted file mode 100644 index 6abced4..0000000 --- a/.config/emacs/modules/editor/file-templates/templates/sh-mode/__zunit +++ /dev/null @@ -1,5 +0,0 @@ -#!/usr/bin/env zunit - -@test '...' { - $0 -} diff --git a/.config/emacs/modules/editor/file-templates/templates/slim-mode/__ b/.config/emacs/modules/editor/file-templates/templates/slim-mode/__ deleted file mode 100644 index 51e72e9..0000000 --- a/.config/emacs/modules/editor/file-templates/templates/slim-mode/__ +++ /dev/null @@ -1,17 +0,0 @@ -doctype html -html(lang="en") - head - meta charset="utf-8" - meta http-equiv="x-ua-compatible" content="ie=edge" - - title ${1:Page Title} - meta name="description" content="" - meta name="viewport" content="width=device-width, initial-scale=1" - - / link rel="apple-touch-icon" href="apple-touch-icon.png" - - link rel="stylesheet" type="text/css" href="css/master.css" - - script src="https://cdnjs.cloudflare.com/ajax/libs/modernizr/2.8.3/modernizr.min.js" - body - $0 diff --git a/.config/emacs/modules/editor/file-templates/templates/snippet-mode/__ b/.config/emacs/modules/editor/file-templates/templates/snippet-mode/__ deleted file mode 100644 index 9b4496f..0000000 --- a/.config/emacs/modules/editor/file-templates/templates/snippet-mode/__ +++ /dev/null @@ -1,8 +0,0 @@ -# -*- mode: snippet -*- -# -- -# -*- mode: snippet -*- -# name: $1 -# key: ${2:trigger-key}${3: -# condition: t} -# -- -$0 diff --git a/.config/emacs/modules/editor/file-templates/templates/solidity-mode/__sol b/.config/emacs/modules/editor/file-templates/templates/solidity-mode/__sol deleted file mode 100644 index 46facfd..0000000 --- a/.config/emacs/modules/editor/file-templates/templates/solidity-mode/__sol +++ /dev/null @@ -1,10 +0,0 @@ -# -*- mode: snippet -*- -# group: file templates -# contributor: Edmund Miller -# name: solidity template -# -- -pragma solidity ^0.4.22; - -contract $0 { - -} \ No newline at end of file diff --git a/.config/emacs/modules/editor/file-templates/templates/text-mode/__license b/.config/emacs/modules/editor/file-templates/templates/text-mode/__license deleted file mode 100644 index b22a289..0000000 --- a/.config/emacs/modules/editor/file-templates/templates/text-mode/__license +++ /dev/null @@ -1,5 +0,0 @@ -# -*- mode: snippet -*- -# name: Insert a license -# type: command -# -- -(+file-templates/insert-license) \ No newline at end of file diff --git a/.config/emacs/modules/editor/file-templates/templates/text-mode/__license-apache b/.config/emacs/modules/editor/file-templates/templates/text-mode/__license-apache deleted file mode 100644 index a50a612..0000000 --- a/.config/emacs/modules/editor/file-templates/templates/text-mode/__license-apache +++ /dev/null @@ -1,207 +0,0 @@ -# -*- mode: snippet -*- -# name: Apache License 2.0 -# uuid: __license-apache -# group: Licenses -# contributor: https://choosealicense.com/licenses/apache-2.0/ -# -- - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "{}" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright `(format-time-string "%Y")` ${1:`user-full-name`} - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. diff --git a/.config/emacs/modules/editor/file-templates/templates/text-mode/__license-apache-bp b/.config/emacs/modules/editor/file-templates/templates/text-mode/__license-apache-bp deleted file mode 100644 index 95d9d8b..0000000 --- a/.config/emacs/modules/editor/file-templates/templates/text-mode/__license-apache-bp +++ /dev/null @@ -1,19 +0,0 @@ -# -*- mode: snippet -*- -# name: Apache License 2.0 (boilerplate) -# uuid: __license-apache-bp -# group: Licenses -# contributor: https://choosealicense.com/licenses/apache-2.0/ -# -- -Copyright ${1:`(format-time-string "%Y")` `user-full-name`} - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. \ No newline at end of file diff --git a/.config/emacs/modules/editor/file-templates/templates/text-mode/__license-bsd2 b/.config/emacs/modules/editor/file-templates/templates/text-mode/__license-bsd2 deleted file mode 100644 index bbff2e3..0000000 --- a/.config/emacs/modules/editor/file-templates/templates/text-mode/__license-bsd2 +++ /dev/null @@ -1,28 +0,0 @@ -# -*- mode: snippet -*- -# name: 2-clause BSD License -# uuid: __license-bsd2 -# group: Licenses -# -- -Copyright (c) ${1:`(format-time-string "%Y")`} ${2:`user-full-name`} -All rights reserved. - -Redistribution and use in source and binary forms, with or without modification, -are permitted provided that the following conditions are met: - -1. Redistributions of source code must retain the above copyright notice, this -list of conditions and the following disclaimer. - -2. Redistributions in binary form must reproduce the above copyright notice, -this list of conditions and the following disclaimer in the documentation and/or -other materials provided with the distribution. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND -ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR -ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON -ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/.config/emacs/modules/editor/file-templates/templates/text-mode/__license-bsd3 b/.config/emacs/modules/editor/file-templates/templates/text-mode/__license-bsd3 deleted file mode 100644 index dc3d0e8..0000000 --- a/.config/emacs/modules/editor/file-templates/templates/text-mode/__license-bsd3 +++ /dev/null @@ -1,31 +0,0 @@ -# -*- mode: snippet -*- -# name: 3-clause BSD License -# uuid: __license-bsd3 -# -- -Copyright (c) ${1:`(format-time-string "%Y")`} ${2:`user-full-name`} -All rights reserved. - -Redistribution and use in source and binary forms, with or without modification, -are permitted provided that the following conditions are met: - -1. Redistributions of source code must retain the above copyright notice, this -list of conditions and the following disclaimer. - -2. Redistributions in binary form must reproduce the above copyright notice, -this list of conditions and the following disclaimer in the documentation and/or -other materials provided with the distribution. - -3. Neither the name of the copyright holder nor the names of its contributors -may be used to endorse or promote products derived from this software without -specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND -ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR -ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON -ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/.config/emacs/modules/editor/file-templates/templates/text-mode/__license-gpl3 b/.config/emacs/modules/editor/file-templates/templates/text-mode/__license-gpl3 deleted file mode 100644 index 9395833..0000000 --- a/.config/emacs/modules/editor/file-templates/templates/text-mode/__license-gpl3 +++ /dev/null @@ -1,680 +0,0 @@ -# -*- mode: snippet -*- -# name: GNU GPL 3.0 License -# uuid: __license-gpl3 -# group: Licenses -# contributor: https://choosealicense.com/licenses/gpl-3.0/ -# -- - GNU GENERAL PUBLIC LICENSE - Version 3, 29 June 2007 - - Copyright (C) 2007 Free Software Foundation, Inc. - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - - Preamble - - The GNU General Public License is a free, copyleft license for -software and other kinds of works. - - The licenses for most software and other practical works are designed -to take away your freedom to share and change the works. By contrast, -the GNU General Public License is intended to guarantee your freedom to -share and change all versions of a program--to make sure it remains free -software for all its users. We, the Free Software Foundation, use the -GNU General Public License for most of our software; it applies also to -any other work released this way by its authors. You can apply it to -your programs, too. - - When we speak of free software, we are referring to freedom, not -price. Our General Public Licenses are designed to make sure that you -have the freedom to distribute copies of free software (and charge for -them if you wish), that you receive source code or can get it if you -want it, that you can change the software or use pieces of it in new -free programs, and that you know you can do these things. - - To protect your rights, we need to prevent others from denying you -these rights or asking you to surrender the rights. Therefore, you have -certain responsibilities if you distribute copies of the software, or if -you modify it: responsibilities to respect the freedom of others. - - For example, if you distribute copies of such a program, whether -gratis or for a fee, you must pass on to the recipients the same -freedoms that you received. You must make sure that they, too, receive -or can get the source code. And you must show them these terms so they -know their rights. - - Developers that use the GNU GPL protect your rights with two steps: -(1) assert copyright on the software, and (2) offer you this License -giving you legal permission to copy, distribute and/or modify it. - - For the developers' and authors' protection, the GPL clearly explains -that there is no warranty for this free software. For both users' and -authors' sake, the GPL requires that modified versions be marked as -changed, so that their problems will not be attributed erroneously to -authors of previous versions. - - Some devices are designed to deny users access to install or run -modified versions of the software inside them, although the manufacturer -can do so. This is fundamentally incompatible with the aim of -protecting users' freedom to change the software. The systematic -pattern of such abuse occurs in the area of products for individuals to -use, which is precisely where it is most unacceptable. Therefore, we -have designed this version of the GPL to prohibit the practice for those -products. If such problems arise substantially in other domains, we -stand ready to extend this provision to those domains in future versions -of the GPL, as needed to protect the freedom of users. - - Finally, every program is threatened constantly by software patents. -States should not allow patents to restrict development and use of -software on general-purpose computers, but in those that do, we wish to -avoid the special danger that patents applied to a free program could -make it effectively proprietary. To prevent this, the GPL assures that -patents cannot be used to render the program non-free. - - The precise terms and conditions for copying, distribution and -modification follow. - - TERMS AND CONDITIONS - - 0. Definitions. - - "This License" refers to version 3 of the GNU General Public License. - - "Copyright" also means copyright-like laws that apply to other kinds of -works, such as semiconductor masks. - - "The Program" refers to any copyrightable work licensed under this -License. Each licensee is addressed as "you". "Licensees" and -"recipients" may be individuals or organizations. - - To "modify" a work means to copy from or adapt all or part of the work -in a fashion requiring copyright permission, other than the making of an -exact copy. The resulting work is called a "modified version" of the -earlier work or a work "based on" the earlier work. - - A "covered work" means either the unmodified Program or a work based -on the Program. - - To "propagate" a work means to do anything with it that, without -permission, would make you directly or secondarily liable for -infringement under applicable copyright law, except executing it on a -computer or modifying a private copy. Propagation includes copying, -distribution (with or without modification), making available to the -public, and in some countries other activities as well. - - To "convey" a work means any kind of propagation that enables other -parties to make or receive copies. Mere interaction with a user through -a computer network, with no transfer of a copy, is not conveying. - - An interactive user interface displays "Appropriate Legal Notices" -to the extent that it includes a convenient and prominently visible -feature that (1) displays an appropriate copyright notice, and (2) -tells the user that there is no warranty for the work (except to the -extent that warranties are provided), that licensees may convey the -work under this License, and how to view a copy of this License. If -the interface presents a list of user commands or options, such as a -menu, a prominent item in the list meets this criterion. - - 1. Source Code. - - The "source code" for a work means the preferred form of the work -for making modifications to it. "Object code" means any non-source -form of a work. - - A "Standard Interface" means an interface that either is an official -standard defined by a recognized standards body, or, in the case of -interfaces specified for a particular programming language, one that -is widely used among developers working in that language. - - The "System Libraries" of an executable work include anything, other -than the work as a whole, that (a) is included in the normal form of -packaging a Major Component, but which is not part of that Major -Component, and (b) serves only to enable use of the work with that -Major Component, or to implement a Standard Interface for which an -implementation is available to the public in source code form. A -"Major Component", in this context, means a major essential component -(kernel, window system, and so on) of the specific operating system -(if any) on which the executable work runs, or a compiler used to -produce the work, or an object code interpreter used to run it. - - The "Corresponding Source" for a work in object code form means all -the source code needed to generate, install, and (for an executable -work) run the object code and to modify the work, including scripts to -control those activities. However, it does not include the work's -System Libraries, or general-purpose tools or generally available free -programs which are used unmodified in performing those activities but -which are not part of the work. For example, Corresponding Source -includes interface definition files associated with source files for -the work, and the source code for shared libraries and dynamically -linked subprograms that the work is specifically designed to require, -such as by intimate data communication or control flow between those -subprograms and other parts of the work. - - The Corresponding Source need not include anything that users -can regenerate automatically from other parts of the Corresponding -Source. - - The Corresponding Source for a work in source code form is that -same work. - - 2. Basic Permissions. - - All rights granted under this License are granted for the term of -copyright on the Program, and are irrevocable provided the stated -conditions are met. This License explicitly affirms your unlimited -permission to run the unmodified Program. The output from running a -covered work is covered by this License only if the output, given its -content, constitutes a covered work. This License acknowledges your -rights of fair use or other equivalent, as provided by copyright law. - - You may make, run and propagate covered works that you do not -convey, without conditions so long as your license otherwise remains -in force. You may convey covered works to others for the sole purpose -of having them make modifications exclusively for you, or provide you -with facilities for running those works, provided that you comply with -the terms of this License in conveying all material for which you do -not control copyright. Those thus making or running the covered works -for you must do so exclusively on your behalf, under your direction -and control, on terms that prohibit them from making any copies of -your copyrighted material outside their relationship with you. - - Conveying under any other circumstances is permitted solely under -the conditions stated below. Sublicensing is not allowed; section 10 -makes it unnecessary. - - 3. Protecting Users' Legal Rights From Anti-Circumvention Law. - - No covered work shall be deemed part of an effective technological -measure under any applicable law fulfilling obligations under article -11 of the WIPO copyright treaty adopted on 20 December 1996, or -similar laws prohibiting or restricting circumvention of such -measures. - - When you convey a covered work, you waive any legal power to forbid -circumvention of technological measures to the extent such circumvention -is effected by exercising rights under this License with respect to -the covered work, and you disclaim any intention to limit operation or -modification of the work as a means of enforcing, against the work's -users, your or third parties' legal rights to forbid circumvention of -technological measures. - - 4. Conveying Verbatim Copies. - - You may convey verbatim copies of the Program's source code as you -receive it, in any medium, provided that you conspicuously and -appropriately publish on each copy an appropriate copyright notice; -keep intact all notices stating that this License and any -non-permissive terms added in accord with section 7 apply to the code; -keep intact all notices of the absence of any warranty; and give all -recipients a copy of this License along with the Program. - - You may charge any price or no price for each copy that you convey, -and you may offer support or warranty protection for a fee. - - 5. Conveying Modified Source Versions. - - You may convey a work based on the Program, or the modifications to -produce it from the Program, in the form of source code under the -terms of section 4, provided that you also meet all of these conditions: - - a) The work must carry prominent notices stating that you modified - it, and giving a relevant date. - - b) The work must carry prominent notices stating that it is - released under this License and any conditions added under section - 7. This requirement modifies the requirement in section 4 to - "keep intact all notices". - - c) You must license the entire work, as a whole, under this - License to anyone who comes into possession of a copy. This - License will therefore apply, along with any applicable section 7 - additional terms, to the whole of the work, and all its parts, - regardless of how they are packaged. This License gives no - permission to license the work in any other way, but it does not - invalidate such permission if you have separately received it. - - d) If the work has interactive user interfaces, each must display - Appropriate Legal Notices; however, if the Program has interactive - interfaces that do not display Appropriate Legal Notices, your - work need not make them do so. - - A compilation of a covered work with other separate and independent -works, which are not by their nature extensions of the covered work, -and which are not combined with it such as to form a larger program, -in or on a volume of a storage or distribution medium, is called an -"aggregate" if the compilation and its resulting copyright are not -used to limit the access or legal rights of the compilation's users -beyond what the individual works permit. Inclusion of a covered work -in an aggregate does not cause this License to apply to the other -parts of the aggregate. - - 6. Conveying Non-Source Forms. - - You may convey a covered work in object code form under the terms -of sections 4 and 5, provided that you also convey the -machine-readable Corresponding Source under the terms of this License, -in one of these ways: - - a) Convey the object code in, or embodied in, a physical product - (including a physical distribution medium), accompanied by the - Corresponding Source fixed on a durable physical medium - customarily used for software interchange. - - b) Convey the object code in, or embodied in, a physical product - (including a physical distribution medium), accompanied by a - written offer, valid for at least three years and valid for as - long as you offer spare parts or customer support for that product - model, to give anyone who possesses the object code either (1) a - copy of the Corresponding Source for all the software in the - product that is covered by this License, on a durable physical - medium customarily used for software interchange, for a price no - more than your reasonable cost of physically performing this - conveying of source, or (2) access to copy the - Corresponding Source from a network server at no charge. - - c) Convey individual copies of the object code with a copy of the - written offer to provide the Corresponding Source. This - alternative is allowed only occasionally and noncommercially, and - only if you received the object code with such an offer, in accord - with subsection 6b. - - d) Convey the object code by offering access from a designated - place (gratis or for a charge), and offer equivalent access to the - Corresponding Source in the same way through the same place at no - further charge. You need not require recipients to copy the - Corresponding Source along with the object code. If the place to - copy the object code is a network server, the Corresponding Source - may be on a different server (operated by you or a third party) - that supports equivalent copying facilities, provided you maintain - clear directions next to the object code saying where to find the - Corresponding Source. Regardless of what server hosts the - Corresponding Source, you remain obligated to ensure that it is - available for as long as needed to satisfy these requirements. - - e) Convey the object code using peer-to-peer transmission, provided - you inform other peers where the object code and Corresponding - Source of the work are being offered to the general public at no - charge under subsection 6d. - - A separable portion of the object code, whose source code is excluded -from the Corresponding Source as a System Library, need not be -included in conveying the object code work. - - A "User Product" is either (1) a "consumer product", which means any -tangible personal property which is normally used for personal, family, -or household purposes, or (2) anything designed or sold for incorporation -into a dwelling. In determining whether a product is a consumer product, -doubtful cases shall be resolved in favor of coverage. For a particular -product received by a particular user, "normally used" refers to a -typical or common use of that class of product, regardless of the status -of the particular user or of the way in which the particular user -actually uses, or expects or is expected to use, the product. A product -is a consumer product regardless of whether the product has substantial -commercial, industrial or non-consumer uses, unless such uses represent -the only significant mode of use of the product. - - "Installation Information" for a User Product means any methods, -procedures, authorization keys, or other information required to install -and execute modified versions of a covered work in that User Product from -a modified version of its Corresponding Source. The information must -suffice to ensure that the continued functioning of the modified object -code is in no case prevented or interfered with solely because -modification has been made. - - If you convey an object code work under this section in, or with, or -specifically for use in, a User Product, and the conveying occurs as -part of a transaction in which the right of possession and use of the -User Product is transferred to the recipient in perpetuity or for a -fixed term (regardless of how the transaction is characterized), the -Corresponding Source conveyed under this section must be accompanied -by the Installation Information. But this requirement does not apply -if neither you nor any third party retains the ability to install -modified object code on the User Product (for example, the work has -been installed in ROM). - - The requirement to provide Installation Information does not include a -requirement to continue to provide support service, warranty, or updates -for a work that has been modified or installed by the recipient, or for -the User Product in which it has been modified or installed. Access to a -network may be denied when the modification itself materially and -adversely affects the operation of the network or violates the rules and -protocols for communication across the network. - - Corresponding Source conveyed, and Installation Information provided, -in accord with this section must be in a format that is publicly -documented (and with an implementation available to the public in -source code form), and must require no special password or key for -unpacking, reading or copying. - - 7. Additional Terms. - - "Additional permissions" are terms that supplement the terms of this -License by making exceptions from one or more of its conditions. -Additional permissions that are applicable to the entire Program shall -be treated as though they were included in this License, to the extent -that they are valid under applicable law. If additional permissions -apply only to part of the Program, that part may be used separately -under those permissions, but the entire Program remains governed by -this License without regard to the additional permissions. - - When you convey a copy of a covered work, you may at your option -remove any additional permissions from that copy, or from any part of -it. (Additional permissions may be written to require their own -removal in certain cases when you modify the work.) You may place -additional permissions on material, added by you to a covered work, -for which you have or can give appropriate copyright permission. - - Notwithstanding any other provision of this License, for material you -add to a covered work, you may (if authorized by the copyright holders of -that material) supplement the terms of this License with terms: - - a) Disclaiming warranty or limiting liability differently from the - terms of sections 15 and 16 of this License; or - - b) Requiring preservation of specified reasonable legal notices or - author attributions in that material or in the Appropriate Legal - Notices displayed by works containing it; or - - c) Prohibiting misrepresentation of the origin of that material, or - requiring that modified versions of such material be marked in - reasonable ways as different from the original version; or - - d) Limiting the use for publicity purposes of names of licensors or - authors of the material; or - - e) Declining to grant rights under trademark law for use of some - trade names, trademarks, or service marks; or - - f) Requiring indemnification of licensors and authors of that - material by anyone who conveys the material (or modified versions of - it) with contractual assumptions of liability to the recipient, for - any liability that these contractual assumptions directly impose on - those licensors and authors. - - All other non-permissive additional terms are considered "further -restrictions" within the meaning of section 10. If the Program as you -received it, or any part of it, contains a notice stating that it is -governed by this License along with a term that is a further -restriction, you may remove that term. If a license document contains -a further restriction but permits relicensing or conveying under this -License, you may add to a covered work material governed by the terms -of that license document, provided that the further restriction does -not survive such relicensing or conveying. - - If you add terms to a covered work in accord with this section, you -must place, in the relevant source files, a statement of the -additional terms that apply to those files, or a notice indicating -where to find the applicable terms. - - Additional terms, permissive or non-permissive, may be stated in the -form of a separately written license, or stated as exceptions; -the above requirements apply either way. - - 8. Termination. - - You may not propagate or modify a covered work except as expressly -provided under this License. Any attempt otherwise to propagate or -modify it is void, and will automatically terminate your rights under -this License (including any patent licenses granted under the third -paragraph of section 11). - - However, if you cease all violation of this License, then your -license from a particular copyright holder is reinstated (a) -provisionally, unless and until the copyright holder explicitly and -finally terminates your license, and (b) permanently, if the copyright -holder fails to notify you of the violation by some reasonable means -prior to 60 days after the cessation. - - Moreover, your license from a particular copyright holder is -reinstated permanently if the copyright holder notifies you of the -violation by some reasonable means, this is the first time you have -received notice of violation of this License (for any work) from that -copyright holder, and you cure the violation prior to 30 days after -your receipt of the notice. - - Termination of your rights under this section does not terminate the -licenses of parties who have received copies or rights from you under -this License. If your rights have been terminated and not permanently -reinstated, you do not qualify to receive new licenses for the same -material under section 10. - - 9. Acceptance Not Required for Having Copies. - - You are not required to accept this License in order to receive or -run a copy of the Program. Ancillary propagation of a covered work -occurring solely as a consequence of using peer-to-peer transmission -to receive a copy likewise does not require acceptance. However, -nothing other than this License grants you permission to propagate or -modify any covered work. These actions infringe copyright if you do -not accept this License. Therefore, by modifying or propagating a -covered work, you indicate your acceptance of this License to do so. - - 10. Automatic Licensing of Downstream Recipients. - - Each time you convey a covered work, the recipient automatically -receives a license from the original licensors, to run, modify and -propagate that work, subject to this License. You are not responsible -for enforcing compliance by third parties with this License. - - An "entity transaction" is a transaction transferring control of an -organization, or substantially all assets of one, or subdividing an -organization, or merging organizations. If propagation of a covered -work results from an entity transaction, each party to that -transaction who receives a copy of the work also receives whatever -licenses to the work the party's predecessor in interest had or could -give under the previous paragraph, plus a right to possession of the -Corresponding Source of the work from the predecessor in interest, if -the predecessor has it or can get it with reasonable efforts. - - You may not impose any further restrictions on the exercise of the -rights granted or affirmed under this License. For example, you may -not impose a license fee, royalty, or other charge for exercise of -rights granted under this License, and you may not initiate litigation -(including a cross-claim or counterclaim in a lawsuit) alleging that -any patent claim is infringed by making, using, selling, offering for -sale, or importing the Program or any portion of it. - - 11. Patents. - - A "contributor" is a copyright holder who authorizes use under this -License of the Program or a work on which the Program is based. The -work thus licensed is called the contributor's "contributor version". - - A contributor's "essential patent claims" are all patent claims -owned or controlled by the contributor, whether already acquired or -hereafter acquired, that would be infringed by some manner, permitted -by this License, of making, using, or selling its contributor version, -but do not include claims that would be infringed only as a -consequence of further modification of the contributor version. For -purposes of this definition, "control" includes the right to grant -patent sublicenses in a manner consistent with the requirements of -this License. - - Each contributor grants you a non-exclusive, worldwide, royalty-free -patent license under the contributor's essential patent claims, to -make, use, sell, offer for sale, import and otherwise run, modify and -propagate the contents of its contributor version. - - In the following three paragraphs, a "patent license" is any express -agreement or commitment, however denominated, not to enforce a patent -(such as an express permission to practice a patent or covenant not to -sue for patent infringement). To "grant" such a patent license to a -party means to make such an agreement or commitment not to enforce a -patent against the party. - - If you convey a covered work, knowingly relying on a patent license, -and the Corresponding Source of the work is not available for anyone -to copy, free of charge and under the terms of this License, through a -publicly available network server or other readily accessible means, -then you must either (1) cause the Corresponding Source to be so -available, or (2) arrange to deprive yourself of the benefit of the -patent license for this particular work, or (3) arrange, in a manner -consistent with the requirements of this License, to extend the patent -license to downstream recipients. "Knowingly relying" means you have -actual knowledge that, but for the patent license, your conveying the -covered work in a country, or your recipient's use of the covered work -in a country, would infringe one or more identifiable patents in that -country that you have reason to believe are valid. - - If, pursuant to or in connection with a single transaction or -arrangement, you convey, or propagate by procuring conveyance of, a -covered work, and grant a patent license to some of the parties -receiving the covered work authorizing them to use, propagate, modify -or convey a specific copy of the covered work, then the patent license -you grant is automatically extended to all recipients of the covered -work and works based on it. - - A patent license is "discriminatory" if it does not include within -the scope of its coverage, prohibits the exercise of, or is -conditioned on the non-exercise of one or more of the rights that are -specifically granted under this License. You may not convey a covered -work if you are a party to an arrangement with a third party that is -in the business of distributing software, under which you make payment -to the third party based on the extent of your activity of conveying -the work, and under which the third party grants, to any of the -parties who would receive the covered work from you, a discriminatory -patent license (a) in connection with copies of the covered work -conveyed by you (or copies made from those copies), or (b) primarily -for and in connection with specific products or compilations that -contain the covered work, unless you entered into that arrangement, -or that patent license was granted, prior to 28 March 2007. - - Nothing in this License shall be construed as excluding or limiting -any implied license or other defenses to infringement that may -otherwise be available to you under applicable patent law. - - 12. No Surrender of Others' Freedom. - - If conditions are imposed on you (whether by court order, agreement or -otherwise) that contradict the conditions of this License, they do not -excuse you from the conditions of this License. If you cannot convey a -covered work so as to satisfy simultaneously your obligations under this -License and any other pertinent obligations, then as a consequence you may -not convey it at all. For example, if you agree to terms that obligate you -to collect a royalty for further conveying from those to whom you convey -the Program, the only way you could satisfy both those terms and this -License would be to refrain entirely from conveying the Program. - - 13. Use with the GNU Affero General Public License. - - Notwithstanding any other provision of this License, you have -permission to link or combine any covered work with a work licensed -under version 3 of the GNU Affero General Public License into a single -combined work, and to convey the resulting work. The terms of this -License will continue to apply to the part which is the covered work, -but the special requirements of the GNU Affero General Public License, -section 13, concerning interaction through a network will apply to the -combination as such. - - 14. Revised Versions of this License. - - The Free Software Foundation may publish revised and/or new versions of -the GNU General Public License from time to time. Such new versions will -be similar in spirit to the present version, but may differ in detail to -address new problems or concerns. - - Each version is given a distinguishing version number. If the -Program specifies that a certain numbered version of the GNU General -Public License "or any later version" applies to it, you have the -option of following the terms and conditions either of that numbered -version or of any later version published by the Free Software -Foundation. If the Program does not specify a version number of the -GNU General Public License, you may choose any version ever published -by the Free Software Foundation. - - If the Program specifies that a proxy can decide which future -versions of the GNU General Public License can be used, that proxy's -public statement of acceptance of a version permanently authorizes you -to choose that version for the Program. - - Later license versions may give you additional or different -permissions. However, no additional obligations are imposed on any -author or copyright holder as a result of your choosing to follow a -later version. - - 15. Disclaimer of Warranty. - - THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY -APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT -HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY -OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, -THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM -IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF -ALL NECESSARY SERVICING, REPAIR OR CORRECTION. - - 16. Limitation of Liability. - - IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING -WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS -THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY -GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE -USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF -DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD -PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), -EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF -SUCH DAMAGES. - - 17. Interpretation of Sections 15 and 16. - - If the disclaimer of warranty and limitation of liability provided -above cannot be given local legal effect according to their terms, -reviewing courts shall apply local law that most closely approximates -an absolute waiver of all civil liability in connection with the -Program, unless a warranty or assumption of liability accompanies a -copy of the Program in return for a fee. - - END OF TERMS AND CONDITIONS - - How to Apply These Terms to Your New Programs - - If you develop a new program, and you want it to be of the greatest -possible use to the public, the best way to achieve this is to make it -free software which everyone can redistribute and change under these terms. - - To do so, attach the following notices to the program. It is safest -to attach them to the start of each source file to most effectively -state the exclusion of warranty; and each file should have at least -the "copyright" line and a pointer to where the full notice is found. - - ${4:} - Copyright (C) ${1:`(format-time-string "%Y")`} ${2:`user-full-name`} - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . - -Also add information on how to contact you by electronic and paper mail. - - If the program does terminal interaction, make it output a short -notice like this when it starts in an interactive mode: - - ${3:} Copyright (C) ${1:`(format-time-string "%Y")`} ${2:`user-full-name`} - This program comes with ABSOLUTELY NO WARRANTY; for details type \`show w'. - This is free software, and you are welcome to redistribute it - under certain conditions; type \`show c' for details. - -The hypothetical commands \`show w' and \`show c' should show the appropriate -parts of the General Public License. Of course, your program's commands -might be different; for a GUI interface, you would use an "about box". - - You should also get your employer (if you work as a programmer) or school, -if any, to sign a "copyright disclaimer" for the program, if necessary. -For more information on this, and how to apply and follow the GNU GPL, see -. - - The GNU General Public License does not permit incorporating your program -into proprietary programs. If your program is a subroutine library, you -may consider it more useful to permit linking proprietary applications with -the library. If this is what you want to do, use the GNU Lesser General -Public License instead of this License. But first, please read -. diff --git a/.config/emacs/modules/editor/file-templates/templates/text-mode/__license-gpl3-bp b/.config/emacs/modules/editor/file-templates/templates/text-mode/__license-gpl3-bp deleted file mode 100644 index 4e8ff3c..0000000 --- a/.config/emacs/modules/editor/file-templates/templates/text-mode/__license-gpl3-bp +++ /dev/null @@ -1,21 +0,0 @@ -# -*- mode: snippet -*- -# name: GNU GPL 3.0 License (boilerplate) -# uuid: __license-gpl3-bp -# group: Licenses -# contributor: https://choosealicense.com/licenses/lgpl-3.0 -# -- -${1:} -Copyright (C) ${2:`(format-time-string "%Y")`} ${3:`user-full-name`} - -This program is free software: you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation, either version 3 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program. If not, see . \ No newline at end of file diff --git a/.config/emacs/modules/editor/file-templates/templates/text-mode/__license-lgpl3 b/.config/emacs/modules/editor/file-templates/templates/text-mode/__license-lgpl3 deleted file mode 100644 index 8aefb50..0000000 --- a/.config/emacs/modules/editor/file-templates/templates/text-mode/__license-lgpl3 +++ /dev/null @@ -1,171 +0,0 @@ -# -*- mode: snippet -*- -# name: GNU LGPL v3 License -# uuid: __license-lgpl3 -# group: Licenses -# contribuer: https://choosealicense.com/licenses/lgpl-3.0/ -# -- - GNU LESSER GENERAL PUBLIC LICENSE - Version 3, 29 June 2007 - - Copyright (C) 2007 Free Software Foundation, Inc. - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - - - This version of the GNU Lesser General Public License incorporates -the terms and conditions of version 3 of the GNU General Public -License, supplemented by the additional permissions listed below. - - 0. Additional Definitions. - - As used herein, "this License" refers to version 3 of the GNU Lesser -General Public License, and the "GNU GPL" refers to version 3 of the GNU -General Public License. - - "The Library" refers to a covered work governed by this License, -other than an Application or a Combined Work as defined below. - - An "Application" is any work that makes use of an interface provided -by the Library, but which is not otherwise based on the Library. -Defining a subclass of a class defined by the Library is deemed a mode -of using an interface provided by the Library. - - A "Combined Work" is a work produced by combining or linking an -Application with the Library. The particular version of the Library -with which the Combined Work was made is also called the "Linked -Version". - - The "Minimal Corresponding Source" for a Combined Work means the -Corresponding Source for the Combined Work, excluding any source code -for portions of the Combined Work that, considered in isolation, are -based on the Application, and not on the Linked Version. - - The "Corresponding Application Code" for a Combined Work means the -object code and/or source code for the Application, including any data -and utility programs needed for reproducing the Combined Work from the -Application, but excluding the System Libraries of the Combined Work. - - 1. Exception to Section 3 of the GNU GPL. - - You may convey a covered work under sections 3 and 4 of this License -without being bound by section 3 of the GNU GPL. - - 2. Conveying Modified Versions. - - If you modify a copy of the Library, and, in your modifications, a -facility refers to a function or data to be supplied by an Application -that uses the facility (other than as an argument passed when the -facility is invoked), then you may convey a copy of the modified -version: - - a) under this License, provided that you make a good faith effort to - ensure that, in the event an Application does not supply the - function or data, the facility still operates, and performs - whatever part of its purpose remains meaningful, or - - b) under the GNU GPL, with none of the additional permissions of - this License applicable to that copy. - - 3. Object Code Incorporating Material from Library Header Files. - - The object code form of an Application may incorporate material from -a header file that is part of the Library. You may convey such object -code under terms of your choice, provided that, if the incorporated -material is not limited to numerical parameters, data structure -layouts and accessors, or small macros, inline functions and templates -(ten or fewer lines in length), you do both of the following: - - a) Give prominent notice with each copy of the object code that the - Library is used in it and that the Library and its use are - covered by this License. - - b) Accompany the object code with a copy of the GNU GPL and this license - document. - - 4. Combined Works. - - You may convey a Combined Work under terms of your choice that, -taken together, effectively do not restrict modification of the -portions of the Library contained in the Combined Work and reverse -engineering for debugging such modifications, if you also do each of -the following: - - a) Give prominent notice with each copy of the Combined Work that - the Library is used in it and that the Library and its use are - covered by this License. - - b) Accompany the Combined Work with a copy of the GNU GPL and this license - document. - - c) For a Combined Work that displays copyright notices during - execution, include the copyright notice for the Library among - these notices, as well as a reference directing the user to the - copies of the GNU GPL and this license document. - - d) Do one of the following: - - 0) Convey the Minimal Corresponding Source under the terms of this - License, and the Corresponding Application Code in a form - suitable for, and under terms that permit, the user to - recombine or relink the Application with a modified version of - the Linked Version to produce a modified Combined Work, in the - manner specified by section 6 of the GNU GPL for conveying - Corresponding Source. - - 1) Use a suitable shared library mechanism for linking with the - Library. A suitable mechanism is one that (a) uses at run time - a copy of the Library already present on the user's computer - system, and (b) will operate properly with a modified version - of the Library that is interface-compatible with the Linked - Version. - - e) Provide Installation Information, but only if you would otherwise - be required to provide such information under section 6 of the - GNU GPL, and only to the extent that such information is - necessary to install and execute a modified version of the - Combined Work produced by recombining or relinking the - Application with a modified version of the Linked Version. (If - you use option 4d0, the Installation Information must accompany - the Minimal Corresponding Source and Corresponding Application - Code. If you use option 4d1, you must provide the Installation - Information in the manner specified by section 6 of the GNU GPL - for conveying Corresponding Source.) - - 5. Combined Libraries. - - You may place library facilities that are a work based on the -Library side by side in a single library together with other library -facilities that are not Applications and are not covered by this -License, and convey such a combined library under terms of your -choice, if you do both of the following: - - a) Accompany the combined library with a copy of the same work based - on the Library, uncombined with any other library facilities, - conveyed under the terms of this License. - - b) Give prominent notice with the combined library that part of it - is a work based on the Library, and explaining where to find the - accompanying uncombined form of the same work. - - 6. Revised Versions of the GNU Lesser General Public License. - - The Free Software Foundation may publish revised and/or new versions -of the GNU Lesser General Public License from time to time. Such new -versions will be similar in spirit to the present version, but may -differ in detail to address new problems or concerns. - - Each version is given a distinguishing version number. If the -Library as you received it specifies that a certain numbered version -of the GNU Lesser General Public License "or any later version" -applies to it, you have the option of following the terms and -conditions either of that published version or of any later version -published by the Free Software Foundation. If the Library as you -received it does not specify a version number of the GNU Lesser -General Public License, you may choose any version of the GNU Lesser -General Public License ever published by the Free Software Foundation. - - If the Library as you received it specifies that a proxy can decide -whether future versions of the GNU Lesser General Public License shall -apply, that proxy's public statement of acceptance of any version is -permanent authorization for you to choose that version for the -Library. diff --git a/.config/emacs/modules/editor/file-templates/templates/text-mode/__license-mit b/.config/emacs/modules/editor/file-templates/templates/text-mode/__license-mit deleted file mode 100644 index dd041f8..0000000 --- a/.config/emacs/modules/editor/file-templates/templates/text-mode/__license-mit +++ /dev/null @@ -1,28 +0,0 @@ -# -*- mode: snippet -*- -# name: MIT License -# uuid: __license-mit -# group: Licenses -# contributor: https://choosealicense.com/licenses/mit/ -# -- -The MIT License (MIT) - -Copyright (c) ${1:`(format-time-string "%Y")`} ${2:`user-full-name`} - -Permission is hereby granted, free of charge, to any person obtaining -a copy of this software and associated documentation files (the -"Software"), to deal in the Software without restriction, including -without limitation the rights to use, copy, modify, merge, publish, -distribute, sublicense, and/or sell copies of the Software, and to -permit persons to whom the Software is furnished to do so, subject to -the following conditions: - -The above copyright notice and this permission notice shall be -included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY -CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, -TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/.config/emacs/modules/editor/file-templates/templates/text-mode/__license-mozilla b/.config/emacs/modules/editor/file-templates/templates/text-mode/__license-mozilla deleted file mode 100644 index bba13b7..0000000 --- a/.config/emacs/modules/editor/file-templates/templates/text-mode/__license-mozilla +++ /dev/null @@ -1,380 +0,0 @@ -# -*- mode: snippet -*- -# name: Mozilla Public License 2.0 -# uuid: __license-mozilla -# group: Licenses -# contributor: https://choosealicense.com/licenses/mpl-2.0 -# -- -Mozilla Public License Version 2.0 -================================== - -1. Definitions --------------- - -1.1. "Contributor" - means each individual or legal entity that creates, contributes to - the creation of, or owns Covered Software. - -1.2. "Contributor Version" - means the combination of the Contributions of others (if any) used - by a Contributor and that particular Contributor's Contribution. - -1.3. "Contribution" - means Covered Software of a particular Contributor. - -1.4. "Covered Software" - means Source Code Form to which the initial Contributor has attached - the notice in Exhibit A, the Executable Form of such Source Code - Form, and Modifications of such Source Code Form, in each case - including portions thereof. - -1.5. "Incompatible With Secondary Licenses" - means - - (a) that the initial Contributor has attached the notice described - in Exhibit B to the Covered Software; or - - (b) that the Covered Software was made available under the terms of - version 1.1 or earlier of the License, but not also under the - terms of a Secondary License. - -1.6. "Executable Form" - means any form of the work other than Source Code Form. - -1.7. "Larger Work" - means a work that combines Covered Software with other material, in - a separate file or files, that is not Covered Software. - -1.8. "License" - means this document. - -1.9. "Licensable" - means having the right to grant, to the maximum extent possible, - whether at the time of the initial grant or subsequently, any and - all of the rights conveyed by this License. - -1.10. "Modifications" - means any of the following: - - (a) any file in Source Code Form that results from an addition to, - deletion from, or modification of the contents of Covered - Software; or - - (b) any new file in Source Code Form that contains any Covered - Software. - -1.11. "Patent Claims" of a Contributor - means any patent claim(s), including without limitation, method, - process, and apparatus claims, in any patent Licensable by such - Contributor that would be infringed, but for the grant of the - License, by the making, using, selling, offering for sale, having - made, import, or transfer of either its Contributions or its - Contributor Version. - -1.12. "Secondary License" - means either the GNU General Public License, Version 2.0, the GNU - Lesser General Public License, Version 2.1, the GNU Affero General - Public License, Version 3.0, or any later versions of those - licenses. - -1.13. "Source Code Form" - means the form of the work preferred for making modifications. - -1.14. "You" (or "Your") - means an individual or a legal entity exercising rights under this - License. For legal entities, "You" includes any entity that - controls, is controlled by, or is under common control with You. For - purposes of this definition, "control" means (a) the power, direct - or indirect, to cause the direction or management of such entity, - whether by contract or otherwise, or (b) ownership of more than - fifty percent (50%) of the outstanding shares or beneficial - ownership of such entity. - -2. License Grants and Conditions --------------------------------- - -2.1. Grants - -Each Contributor hereby grants You a world-wide, royalty-free, -non-exclusive license: - -(a) under intellectual property rights (other than patent or trademark) - Licensable by such Contributor to use, reproduce, make available, - modify, display, perform, distribute, and otherwise exploit its - Contributions, either on an unmodified basis, with Modifications, or - as part of a Larger Work; and - -(b) under Patent Claims of such Contributor to make, use, sell, offer - for sale, have made, import, and otherwise transfer either its - Contributions or its Contributor Version. - -2.2. Effective Date - -The licenses granted in Section 2.1 with respect to any Contribution -become effective for each Contribution on the date the Contributor first -distributes such Contribution. - -2.3. Limitations on Grant Scope - -The licenses granted in this Section 2 are the only rights granted under -this License. No additional rights or licenses will be implied from the -distribution or licensing of Covered Software under this License. -Notwithstanding Section 2.1(b) above, no patent license is granted by a -Contributor: - -(a) for any code that a Contributor has removed from Covered Software; - or - -(b) for infringements caused by: (i) Your and any other third party's - modifications of Covered Software, or (ii) the combination of its - Contributions with other software (except as part of its Contributor - Version); or - -(c) under Patent Claims infringed by Covered Software in the absence of - its Contributions. - -This License does not grant any rights in the trademarks, service marks, -or logos of any Contributor (except as may be necessary to comply with -the notice requirements in Section 3.4). - -2.4. Subsequent Licenses - -No Contributor makes additional grants as a result of Your choice to -distribute the Covered Software under a subsequent version of this -License (see Section 10.2) or under the terms of a Secondary License (if -permitted under the terms of Section 3.3). - -2.5. Representation - -Each Contributor represents that the Contributor believes its -Contributions are its original creation(s) or it has sufficient rights -to grant the rights to its Contributions conveyed by this License. - -2.6. Fair Use - -This License is not intended to limit any rights You have under -applicable copyright doctrines of fair use, fair dealing, or other -equivalents. - -2.7. Conditions - -Sections 3.1, 3.2, 3.3, and 3.4 are conditions of the licenses granted -in Section 2.1. - -3. Responsibilities -------------------- - -3.1. Distribution of Source Form - -All distribution of Covered Software in Source Code Form, including any -Modifications that You create or to which You contribute, must be under -the terms of this License. You must inform recipients that the Source -Code Form of the Covered Software is governed by the terms of this -License, and how they can obtain a copy of this License. You may not -attempt to alter or restrict the recipients' rights in the Source Code -Form. - -3.2. Distribution of Executable Form - -If You distribute Covered Software in Executable Form then: - -(a) such Covered Software must also be made available in Source Code - Form, as described in Section 3.1, and You must inform recipients of - the Executable Form how they can obtain a copy of such Source Code - Form by reasonable means in a timely manner, at a charge no more - than the cost of distribution to the recipient; and - -(b) You may distribute such Executable Form under the terms of this - License, or sublicense it under different terms, provided that the - license for the Executable Form does not attempt to limit or alter - the recipients' rights in the Source Code Form under this License. - -3.3. Distribution of a Larger Work - -You may create and distribute a Larger Work under terms of Your choice, -provided that You also comply with the requirements of this License for -the Covered Software. If the Larger Work is a combination of Covered -Software with a work governed by one or more Secondary Licenses, and the -Covered Software is not Incompatible With Secondary Licenses, this -License permits You to additionally distribute such Covered Software -under the terms of such Secondary License(s), so that the recipient of -the Larger Work may, at their option, further distribute the Covered -Software under the terms of either this License or such Secondary -License(s). - -3.4. Notices - -You may not remove or alter the substance of any license notices -(including copyright notices, patent notices, disclaimers of warranty, -or limitations of liability) contained within the Source Code Form of -the Covered Software, except that You may alter any license notices to -the extent required to remedy known factual inaccuracies. - -3.5. Application of Additional Terms - -You may choose to offer, and to charge a fee for, warranty, support, -indemnity or liability obligations to one or more recipients of Covered -Software. However, You may do so only on Your own behalf, and not on -behalf of any Contributor. You must make it absolutely clear that any -such warranty, support, indemnity, or liability obligation is offered by -You alone, and You hereby agree to indemnify every Contributor for any -liability incurred by such Contributor as a result of warranty, support, -indemnity or liability terms You offer. You may include additional -disclaimers of warranty and limitations of liability specific to any -jurisdiction. - -4. Inability to Comply Due to Statute or Regulation ---------------------------------------------------- - -If it is impossible for You to comply with any of the terms of this -License with respect to some or all of the Covered Software due to -statute, judicial order, or regulation then You must: (a) comply with -the terms of this License to the maximum extent possible; and (b) -describe the limitations and the code they affect. Such description must -be placed in a text file included with all distributions of the Covered -Software under this License. Except to the extent prohibited by statute -or regulation, such description must be sufficiently detailed for a -recipient of ordinary skill to be able to understand it. - -5. Termination --------------- - -5.1. The rights granted under this License will terminate automatically -if You fail to comply with any of its terms. However, if You become -compliant, then the rights granted under this License from a particular -Contributor are reinstated (a) provisionally, unless and until such -Contributor explicitly and finally terminates Your grants, and (b) on an -ongoing basis, if such Contributor fails to notify You of the -non-compliance by some reasonable means prior to 60 days after You have -come back into compliance. Moreover, Your grants from a particular -Contributor are reinstated on an ongoing basis if such Contributor -notifies You of the non-compliance by some reasonable means, this is the -first time You have received notice of non-compliance with this License -from such Contributor, and You become compliant prior to 30 days after -Your receipt of the notice. - -5.2. If You initiate litigation against any entity by asserting a patent -infringement claim (excluding declaratory judgment actions, -counter-claims, and cross-claims) alleging that a Contributor Version -directly or indirectly infringes any patent, then the rights granted to -You by any and all Contributors for the Covered Software under Section -2.1 of this License shall terminate. - -5.3. In the event of termination under Sections 5.1 or 5.2 above, all -end user license agreements (excluding distributors and resellers) which -have been validly granted by You or Your distributors under this License -prior to termination shall survive termination. - -************************************************************************ -* * -* 6. Disclaimer of Warranty * -* ------------------------- * -* * -* Covered Software is provided under this License on an "as is" * -* basis, without warranty of any kind, either expressed, implied, or * -* statutory, including, without limitation, warranties that the * -* Covered Software is free of defects, merchantable, fit for a * -* particular purpose or non-infringing. The entire risk as to the * -* quality and performance of the Covered Software is with You. * -* Should any Covered Software prove defective in any respect, You * -* (not any Contributor) assume the cost of any necessary servicing, * -* repair, or correction. This disclaimer of warranty constitutes an * -* essential part of this License. No use of any Covered Software is * -* authorized under this License except under this disclaimer. * -* * -************************************************************************ - -************************************************************************ -* * -* 7. Limitation of Liability * -* -------------------------- * -* * -* Under no circumstances and under no legal theory, whether tort * -* (including negligence), contract, or otherwise, shall any * -* Contributor, or anyone who distributes Covered Software as * -* permitted above, be liable to You for any direct, indirect, * -* special, incidental, or consequential damages of any character * -* including, without limitation, damages for lost profits, loss of * -* goodwill, work stoppage, computer failure or malfunction, or any * -* and all other commercial damages or losses, even if such party * -* shall have been informed of the possibility of such damages. This * -* limitation of liability shall not apply to liability for death or * -* personal injury resulting from such party's negligence to the * -* extent applicable law prohibits such limitation. Some * -* jurisdictions do not allow the exclusion or limitation of * -* incidental or consequential damages, so this exclusion and * -* limitation may not apply to You. * -* * -************************************************************************ - -8. Litigation -------------- - -Any litigation relating to this License may be brought only in the -courts of a jurisdiction where the defendant maintains its principal -place of business and such litigation shall be governed by laws of that -jurisdiction, without reference to its conflict-of-law provisions. -Nothing in this Section shall prevent a party's ability to bring -cross-claims or counter-claims. - -9. Miscellaneous ----------------- - -This License represents the complete agreement concerning the subject -matter hereof. If any provision of this License is held to be -unenforceable, such provision shall be reformed only to the extent -necessary to make it enforceable. Any law or regulation which provides -that the language of a contract shall be construed against the drafter -shall not be used to construe this License against a Contributor. - -10. Versions of the License ---------------------------- - -10.1. New Versions - -Mozilla Foundation is the license steward. Except as provided in Section -10.3, no one other than the license steward has the right to modify or -publish new versions of this License. Each version will be given a -distinguishing version number. - -10.2. Effect of New Versions - -You may distribute the Covered Software under the terms of the version -of the License under which You originally received the Covered Software, -or under the terms of any subsequent version published by the license -steward. - -10.3. Modified Versions - -If you create software not governed by this License, and you want to -create a new license for such software, you may create and use a -modified version of this License if you rename the license and remove -any references to the name of the license steward (except to note that -such modified license differs from this License). - -10.4. Distributing Source Code Form that is Incompatible With Secondary -Licenses - -If You choose to distribute Source Code Form that is Incompatible With -Secondary Licenses under the terms of this version of the License, the -notice described in Exhibit B of this License must be attached. - -Exhibit A - Source Code Form License Notice -------------------------------------------- - - This Source Code Form is subject to the terms of the Mozilla Public - License, v. 2.0. If a copy of the MPL was not distributed with this - file, You can obtain one at http://mozilla.org/MPL/2.0/. - -If it is not possible or desirable to put the notice in a particular -file, then You may include the notice in a location (such as a LICENSE -file in a relevant directory) where a recipient would be likely to look -for such a notice. - -You may add additional accurate notices of copyright ownership. - -Exhibit B - "Incompatible With Secondary Licenses" Notice ---------------------------------------------------------- - - This Source Code Form is "Incompatible With Secondary Licenses", as - defined by the Mozilla Public License, v. 2.0. - diff --git a/.config/emacs/modules/editor/file-templates/templates/text-mode/__license-mozilla-bp b/.config/emacs/modules/editor/file-templates/templates/text-mode/__license-mozilla-bp deleted file mode 100644 index 7a7fc42..0000000 --- a/.config/emacs/modules/editor/file-templates/templates/text-mode/__license-mozilla-bp +++ /dev/null @@ -1,9 +0,0 @@ -# -*- mode: snippet -*- -# name: Mozilla Public License 2.0 (boilerplate) -# uuid: __license-mozilla-bp -# group: Licenses -# contributor: https://choosealicense.com/licenses/mpl-2.0 -# -- -This Source Code Form is subject to the terms of the Mozilla Public -License, v. 2.0. If a copy of the MPL was not distributed with this -file, You can obtain one at http://mozilla.org/MPL/2.0/. \ No newline at end of file diff --git a/.config/emacs/modules/editor/file-templates/templates/text-mode/__license-unlicense b/.config/emacs/modules/editor/file-templates/templates/text-mode/__license-unlicense deleted file mode 100644 index 6eb9927..0000000 --- a/.config/emacs/modules/editor/file-templates/templates/text-mode/__license-unlicense +++ /dev/null @@ -1,30 +0,0 @@ -# -*- mode: snippet -*- -# name: The Unlicense -# uuid: __license-unlicense -# group: Licenses -# contributor: https://choosealicense.com/licenses/unlicense -# -- -This is free and unencumbered software released into the public domain. - -Anyone is free to copy, modify, publish, use, compile, sell, or -distribute this software, either in source code form or as a compiled -binary, for any purpose, commercial or non-commercial, and by any -means. - -In jurisdictions that recognize copyright laws, the author or authors -of this software dedicate any and all copyright interest in the -software to the public domain. We make this dedication for the benefit -of the public at large and to the detriment of our heirs and -successors. We intend this dedication to be an overt act of -relinquishment in perpetuity of all present and future rights to this -software under copyright law. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR -OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR -OTHER DEALINGS IN THE SOFTWARE. - -For more information, please refer to diff --git a/.config/emacs/modules/editor/file-templates/templates/web-mode/__.html b/.config/emacs/modules/editor/file-templates/templates/web-mode/__.html deleted file mode 100644 index 632e8c8..0000000 --- a/.config/emacs/modules/editor/file-templates/templates/web-mode/__.html +++ /dev/null @@ -1,25 +0,0 @@ - - - - - - ${1:Untitled} - - - - - - - - - - - $0 - - diff --git a/.config/emacs/modules/editor/file-templates/templates/web-mode/__jekyll-layout.html b/.config/emacs/modules/editor/file-templates/templates/web-mode/__jekyll-layout.html deleted file mode 100644 index e69de29..0000000 diff --git a/.config/emacs/modules/editor/file-templates/templates/yaml-mode/__docker-compose.yml b/.config/emacs/modules/editor/file-templates/templates/yaml-mode/__docker-compose.yml deleted file mode 100644 index 29d2053..0000000 --- a/.config/emacs/modules/editor/file-templates/templates/yaml-mode/__docker-compose.yml +++ /dev/null @@ -1,15 +0,0 @@ -web: - build: . - ports: - - "8080:80" - volumes: - - ./public:/var/www - links: - - mysql - - memcache - -mysql: - image: mysql - -redis: - image: redis diff --git a/.config/emacs/modules/editor/fold/README.org b/.config/emacs/modules/editor/fold/README.org deleted file mode 100644 index 5064eb7..0000000 --- a/.config/emacs/modules/editor/fold/README.org +++ /dev/null @@ -1,44 +0,0 @@ -#+TITLE: editor/fold -#+DATE: February 17, 2019 -#+SINCE: v2.1 -#+STARTUP: inlineimages - -* Table of Contents :TOC_3:noexport: -- [[#description][Description]] - - [[#module-flags][Module Flags]] - - [[#plugins][Plugins]] -- [[#prerequisites][Prerequisites]] -- [[#features][Features]] -- [[#configuration][Configuration]] -- [[#troubleshooting][Troubleshooting]] - -* Description -This module marries hideshow, vimish-fold and outline-minor-mode to bring you -marker, indent and syntax-based code folding for as many languages as possible. - -** Module Flags -This module provides no flags. - -** Plugins -+ [[https://github.com/alexmurray/evil-vimish-fold][evil-vimish-fold]] -+ [[https://github.com/matsievskiysv/vimish-fold][vimish-fold]] - -* Prerequisites -This module has no prerequisites. - -* Features - -Emacs keybinds when evil +everywhere is disabled. -| Keybind | Description | -|------------------------+---------------------------| -| =C-c C-f C-f= | Fold region | -| =C-c C-f C-u= or =C `= | Unfold region | -| =C-c C-f C-d= | Delete folded region | -| =C-c C-f C-a C-f= | Fold all regions | -| =C-c C-f C-a C-u= | Unfold all regions | -| =C-c C-a C-d= | Delete all folded regions | - -* TODO Configuration - -* Troubleshooting -Sometimes an unfolded region does not fold back with =C-c C-f C-f=. To bypass this bug you must delete the folded region (=C-c C-f C-d=) and then fold it(=C-c C-f C-f=) again. diff --git a/.config/emacs/modules/editor/fold/autoload/fold.el b/.config/emacs/modules/editor/fold/autoload/fold.el deleted file mode 100644 index 69726eb..0000000 --- a/.config/emacs/modules/editor/fold/autoload/fold.el +++ /dev/null @@ -1,158 +0,0 @@ -;;; editor/fold/autoload/fold.el -*- lexical-binding: t; -*- - -;; `hideshow' is a decent code folding implementation, but it won't let you -;; create custom folds. `vimish-fold' offers custom folds, but essentially -;; ignores any other type of folding (indent or custom markers, which hideshow -;; and `outline-mode' give you). This is my effort to combine them. - -;; -;;; Helpers - -(defun +fold--ensure-hideshow-mode () - (unless (bound-and-true-p hs-minor-mode) - (hs-minor-mode +1))) - -(defun +fold--vimish-fold-p () - (and (featurep 'vimish-fold) - (cl-some #'vimish-fold--vimish-overlay-p - (overlays-at (point))))) - -(defun +fold--outline-fold-p () - (and (or (bound-and-true-p outline-minor-mode) - (derived-mode-p 'outline-mode)) - (outline-on-heading-p))) - -(defun +fold--hideshow-fold-p () - (+fold--ensure-hideshow-mode) - (save-excursion - (ignore-errors - (or (hs-looking-at-block-start-p) - (hs-find-block-beginning) - (unless (eolp) - (end-of-line) - (+fold--hideshow-fold-p)))))) - -(defun +fold--invisible-points (count) - (let (points) - (save-excursion - (catch 'abort - (if (< count 0) (beginning-of-line)) - (while (re-search-forward hs-block-start-regexp nil t - (if (> count 0) 1 -1)) - (unless (invisible-p (point)) - (end-of-line) - (when (hs-already-hidden-p) - (push (point) points) - (when (>= (length points) count) - (throw 'abort nil)))) - (forward-line (if (> count 0) 1 -1))))) - points)) - -(defmacro +fold-from-eol (&rest body) - "Perform action after moving to the end of the line." - `(save-excursion - (end-of-line) - ,@body)) - - -;; -;;; Commands - -;;;###autoload -(defun +fold/toggle () - "Toggle the fold at point. - -Targets `vimmish-fold', `hideshow' and `outline' folds." - (interactive) - (save-excursion - (cond ((+fold--vimish-fold-p) (vimish-fold-toggle)) - ((+fold--outline-fold-p) - (cl-letf (((symbol-function #'outline-hide-subtree) - (symbol-function #'outline-hide-entry))) - (outline-toggle-children))) - ((+fold--hideshow-fold-p) (+fold-from-eol (hs-toggle-hiding)))))) - -;;;###autoload -(defun +fold/open () - "Open the folded region at point. - -Targets `vimmish-fold', `hideshow' and `outline' folds." - (interactive) - (save-excursion - (cond ((+fold--vimish-fold-p) (vimish-fold-unfold)) - ((+fold--outline-fold-p) - (outline-show-children) - (outline-show-entry)) - ((+fold--hideshow-fold-p) (+fold-from-eol (hs-show-block)))))) - -;;;###autoload -(defun +fold/close () - "Close the folded region at point. - -Targets `vimmish-fold', `hideshow' and `outline' folds." - (interactive) - (save-excursion - (cond ((+fold--vimish-fold-p) (vimish-fold-refold)) - ((+fold--hideshow-fold-p) (+fold-from-eol (hs-hide-block))) - ((+fold--outline-fold-p) (outline-hide-subtree))))) - -;;;###autoload -(defun +fold/open-all (&optional level) - "Open folds at LEVEL (or all folds if LEVEL is nil)." - (interactive - (list (if current-prefix-arg (prefix-numeric-value current-prefix-arg)))) - (when (featurep 'vimish-fold) - (vimish-fold-unfold-all)) - (save-excursion - (+fold--ensure-hideshow-mode) - (if (integerp level) - (progn - (outline-hide-sublevels (max 1 (1- level))) - (hs-life-goes-on - (hs-hide-level-recursive (1- level) (point-min) (point-max)))) - (hs-show-all) - (when (fboundp 'outline-show-all) - (outline-show-all))))) - -;;;###autoload -(defun +fold/close-all (&optional level) - "Close folds at LEVEL (or all folds if LEVEL is nil)." - (interactive - (list (if current-prefix-arg (prefix-numeric-value current-prefix-arg)))) - (save-excursion - (when (featurep 'vimish-fold) - (vimish-fold-refold-all)) - (+fold--ensure-hideshow-mode) - (hs-life-goes-on - (if (integerp level) - (hs-hide-level-recursive (1- level) (point-min) (point-max)) - (hs-hide-all))))) - -;;;###autoload -(defun +fold/next (count) - "Jump to the next vimish fold, outline heading or folded region." - (interactive "p") - (cl-loop with orig-pt = (point) - for fn - in (list (lambda () - (when (bound-and-true-p hs-block-start-regexp) - (car (+fold--invisible-points count)))) - (lambda () - (when (featurep 'vimish-fold) - (if (> count 0) - (evil-vimish-fold/next-fold count) - (evil-vimish-fold/previous-fold (- count)))) - (if (/= (point) orig-pt) (point)))) - if (save-excursion (funcall fn)) - collect it into points - finally do - (if-let* ((pt (car (sort points (if (> count 0) #'< #'>))))) - (goto-char pt) - (message "No more folds %s point" (if (> count 0) "after" "before")) - (goto-char orig-pt)))) - -;;;###autoload -(defun +fold/previous (count) - "Jump to the previous vimish fold, outline heading or folded region." - (interactive "p") - (+fold/next (- count))) diff --git a/.config/emacs/modules/editor/fold/autoload/hideshow.el b/.config/emacs/modules/editor/fold/autoload/hideshow.el deleted file mode 100644 index a124506..0000000 --- a/.config/emacs/modules/editor/fold/autoload/hideshow.el +++ /dev/null @@ -1,83 +0,0 @@ -;;; editor/fold/autoload/hideshow.el -*- lexical-binding: t; -*- - -(defface +fold-hideshow-folded-face - `((t (:inherit font-lock-comment-face :weight light))) - "Face to hightlight `hideshow' overlays." - :group 'doom-themes) - -;;;###autoload -(defun +fold-hideshow-haml-forward-sexp-fn (arg) - (haml-forward-sexp arg) - (move-beginning-of-line 1)) - -;;;###autoload -(defun +fold-hideshow-forward-block-by-indent-fn (_arg) - (let ((start (current-indentation))) - (forward-line) - (unless (= start (current-indentation)) - (let ((range (+fold-hideshow-indent-range))) - (goto-char (cadr range)) - (end-of-line))))) - -;;;###autoload -(defun +fold-hideshow-set-up-overlay-fn (ov) - (when (eq 'code (overlay-get ov 'hs)) - (when (featurep 'vimish-fold) - (overlay-put - ov 'before-string - (propertize "…" 'display - (list vimish-fold-indication-mode - 'empty-line - 'vimish-fold-fringe)))) - (overlay-put - ov 'display (propertize " [...] " 'face '+fold-hideshow-folded-face)))) - - -;; -;;; Indentation detection - -(defun +fold--hideshow-empty-line-p (_) - (string= "" (string-trim (thing-at-point 'line 'no-props)))) - -(defun +fold--hideshow-geq-or-empty-p (base-indent) - (or (+fold--hideshow-empty-line-p base-indent) - (>= (current-indentation) base-indent))) - -(defun +fold--hideshow-g-or-empty-p (base-indent) - (or (+fold--hideshow-empty-line-p base-indent) - (> (current-indentation) base-indent))) - -(defun +fold--hideshow-seek (start direction before skip predicate base-indent) - "Seeks forward (if direction is 1) or backward (if direction is -1) from start, until predicate -fails. If before is nil, it will return the first line where predicate fails, otherwise it returns -the last line where predicate holds." - (save-excursion - (goto-char start) - (goto-char (point-at-bol)) - (let ((bnd (if (> 0 direction) - (point-min) - (point-max))) - (pt (point))) - (when skip (forward-line direction)) - (cl-loop while (and (/= (point) bnd) (funcall predicate base-indent)) - do (progn - (when before (setq pt (point-at-bol))) - (forward-line direction) - (unless before (setq pt (point-at-bol))))) - pt))) - -(defun +fold-hideshow-indent-range (&optional point) - "Return the point at the begin and end of the text block with the same (or -greater) indentation. If `point' is supplied and non-nil it will return the -begin and end of the block surrounding point." - (save-excursion - (when point - (goto-char point)) - (let ((base-indent (current-indentation)) - (begin (point)) - (end (point))) - (setq begin (+fold--hideshow-seek begin -1 t nil #'+fold--hideshow-geq-or-empty-p base-indent) - begin (+fold--hideshow-seek begin 1 nil nil #'+fold--hideshow-g-or-empty-p base-indent) - end (+fold--hideshow-seek end 1 t nil #'+fold--hideshow-geq-or-empty-p base-indent) - end (+fold--hideshow-seek end -1 nil nil #'+fold--hideshow-empty-line-p base-indent)) - (list begin end base-indent)))) diff --git a/.config/emacs/modules/editor/fold/config.el b/.config/emacs/modules/editor/fold/config.el deleted file mode 100644 index 3dd9ed5..0000000 --- a/.config/emacs/modules/editor/fold/config.el +++ /dev/null @@ -1,88 +0,0 @@ -;;; editor/fold/config.el -*- lexical-binding: t; -*- - -(when (featurep! :editor evil) - ;; Add vimish-fold, outline-mode & hideshow support to folding commands - (define-key! 'global - [remap evil-toggle-fold] #'+fold/toggle - [remap evil-close-fold] #'+fold/close - [remap evil-open-fold] #'+fold/open - [remap evil-open-fold-rec] #'+fold/open - [remap evil-close-folds] #'+fold/close-all - [remap evil-open-folds] #'+fold/open-all) - (after! evil - (evil-define-key* 'motion 'global - "zj" #'+fold/next - "zk" #'+fold/previous))) - - -;; -;; Packages - -(use-package! hideshow ; built-in - :commands (hs-toggle-hiding - hs-hide-block - hs-hide-level - hs-show-all - hs-hide-all) - :config - (setq hs-hide-comments-when-hiding-all nil - ;; Nicer code-folding overlays (with fringe indicators) - hs-set-up-overlay #'+fold-hideshow-set-up-overlay-fn) - - (defadvice! +fold--hideshow-ensure-mode-a (&rest _) - "Ensure `hs-minor-mode' is enabled when we need it, no sooner or later." - :before '(hs-toggle-hiding hs-hide-block hs-hide-level hs-show-all hs-hide-all) - (unless (bound-and-true-p hs-minor-mode) - (hs-minor-mode +1))) - - ;; extra folding support for more languages - (unless (assq 't hs-special-modes-alist) - (setq hs-special-modes-alist - (append - '((vimrc-mode "{{{" "}}}" "\"") - (yaml-mode "\\s-*\\_<\\(?:[^:]+\\)\\_>" - "" - "#" - +fold-hideshow-forward-block-by-indent-fn nil) - (haml-mode "[#.%]" "\n" "/" +fold-hideshow-haml-forward-sexp-fn nil) - (ruby-mode "class\\|d\\(?:ef\\|o\\)\\|module\\|[[{]" - "end\\|[]}]" - "#\\|=begin" - ruby-forward-sexp) - (matlab-mode "if\\|switch\\|case\\|otherwise\\|while\\|for\\|try\\|catch" - "end" - nil (lambda (_arg) (matlab-forward-sexp))) - (nxml-mode "\\|]*[^/]>" - "" . #Xe113) - ("->" . #Xe114) - ("->>" . #Xe115) - ("-<" . #Xe116) - ("-<<" . #Xe117) - ("-~" . #Xe118) - ("#{" . #Xe119) - ("#[" . #Xe11a) - ("##" . #Xe11b) - ("###" . #Xe11c) - ("####" . #Xe11d) - ("#(" . #Xe11e) - ("#?" . #Xe11f) - ("#_" . #Xe120) - ("#_(" . #Xe121) - (".-" . #Xe122) - (".=" . #Xe123) - (".." . #Xe124) - ("..<" . #Xe125) - ("..." . #Xe126) - ("?=" . #Xe127) - ("??" . #Xe128) - (";;" . #Xe129) - ("/*" . #Xe12a) - ("/**" . #Xe12b) - ("/=" . #Xe12c) - ("/==" . #Xe12d) - ("/>" . #Xe12e) - ("//" . #Xe12f) - ("///" . #Xe130) - ("&&" . #Xe131) - ("||" . #Xe132) - ("||=" . #Xe133) - ("|=" . #Xe134) - ("|>" . #Xe135) - ("^=" . #Xe136) - ("$>" . #Xe137) - ("++" . #Xe138) - ("+++" . #Xe139) - ("+>" . #Xe13a) - ("=:=" . #Xe13b) - ("==" . #Xe13c) - ("===" . #Xe13d) - ("==>" . #Xe13e) - ("=>" . #Xe13f) - ("=>>" . #Xe140) - ("=<" . #Xe141) - ("=<<" . #Xe142) - ("=/=" . #Xe143) - (">-" . #Xe144) - (">=" . #Xe145) - (">=>" . #Xe146) - (">>" . #Xe147) - (">>-" . #Xe148) - (">>=" . #Xe149) - (">>>" . #Xe14a) - ("<*" . #Xe14b) - ("<*>" . #Xe14c) - ("<|" . #Xe14d) - ("<|>" . #Xe14e) - ("<$" . #Xe14f) - ("<$>" . #Xe150) - ("" . #Xe101) - ("<--->" . #Xe102) - ("<---->" . #Xe103) - ("<----->" . #Xe104) - ;; Double-ended equals arrows - ("<=>" . #Xe105) - ("<==>" . #Xe106) - ("<===>" . #Xe107) - ("<====>" . #Xe108) - ("<=====>" . #Xe109) - ;; Double-ended asterisk operators - ("<**>" . #Xe10a) - ("<***>" . #Xe10b) - ("<****>" . #Xe10c) - ("<*****>" . #Xe10d) - ;; HTML comments - ("" . #Xe152) - ("-->-" . #Xe153) - ("-->--" . #Xe154) - ("-->>" . #Xe155) - ("-->>-" . #Xe156) - ("-->>--" . #Xe157) - ("-->>>" . #Xe158) - ("-->>>-" . #Xe159) - ("-->>>--" . #Xe15a) - (">-" . #Xe15b) - (">--" . #Xe15c) - (">>-" . #Xe15d) - (">>--" . #Xe15e) - (">>>-" . #Xe15f) - (">>>--" . #Xe160) - ("=>" . #Xe161) - ("=>=" . #Xe162) - ("=>==" . #Xe163) - ("=>>" . #Xe164) - ("=>>=" . #Xe165) - ("=>>==" . #Xe166) - ("=>>>" . #Xe167) - ("=>>>=" . #Xe168) - ("=>>>==" . #Xe169) - ("==>" . #Xe16a) - ("==>=" . #Xe16b) - ("==>==" . #Xe16c) - ("==>>" . #Xe16d) - ("==>>=" . #Xe16e) - ("==>>==" . #Xe16f) - ("==>>>" . #Xe170) - ("==>>>=" . #Xe171) - ("==>>>==" . #Xe172) - (">=" . #Xe173) - (">==" . #Xe174) - (">>=" . #Xe175) - (">>==" . #Xe176) - (">>>=" . #Xe177) - (">>>==" . #Xe178) - ("<-" . #Xe179) - ("-<-" . #Xe17a) - ("--<-" . #Xe17b) - ("<<-" . #Xe17c) - ("-<<-" . #Xe17d) - ("--<<-" . #Xe17e) - ("<<<-" . #Xe17f) - ("-<<<-" . #Xe180) - ("--<<<-" . #Xe181) - ("<--" . #Xe182) - ("-<--" . #Xe183) - ("--<--" . #Xe184) - ("<<--" . #Xe185) - ("-<<--" . #Xe186) - ("--<<--" . #Xe187) - ("<<<--" . #Xe188) - ("-<<<--" . #Xe189) - ("--<<<--" . #Xe18a) - ("-<" . #Xe18b) - ("--<" . #Xe18c) - ("-<<" . #Xe18d) - ("--<<" . #Xe18e) - ("-<<<" . #Xe18f) - ("--<<<" . #Xe190) - ("<=" . #Xe191) - ("=<=" . #Xe192) - ("==<=" . #Xe193) - ("<<=" . #Xe194) - ("=<<=" . #Xe195) - ("==<<=" . #Xe196) - ("<<<=" . #Xe197) - ("=<<<=" . #Xe198) - ("==<<<=" . #Xe199) - ("<==" . #Xe19a) - ("=<==" . #Xe19b) - ("==<==" . #Xe19c) - ("<<==" . #Xe19d) - ("=<<==" . #Xe19e) - ("==<<==" . #Xe19f) - ("<<<==" . #Xe1a0) - ("=<<<==" . #Xe1a1) - ("==<<<==" . #Xe1a2) - ("=<" . #Xe1a3) - ("==<" . #Xe1a4) - ("=<<" . #Xe1a5) - ("==<<" . #Xe1a6) - ("=<<<" . #Xe1a7) - ("==<<<" . #Xe1a8) - ;; Monadic operators - (">=>" . #Xe1a9) - (">->" . #Xe1aa) - (">-->" . #Xe1ab) - (">==>" . #Xe1ac) - ("<=<" . #Xe1ad) - ("<-<" . #Xe1ae) - ("<--<" . #Xe1af) - ("<==<" . #Xe1b0) - ;; Composition operators - (">>" . #Xe1b1) - (">>>" . #Xe1b2) - ("<<" . #Xe1b3) - ("<<<" . #Xe1b4) - ;; Lens operators - (":+" . #Xe1b5) - (":-" . #Xe1b6) - (":=" . #Xe1b7) - ("+:" . #Xe1b8) - ("-:" . #Xe1b9) - ("=:" . #Xe1ba) - ("=^" . #Xe1bb) - ("=+" . #Xe1bc) - ("=-" . #Xe1bd) - ("=*" . #Xe1be) - ("=/" . #Xe1bf) - ("=%" . #Xe1c0) - ("^=" . #Xe1c1) - ("+=" . #Xe1c2) - ("-=" . #Xe1c3) - ("*=" . #Xe1c4) - ("/=" . #Xe1c5) - ("%=" . #Xe1c6) - ;; Logical - ("/\\" . #Xe1c7) - ("\\/" . #Xe1c8) - ;; Semigroup/monoid operators - ("<>" . #Xe1c9) - ("<+" . #Xe1ca) - ("<+>" . #Xe1cb) - ("+>" . #Xe1cc)) diff --git a/.config/emacs/modules/ui/ligatures/+pragmata-pro.el b/.config/emacs/modules/ui/ligatures/+pragmata-pro.el deleted file mode 100644 index eff991a..0000000 --- a/.config/emacs/modules/ui/ligatures/+pragmata-pro.el +++ /dev/null @@ -1,259 +0,0 @@ -;;; ui/ligatures/+pragmata-pro.el -*- lexical-binding: t; -*- - -(+ligatures--def-font pragmata-pro - ("PragmataPro") - ;; Double-ended hyphen arrows - ("[INFO]" . #Xe2b0) - ("[WARN]" . #Xe2b1) - ("[PASS]" . #Xe2b2) - ("[VERBOSE]" . #Xe2b3) - ("[KO]" . #Xe2b4) - ("[OK]" . #Xe2b5) - ("[PASS]" . #Xe2b6) - ("[ERROR]" . #Xe2c0) - ("[DEBUG]" . #Xe2c1) - ("[INFO]" . #Xe2c2) - ("[WARN]" . #Xe2c3) - ("[WARNING]" . #Xe2c4) - ("[ERR]" . #Xe2c5) - ("[FATAL]" . #Xe2c6) - ("[TRACE]" . #Xe2c7) - ("[FIXME]" . #Xe2c8) - ("[TODO]" . #Xe2c9) - ("[BUG]" . #Xe2ca) - ("[NOTE]" . #Xe2cb) - ("[HACK]" . #Xe2cc) - ("[MARK]" . #Xe2cd) - ("[FAIL]" . #Xe2ce) - ("// ERROR" . #Xe2e0) - ("// DEBUG" . #Xe2e1) - ("// INFO" . #Xe2e2) - ("// WARN" . #Xe2e3) - ("// WARNING" . #Xe2e4) - ("// ERR" . #Xe2e5) - ("// FATAL" . #Xe2e6) - ("// TRACE" . #Xe2e7) - ("// FIXME" . #Xe2e8) - ("// TODO" . #Xe2e9) - ("// BUG" . #Xe2ea) - ("// NOTE" . #Xe2eb) - ("// HACK" . #Xe2ec) - ("// MARK" . #Xe2ed) - ("// FAIL" . #Xe2ee) - ("# ERROR" . #Xe2f0) - ("# DEBUG" . #Xe2f1) - ("# INFO" . #Xe2f2) - ("# WARN" . #Xe2f3) - ("# WARNING" . #Xe2f4) - ("# ERR" . #Xe2f5) - ("# FATAL" . #Xe2f6) - ("# TRACE" . #Xe2f7) - ("# FIXME" . #Xe2f8) - ("# TODO" . #Xe2f9) - ("# BUG" . #Xe2fa) - ("# NOTE" . #Xe2fb) - ("# HACK" . #Xe2fc) - ("# MARK" . #Xe2fd) - ("# FAIL" . #Xe2fe) - ("!=" . #Xe900) - ("!==" . #Xe901) - ("!≡" . #Xe902) - ("!≡≡" . #Xe903) - ("!=<" . #Xe904) - ("#(" . #Xe90c) - ("#_" . #Xe90d) - ("#{" . #Xe90e) - ("#?" . #Xe90f) - ("##" . #Xe910) - ("#_(" . #Xe911) - ("#[" . #Xe912) - ("%=" . #Xe920) - ("&%" . #Xe92c) - ("&&" . #Xe92d) - ("&+" . #Xe92e) - ("&-" . #Xe92f) - ("&/" . #Xe930) - ("&=" . #Xe931) - ("&&&" . #Xe932) - ("$>" . #Xe93a) - ("(|" . #Xe940) - ("*>" . #Xe946) - ("++" . #Xe94c) - ("+++" . #Xe94d) - ("+=" . #Xe94e) - ("+>" . #Xe94f) - ("++=" . #Xe950) - ("--" . #Xe960) - ("-<" . #Xe961) - ("-<<" . #Xe962) - ("-=" . #Xe963) - ("->" . #Xe964) - ("->>" . #Xe965) - ("---" . #Xe966) - ("-->" . #Xe967) - ("-+-" . #Xe968) - ("-\\/" . #Xe969) - ("-|>" . #Xe96a) - ("-<|" . #Xe96b) - ("->-" . #Xe96c) - ("-<-" . #Xe96d) - ("-|" . #Xe96e) - ("-||" . #Xe96f) - ("-|:" . #Xe970) - (".=" . #Xe979) - ("//=" . #Xe994) - ("/=" . #Xe995) - ("/==" . #Xe996) - ("/-\\" . #Xe997) - ("/-:" . #Xe998) - ("/->" . #Xe999) - ("/=>" . #Xe99a) - ("/-<" . #Xe99b) - ("/=<" . #Xe99c) - ("/=:" . #Xe99d) - (":=" . #Xe9ac) - (":≡" . #Xe9ad) - (":=>" . #Xe9ae) - (":-\\" . #Xe9af) - (":=\\" . #Xe9b0) - (":-/" . #Xe9b1) - (":=/" . #Xe9b2) - (":-|" . #Xe9b3) - (":=|" . #Xe9b4) - (":|-" . #Xe9b5) - (":|=" . #Xe9b6) - ("<$>" . #Xe9c0) - ("<*" . #Xe9c1) - ("<*>" . #Xe9c2) - ("<+>" . #Xe9c3) - ("<-" . #Xe9c4) - ("<<=" . #Xe9c5) - ("<=" . #Xe9c6) - ("<=>" . #Xe9c7) - ("<>" . #Xe9c8) - ("<|>" . #Xe9c9) - ("<<-" . #Xe9ca) - ("<|" . #Xe9cb) - ("<=<" . #Xe9cc) - ("<~" . #Xe9cd) - ("<~~" . #Xe9ce) - ("<<~" . #Xe9cf) - ("<$" . #Xe9d0) - ("<+" . #Xe9d1) - ("" . #Xe9d2) - ("<@>" . #Xe9d3) - ("<#>" . #Xe9d4) - ("<%>" . #Xe9d5) - ("<^>" . #Xe9d6) - ("<&>" . #Xe9d7) - ("" . #Xe9d8) - ("<.>" . #Xe9d9) - ("" . #Xe9da) - ("<\\>" . #Xe9db) - ("<\">" . #Xe9dc) - ("<:>" . #Xe9dd) - ("<~>" . #Xe9de) - ("<**>" . #Xe9df) - ("<<^" . #Xe9e0) - ("<=" . #Xe9e1) - ("<->" . #Xe9e2) - ("" . #Xe9eb) - ("<<==" . #Xe9ec) - ("<==" . #Xe9ed) - ("<-\\" . #Xe9ee) - ("<-/" . #Xe9ef) - ("<=\\" . #Xe9f0) - ("<=/" . #Xe9f1) - ("=<<" . #Xea00) - ("==" . #Xea01) - ("===" . #Xea02) - ("==>" . #Xea03) - ("=>" . #Xea04) - ("=~" . #Xea05) - ("=>>" . #Xea06) - ("=~=" . #Xea07) - ("==>>" . #Xea08) - ("=>=" . #Xea09) - ("=<=" . #Xea0a) - ("=<" . #Xea0b) - ("==<" . #Xea0c) - ("=<|" . #Xea0d) - ("=/" . #Xea0e) - ("=/=" . #Xea0f) - ("=/<" . #Xea10) - ("=|" . #Xea11) - ("=||" . #Xea12) - ("=|:" . #Xea13) - (">-" . #Xea20) - (">=" . #Xea21) - (">>-" . #Xea22) - (">>=" . #Xea23) - (">=>" . #Xea24) - (">>^" . #Xea25) - (">>|" . #Xea26) - (">!=" . #Xea27) - (">->" . #Xea28) - (">==" . #Xea29) - (">=" . #Xea2a) - (">/=" . #Xea2b) - (">-|" . #Xea2c) - (">=|" . #Xea2d) - (">-\\" . #Xea2e) - (">=\\" . #Xea2f) - (">-/" . #Xea30) - (">=/" . #Xea31) - (">λ=" . #Xea32) - ("?." . #Xea3f) - ("^=" . #Xea43) - ("^^" . #Xea44) - ("^<<" . #Xea48) - ("^>>" . #Xea49) - ("\\=" . #Xea54) - ("\\==" . #Xea55) - ("\\/-" . #Xea56) - ("\\-/" . #Xea57) - ("\\-:" . #Xea58) - ("\\->" . #Xea59) - ("\\=>" . #Xea5a) - ("\\-<" . #Xea5b) - ("\\=<" . #Xea5c) - ("\\=:" . #Xea5d) - ("|=" . #Xea69) - ("|>=" . #Xea6a) - ("|>" . #Xea6b) - ("|+|" . #Xea6c) - ("|->" . #Xea6d) - ("|-->" . #Xea6e) - ("|=>" . #Xea6f) - ("|==>" . #Xea70) - ("|>-" . #Xea71) - ("|<<" . #Xea72) - ("||>" . #Xea73) - ("|>>" . #Xea74) - ("|-" . #Xea75) - ("||-" . #Xea76) - ("||=" . #Xea77) - ("|)" . #Xea78) - ("|]" . #Xea79) - ("|-:" . #Xea7a) - ("|=:" . #Xea7b) - ("|-<" . #Xea7c) - ("|=<" . #Xea7d) - ("|--<" . #Xea7e) - ("|==<" . #Xea7f) - ("~=" . #Xea8a) - ("~>" . #Xea8b) - ("~~>" . #Xea8c) - ("~>>" . #Xea8d) - ("[[" . #Xea8f) - ("[|" . #Xea90) - ("_|_" . #Xea97) - ("]]" . #Xeaa0)) diff --git a/.config/emacs/modules/ui/ligatures/README.org b/.config/emacs/modules/ui/ligatures/README.org deleted file mode 100644 index 66d969f..0000000 --- a/.config/emacs/modules/ui/ligatures/README.org +++ /dev/null @@ -1,216 +0,0 @@ -#+TITLE: ui/ligatures -#+DATE: June 16, 2018 -#+SINCE: v2.0.9 -#+STARTUP: inlineimages nofold - -* Table of Contents :TOC_3:noexport: -- [[#description][Description]] - - [[#maintainers][Maintainers]] - - [[#module-flags][Module Flags]] - - [[#font-ligatures-module-flags][Font ligatures module flags]] - - [[#plugins][Plugins]] -- [[#prerequisites][Prerequisites]] - - [[#mutsuharus-emacs-mac-port-or-emacs-28-with-harfbuzz-support][Mutsuharu's emacs-mac port or Emacs 28+ with Harfbuzz support]] - - [[#not-emacs-mac-and-emacs--27][Not Emacs-mac and Emacs <= 27]] -- [[#features][Features]] - - [[#mathematical-symbols-replacement][Mathematical symbols replacement]] - - [[#coding-ligatures][Coding ligatures]] -- [[#configuration][Configuration]] - - [[#setting-ligatures][Setting ligatures]] - - [[#changing-ligatures][Changing ligatures]] -- [[#troubleshooting][Troubleshooting]] - -* Description -This module enables ligatures and arbitrary symbol substitutions with -~mac-auto-operator-composition-mode~ (on supported macOS systems) or composition -tables (harfbuzz on Emacs 28), falling back on ~prettify-symbols-mode~ -otherwise. - -** Maintainers -This module has no dedicated maintainers. - -** Module Flags -+ =+extra= Enables extra symbol substitutions in certain modes, for example - ~lambda~ in lisps are replaced with ~λ~. - -*** Font ligatures module flags -This module provides four flags for enabling fall-back ligature support for a -particular font. They are: - -+ =+fira= Enables =Fira Code= ligatures. This requires Fira Code Symbol and a - patched version of Fira Code (see below). -+ =+hasklig= Enable =Hasklig= ligatures. This requires a patched version of the - HaskLig font (see below). -+ =+iosevka= Enable =Iosevka= ligatures. This requires a patched version of the - Iosevka font (see below). -+ =+pragmata-pro= Enable =Pragmata Pro= ligatures. This requires the [[https://www.fsd.it/shop/fonts/pragmatapro/][Pragmata - Pro font]]. - -#+begin_quote -All these flags are ignored _if_ you're sporting either a) Emacs 28+ with -Harfbuzz support (which can compose ligatures natively), or b) Mitsuharu's -=emacs-mac= build on macOS (which uses ~mac-auto-operator-composition-mode~). -#+end_quote - -** Plugins -This module installs no packages. - -* Prerequisites -This module requires one of three setups for ligatures to work: - -- A recent enough version of Emacs which will compose ligatures automatically - (Emacs 28 with Harfbuzz support), or -- Mitsuharu's =emacs-mac= build on macOS (available on homebrew), or -- A patched font for Doom's fallback ligature support. - -** Mutsuharu's emacs-mac port or Emacs 28+ with Harfbuzz support -Ligatures should be handled without any additional configuration. - -** Not Emacs-mac and Emacs <= 27 -1. Enable one of the four ligature font flags: =+fira=, =+hasklig=, =+iosevka= - or =+pragmata-pro=. -2. Install the patched version of the associated font with ~M-x - +ligatures/install-patched-font~. Note: Pragmata Pro cannot be installed this - way because it is a non-free font and must be purchased and installed - manually. - -* TODO Features -** TODO Mathematical symbols replacement -** Coding ligatures -This module includes configuration to compose combinations like =->= or =::= -into prettier glyphs (called a ligature). Depending on the current version of -emacs, this is implemented in two different ways : - -- prettify-symbols-mode method :: this is the "legacy" method. It uses a font - which haves the ligatures as separate unicode symbols, and using - prettify-symbols-mode, =->=-like combinations are manually listed and replaced - with the correct symbol. The mapping between =->=-like sequences and unicode - values in the font are font-specific ; therefore =+fira=, =+iosevka=... files - and specific fonts are necessary for it to work. -- composition-function-table method :: regexps are used to match all the usual - sequences which are composed into ligatures. These regexps are passed to emacs - directly, which asks Harfbuzz to shape it. Ligatures are obtained - automatically depending on the capabilities of the font, and no font-specific - configuration is necessary. - -Emacs-mac port implements the /composition-function-table/ method in [[https://bitbucket.org/mituharu/emacs-mac/src/26c8fd9920db9d34ae8f78bceaec714230824dac/lisp/term/mac-win.el?at=master#lines-345:805][its code]], -nothing is necessary on Doom side; otherwise, Doom implements the -/composition-function-table/ for emacs 28+ built with Harfbuzz support, and the -/prettify-symbols-mode/ method otherwise. - -Even though harfbuzz has been included in emacs 27, there is currently a [[https://lists.gnu.org/archive/html/bug-gnu-emacs/2020-04/msg01121.html][bug -(#40864)]] which prevents a safe usage of /composition-function-table/ method in -emacs 27. - -* Configuration -** Setting ligatures -If you want to set ligatures for modules that don't have them by default you can -use the ~set-ligatures!~ macro in your config el file -#+BEGIN_SRC emacs-lisp -(after! PACKAGE - (set-ligatures! 'MAJOR-MODE - :symbol "keyword")) -#+END_SRC -eg. -#+BEGIN_SRC emacs-lisp -(after! go-mode ; in this case the major mode and package named the same thing - (set-ligatures! 'go-mode - :def "func" ; function keyword - :true "true" :false "false" - ; this will replace not only definitions - ; but coresponding functions aswell - :int "int" :str "string" - :float "float" :bool "bool" - :for "for" - :return "return" :yeild "yeild")) -#+END_SRC -you can set these symbols out of the box -#+BEGIN_SRC emacs-lisp -(set-ligatures! 'MAJOR-MODE - ;; Functional - :lambda "lambda keyword" - :def "function keyword" - :composition "composition" - :map "map/dictionary keyword" - ;; Types - :null "null type" - :true "true keyword" - :false "false keyword" - :int "int keyword" - :float "float keyword" - :str "string keyword" - :bool "boolean keywork" - :list "list keyword" - ;; Flow - :not "not operator" - :in "in operator" - :not-in "not in operator" - :and "and keyword" - :or "or keyword" - :for "for keyword" - :some "some keyword" - :return "return" - :yield "yeild" - ;; Other - :union "Union keyword" - :intersect "Intersect keyword" - :diff "diff keyword" - :tuple "Tuple Keyword " - :pipe "Pipe Keyword" ;; FIXME: find a non-private char - :dot "Dot operator") -#+END_SRC - -If you have multiple versions of the same keyword you can set the symbol twice - -#+BEGIN_SRC emacs-lisp -(set-ligatures! scala-mode - :null "none" - :null "None") -#+END_SRC -** Changing ligatures -if you don't like the symbols chosen you can change them by using... - -#+BEGIN_SRC emacs-lisp -;; you don't need to include all of them you can pick and mix -(plist-put! +ligatures-extra-symbols - ;; org - :name "»" - :src_block "»" - :src_block_end "«" - :quote "“" - :quote_end "”" - ;; Functional - :lambda "λ" - :def "ƒ" - :composition "∘" - :map "↦" - ;; Types - :null "∅" - :true "𝕋" - :false "𝔽" - :int "ℤ" - :float "ℝ" - :str "𝕊" - :bool "𝔹" - :list "𝕃" - ;; Flow - :not "¬" - :in "∈" - :not-in "∉" - :and "∧" - :or "∨" - :for "∀" - :some "∃" - :return "⟼" - :yield "⟻" - ;; Other - :union "⋃" - :intersect "∩" - :diff "∖" - :tuple "⨂" - :pipe "" ;; FIXME: find a non-private char - :dot "•") ;; you could also add your own if you want -#+END_SRC - -* TODO Troubleshooting - If you have any problems with this module, do get in touch! diff --git a/.config/emacs/modules/ui/ligatures/autoload/install.el b/.config/emacs/modules/ui/ligatures/autoload/install.el deleted file mode 100644 index e272701..0000000 --- a/.config/emacs/modules/ui/ligatures/autoload/install.el +++ /dev/null @@ -1,58 +0,0 @@ -;;; ui/ligatures/autoload/install.el -*- lexical-binding: t; -*- -;;;###if (or (featurep! +fira) (featurep! +hasklig) (featurep! +iosevka)) - -(defun +ligatures--install-font (prefix name url-format fonts-alist &optional extra-fonts) - "Install fonts to the local system. - -If PREFIX is nil, will prompt whether or not to download. NAME is informational -only. URL-FORMAT is a format string that should be a url and have a single %s, -which is expanded for each font in FONTS-ALIST. FONTS-ALIST should be the -filename of each font. It is used as the source and destination filename." - (unless (or prefix - (yes-or-no-p - (format "This will download and install the %s fonts, continue?" - name))) - (user-error "Aborted")) - (let* ((font-dest - (cond (IS-LINUX - (expand-file-name - "fonts/" (or (getenv "XDG_DATA_HOME") - "~/.local/share"))) - (IS-MAC - (expand-file-name "~/Library/Fonts/")))) - (known-dest-p (stringp font-dest)) - (font-dest (or font-dest (read-directory-name "Font installation directory: " "~/")))) - (unless (file-directory-p font-dest) - (mkdir font-dest t)) - (dolist (font fonts-alist) - (url-copy-file (format url-format font) - (expand-file-name font font-dest) - t)) - (when known-dest-p - (message "Font downloaded, updating font cache... ") - (shell-command-to-string "fc-cache -f -v")) - (if IS-WINDOWS - (when (y-or-n-p "The %S font was downloaded, but Windows users must install them manually.\n\nShow files in windows explorer?") - (call-process "explorer.exe" nil nil nil font-dest)) - (message "Successfully %s %S fonts to %S!" - (if known-dest-p "installed" "downloaded") - name font-dest)))) - -;;;###autoload -(defun +ligatures/install-patched-font (font-id &optional arg) - "Install the font FONT-ID on your system. -FONT-ID must be a key from `+ligatures--font-alist'. -If PREFIX is non-nil, don't ask for confirmation and install it." - (interactive - (list - (car (cl-find (completing-read - "Install font: " - (mapcar #'cadr +ligatures--font-alist)) - +ligatures--font-alist - :key #'cadr - :test #'equal)) - current-prefix-arg)) - (cl-destructuring-bind (font-name &key _range url files) - (or (alist-get font-id +ligatures--font-alist) - (user-error "%S is not a valid font" font-id)) - (+ligatures--install-font arg font-name url files))) diff --git a/.config/emacs/modules/ui/ligatures/autoload/ligatures.el b/.config/emacs/modules/ui/ligatures/autoload/ligatures.el deleted file mode 100644 index 7856ff7..0000000 --- a/.config/emacs/modules/ui/ligatures/autoload/ligatures.el +++ /dev/null @@ -1,50 +0,0 @@ -;;; ui/ligatures/autoload/ligatures.el -*- lexical-binding: t; -*- - -;; DEPRECATED -;;;###autodef -(define-obsolete-function-alias 'set-pretty-symbols! 'set-ligatures! "3.0.0") - -;;;###autodef -(defun set-ligatures! (modes &rest plist) - "Associates string patterns with icons in certain major-modes. - - MODES is a major mode symbol or a list of them. - PLIST is a property list whose keys must match keys in -`+ligatures-extra-symbols', and whose values are strings representing the text -to be replaced with that symbol. If the car of PLIST is nil, then unset any -pretty symbols previously defined for MODES. - -This function accepts one special property: - - :alist ALIST - Appends ALIST to `prettify-symbols-alist' literally, without mapping text to - `+ligatures-extra-symbols'. - -For example, the rule for emacs-lisp-mode is very simple: - - (set-ligatures! 'emacs-lisp-mode - :lambda \"lambda\") - -This will replace any instances of \"lambda\" in emacs-lisp-mode with the symbol -assicated with :lambda in `+ligatures-extra-symbols'. - -Pretty symbols can be unset for emacs-lisp-mode with: - - (set-ligatures! 'emacs-lisp-mode nil)" - (declare (indent defun)) - (if (null (car-safe plist)) - (dolist (mode (doom-enlist modes)) - (delq! mode +ligatures-extra-alist 'assq)) - (let (results) - (while plist - (let ((key (pop plist))) - (if (eq key :alist) - (prependq! results (pop plist)) - (when-let (char (plist-get +ligatures-extra-symbols key)) - (push (cons (pop plist) char) results))))) - (dolist (mode (doom-enlist modes)) - (setf (alist-get mode +ligatures-extra-alist) - (if-let (old-results (alist-get mode +ligatures-extra-alist)) - (dolist (cell results old-results) - (setf (alist-get (car cell) old-results) (cdr cell))) - results)))))) diff --git a/.config/emacs/modules/ui/ligatures/config.el b/.config/emacs/modules/ui/ligatures/config.el deleted file mode 100644 index 2c34fce..0000000 --- a/.config/emacs/modules/ui/ligatures/config.el +++ /dev/null @@ -1,220 +0,0 @@ -;;; ui/ligatures/config.el -*- lexical-binding: t; -*- - -(defvar +ligatures-extra-symbols - '(;; org - :name "»" - :src_block "»" - :src_block_end "«" - :quote "“" - :quote_end "”" - ;; Functional - :lambda "λ" - :def "ƒ" - :composition "∘" - :map "↦" - ;; Types - :null "∅" - :true "𝕋" - :false "𝔽" - :int "ℤ" - :float "ℝ" - :str "𝕊" - :bool "𝔹" - :list "𝕃" - ;; Flow - :not "¬" - :in "∈" - :not-in "∉" - :and "∧" - :or "∨" - :for "∀" - :some "∃" - :return "⟼" - :yield "⟻" - ;; Other - :union "⋃" - :intersect "∩" - :diff "∖" - :tuple "⨂" - :pipe "" ;; FIXME: find a non-private char - :dot "•") - "Maps identifiers to symbols, recognized by `set-ligatures'. - -This should not contain any symbols from the Unicode Private Area! There is no -universal way of getting the correct symbol as that area varies from font to -font.") - -(defvar +ligatures-extra-alist '((t)) - "A map of major modes to symbol lists (for `prettify-symbols-alist').") - -(defvar +ligatures-composition-alist - '((?! . "\\(?:!\\(?:==\\|[!=]\\)\\)") ; (regexp-opt '("!!" "!=" "!==")) - (?# . "\\(?:#\\(?:###?\\|_(\\|[#(:=?[_{]\\)\\)") ; (regexp-opt '("##" "###" "####" "#(" "#:" "#=" "#?" "#[" "#_" "#_(" "#{")) - (?$ . "\\(?:\\$>>?\\)") ; (regexp-opt '("$>" "$>>")) - (?% . "\\(?:%%%?\\)") ; (regexp-opt '("%%" "%%%")) - (?& . "\\(?:&&&?\\)") ; (regexp-opt '("&&" "&&&")) - (?* . "\\(?:\\*\\(?:\\*[*/]\\|[)*/>]\\)?\\)") ; (regexp-opt '("*" "**" "***" "**/" "*/" "*>" "*)")) - (?+ . "\\(?:\\+\\(?:\\+\\+\\|[+:>]\\)?\\)") ; (regexp-opt '("+" "++" "+++" "+>" "+:")) - (?- . "\\(?:-\\(?:-\\(?:->\\|[>-]\\)\\|<[<-]\\|>[>-]\\|[:<>|}~-]\\)\\)") ; (regexp-opt '("--" "---" "-->" "--->" "->-" "-<" "-<-" "-<<" "->" "->>" "-}" "-~" "-:" "-|")) - (?. . "\\(?:\\.\\(?:\\.[.<]\\|[.=>-]\\)\\)") ; (regexp-opt '(".-" ".." "..." "..<" ".=" ".>")) - (?/ . "\\(?:/\\(?:\\*\\*\\|//\\|==\\|[*/=>]\\)\\)") ; (regexp-opt '("/*" "/**" "//" "///" "/=" "/==" "/>")) - (?: . "\\(?::\\(?:::\\|[+:<=>]\\)?\\)") ; (regexp-opt '(":" "::" ":::" ":=" ":<" ":=" ":>" ":+")) - (?\; . ";;") ; (regexp-opt '(";;")) - (?0 . "0\\(?:\\(x[a-fA-F0-9]\\).?\\)") ; Tries to match the x in 0xDEADBEEF - ;; (?x . "x") ; Also tries to match the x in 0xDEADBEEF - ;; (regexp-opt '("" "<--->" "" "<<" "<<-" "<<<" "<<=" "<=" "<=<" "<==" "<=>" "<===>" "<>" "<|" "<|>" "<~" "<~~" "<." "<.>" "<..>")) - (?< . "\\(?:<\\(?:!--\\|\\$>\\|\\*\\(?:\\*?>\\)\\|\\+>\\|-\\(?:-\\(?:->\\|[>-]\\)\\|[>-]\\)\\|\\.\\(?:\\.?>\\)\\|/>\\|<[<=-]\\|=\\(?:==>\\|[<=>]\\)\\||>\\|~~\\|[$*+./<=>|~-]\\)\\)") - (?= . "\\(?:=\\(?:/=\\|:=\\|<<\\|=[=>]\\|>>\\|[=>]\\)\\)") ; (regexp-opt '("=/=" "=:=" "=<<" "==" "===" "==>" "=>" "=>>")) - (?> . "\\(?:>\\(?:->\\|=>\\|>[=>-]\\|[:=>-]\\)\\)") ; (regexp-opt '(">-" ">->" ">:" ">=" ">=>" ">>" ">>-" ">>=" ">>>")) - (?? . "\\(?:\\?[.:=?]\\)") ; (regexp-opt '("??" "?." "?:" "?=")) - (?\[ . "\\(?:\\[\\(?:|]\\|[]|]\\)\\)") ; (regexp-opt '("[]" "[|]" "[|")) - (?\\ . "\\(?:\\\\\\\\[\\n]?\\)") ; (regexp-opt '("\\\\" "\\\\\\" "\\\\n")) - (?^ . "\\(?:\\^==?\\)") ; (regexp-opt '("^=" "^==")) - (?w . "\\(?:wwww?\\)") ; (regexp-opt '("www" "wwww")) - (?{ . "\\(?:{\\(?:|\\(?:|}\\|[|}]\\)\\|[|-]\\)\\)") ; (regexp-opt '("{-" "{|" "{||" "{|}" "{||}")) - (?| . "\\(?:|\\(?:->\\|=>\\||=\\|[]=>|}-]\\)\\)") ; (regexp-opt '("|=" "|>" "||" "||=" "|->" "|=>" "|]" "|}" "|-")) - (?_ . "\\(?:_\\(?:|?_\\)\\)") ; (regexp-opt '("_|_" "__")) - (?\( . "\\(?:(\\*\\)") ; (regexp-opt '("(*")) - (?~ . "\\(?:~\\(?:~>\\|[=>@~-]\\)\\)")) ; (regexp-opt '("~-" "~=" "~>" "~@" "~~" "~~>")) - "An alist of all ligatures used by `+ligatures-extras-in-modes'. - -The car is the character ASCII number, cdr is a regex which will call -`font-shape-gstring' when matched. - -Because of the underlying code in :ui ligatures module, the regex should match a -string starting with the character contained in car. - -This variable is used only if you built Emacs with Harfbuzz on a version >= 28") - -(defvar +ligatures-in-modes - '(not special-mode comint-mode eshell-mode term-mode vterm-mode Info-mode - elfeed-search-mode elfeed-show-mode) - "List of major modes where ligatures should be enabled. - - If t, enable it everywhere (except `fundamental-mode'). - If the first element is 'not, enable it in any mode besides what is listed. - If nil, don't enable ligatures anywhere.") - -(defvar +ligatures-extras-in-modes t - "List of major modes where extra ligatures should be enabled. - -Extra ligatures are mode-specific substituions, defined in -`+ligatures-extra-symbols' and assigned with `set-ligatures!'. This variable -controls where these are enabled. - - If t, enable it everywhere (except `fundamental-mode'). - If the first element is 'not, enable it in any mode besides what is listed. - If nil, don't enable these extra ligatures anywhere (though it's more -efficient to remove the `+extra' flag from the :ui ligatures module instead).") - -(defvar +ligatures--init-font-hook nil) - -(defun +ligatures--correct-symbol-bounds (ligature-alist) - "Prepend non-breaking spaces to a ligature. - -This way `compose-region' (called by `prettify-symbols-mode') will use the -correct width of the symbols instead of the width measured by `char-width'." - (let ((len (length (car ligature-alist))) - (acc (list (cdr ligature-alist)))) - (while (> len 1) - (setq acc (cons #X00a0 (cons '(Br . Bl) acc)) - len (1- len))) - (cons (car ligature-alist) acc))) - -(defun +ligatures--enable-p (modes) - "Return t if ligatures should be enabled in this buffer depending on MODES." - (unless (eq major-mode 'fundamental-mode) - (or (eq modes t) - (if (eq (car modes) 'not) - (not (apply #'derived-mode-p (cdr modes))) - (apply #'derived-mode-p modes))))) - -(defun +ligatures-init-buffer-h () - "Set up ligatures for the current buffer. - -Extra ligatures are mode-specific substituions, defined in -`+ligatures-extra-symbols', assigned with `set-ligatures!', and made possible -with `prettify-symbols-mode'. This variable controls where these are enabled. -See `+ligatures-extras-in-modes' to control what major modes this function can -and cannot run in." - (when after-init-time - (let ((in-mode-p - (+ligatures--enable-p +ligatures-in-modes)) - (in-mode-extras-p - (and (featurep! +extra) - (+ligatures--enable-p +ligatures-extras-in-modes)))) - (when in-mode-p - (if (boundp '+ligature--composition-table) - (setq-local composition-function-table +ligature--composition-table) - (run-hooks '+ligatures--init-font-hook) - (setq +ligatures--init-font-hook nil))) - (when in-mode-extras-p - (prependq! prettify-symbols-alist - (alist-get major-mode +ligatures-extra-alist))) - (when (and (or in-mode-p in-mode-extras-p) - prettify-symbols-alist) - (when prettify-symbols-mode - (prettify-symbols-mode -1)) - (prettify-symbols-mode +1))))) - - -;; -;;; Bootstrap - -;;;###package prettify-symbols -;; When you get to the right edge, it goes back to how it normally prints -(setq prettify-symbols-unprettify-at-point 'right-edge) - -(add-hook! 'doom-init-ui-hook :append - (defun +ligatures-init-h () - (add-hook 'after-change-major-mode-hook #'+ligatures-init-buffer-h))) - -(cond - ;; The emacs-mac build of Emacs appears to have built-in support for ligatures, - ;; using the same composition-function-table method - ;; https://bitbucket.org/mituharu/emacs-mac/src/26c8fd9920db9d34ae8f78bceaec714230824dac/lisp/term/mac-win.el?at=master#lines-345:805 - ;; so use that instead if this module is enabled. - ((and IS-MAC (fboundp 'mac-auto-operator-composition-mode)) - (add-hook 'doom-init-ui-hook #'mac-auto-operator-composition-mode 'append)) - - ;; Harfbuzz and Mac builds do not need font-specific ligature support - ;; if they are above emacs-27. - ((and EMACS28+ - (or (featurep 'ns) - (string-match-p "HARFBUZZ" system-configuration-features)) - (featurep 'composite)) ; Emacs loads `composite' at startup - (defvar +ligature--composition-table (make-char-table nil)) - (add-hook! 'doom-init-ui-hook :append - (defun +ligature-init-composition-table-h () - (dolist (char-regexp +ligatures-composition-alist) - (set-char-table-range - +ligature--composition-table - (car char-regexp) `([,(cdr char-regexp) 0 font-shape-gstring]))) - (set-char-table-parent +ligature--composition-table composition-function-table)))) - - ;; Fallback ligature support for certain, patched fonts. Install them with - ;; `+ligatures/install-patched-font' - ((defmacro +ligatures--def-font (id font-plist &rest alist) - (declare (indent 2)) - (let ((alist-var (intern (format "+ligatures-%s-font-alist" id))) - (setup-fn (intern (format "+ligatures-init-%s-font-h" id)))) - `(progn - (setf (alist-get ',id +ligatures--font-alist) (list ,@font-plist)) - (defvar ,alist-var ',alist ,(format "Name of the %s ligature font." id)) - (defun ,setup-fn (&rest _) - (cl-destructuring-bind (name &key _url files range) - (or (alist-get ',id +ligatures--font-alist) - (error "No ligature font called %s" ',id)) - (when range - (set-fontset-font t range name nil 'prepend)) - (setq-default prettify-symbols-alist - (append (default-value 'prettify-symbols-alist) - (mapcar #'+ligatures--correct-symbol-bounds ,alist-var))))) - (add-hook '+ligatures--init-font-hook #',setup-fn)))) - - (defvar +ligatures--font-alist ()) - - (cond ((featurep! +fira) (load! "+fira")) - ((featurep! +iosevka) (load! "+iosevka")) - ((featurep! +hasklig) (load! "+hasklig")) - ((featurep! +pragmata-pro) (load! "+pragmata-pro"))))) diff --git a/.config/emacs/modules/ui/minimap/README.org b/.config/emacs/modules/ui/minimap/README.org deleted file mode 100644 index 28d4858..0000000 --- a/.config/emacs/modules/ui/minimap/README.org +++ /dev/null @@ -1,43 +0,0 @@ -#+TITLE: :ui minimap -#+DATE: May 8, 2020 -#+SINCE: v3.0.0 -#+STARTUP: inlineimages nofold - -* Table of Contents :TOC_3:noexport: -- [[#description][Description]] - - [[#maintainers][Maintainers]] - - [[#module-flags][Module Flags]] - - [[#plugins][Plugins]] -- [[#features][Features]] -- [[#configuration][Configuration]] -- [[#troubleshooting][Troubleshooting]] - - [[#scrolling-is-slowlaggy][Scrolling is slow/laggy]] - - [[#minimap-doesnt-close-when-disabled][Minimap doesn't close when disabled]] - -* Description -This module adds a minimap to the right side of Emacs, similar to the feature -found in many other editors. - -** Maintainers -+ [[https://github.com/rushsteve1][@rushsteve1]] (Author) - -** Module Flags -This module provides no flags. - -** Plugins -+ [[https://elpa.gnu.org/packages/minimap.html][minimap.el]] - -* Features -A minimap which provides an overview of the current buffer to the side, -displaying the currently visible region and the current line. You can left-click -and drag to scroll along the buffer, or right-click anywhere to jump to there. - -* Configuration -There are a number of options provided by the =minimap.el= package this module -is based on. The easiest way to see all of them is =SPC h v minimap=. - -* Troubleshooting -** Scrolling is slow/laggy -Disable the minimap using =SPC t m= - -** TODO Minimap doesn't close when disabled diff --git a/.config/emacs/modules/ui/minimap/config.el b/.config/emacs/modules/ui/minimap/config.el deleted file mode 100644 index 40389aa..0000000 --- a/.config/emacs/modules/ui/minimap/config.el +++ /dev/null @@ -1,10 +0,0 @@ -;;; ui/minimap/config.el -*- lexical-binding: t; -*- - -(use-package! minimap - :defer t - :config - (setq minimap-window-location 'right - minimap-update-delay 0 - minimap-width-fraction 0.09 - minimap-minimum-width 15) - (pushnew! minimap-major-modes 'text-mode 'conf-mode)) diff --git a/.config/emacs/modules/ui/minimap/packages.el b/.config/emacs/modules/ui/minimap/packages.el deleted file mode 100644 index b020b77..0000000 --- a/.config/emacs/modules/ui/minimap/packages.el +++ /dev/null @@ -1,4 +0,0 @@ -;; -*- no-byte-compile: t; -*- -;;; ui/minimap/packages.el - -(package! minimap :pin "ed7490652a676c0510ed57d5366c445de20a370b") diff --git a/.config/emacs/modules/ui/modeline/+light.el b/.config/emacs/modules/ui/modeline/+light.el deleted file mode 100644 index 289ef10..0000000 --- a/.config/emacs/modules/ui/modeline/+light.el +++ /dev/null @@ -1,613 +0,0 @@ -;;; ui/modeline/+default.el -*- lexical-binding: t; -*- - -;; This is a slimmed down version of `doom-modeline' that manipulates -;; `mode-line-format' directly. Its purpose is to be truer to the original goal -;; of Doom's modeline: to be more performant and minimalistic alternative to -;; other modeline packages and to be abstraction-light. Too much abstraction is -;; too much magic. -;; -;; Warning: this is still a WIP! - -(defun +modeline--set-var-and-refresh-bars-fn (&optional symbol value) - (when symbol - (set-default symbol value)) - (when doom-init-time - (+modeline-refresh-bars-h))) - - -;; -;;; Variables - -(defcustom +modeline-height 31 - "The height of the modeline. - -This is enforced by the xpm bitmap bar in `+modeline-bar'. Without it (and in -the terminal), this variable does nothing. - -Use `setq!' to adjust this variable live, as it will trigger an refresh of the -bars in the modeline. `setq' will not." - :type 'integer - :set #'+modeline--set-var-and-refresh-bars-fn) - -(defcustom +modeline-bar-width 3 - "The width of the bar in the modeline. - -If nil, the bar will be made transparent and 1 pixel wide, as to be invisible, -but without sacrificing its ability to enforce `+modeline-height'. - -Use `setq!' to adjust this variable live, as it will trigger an refresh of the -bars in the modeline. `setq' will not." - :type 'integer - :set #'+modeline--set-var-and-refresh-bars-fn) - -(defvar +modeline-format-alist () - "An alist of modeline formats defined with `def-modeline!'. - -Each entry's CAR is the name and CDR is a cons cell whose CAR is the left-hand -side of the modeline, and whose CDR is the right-hand side.") - - -;; -;;; Faces - -(defface doom-modeline-bar '((t (:inherit highlight))) - "Face used for left-most bar on the mode-line of an active window.") - -(defface doom-modeline-bar-inactive '((t (:inherit mode-line-inactive))) - "Face used for left-most bar on the mode-line of an inactive window.") - -(defface doom-modeline-highlight - '((t (:inherit mode-line-highlight))) - "Face used for highlighted modeline panels (like search counts).") - -(defface doom-modeline-alternate-highlight - '((t (:inherit mode-line-highlight))) - "Alternative face used for highlighted modeline panels (like search counts).") - - -;; -;;; Helpers - -;;; `active' -(defvar +modeline--active-window (selected-window)) - -(defun +modeline-active () - "Return non-nil if the selected window has an active modeline." - (eq (selected-window) +modeline--active-window)) - -(add-hook! 'pre-redisplay-functions - (defun +modeline-set-selected-window-h (&rest _) - "Track the active modeline's window in `+modeline--active-window'." - (let ((win (selected-window))) - (unless (minibuffer-window-active-p win) - (setq +modeline--active-window (frame-selected-window)))))) - -(defun +modeline--make-xpm (color width height) - "Create an XPM bitmap via COLOR, WIDTH and HEIGHT. Inspired by `powerline''s `pl/+modeline--make-xpm'." - (propertize - " " 'display - (let ((data (make-list height (make-list width 1))) - (color (or color "None"))) - (ignore-errors - (create-image - (concat - (format "/* XPM */\nstatic char * percent[] = {\n\"%i %i 2 1\",\n\". c %s\",\n\" c %s\"," - (length (car data)) - (length data) - color - color) - (apply #'concat - (cl-loop with idx = 0 - with len = (length data) - for dl in data - do (cl-incf idx) - collect - (concat "\"" - (cl-loop for d in dl - if (= d 0) collect (string-to-char " ") - else collect (string-to-char ".")) - (if (eq idx len) "\"};" "\",\n"))))) - 'xpm t :ascent 'center))))) - -(defun +modeline-format-icon (icon-set icon label &optional face help-echo voffset) - "Build from ICON-SET the ICON with LABEL. -Using optionals attributes FACE, HELP-ECHO and VOFFSET." - (let ((icon-set-fn (pcase icon-set - ('octicon #'all-the-icons-octicon) - ('faicon #'all-the-icons-faicon) - ('material #'all-the-icons-material) - ('alltheicon #'all-the-icons-alltheicon) - ('fileicon #'all-the-icons-fileicon)))) - (propertize (concat (funcall icon-set-fn - icon - :face face - :height 1.1 - :v-adjust (or voffset -0.225)) - (propertize label 'face face)) - 'help-echo help-echo))) - -(defun set-modeline! (name &optional default) - "Set the modeline to NAME. -If DEFAULT is non-nil, apply to all future buffers. Modelines are defined with -`def-modeline!'." - (if-let (format (assq name +modeline-format-alist)) - (cl-destructuring-bind (lhs . rhs) (cdr format) - (if default - (setq-default +modeline-format-left lhs - +modeline-format-right rhs) - (setq +modeline-format-left lhs - +modeline-format-right rhs))) - (error "Could not find %S modeline format" name))) - -(defun set-modeline-hook! (hooks name) - "Set the modeline to NAME on HOOKS. -See `def-modeline!' on how modelines are defined." - (let ((fn (intern (format "+modeline-set-%s-format-h" name)))) - (dolist (hook (doom-enlist hooks)) - (when after-init-time - (dolist (name (mapcar #'car +modeline-format-alist)) - (remove-hook hook (intern (format "+modeline-set-%s-format-h" name))))) - (add-hook hook fn)))) - -(defun def-modeline! (name lhs rhs) - "Define a modeline format by NAME. -LHS and RHS are the formats representing the left and right hand side of the -mode-line, respectively. See the variable `format-mode-line' for details on what -LHS and RHS will accept." - (setf (alist-get name +modeline-format-alist) - (cons lhs rhs)) - (fset (intern (format "+modeline-set-%s-format-h" name)) - (lambda (&rest _) (set-modeline! name)))) - -(defmacro def-modeline-var! (name body &optional docstring &rest plist) - "Define a modeline segment variable." - (unless (stringp docstring) - (push docstring plist) - (setq docstring nil)) - `(progn - (defconst ,name ,body ,docstring) - ,@(if (plist-get plist :local) `((make-variable-buffer-local ',name))) - (put ',name 'risky-local-variable t))) - - -;; -;;; Segments - -(def-modeline-var! +modeline-format-left nil - "The left-hand side of the modeline." - :local t) - -(def-modeline-var! +modeline-format-right nil - "The right-hand side of the modeline." - :local t) - - -;;; `+modeline-bar' -(def-modeline-var! +modeline-bar "") - -(defvar +modeline-active-bar "") -(defvar +modeline-inactive-bar "") - -(add-hook! '(doom-init-ui-hook doom-load-theme-hook) :append - (defun +modeline-refresh-bars-h () - (let ((width (or +modeline-bar-width 1)) - (height (max +modeline-height 0)) - (active-bg (face-background 'doom-modeline-bar nil t)) - (inactive-bg (face-background 'doom-modeline-bar-inactive nil t))) - (when (or (null +modeline-bar-width) - (= +modeline-bar-width 0)) - (setq active-bg nil - inactive-bg nil)) - (setq +modeline-active-bar - (+modeline--make-xpm (and +modeline-bar-width active-bg) - width height) - +modeline-inactive-bar - (+modeline--make-xpm (and +modeline-bar-width inactive-bg) - width height) - +modeline-bar - '(:eval (if (+modeline-active) - +modeline-active-bar - +modeline-inactive-bar)))))) - -(add-hook! 'doom-change-font-size-hook - (defun +modeline-adjust-height-h () - (defvar +modeline--old-height +modeline-height) - (let ((default-height +modeline--old-height) - (scale (or (frame-parameter nil 'font-scale) 0))) - (setq +modeline-height - (if (> scale 0) - (+ default-height (* (or (frame-parameter nil 'font-scale) 1) - doom-font-increment)) - default-height)) - (when doom-init-time - (+modeline-refresh-bars-h))))) - - -;;; `+modeline-matches' -(use-package! anzu - :after-call isearch-mode - :config - ;; We manage our own modeline segments - (setq anzu-cons-mode-line-p nil) - ;; Ensure anzu state is cleared when searches & iedit are done - (add-hook 'iedit-mode-end-hook #'anzu--reset-status) - (advice-add #'evil-force-normal-state :before #'anzu--reset-status) - ;; Fix matches segment mirroring across all buffers - (mapc #'make-variable-buffer-local - '(anzu--total-matched - anzu--current-position - anzu--state - anzu--cached-count - anzu--cached-positions anzu--last-command - anzu--last-isearch-string anzu--overflow-p))) - -(use-package! evil-anzu - :when (featurep! :editor evil) - :after-call evil-ex-start-search evil-ex-start-word-search evil-ex-search-activate-highlight - :config (global-anzu-mode +1)) - -(defun +modeline--anzu () - "Show the match index and total number thereof. -Requires `anzu', also `evil-anzu' if using `evil-mode' for compatibility with -`evil-search'." - (when (and (bound-and-true-p anzu--state) - (not (bound-and-true-p iedit-mode))) - (propertize - (let ((here anzu--current-position) - (total anzu--total-matched)) - (cond ((eq anzu--state 'replace-query) - (format " %d replace " anzu--cached-count)) - ((eq anzu--state 'replace) - (format " %d/%d " (1+ here) total)) - (anzu--overflow-p - (format " %s+ " total)) - (t - (format " %s/%d " here total)))) - 'face (if (+modeline-active) 'doom-modeline-highlight)))) - -(defun +modeline--evil-substitute () - "Show number of matches for evil-ex substitutions and highlights in real time." - (when (and (bound-and-true-p evil-local-mode) - (or (assq 'evil-ex-substitute evil-ex-active-highlights-alist) - (assq 'evil-ex-global-match evil-ex-active-highlights-alist) - (assq 'evil-ex-buffer-match evil-ex-active-highlights-alist))) - (propertize - (let ((range (if evil-ex-range - (cons (car evil-ex-range) (cadr evil-ex-range)) - (cons (line-beginning-position) (line-end-position)))) - (pattern (car-safe (evil-delimited-arguments evil-ex-argument 2)))) - (if pattern - (format " %s matches " (how-many pattern (car range) (cdr range))) - " - ")) - 'face (if (+modeline-active) 'doom-modeline-highlight)))) - -(defun +modeline--multiple-cursors () - "Show the number of multiple cursors." - (when (bound-and-true-p evil-mc-cursor-list) - (let ((count (length evil-mc-cursor-list))) - (when (> count 0) - (let ((face (cond ((not (+modeline-active)) 'mode-line-inactive) - (evil-mc-frozen 'doom-modeline-highlight) - ('doom-modeline-alternate-highlight)))) - (concat (propertize " " 'face face) - (all-the-icons-faicon "i-cursor" :face face :v-adjust -0.0575) - (propertize " " 'face `(:inherit (variable-pitch ,face))) - (propertize (format "%d " count) - 'face face))))))) - -(defun +modeline--overlay< (a b) - "Sort overlay A and B." - (< (overlay-start a) (overlay-start b))) - -(defun +modeline--iedit () - "Show the number of iedit regions matches + what match you're on." - (when (and (bound-and-true-p iedit-mode) - (bound-and-true-p iedit-occurrences-overlays)) - (propertize - (let ((this-oc (or (let ((inhibit-message t)) - (iedit-find-current-occurrence-overlay)) - (save-excursion - (iedit-prev-occurrence) - (iedit-find-current-occurrence-overlay)))) - (length (length iedit-occurrences-overlays))) - (format " %s/%d " - (if this-oc - (- length - (length (memq this-oc (sort (append iedit-occurrences-overlays nil) - #'+modeline--overlay<))) - -1) - "-") - length)) - 'face (if (+modeline-active) 'doom-modeline-highlight)))) - -(defun +modeline--macro-recording () - "Display current Emacs or evil macro being recorded." - (when (and (+modeline-active) - (or defining-kbd-macro - executing-kbd-macro)) - (let ((sep (propertize " " 'face 'doom-modeline-highlight))) - (concat sep - (propertize (if (bound-and-true-p evil-this-macro) - (char-to-string evil-this-macro) - "Macro") - 'face 'doom-modeline-highlight) - sep - (all-the-icons-octicon "triangle-right" - :face 'doom-modeline-highlight - :v-adjust -0.05) - sep)))) - -(def-modeline-var! +modeline-matches - '(:eval - (let ((meta (concat (+modeline--macro-recording) - (+modeline--anzu) - (+modeline--evil-substitute) - (+modeline--iedit) - (+modeline--multiple-cursors)))) - (or (and (not (equal meta "")) meta) - " %I ")))) - - -;;; `+modeline-modes' -(def-modeline-var! +modeline-modes ; remove minor modes - '("" - (:propertize mode-name - face bold - mouse-face doom-modeline-highlight) - mode-line-process - "%n" - " ")) - - -;;; `+modeline-buffer-identification' -(defvar-local +modeline--buffer-id-cache nil) - -;; REVIEW Generating the buffer's file name can be relatively expensive. -;; Compounded with how often the modeline updates this can add up, so -;; we cache it ahead of time. -(add-hook! '(change-major-mode-after-body-hook - ;; In case the user saves the file to a new location - after-save-hook - ;; ...or makes external changes then returns to Emacs - focus-in-hook - ;; ...or when we change the current project! - projectile-after-switch-project-hook - ;; ...when the visited file changes (e.g. it's renamed) - after-set-visited-file-name-hook - ;; ...when the underlying file changes - after-revert-hook) - (defun +modeline--generate-buffer-id-cache-h () - (when after-init-time - (setq +modeline--buffer-id-cache - (let ((file-name (buffer-file-name (buffer-base-buffer)))) - (unless (or (null default-directory) - (null file-name) - (file-remote-p file-name)) - (when-let (project-root (doom-project-root)) - (file-relative-name (or buffer-file-truename (file-truename file-name)) - (concat project-root ".."))))))))) - -(def-modeline-var! +modeline-buffer-identification ; slightly more informative buffer id - '((:eval - (propertize - (or +modeline--buffer-id-cache "%b") - 'face (cond ((buffer-modified-p) '(error bold mode-line-buffer-id)) - ((+modeline-active) 'mode-line-buffer-id)) - 'help-echo (or +modeline--buffer-id-cache (buffer-name)))) - (buffer-read-only (:propertize " RO" face warning)))) - - -;;; `+modeline-position' -(def-modeline-var! +modeline-position '(" %l:%C %p ")) - - -;;; `+modeline-checker' -(def-modeline-var! +modeline-checker nil - "Displays color-coded error status & icon for the current buffer." - :local t) - -(add-hook! '(flycheck-status-changed-functions - flycheck-mode-hook) - (defun +modeline-checker-update (&optional status) - "Update flycheck text via STATUS." - (setq +modeline-checker - (pcase status - (`finished - (if flycheck-current-errors - (let-alist (flycheck-count-errors flycheck-current-errors) - (let ((error (or .error 0)) - (warning (or .warning 0)) - (info (or .info 0))) - (+modeline-format-icon 'material "do_not_disturb_alt" - (number-to-string (+ error warning info)) - (cond ((> error 0) 'error) - ((> warning 0) 'warning) - ('success)) - (format "Errors: %d, Warnings: %d, Debug: %d" - error - warning - info)))) - (+modeline-format-icon 'material "check" "" 'success))) - (`running (+modeline-format-icon 'material "access_time" "*" 'mode-line-inactive "Running...")) - (`errored (+modeline-format-icon 'material "sim_card_alert" "!" 'error "Errored!")) - (`interrupted (+modeline-format-icon 'material "pause" "!" 'mode-line-inactive "Interrupted")) - (`suspicious (+modeline-format-icon 'material "priority_high" "!" 'error "Suspicious")))))) - - - -;;; `+modeline-selection-info' -(defsubst +modeline--column (pos) - "Get the column of the position `POS'." - (save-excursion (goto-char pos) - (current-column))) - -(def-modeline-var! +modeline-selection-info - '(:eval - (when (or (and (bound-and-true-p evil-local-mode) - (eq evil-state 'visual)) - mark-active) - (cl-destructuring-bind (beg . end) - (if (bound-and-true-p evil-visual-selection) - (cons evil-visual-beginning evil-visual-end) - (cons (region-beginning) (region-end))) - (propertize - (let ((lines (count-lines beg (min end (point-max))))) - (concat " " - (cond ((or (bound-and-true-p rectangle-mark-mode) - (and (bound-and-true-p evil-visual-selection) - (eq 'block evil-visual-selection))) - (let ((cols (abs (- (+modeline--column end) - (+modeline--column beg))))) - (format "%dx%dB" lines cols))) - ((and (bound-and-true-p evil-visual-selection) - (eq evil-visual-selection 'line)) - (format "%dL" lines)) - ((> lines 1) - (format "%dC %dL" (- end beg) lines)) - ((format "%dC" (- end beg)))) - (when (derived-mode-p 'text-mode) - (format " %dW" (count-words beg end))) - " ")) - 'face (if (+modeline-active) 'success))))) - "Information about the current selection, such as how many characters and -lines are selected, or the NxM dimensions of a block selection.") - -(defun +modeline-add-selection-segment-h () - (add-to-list '+modeline-format-left '+modeline-selection-info 'append)) -(defun +modeline-remove-selection-segment-h () - (delq! '+modeline-selection-info +modeline-format-left)) - -(if (featurep 'evil) - (progn - (add-hook 'evil-visual-state-entry-hook #'+modeline-add-selection-segment-h) - (add-hook 'evil-visual-state-exit-hook #'+modeline-remove-selection-segment-h)) - (add-hook 'activate-mark-hook #'+modeline-add-selection-segment-h) - (add-hook 'deactivate-mark-hook #'+modeline-remove-selection-segment-h)) - - -;;; `+modeline-encoding' -(def-modeline-var! +modeline-encoding - `(:eval - (let ((sys (coding-system-plist buffer-file-coding-system)) - (eol (coding-system-eol-type-mnemonic buffer-file-coding-system))) - (concat (unless (equal eol ,(if IS-WINDOWS "CRLF" "LF")) - (concat " " eol " ")) - (if (memq (plist-get sys :category) - '(coding-category-undecided coding-category-utf-8)) - (unless (string-match-p "utf-8" (symbol-name buffer-file-coding-system)) - "UTF-8 ") - (concat (upcase (symbol-name (plist-get sys :name))) - " ")))))) - -(def-modeline-var! +modeline-pdf-page nil - "Display page number of pdf" - :local t) - -(defun +modeline-update-pdf-pages () - "Update PDF pages." - (setq +modeline-pdf-page - (format " P%d/%d " - (eval `(pdf-view-current-page)) - (pdf-cache-number-of-pages)))) - -(add-hook 'pdf-view-change-page-hook #'+modeline-update-pdf-pages) - -;; Clearer mnemonic labels for EOL styles -(setq eol-mnemonic-dos "CRLF" - eol-mnemonic-mac "CR" - eol-mnemonic-unix "LF" - eol-mnemonic-undecided "??") - - -;; -;;; Default modeline - -(def-modeline! :main - '("" - +modeline-matches - " " - +modeline-buffer-identification - +modeline-position) - `("" - mode-line-misc-info - +modeline-modes - (vc-mode (" " - ,(all-the-icons-octicon "git-branch" :v-adjust 0.0) - vc-mode " ")) - " " - +modeline-encoding - (+modeline-checker ("" +modeline-checker " ")))) - -(def-modeline! 'project - `(" " - ,(all-the-icons-octicon - "file-directory" - :face 'bold - :v-adjust -0.06 - :height 1.1) - (:propertize (" " (:eval (abbreviate-file-name default-directory))) - face bold)) - '("" mode-line-misc-info +modeline-modes)) - -(def-modeline! 'special - '("" +modeline-matches - " " +modeline-buffer-identification) - '("" +modeline-modes)) - -(def-modeline! 'pdf - '("" - +modeline-matches - " " - +modeline-buffer-identification - +modeline-pdf-page) - `("" - +modeline-modes - " ")) -;; TODO (def-modeline! helm ...) - - -;; Other modes -(set-modeline! :main 'default) -(set-modeline-hook! '+doom-dashboard-mode-hook 'project) -(set-modeline-hook! 'pdf-tools-enabled-hook 'pdf) -(set-modeline-hook! '(special-mode-hook - image-mode-hook - circe-mode-hook) - 'special) - -(add-hook! 'magit-mode-hook - (defun +modeline-init-project-or-hide-h () - (if (eq major-mode 'magit-status-mode) - (set-modeline! 'project) - (hide-mode-line-mode +1)))) - - -;; -;;; Bootstrap - -(defvar +modeline--old-format (default-value 'mode-line-format)) - -(define-minor-mode +modeline-mode - "TODO" - :init-value nil - :global nil - (cond - (+modeline-mode - (setq mode-line-format - (cons - "" '(+modeline-bar - +modeline-format-left - (:eval - (propertize - " " - 'display - `((space :align-to (- (+ right right-fringe right-margin) - ,(string-width - (format-mode-line '("" +modeline-format-right)))))))) - +modeline-format-right)))) - ((setq mode-line-format +modeline--old-format)))) - -(define-global-minor-mode +modeline-global-mode +modeline-mode +modeline-mode) - -(add-hook '+modeline-global-mode-hook #'size-indication-mode) -(add-hook 'doom-init-ui-hook #'+modeline-global-mode) diff --git a/.config/emacs/modules/ui/modeline/README.org b/.config/emacs/modules/ui/modeline/README.org deleted file mode 100644 index 5088692..0000000 --- a/.config/emacs/modules/ui/modeline/README.org +++ /dev/null @@ -1,165 +0,0 @@ -#+TITLE: ui/modeline -#+DATE: July 29, 2018 -#+SINCE: v2.0.9 -#+STARTUP: inlineimages - -* Table of Contents :TOC_2:noexport: -- [[#description][Description]] - - [[#module-flags][Module Flags]] - - [[#plugins][Plugins]] -- [[#prerequisites][Prerequisites]] -- [[#usage][Usage]] - - [[#hiding-the-modeline][Hiding the modeline]] - - [[#switching-the-modeline-and-header-line][Switching the modeline and header line]] -- [[#configuration][Configuration]] - - [[#changing-the-default-modeline][Changing the default modeline]] - - [[#activating-a-format][Activating a format]] - - [[#defining-a-modeline-format][Defining a modeline format]] - - [[#defining-a-modeline-segment][Defining a modeline segment]] - - [[#extracting-dooms-modeline-into-your-config][Extracting Doom's modeline into your config]] -- [[#troubleshooting][Troubleshooting]] - - [[#where-are-my-minor-modes][Where are my minor modes?]] - - [[#icons-in-my-modeline-look-strange][Icons in my modeline look strange]] - - [[#the-right-side-of-the-modeline-is-cut-off][The right side of the modeline is cut off]] -- [[#appendix][Appendix]] - - [[#autodefs][Autodefs]] - - [[#variables][Variables]] - - [[#faces][Faces]] - -* Description -This module provides an Atom-inspired, minimalistic modeline for Doom Emacs, -powered by [[https://github.com/seagle0128/doom-modeline][the doom-modeline package]] (where you can find screenshots). - -** Module Flags -+ =+light= Enables a lighter, less featureful version of the modeline that does - not depend on ~doom-modeline~, which has performances issues in some cases. - -** Plugins -+ [[https://github.com/seagle0128/doom-modeline][doom-modeline]] -+ [[https://github.com/syohex/emacs-anzu][anzu]] -+ [[https://github.com/syohex/emacs-evil-anzu][evil-anzu]] - -* Prerequisites -This module has no prerequisites. - -* Usage -** TODO Hiding the modeline - -** TODO Switching the modeline and header line - -* Configuration -** TODO Changing the default modeline - -** TODO Activating a format - -** TODO Defining a modeline format - -** TODO Defining a modeline segment - -** TODO Extracting Doom's modeline into your config - -* Troubleshooting -** Where are my minor modes? -I rarely need to know what minor modes are active, so I removed them. ~M-x -doom/describe-active-minor-mode~ was written to substitute for it. - -** TODO Icons in my modeline look strange -** TODO The right side of the modeline is cut off -I believe the consensus is: this is due to oversized icons, i.e. a font issue. Some possible solutions: - -1. Tweak ~all-the-icons-scale-factor~ (1.2 by default): ~(setq - all-the-icons-scale-factor 1.1)~ - -2. Add some padding to the modeline definition: - - #+begin_src elisp - (after! doom-modeline - (doom-modeline-def-modeline 'main - '(bar matches buffer-info remote-host buffer-position parrot selection-info) - '(misc-info minor-modes checker input-method buffer-encoding major-mode process vcs " "))) ; <-- added padding here - #+end_src - -3. Use another font for the mode line (or a different ~:height~) (source) - - #+BEGIN_SRC elisp - (custom-set-faces! - '(mode-line :family "Noto Sans" :height 0.9) - '(mode-line-inactive :family "Noto Sans" :height 0.9)) - #+END_SRC - -(Mentioned in #1680, #278 and seagle0128/doom-modeline#334) - -4. Change the width of icon characters in ~char-width-table~: - - #+BEGIN_SRC elisp - (add-hook! 'doom-modeline-mode-hook - (let ((char-table char-width-table)) - (while (setq char-table (char-table-parent char-table))) - (dolist (pair doom-modeline-rhs-icons-alist) - (let ((width 2) ; <-- tweak this - (chars (cdr pair)) - (table (make-char-table nil))) - (dolist (char chars) - (set-char-table-range table char width)) - (optimize-char-table table) - (set-char-table-parent table char-table) - (setq char-width-table table))))) - #+END_SRC - - If this doesn't help, try different values for ~width~ such as ~width 1~ or ~width 3~. - -* Appendix -** Autodefs -+ ~def-modeline-format! NAME LEFT &optional RIGHT~ -+ ~def-modeline-segment! NAME &rest REST~ -+ ~set-modeline! NAME &optional DEFAULT~ -** Variables -+ doom-modeline-height -+ doom-modeline-bar-width -+ doom-modeline-buffer-file-name-style -+ doom-modeline-icon -+ doom-modeline-major-mode-icon -+ doom-modeline-major-mode-color-icon -+ doom-modeline-buffer-state-icon -+ doom-modeline-buffer-modification-icon -+ doom-modeline-minor-modes -+ doom-modeline-enable-word-count -+ doom-modeline-buffer-encoding -+ doom-modeline-indent-info -+ doom-modeline-checker-simple-format -+ doom-modeline-vcs-max-length -+ doom-modeline-persp-name -+ doom-modeline-lsp -+ doom-modeline-github -+ doom-modeline-github-interval -+ doom-modeline-env-version -+ doom-modeline-mu4e -+ doom-modeline-irc -+ doom-modeline-irc-stylize -** Faces -+ doom-modeline-buffer-path -+ doom-modeline-buffer-file -+ doom-modeline-buffer-modified -+ doom-modeline-buffer-major-mode -+ doom-modeline-buffer-minor-mode -+ doom-modeline-project-parent-dir -+ doom-modeline-project-dir -+ doom-modeline-project-root-dir -+ doom-modeline-highlight -+ doom-modeline-panel -+ doom-modeline-debug -+ doom-modeline-info -+ doom-modeline-warning -+ doom-modeline-urgent -+ doom-modeline-unread-number -+ doom-modeline-bar -+ doom-modeline-inactive-bar -+ doom-modeline-evil-emacs-state -+ doom-modeline-evil-insert-state -+ doom-modeline-evil-motion-state -+ doom-modeline-evil-normal-state -+ doom-modeline-evil-operator-state -+ doom-modeline-evil-visual-state -+ doom-modeline-evil-replace-state -+ doom-modeline-persp-name -+ doom-modeline-persp-buffer-not-in-persp diff --git a/.config/emacs/modules/ui/modeline/autoload.el b/.config/emacs/modules/ui/modeline/autoload.el deleted file mode 100644 index 437390d..0000000 --- a/.config/emacs/modules/ui/modeline/autoload.el +++ /dev/null @@ -1,36 +0,0 @@ -;;; ui/modeline/autoload/modeline.el -*- lexical-binding: t; -*- - -(defvar +modeline--old-bar-height nil) -;;;###autoload -(defun +modeline-resize-for-font-h () - "Adjust the modeline's height when the font size is changed by -`doom/increase-font-size' or `doom/decrease-font-size'. - -Meant for `doom-change-font-size-hook'." - (unless +modeline--old-bar-height - (setq +modeline--old-bar-height doom-modeline-height)) - (let ((default-height +modeline--old-bar-height) - (scale (or (frame-parameter nil 'font-scale) 0))) - (setq doom-modeline-height - (if (> scale 0) - (+ default-height (* scale doom-font-increment)) - default-height)))) - -;;;###autoload -(defun +modeline-update-env-in-all-windows-h (&rest _) - "Update version strings in all buffers." - (dolist (window (window-list)) - (with-selected-window window - (when (fboundp 'doom-modeline-update-env) - (doom-modeline-update-env)) - (force-mode-line-update)))) - -;;;###autoload -(defun +modeline-clear-env-in-all-windows-h (&rest _) - "Blank out version strings in all buffers." - (unless (featurep! +light) - (dolist (buffer (buffer-list)) - (with-current-buffer buffer - (setq doom-modeline-env--version - (bound-and-true-p doom-modeline-load-string))))) - (force-mode-line-update t)) diff --git a/.config/emacs/modules/ui/modeline/config.el b/.config/emacs/modules/ui/modeline/config.el deleted file mode 100644 index 5797b9e..0000000 --- a/.config/emacs/modules/ui/modeline/config.el +++ /dev/null @@ -1,80 +0,0 @@ -;;; ui/modeline/config.el -*- lexical-binding: t; -*- - -(when (featurep! +light) - (load! "+light")) - - -(use-package! doom-modeline - :unless (featurep! +light) - :hook (after-init . doom-modeline-mode) - :hook (doom-modeline-mode . size-indication-mode) ; filesize in modeline - :hook (doom-modeline-mode . column-number-mode) ; cursor column in modeline - :init - (unless after-init-time - ;; prevent flash of unstyled modeline at startup - (setq-default mode-line-format nil)) - ;; We display project info in the modeline ourselves - (setq projectile-dynamic-mode-line nil) - ;; Set these early so they don't trigger variable watchers - (setq doom-modeline-bar-width 3 - doom-modeline-github nil - doom-modeline-mu4e nil - doom-modeline-persp-name nil - doom-modeline-minor-modes nil - doom-modeline-major-mode-icon nil - doom-modeline-buffer-file-name-style 'relative-from-project - ;; Only show file encoding if it's non-UTF-8 and different line endings - ;; than the current OSes preference - doom-modeline-buffer-encoding 'nondefault - doom-modeline-default-eol-type - (cond (IS-MAC 2) - (IS-WINDOWS 1) - (0))) - - ;; Fix modeline icons in daemon-spawned graphical frames. We have our own - ;; mechanism for disabling all-the-icons, so we don't need doom-modeline to do - ;; it for us. However, this may cause unwanted padding in the modeline in - ;; daemon-spawned terminal frames. If it bothers you, you may prefer - ;; `doom-modeline-icon' set to `nil'. - (when (daemonp) - (setq doom-modeline-icon t)) - :config - ;; HACK Fix #4102 due to empty all-the-icons return value (caused by - ;; `doom--disable-all-the-icons-in-tty-a' advice) in tty daemon frames. - (defadvice! +modeline-disable-icon-in-daemon-a (fn &rest args) - :around #'doom-modeline-propertize-icon - (when (display-graphic-p) - (apply fn args))) - - ;; Fix an issue where these two variables aren't defined in TTY Emacs on MacOS - (defvar mouse-wheel-down-event nil) - (defvar mouse-wheel-up-event nil) - - (add-hook 'after-setting-font-hook #'+modeline-resize-for-font-h) - (add-hook 'doom-load-theme-hook #'doom-modeline-refresh-bars) - - (add-hook '+doom-dashboard-mode-hook #'doom-modeline-set-project-modeline) - - (add-hook! 'magit-mode-hook - (defun +modeline-hide-in-non-status-buffer-h () - "Show minimal modeline in magit-status buffer, no modeline elsewhere." - (if (eq major-mode 'magit-status-mode) - (doom-modeline-set-vcs-modeline) - (hide-mode-line-mode)))) - - ;; Some functions modify the buffer, causing the modeline to show a false - ;; modified state, so force them to behave. - (defadvice! +modeline--inhibit-modification-hooks-a (fn &rest args) - :around #'ws-butler-after-save - (with-silent-modifications (apply fn args))) - - - ;; - ;;; Extensions - (use-package! anzu - :after-call isearch-mode) - - (use-package! evil-anzu - :when (featurep! :editor evil) - :after-call evil-ex-start-search evil-ex-start-word-search evil-ex-search-activate-highlight - :config (global-anzu-mode +1))) diff --git a/.config/emacs/modules/ui/modeline/packages.el b/.config/emacs/modules/ui/modeline/packages.el deleted file mode 100644 index 6f97349..0000000 --- a/.config/emacs/modules/ui/modeline/packages.el +++ /dev/null @@ -1,8 +0,0 @@ -;; -*- no-byte-compile: t; -*- -;;; ui/modeline/packages.el - -(unless (featurep! +light) - (package! doom-modeline :pin "84573ae5e7db2705da67c2eda94b786a99346272")) -(package! anzu :pin "5abb37455ea44fa401d5f4c1bdc58adb2448db67") -(when (featurep! :editor evil) - (package! evil-anzu :pin "d3f6ed4773b48767bd5f4708c7f083336a8a8a86")) diff --git a/.config/emacs/modules/ui/nav-flash/README.org b/.config/emacs/modules/ui/nav-flash/README.org deleted file mode 100644 index b8a23ff..0000000 --- a/.config/emacs/modules/ui/nav-flash/README.org +++ /dev/null @@ -1,37 +0,0 @@ -#+TITLE: ui/nav-flash -#+DATE: June 4, 2017 -#+SINCE: v2.0 -#+STARTUP: inlineimages - -* Table of Contents :TOC: -- [[#description][Description]] - - [[#plugins][Plugins]] -- [[#prerequisites][Prerequisites]] -- [[#configuration][Configuration]] - -* Description -This module flashes the line around the cursor after any significant motion, to -make it easy to follow after big operations. - -#+begin_quote -Tremendously helpful on large, 1600p+ or 4K displays. -#+end_quote - -** Plugins -+ [[https://github.com/rolandwalker/nav-flash][nav-flash]] - -* Prerequisites -This module has no dependencies. - -* Configuration -By default, ~nav-flash~ will be triggered whenever ~recenter~ is called or an -entry is added to the jump-list (managed by better-jumper). - -~recenter~ is called after many hooks and commands, such as: - -+ better-jumper-post-jump-hook -+ rtags-after-find-file-hook -+ org-follow-link-hook -+ imenu-after-jump-hook -+ counsel-grep-post-action-hook -+ dumb-jump-after-jump-hook diff --git a/.config/emacs/modules/ui/nav-flash/autoload.el b/.config/emacs/modules/ui/nav-flash/autoload.el deleted file mode 100644 index f558f69..0000000 --- a/.config/emacs/modules/ui/nav-flash/autoload.el +++ /dev/null @@ -1,48 +0,0 @@ -;;; ui/nav-flash/autoload.el -*- lexical-binding: t; -*- - -(defvar +nav-flash--last-point nil) - -;;;###autoload -(defun +nav-flash-blink-cursor (&rest _) - "Blinks the current line in the current window, to make it clear where the -cursor has landed (typically after a large motion, like switching windows or -jumping to another part of the file)." - (unless (minibufferp) - (nav-flash-show) - ;; only show in the current window - (when (overlayp compilation-highlight-overlay) - (overlay-put compilation-highlight-overlay 'window (selected-window))))) - -;;;###autoload -(defun +nav-flash-blink-cursor-maybe (&rest _) - "Like `+nav-flash-blink-cursor', but no-ops if in special-mode, term-mode, -vterm-mode, or triggered from one of `+nav-flash-exclude-commands'." - (unless (or (memq this-command +nav-flash-exclude-commands) - (bound-and-true-p so-long-minor-mode) - (apply #'derived-mode-p +nav-flash-exclude-modes) - (equal +nav-flash--last-point - (list (selected-window) - (current-buffer) - (point)))) - (+nav-flash-blink-cursor) - (setq +nav-flash--last-point (list (selected-window) (current-buffer) (point))))) - -;;;###autoload -(defun +nav-flash-delayed-blink-cursor-h (&rest _) - "Like `+nav-flash-blink-cursor', but links after a tiny pause, in case it -isn't clear at run-time if the point will be in the correct window/buffer (like -for `org-follow-link-hook')." - (run-at-time 0.1 nil #'+nav-flash-blink-cursor-h)) - -;;;###autoload -(defalias '+nav-flash-blink-cursor-h #'+nav-flash-blink-cursor) -;;;###autoload -(defalias '+nav-flash-blink-cursor-maybe-h #'+nav-flash-blink-cursor-maybe) -;;;###autoload -(defalias '+nav-flash-blink-cursor-a #'+nav-flash-blink-cursor-maybe) - -;;;###autoload -(defun +nav-flash/blink-cursor (&rest _) - "Blink current line using `nav-flash'." - (interactive) - (+nav-flash-blink-cursor)) diff --git a/.config/emacs/modules/ui/nav-flash/config.el b/.config/emacs/modules/ui/nav-flash/config.el deleted file mode 100644 index d8b0535..0000000 --- a/.config/emacs/modules/ui/nav-flash/config.el +++ /dev/null @@ -1,41 +0,0 @@ -;;; ui/nav-flash/config.el -*- lexical-binding: t; -*- - -(defvar +nav-flash-exclude-commands - '(mouse-set-point mouse-drag-region evil-mouse-drag-region +org/dwim-at-point - org-find-file org-find-file-at-mouse) - "A list of commands that should not trigger nav-flash.") - -(defvar +nav-flash-exclude-modes - '(so-long-mode special-mode comint-mode term-mode vterm-mode) - "List of major modes where nav-flash won't automatically trigger.") - - -;; -;;; Packages - -(use-package! nav-flash - :defer t - :init - ;; NOTE In :tools lookup `recenter' is hooked to a bunch of jumping - ;; commands, which will trigger nav-flash. - (add-hook! '(imenu-after-jump-hook - better-jumper-post-jump-hook - counsel-grep-post-action-hook - dumb-jump-after-jump-hook) - #'+nav-flash-blink-cursor-maybe-h) - - (add-hook 'doom-switch-window-hook #'+nav-flash-blink-cursor-maybe-h) - - ;; `org' - (add-hook 'org-follow-link-hook #'+nav-flash-delayed-blink-cursor-h) - - ;; `saveplace' - (advice-add #'save-place-find-file-hook :after #'+nav-flash-blink-cursor-a) - - ;; `evil' - (advice-add #'evil-window-top :after #'+nav-flash-blink-cursor-a) - (advice-add #'evil-window-middle :after #'+nav-flash-blink-cursor-a) - (advice-add #'evil-window-bottom :after #'+nav-flash-blink-cursor-a) - - ;; Bound to `ga' for evil users - (advice-add #'what-cursor-position :after #'+nav-flash-blink-cursor-a)) diff --git a/.config/emacs/modules/ui/nav-flash/packages.el b/.config/emacs/modules/ui/nav-flash/packages.el deleted file mode 100644 index 9b9a1ab..0000000 --- a/.config/emacs/modules/ui/nav-flash/packages.el +++ /dev/null @@ -1,4 +0,0 @@ -;; -*- no-byte-compile: t; -*- -;;; ui/nav-flash/packages.el - -(package! nav-flash :pin "2e31f32085757e1dfdd8ec78e9940fd1c88750de") diff --git a/.config/emacs/modules/ui/neotree/README.org b/.config/emacs/modules/ui/neotree/README.org deleted file mode 100644 index efbf410..0000000 --- a/.config/emacs/modules/ui/neotree/README.org +++ /dev/null @@ -1,9 +0,0 @@ -#+TITLE: :evil neotree - -This module brings a side panel for browsing project files, inspired by vim's -NERDTree. - -#+begin_quote -Sure, there's dired and projectile, but sometimes I'd like a bird's eye view of -a project. -#+end_quote diff --git a/.config/emacs/modules/ui/neotree/autoload.el b/.config/emacs/modules/ui/neotree/autoload.el deleted file mode 100644 index 2b26442..0000000 --- a/.config/emacs/modules/ui/neotree/autoload.el +++ /dev/null @@ -1,70 +0,0 @@ -;;; ui/neotree/autoload.el -*- lexical-binding: t; -*- - -;; `neotree-show' and `neotree-find' don't respect the current project, and open -;; neotree in `default-directory'. `+neotree/open' and `neotree/find-this-file' -;; will ensure the neotree pane is always rooted in the project root. - -;;;###autoload -(defun +neotree/open () - "Open the neotree window in the current project." - (interactive) - (require 'neotree) - (if (neo-global--window-exists-p) - (neotree-hide) - (neotree-dir (or (doom-project-root) - default-directory)))) - -;;;###autoload -(defun +neotree/find-this-file () - "Open the neotree window in the current project, and find the current file." - (interactive) - (let ((path buffer-file-name) - (project-root (or (doom-project-root) - default-directory))) - (require 'neotree) - (cond ((and (neo-global--window-exists-p) - (get-buffer-window neo-buffer-name t)) - (neotree-find path project-root) - (neotree-refresh)) - ((not (and (neo-global--window-exists-p) - (equal (file-truename (neo-global--with-buffer neo-buffer--start-node)) - (file-truename project-root)))) - (neotree-dir project-root) - (neotree-find path project-root)) - (t - (neotree-find path project-root))))) - -;;;###autoload -(defun +neotree/collapse-or-up () - "Collapse an expanded directory node or go to the parent node." - (interactive) - (when-let (node (neo-buffer--get-filename-current-line)) - (if (and (file-directory-p node) - (neo-buffer--expanded-node-p node)) - (+neotree/collapse) - (neotree-select-up-node)))) - -;;;###autoload -(defun +neotree/collapse () - "Collapse a neotree node." - (interactive) - (when-let (node (neo-buffer--get-filename-current-line)) - (when (file-directory-p node) - (neo-buffer--set-expand node nil) - (neo-buffer--refresh t)) - (when neo-auto-indent-point - (neo-point-auto-indent)))) - -;;;###autoload -(defun +neotree/expand-or-open () - "Expand or open a neotree node." - (interactive) - (when-let (node (neo-buffer--get-filename-current-line)) - (cond ((file-directory-p node) - (neo-buffer--set-expand node t) - (neo-buffer--refresh t) - (when neo-auto-indent-point - (forward-line) - (neo-point-auto-indent))) - (t - (call-interactively #'neotree-enter))))) diff --git a/.config/emacs/modules/ui/neotree/config.el b/.config/emacs/modules/ui/neotree/config.el deleted file mode 100644 index 4f46167..0000000 --- a/.config/emacs/modules/ui/neotree/config.el +++ /dev/null @@ -1,73 +0,0 @@ -;;; ui/neotree/config.el -*- lexical-binding: t; -*- - -(use-package! neotree - :commands (neotree-show - neotree-hide - neotree-toggle - neotree-dir - neotree-find - neo-global--with-buffer - neo-global--window-exists-p) - :init - (setq neo-create-file-auto-open nil - neo-auto-indent-point nil - neo-autorefresh nil - neo-mode-line-type 'none - neo-window-width 30 - neo-show-updir-line nil - neo-theme 'icons - neo-banner-message nil - neo-confirm-create-file #'off-p - neo-confirm-create-directory #'off-p - neo-show-hidden-files nil - neo-keymap-style 'concise - neo-show-hidden-files t - neo-hidden-regexp-list - '(;; vcs folders - "^\\.\\(?:git\\|hg\\|svn\\)$" - ;; compiled files - "\\.\\(?:pyc\\|o\\|elc\\|lock\\|css.map\\|class\\)$" - ;; generated files, caches or local pkgs - "^\\(?:node_modules\\|vendor\\|.\\(project\\|cask\\|yardoc\\|sass-cache\\)\\)$" - ;; org-mode folders - "^\\.\\(?:sync\\|export\\|attach\\)$" - ;; temp files - "~$" - "^#.*#$")) - - :config - (set-popup-rule! "^ ?\\*NeoTree" :ignore t) - - (after! winner - (add-to-list 'winner-boring-buffers neo-buffer-name)) - - ;; The cursor always sits at bol. `+neotree--fix-cursor-h' and - ;; `+neotree--indent-cursor-a' change that behavior so that the cursor is - ;; always on the first non-blank character on the line, in the neo buffer. - (add-hook! 'neo-enter-hook - (defun +neotree-fix-cursor-h (&rest _) - (with-current-buffer neo-global--buffer - (+neotree--indent-cursor-a)))) - - (defadvice! +neotree--indent-cursor-a (&rest _) - :after '(neotree-next-line neotree-previous-line) - (beginning-of-line) - (skip-chars-forward " \t\r")) - - (map! :map neotree-mode-map - :n [tab] (neotree-make-executor - :dir-fn #'neo-open-dir - :file-fn #'neotree-quick-look) - :n "DEL" #'evil-window-prev - :n "n" #'neotree-next-line - :n "p" #'neotree-previous-line - :m "h" #'+neotree/collapse-or-up - :m "l" #'+neotree/expand-or-open - :n "J" #'neotree-select-next-sibling-node - :n "K" #'neotree-select-previous-sibling-node - :n "H" #'neotree-select-up-node - :n "L" #'neotree-select-down-node - :n "G" #'evil-goto-line - :n "gg" #'evil-goto-first-line - :n "v" (neotree-make-executor :file-fn 'neo-open-file-vertical-split) - :n "s" (neotree-make-executor :file-fn 'neo-open-file-horizontal-split))) diff --git a/.config/emacs/modules/ui/neotree/packages.el b/.config/emacs/modules/ui/neotree/packages.el deleted file mode 100644 index 3a3e93f..0000000 --- a/.config/emacs/modules/ui/neotree/packages.el +++ /dev/null @@ -1,4 +0,0 @@ -;; -*- no-byte-compile: t; -*- -;;; ui/neotree/packages.el - -(package! neotree :pin "98fe21334affaffe2334bf7c987edaf1980d2d0b") diff --git a/.config/emacs/modules/ui/ophints/README.org b/.config/emacs/modules/ui/ophints/README.org deleted file mode 100644 index 49868b9..0000000 --- a/.config/emacs/modules/ui/ophints/README.org +++ /dev/null @@ -1,23 +0,0 @@ -#+TITLE: ui/ophints -#+DATE: June 4, 2017 -#+SINCE: v2.0 -#+STARTUP: inlineimages - -* Table of Contents :TOC_3:noexport: -- [[#description][Description]] - - [[#module-flags][Module Flags]] - - [[#plugins][Plugins]] - -* Description -This module provides op-hints (operation hinting), i.e. visual feedback for -certain operations. It highlights regions of text that the last operation (like -yank) acted on. - -Uses ~evil-goggles~ for evil users and ~volatile-highlights~ otherwise. - -** Module Flags -This module provides no flags. - -** Plugins -+ [[https://github.com/edkolev/evil-goggles/][evil-goggles]]* -+ [[https://github.com/k-talo/volatile-highlights.el][volatile-highlights]]* diff --git a/.config/emacs/modules/ui/ophints/config.el b/.config/emacs/modules/ui/ophints/config.el deleted file mode 100644 index faf383c..0000000 --- a/.config/emacs/modules/ui/ophints/config.el +++ /dev/null @@ -1,73 +0,0 @@ -;;; ui/ophints/config.el -*- lexical-binding: t; -*- - -(use-package! evil-goggles - :when (featurep! :editor evil) - :hook (doom-first-input . evil-goggles-mode) - :init - (setq evil-goggles-duration 0.1 - evil-goggles-pulse nil ; too slow - ;; evil-goggles provides a good indicator of what has been affected. - ;; delete/change is obvious, so I'd rather disable it for these. - evil-goggles-enable-delete nil - evil-goggles-enable-change nil) - :config - (pushnew! evil-goggles--commands - '(evil-magit-yank-whole-line - :face evil-goggles-yank-face - :switch evil-goggles-enable-yank - :advice evil-goggles--generic-async-advice) - '(+evil:yank-unindented - :face evil-goggles-yank-face - :switch evil-goggles-enable-yank - :advice evil-goggles--generic-async-advice) - '(+eval:region - :face evil-goggles-yank-face - :switch evil-goggles-enable-yank - :advice evil-goggles--generic-async-advice)) - (when (featurep! :editor lispy) - (pushnew! evil-goggles--commands - '(lispyville-delete - :face evil-goggles-delete-face - :switch evil-goggles-enable-delete - :advice evil-goggles--generic-blocking-advice) - '(lispyville-delete-line - :face evil-goggles-delete-face - :switch evil-goggles-enable-delete - :advice evil-goggles--delete-line-advice) - '(lispyville-yank - :face evil-goggles-yank-face - :switch evil-goggles-enable-yank - :advice evil-goggles--generic-async-advice) - '(lispyville-yank-line - :face evil-goggles-yank-face - :switch evil-goggles-enable-yank - :advice evil-goggles--generic-async-advice) - '(lispyville-change - :face evil-goggles-change-face - :switch evil-goggles-enable-change - :advice evil-goggles--generic-blocking-advice) - '(lispyville-change-line - :face evil-goggles-change-face - :switch evil-goggles-enable-change - :advice evil-goggles--generic-blocking-advice) - '(lispyville-change-whole-line - :face evil-goggles-change-face - :switch evil-goggles-enable-change - :advice evil-goggles--generic-blocking-advice) - '(lispyville-indent - :face evil-goggles-indent-face - :switch evil-goggles-enable-indent - :advice evil-goggles--generic-async-advice) - '(lispyville-join - :face evil-goggles-join-face - :switch evil-goggles-enable-join - :advice evil-goggles--join-advice)))) - - -(use-package! volatile-highlights - :unless (featurep! :editor evil) - :hook (doom-first-input . volatile-highlights-mode) - :config - (after! undo-fu - (vhl/define-extension 'undo-fu 'undo-fu-only-undo 'undo-fu-only-redo) - (vhl/install-extension 'undo-fu))) diff --git a/.config/emacs/modules/ui/ophints/packages.el b/.config/emacs/modules/ui/ophints/packages.el deleted file mode 100644 index 3070cc9..0000000 --- a/.config/emacs/modules/ui/ophints/packages.el +++ /dev/null @@ -1,6 +0,0 @@ -;; -*- no-byte-compile: t; -*- -;;; ui/ophints/packages.el - -(if (featurep! :editor evil) - (package! evil-goggles :pin "08a22058fd6a167f9f1b684c649008caef571459") - (package! volatile-highlights :pin "9a20091f0ce7fc0a6b3e641a6a46d5f3ac4d8392")) diff --git a/.config/emacs/modules/ui/popup/+hacks.el b/.config/emacs/modules/ui/popup/+hacks.el deleted file mode 100644 index 7729dc9..0000000 --- a/.config/emacs/modules/ui/popup/+hacks.el +++ /dev/null @@ -1,411 +0,0 @@ -;;; ui/popup/+hacks.el -*- lexical-binding: t; -*- - -;; What follows are all the hacks needed to get various parts of Emacs and other -;; plugins to cooperate with the popup management system. Essentially, it comes -;; down to: -;; -;; 1. Making plugins that control their own window environment less greedy (e.g. -;; org agenda, which tries to reconfigure the entire frame by deleting all -;; other windows just to pop up one tiny window). -;; 2. Forcing plugins to use `display-buffer' and `pop-to-buffer' instead of -;; `switch-to-buffer' (which is unaffected by `display-buffer-alist', which -;; we must rely on, heavily). -;; 3. Closing popups (temporarily) before functions that are highly destructive -;; to the illusion of popup control get run (with the use of the -;; `save-popups!' macro). -;; -;; Keep in mind, all this black magic may break in future updates, and will need -;; to be watched carefully for corner cases. Also, once this file is loaded, -;; many of its changes are irreversible without restarting Emacs! I don't like -;; it either, but I will address this over time. -;; -;; Hacks should be kept in alphabetical order, named after the feature they -;; modify, and should follow a ;;;## package-name header line (if not using -;; `after!' or `use-package!'). - -;; -;;; Core functions - -(defadvice! +popup--make-case-sensitive-a (fn &rest args) - "Make regexps in `display-buffer-alist' case-sensitive. - -To reduce fewer edge cases and improve performance when `display-buffer-alist' -grows larger." - :around #'display-buffer-assq-regexp - (let (case-fold-search) - (apply fn args))) - -;; Don't try to resize popup windows -(advice-add #'balance-windows :around #'+popup-save-a) - -(defun +popup/quit-window () - "The regular `quit-window' sometimes kills the popup buffer and switches to a -buffer that shouldn't be in a popup. We prevent that by remapping `quit-window' -to this commmand." - (interactive) - (let ((orig-buffer (current-buffer))) - (quit-window) - (when (and (eq orig-buffer (current-buffer)) - (+popup-buffer-p)) - (+popup/close nil 'force)))) -(global-set-key [remap quit-window] #'+popup/quit-window) - -(defadvice! +popup-override-display-buffer-alist-a (fn &rest args) - "When `pop-to-buffer' is called with non-nil ACTION, that ACTION should -override `display-buffer-alist'." - :around #'switch-to-buffer-other-tab - :around #'switch-to-buffer-other-window - :around #'switch-to-buffer-other-frame - (let ((display-buffer-alist nil)) - (apply fn args))) - - -;; -;;; External functions - -;;;###package buff-menu -(define-key Buffer-menu-mode-map (kbd "RET") #'Buffer-menu-other-window) - - -;;;###package company -(defadvice! +popup--dont-select-me-a (fn &rest args) - :around #'company-show-doc-buffer - (let ((+popup--inhibit-select t)) - (apply fn args))) - - -;;;###package compile -(defadvice! +popup--compilation-goto-locus-a (fn &rest args) - "Fix links in popup compilation buffers creating a new window each time they -were followed." - :around #'compilation-goto-locus - (letf! (defun pop-to-buffer (buffer &optional action norecord) - (let ((pop-up-windows (not (+popup-buffer-p (current-buffer))))) - (funcall pop-to-buffer buffer action norecord))) - (apply fn args))) - - -;;;###package eshell -(progn - (setq eshell-destroy-buffer-when-process-dies t) - - ;; When eshell runs a visual command (see `eshell-visual-commands'), it spawns - ;; a term buffer to run it in, but where it spawns it is the problem... - (defadvice! +popup--eshell-undedicate-popup (&rest _) - "Force spawned term buffer to share with the eshell popup (if necessary)." - :before #'eshell-exec-visual - (when (+popup-window-p) - (set-window-dedicated-p nil nil) - (add-transient-hook! #'eshell-query-kill-processes :after - (set-window-dedicated-p nil t))))) - - -;;;###package evil -(progn - ;; Make evil-mode cooperate with popups - (defadvice! +popup--evil-command-window-a (hist cmd-key execute-fn) - "Monkey patch the evil command window to use `pop-to-buffer' instead of -`switch-to-buffer', allowing the popup manager to handle it." - :override #'evil-command-window - (when (eq major-mode 'evil-command-window-mode) - (user-error "Cannot recursively open command line window")) - (dolist (win (window-list)) - (when (equal (buffer-name (window-buffer win)) - "*Command Line*") - (kill-buffer (window-buffer win)) - (delete-window win))) - (setq evil-command-window-current-buffer (current-buffer)) - (ignore-errors (kill-buffer "*Command Line*")) - (with-current-buffer (pop-to-buffer "*Command Line*") - (setq-local evil-command-window-execute-fn execute-fn) - (setq-local evil-command-window-cmd-key cmd-key) - (evil-command-window-mode) - (evil-command-window-insert-commands hist))) - - (defadvice! +popup--evil-command-window-execute-a () - "Execute the command under the cursor in the appropriate buffer, rather than -the command buffer." - :override #'evil-command-window-execute - (interactive) - (let ((result (buffer-substring (line-beginning-position) - (line-end-position))) - (execute-fn evil-command-window-execute-fn) - (execute-window (get-buffer-window evil-command-window-current-buffer)) - (popup (selected-window))) - (if execute-window - (select-window execute-window) - (user-error "Originating buffer is no longer active")) - ;; (kill-buffer "*Command Line*") - (delete-window popup) - (funcall execute-fn result) - (setq evil-command-window-current-buffer nil))) - - ;; Don't mess with popups - (advice-add #'+evil--window-swap :around #'+popup-save-a) - (advice-add #'evil-window-move-very-bottom :around #'+popup-save-a) - (advice-add #'evil-window-move-very-top :around #'+popup-save-a) - (advice-add #'evil-window-move-far-left :around #'+popup-save-a) - (advice-add #'evil-window-move-far-right :around #'+popup-save-a)) - - -;;;###package help-mode -(after! help-mode - (defun +popup--switch-from-popup (location) - (let (origin enable-local-variables) - (save-popups! - (switch-to-buffer (car location) nil t) - (if (not (cdr location)) - (message "Unable to find location in file") - (goto-char (cdr location)) - (recenter) - (setq origin (selected-window)))) - (select-window origin))) - - ;; Help buffers use `pop-to-window' to decide where to open followed links, - ;; which can be unpredictable. It should *only* replace the original buffer we - ;; opened the popup from. To fix this these three button types need to be - ;; redefined to set aside the popup before following a link. - (define-button-type 'help-function-def - :supertype 'help-xref - 'help-function - (lambda (fun file) - (require 'find-func) - (when (eq file 'C-source) - (setq file (help-C-file-name (indirect-function fun) 'fun))) - (+popup--switch-from-popup (find-function-search-for-symbol fun nil file)))) - - (define-button-type 'help-variable-def - :supertype 'help-xref - 'help-function - (lambda (var &optional file) - (when (eq file 'C-source) - (setq file (help-C-file-name var 'var))) - (+popup--switch-from-popup (find-variable-noselect var file)))) - - (define-button-type 'help-face-def - :supertype 'help-xref - 'help-function - (lambda (fun file) - (require 'find-func) - (+popup--switch-from-popup (find-function-search-for-symbol fun 'defface file))))) - - -;;;###package helpful -(defadvice! +popup--helpful-open-in-origin-window-a (button) - "Open links in non-popup, originating window rather than helpful's window." - :override #'helpful--navigate - (let ((path (substring-no-properties (button-get button 'path))) - enable-local-variables - origin) - (save-popups! - (find-file path) - (when-let (pos (get-text-property button 'position - (marker-buffer button))) - (goto-char pos)) - (setq origin (selected-window)) - (recenter)) - (select-window origin))) - - -;;;###package helm -;;;###package helm-ag -(when (featurep! :completion helm) - (setq helm-default-display-buffer-functions '(+popup-display-buffer-stacked-side-window-fn)) - - ;; Fix #897: "cannot open side window" error when TAB-completing file links - (defadvice! +popup--helm-hide-org-links-popup-a (fn &rest args) - :around #'org-insert-link - (letf! ((defun org-completing-read (&rest args) - (when-let (win (get-buffer-window "*Org Links*")) - ;; While helm is opened as a popup, it will mistaken the *Org - ;; Links* popup for the "originated window", and will target it - ;; for actions invoked by the user. However, since *Org Links* - ;; is a popup too (they're dedicated side windows), Emacs - ;; complains about being unable to split a side window. The - ;; simple fix: get rid of *Org Links*! - (delete-window win) - ;; ...but it must exist for org to clean up later. - (get-buffer-create "*Org Links*")) - (apply org-completing-read args))) - (apply #'funcall-interactively fn args))) - - ;; Fix left-over popup window when closing persistent help for `helm-M-x' - (defadvice! +popup--helm-elisp--persistent-help-a (candidate _fun &optional _name) - :before #'helm-elisp--persistent-help - (let (win) - (and (helm-attr 'help-running-p) - (string= candidate (helm-attr 'help-current-symbol)) - (setq win (get-buffer-window (get-buffer (help-buffer)))) - (delete-window win))))) - - -;;;###package Info -(defadvice! +popup--switch-to-info-window-a (&rest _) - :after #'info-lookup-symbol - (when-let (win (get-buffer-window "*info*")) - (when (+popup-window-p win) - (select-window win)))) - - -;;;###package latex -(defadvice! +popup--use-popup-window-for-reftex-citation-a (fn &rest args) - :around #'reftex-do-citation - (letf! ((#'switch-to-buffer-other-window #'pop-to-buffer)) - (apply fn args))) - - -;;;###package org -(after! org - (defadvice! +popup--suppress-delete-other-windows-a (fn &rest args) - "Org has a scorched-earth window management policy I'm not fond of. i.e. it -kills all other windows just so it can monopolize the frame. No thanks. We can -do better." - :around #'org-add-log-note - :around #'org-capture-place-template - :around #'org-export--dispatch-ui - :around #'org-agenda-get-restriction-and-command - :around #'org-goto-location - :around #'org-fast-tag-selection - :around #'org-fast-todo-selection - (if +popup-mode - (letf! ((#'delete-other-windows #'ignore) - (#'delete-window #'ignore)) - (apply fn args)) - (apply fn args))) - - (defadvice! +popup--org-fix-goto-a (fn &rest args) - "`org-goto' uses `with-output-to-temp-buffer' to display its help buffer, -for some reason, which is very unconventional, and so requires these gymnastics -to tame (i.e. to get the popup manager to handle it)." - :around #'org-goto-location - (if +popup-mode - (letf! (defun internal-temp-output-buffer-show (buffer) - (let ((temp-buffer-show-function - (doom-rpartial #'+popup-display-buffer-stacked-side-window-fn nil))) - (with-current-buffer buffer - (+popup-buffer-mode +1)) - (funcall internal-temp-output-buffer-show buffer))) - (apply fn args)) - (apply fn args))) - - (defadvice! +popup--org-fix-popup-window-shrinking-a (fn &rest args) - "Hides the mode-line in *Org tags* buffer so you can actually see its -content and displays it in a side window without deleting all other windows. -Ugh, such an ugly hack." - :around #'org-fast-tag-selection - :around #'org-fast-todo-selection - (if +popup-mode - (letf! ((defun read-char-exclusive (&rest args) - (message nil) - (apply read-char-exclusive args)) - (defun split-window-vertically (&optional _size) - (funcall split-window-vertically (- 0 window-min-height 1))) - (defun org-fit-window-to-buffer (&optional window max-height min-height shrink-only) - (when-let (buf (window-buffer window)) - (with-current-buffer buf - (+popup-buffer-mode))) - (when (> (window-buffer-height window) - (window-height window)) - (fit-window-to-buffer window (window-buffer-height window))))) - (apply fn args)) - (apply fn args))) - - (defadvice! +popup--org-edit-src-exit-a (fn &rest args) - "If you switch workspaces or the src window is recreated..." - :around #'org-edit-src-exit - (let* ((window (selected-window)) - (popup-p (+popup-window-p window))) - (prog1 (apply fn args) - (when (and popup-p (window-live-p window)) - (delete-window window))))) - - ;; Ensure todo, agenda, and other minor popups are delegated to the popup system. - (defadvice! +popup--org-pop-to-buffer-a (fn buf &optional norecord) - "Use `pop-to-buffer' instead of `switch-to-buffer' to open buffer.'" - :around #'org-switch-to-buffer-other-window - (if +popup-mode - (pop-to-buffer buf nil norecord) - (funcall fn buf norecord)))) - - -;;;###package org-journal -(defadvice! +popup--use-popup-window-a (fn &rest args) - :around #'org-journal-search-by-string - (letf! ((#'switch-to-buffer #'pop-to-buffer)) - (apply fn args))) - - -;;;###package persp-mode -(defadvice! +popup--persp-mode-restore-popups-a (&rest _) - "Restore popup windows when loading a perspective from file." - :after #'persp-load-state-from-file - (dolist (window (window-list)) - (when (+popup-parameter 'popup window) - (+popup--init window nil)))) - - -;;;###package pdf-tools -(after! pdf-tools - (setq tablist-context-window-display-action - '((+popup-display-buffer-stacked-side-window-fn) - (side . left) - (slot . 2) - (window-height . 0.3) - (inhibit-same-window . t)) - pdf-annot-list-display-buffer-action - '((+popup-display-buffer-stacked-side-window-fn) - (side . left) - (slot . 3) - (inhibit-same-window . t)))) - - -;;;###package profiler -(defadvice! +popup--profiler-report-find-entry-in-other-window-a (fn function) - :around #'profiler-report-find-entry - (letf! ((#'find-function #'find-function-other-window)) - (funcall fn function))) - - -;;;###package undo-tree -(defadvice! +popup--use-popup-window-for-undo-tree-visualizer-a (fn &rest args) - "TODO" - :around #'undo-tree-visualize - (if undo-tree-visualizer-diff - (apply fn args) - (letf! ((#'switch-to-buffer-other-window #'pop-to-buffer)) - (apply fn args)))) - -;;;###package wgrep -(progn - ;; close the popup after you're done with a wgrep buffer - (advice-add #'wgrep-abort-changes :after #'+popup-close-a) - (advice-add #'wgrep-finish-edit :after #'+popup-close-a)) - - -;;;###package which-key -(after! which-key - (when (eq which-key-popup-type 'side-window) - (setq which-key-popup-type 'custom - which-key-custom-popup-max-dimensions-function - (lambda (_) (which-key--side-window-max-dimensions)) - which-key-custom-hide-popup-function #'which-key--hide-buffer-side-window - which-key-custom-show-popup-function - (lambda (act-popup-dim) - (letf! (defun display-buffer-in-side-window (buffer alist) - (+popup-display-buffer-stacked-side-window-fn - buffer (append '((vslot . -9999) (select . t)) alist))) - ;; HACK Fix #2219 where the which-key popup would get cut off. - (setcar act-popup-dim (1+ (car act-popup-dim))) - (which-key--show-buffer-side-window act-popup-dim)))))) - - -;;;###package windmove -;; Users should be able to hop into popups easily, but Elisp shouldn't. -(defadvice! +popup--ignore-window-parameters-a (fn &rest args) - "Allow *interactive* window moving commands to traverse popups." - :around '(windmove-up windmove-down windmove-left windmove-right) - (letf! (defun windmove-find-other-window (dir &optional arg window) - (window-in-direction - (pcase dir (`up 'above) (`down 'below) (_ dir)) - window (bound-and-true-p +popup-mode) arg windmove-wrap-around t)) - (apply fn args))) diff --git a/.config/emacs/modules/ui/popup/README.org b/.config/emacs/modules/ui/popup/README.org deleted file mode 100644 index 38efc7c..0000000 --- a/.config/emacs/modules/ui/popup/README.org +++ /dev/null @@ -1,140 +0,0 @@ -#+TITLE: ui/popup -#+DATE: January 6, 2018 -#+SINCE: v2.0.9 -#+STARTUP: inlineimages - -* 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-hidden-mode-line-in-popups][Disabling hidden mode-line in popups]] -- [[#appendix][Appendix]] - - [[#commands][Commands]] - - [[#library][Library]] - - [[#hacks][Hacks]] - -* Description -This module provides a customizable popup window management system. - -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 the second class citizens of my editor; -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. - -** 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-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 - -~PREDICATE~ is a predicate function or regexp string to match against the -buffer's name. You'll find comprehensive documentation on the other keywords in -~set-popup-rule!~'s docstring (=SPC h f set-popup-rule!=). - -#+begin_quote -Popup rules end up in ~display-buffer-alist~, which instructs ~display-buffer~ -calls on how to set up windows for buffers that meet certain conditions. -However, some plugins can avoid it entirely if they use ~set-buffer~ or -~switch-to-buffer~, which don't obey ~display-buffer-alist~. -#+end_quote - -Multiple popup rules can be defined with ~set-popup-rules!~: - -#+BEGIN_SRC emacs-lisp -(set-popup-rules! - '(("^ \\*" :slot -1) ; fallback rule for special buffers - ("^\\*" :select t) - ("^\\*Completions" :slot -1 :ttl 0) - ("^\\*\\(?:scratch\\|Messages\\)" :ttl t) - ("^\\*Help" :slot -1 :size 0.2 :select t) - ("^\\*doom:" - :size 0.35 :select t :modeline t :quit t :ttl t))) -#+END_SRC - -Omitted parameters in a ~set-popup-rules!~ will use the defaults set in -~+popup-defaults~. - -** Disabling hidden mode-line in popups -By default, the mode-line is hidden in popups. To disable this, you can either: - -1. Change the default ~:modeline~ property in ~+popup-defaults~: - - #+BEGIN_SRC emacs-lisp - ;; add to $DOOMDIR/config.el - (plist-put +popup-defaults :modeline t) - #+END_SRC - - A value of ~t~ will instruct popups to use the default mode-line. Any - popup rule with a ~:modeline~ property can still override this. - -2. Completely disable management of the mode-line in popups: - - #+BEGIN_SRC emacs-lisp - ;; add to ~/.doom.d/config.el - (remove-hook '+popup-buffer-mode-hook #'+popup-set-modeline-on-enable-h) - #+END_SRC - -* Appendix -** Commands -+ ~+popup/other~ (aliased to ~other-popup~, bound to ~C-x p~) -+ ~+popup/toggle~ -+ ~+popup/close~ -+ ~+popup/close-all~ -+ ~+popup/toggle~ -+ ~+popup/restore~ -+ ~+popup/raise~ -** Library -+ Functions - + ~+popup-window-p WINDOW~ - + ~+popup-buffer-p BUFFER~ - + ~+popup-buffer BUFFER &optional ALIST~ - + ~+popup-parameter PARAMETER &optional WINDOW~ - + ~+popup-parameter-fn PARAMETER &optional WINDOW~ - + ~+popup-windows~ -+ Macros - + ~without-popups!~ - + ~save-popups!~ -+ Hooks - + ~+popup-adjust-fringes-h~ - + ~+popup|set-modeline~ - + ~+popup-close-on-escape-h~ - + ~+popup-cleanup-rules-h~ -+ Minor modes - + ~+popup-mode~ - + ~+popup-buffer-mode~ -** Hacks -+ =help-mode= has been advised to follow file links in the buffer you were in - before entering the popup, rather than in a new window. -+ =wgrep= buffers are advised to close themselves when aborting or committing - changes. -+ =persp-mode= is advised to restore popup windows when loading a session from - file. -+ Interactive calls to ~windmove-*~ commands (used by ~evil-window-*~ commands) - will ignore the ~no-other-window~ window parameter, allowing you to switch to - popup windows as if they're ordinary windows. -+ ~balance-windows~ has been advised to close popups while it does its business, - then restore them afterwards. -+ =neotree= advises ~balance-windows~, which causes major slow-downs when paired - with our ~balance-window~ advice, so we removes neotree's advice. -+ =org-mode= is an ongoing (and huge) effort. It has a scorched-earth window - management system I'm not fond of. ie. it kills all windows and monopolizes - the frame. On top of that, it /really/ likes to use ~switch-to-buffer~ for - most of its buffer management, which completely bypasses - ~display-buffer-alist~. Some work has gone into reversing this. diff --git a/.config/emacs/modules/ui/popup/autoload/popup.el b/.config/emacs/modules/ui/popup/autoload/popup.el deleted file mode 100644 index 51e944b..0000000 --- a/.config/emacs/modules/ui/popup/autoload/popup.el +++ /dev/null @@ -1,614 +0,0 @@ -;;; ui/popup/autoload/popup.el -*- lexical-binding: t; -*- - -(defvar +popup--internal nil) - -(defun +popup--remember (windows) - "Remember WINDOWS (a list of windows) for later restoration." - (cl-assert (cl-every #'windowp windows) t) - (setq +popup--last - (cl-loop for w in windows - collect (cons (window-buffer w) - (window-state-get w))))) - -(defun +popup--kill-buffer (buffer ttl) - "Tries to kill BUFFER, as was requested by a transient timer. If it fails, eg. -the buffer is visible, then set another timer and try again later." - (let ((inhibit-quit t)) - (cond ((not (buffer-live-p buffer))) - ((not (get-buffer-window buffer t)) - (with-demoted-errors "Error killing transient buffer: %s" - (with-current-buffer buffer - (let ((kill-buffer-hook (remq '+popup-kill-buffer-hook-h kill-buffer-hook)) - confirm-kill-processes) - (when-let (process (get-buffer-process buffer)) - (when (eq (process-type process) 'real) - (kill-process process))) - (let (kill-buffer-query-functions) - ;; HACK The debugger backtrace buffer, when killed, called - ;; `top-level'. This causes jumpiness when the popup - ;; manager tries to clean it up. - (cl-letf (((symbol-function #'top-level) #'ignore)) - (kill-buffer buffer))))))) - ((let ((ttl (if (= ttl 0) - (or (plist-get +popup-defaults :ttl) 3) - ttl))) - (with-current-buffer buffer - (setq +popup--timer - (run-at-time ttl nil #'+popup--kill-buffer buffer ttl)))))))) - -(defun +popup--delete-window (window) - "Do housekeeping before destroying a popup window. - -+ Disables `+popup-buffer-mode' so that any hooks attached to it get a chance to - run and do cleanup of its own. -+ Either kills the buffer or sets a transient timer, if the window has a - `transient' window parameter (see `+popup-window-parameters'). -+ And finally deletes the window!" - (let ((buffer (window-buffer window)) - (inhibit-quit t)) - (and (or (buffer-file-name buffer) - (if-let (base-buffer (buffer-base-buffer buffer)) - (buffer-file-name base-buffer))) - (buffer-modified-p buffer) - (let ((autosave (+popup-parameter 'autosave window))) - (cond ((eq autosave 't)) - ((null autosave) - (y-or-n-p "Popup buffer is modified. Save it?")) - ((functionp autosave) - (funcall autosave buffer)))) - (with-current-buffer buffer (save-buffer))) - (let ((ignore-window-parameters t)) - (if-let (wconf (window-parameter window 'saved-wconf)) - (set-window-configuration wconf) - (delete-window window))) - (unless (window-live-p window) - (with-current-buffer buffer - (set-buffer-modified-p nil) - (+popup-buffer-mode -1) - (unless +popup--inhibit-transient - (let ((ttl (+popup-parameter 'ttl window))) - (when (eq ttl 't) - (setq ttl (plist-get +popup-defaults :ttl))) - (cond ((null ttl)) - ((functionp ttl) - (funcall ttl buffer)) - ((not (integerp ttl)) - (signal 'wrong-type-argument (list 'integerp ttl))) - ((= ttl 0) - (+popup--kill-buffer buffer 0)) - ((add-hook 'kill-buffer-hook #'+popup-kill-buffer-hook-h nil t) - (setq +popup--timer - (run-at-time ttl nil #'+popup--kill-buffer - buffer ttl)))))))))) - -(defun +popup--delete-other-windows (window) - "Fixes `delete-other-windows' when used from a popup window." - (when-let (window (ignore-errors (+popup/raise window))) - (let ((ignore-window-parameters t)) - (delete-other-windows window))) - nil) - -(defun +popup--normalize-alist (alist) - "Merge `+popup-default-alist' and `+popup-default-parameters' with ALIST." - (when alist - (let ((alist ; handle defaults - (cl-remove-duplicates - (append alist +popup-default-alist) - :key #'car-safe :from-end t)) - (parameters - (cl-remove-duplicates - (append (cdr (assq 'window-parameters alist)) - +popup-default-parameters) - :key #'car-safe :from-end t))) - ;; handle `size' - (when-let* ((size (cdr (assq 'size alist))) - (side (or (cdr (assq 'side alist)) 'bottom)) - (param (if (memq side '(left right)) - 'window-width - 'window-height))) - (setq list (assq-delete-all 'size alist)) - (setf (alist-get param alist) size)) - (setf (alist-get 'window-parameters alist) - parameters) - ;; Fixes #1305: addresses an edge case where a popup with a :size, :width - ;; or :height greater than the current frame's dimensions causes - ;; hanging/freezing (a bug in Emacs' `display-buffer' API perhaps?) - (let ((width (cdr (assq 'window-width alist))) - (height (cdr (assq 'window-height alist)))) - (setf (alist-get 'window-width alist) - (if (numberp width) - (min width (frame-width)) - width)) - (setf (alist-get 'window-height alist) - (if (numberp height) - (min height (frame-height)) - height)) - alist)))) - -(defun +popup--split-window (window size side) - "Ensure a non-dedicated/popup window is selected when splitting a window." - (unless +popup--internal - (cl-loop for win - in (cons (or window (selected-window)) - (window-list nil 0 window)) - unless (+popup-window-p win) - return (setq window win))) - (let ((ignore-window-parameters t)) - (split-window window size side))) - -(defun +popup--maybe-select-window (window origin) - "Select a window based on `+popup--inhibit-select' and this window's `select' parameter." - (unless +popup--inhibit-select - (let ((select (+popup-parameter 'select window))) - (if (functionp select) - (funcall select window origin) - (select-window (if select window origin)))))) - -;;;###autoload -(defun +popup--init (window &optional alist) - "Initializes a popup window. Run any time a popup is opened. It sets the -default window parameters for popup windows, clears leftover transient timers -and enables `+popup-buffer-mode'." - (with-selected-window window - (setq alist (delq (assq 'actions alist) alist)) - (set-window-parameter window 'popup t) - (set-window-parameter window 'split-window #'+popup--split-window) - (set-window-parameter window 'delete-window #'+popup--delete-window) - (set-window-parameter window 'delete-other-windows #'+popup--delete-other-windows) - (set-window-dedicated-p window 'popup) - (window-preserve-size - window (memq (window-parameter window 'window-side) - '(left right)) - t) - (+popup-buffer-mode +1) - (run-hooks '+popup-create-window-hook))) - - -;; -;; Public library - -;;;###autoload -(defun +popup-buffer-p (&optional buffer) - "Return non-nil if BUFFER is a popup buffer. Defaults to the current buffer." - (when +popup-mode - (let ((buffer (or buffer (current-buffer)))) - (and (bufferp buffer) - (buffer-live-p buffer) - (buffer-local-value '+popup-buffer-mode buffer) - buffer)))) - -;;;###autoload -(defun +popup-window-p (&optional window) - "Return non-nil if WINDOW is a popup window. Defaults to the current window." - (when +popup-mode - (let ((window (or window (selected-window)))) - (and (windowp window) - (window-live-p window) - (window-parameter window 'popup) - window)))) - -;;;###autoload -(defun +popup-buffer (buffer &optional alist) - "Open BUFFER in a popup window. ALIST describes its features." - (let* ((origin (selected-window)) - (window-min-height 3) - (alist (+popup--normalize-alist alist)) - (actions (or (cdr (assq 'actions alist)) - +popup-default-display-buffer-actions))) - (or (let* ((alist (remove (assq 'window-width alist) alist)) - (alist (remove (assq 'window-height alist) alist)) - (window (display-buffer-reuse-window buffer alist))) - (when window - (+popup--maybe-select-window window origin) - window)) - (when-let (popup (cl-loop for func in actions - if (funcall func buffer alist) - return it)) - (+popup--init popup alist) - (+popup--maybe-select-window popup origin) - popup)))) - -;;;###autoload -(defun +popup-parameter (parameter &optional window) - "Fetch the window PARAMETER (symbol) of WINDOW" - (window-parameter (or window (selected-window)) parameter)) - -;;;###autoload -(defun +popup-parameter-fn (parameter &optional window &rest args) - "Fetch the window PARAMETER (symbol) of WINDOW. If it is a function, run it -with ARGS to get its return value." - (let ((val (+popup-parameter parameter window))) - (if (functionp val) - (apply val args) - val))) - -;;;###autoload -(defun +popup-windows () - "Returns a list of all popup windows." - (cl-remove-if-not #'+popup-window-p (window-list))) - -;;;###autoload -(defun +popup-shrink-to-fit (&optional window) - "Shrinks WINDOW to fit the buffer contents, if the buffer isn't empty. - -Uses `shrink-window-if-larger-than-buffer'." - (unless window - (setq window (selected-window))) - (unless (= (- (point-max) (point-min)) 0) - (shrink-window-if-larger-than-buffer window))) - -;;;###autoload -(defun +popup-alist-from-window-state (state) - "Convert window STATE (from `window-state-get') to a `display-buffer' alist." - (let* ((params (alist-get 'parameters state))) - `((side . ,(alist-get 'window-side params)) - (window-width . ,(alist-get 'total-width state)) - (window-height . ,(alist-get 'total-height state)) - (window-parameters ,@params)))) - - -;; -;; Hooks - -;;;###autoload -(defun +popup-adjust-fringes-h () - "Hides the fringe in popup windows, restoring them if `+popup-buffer-mode' is -disabled." - (let ((f (if (bound-and-true-p +popup-buffer-mode) 0))) - (set-window-fringes nil f f fringes-outside-margins))) - -;;;###autoload -(defun +popup-adjust-margins-h () - "Creates padding for the popup window determined by `+popup-margin-width', -restoring it if `+popup-buffer-mode' is disabled." - (when +popup-margin-width - (unless (memq (window-parameter nil 'window-side) '(left right)) - (let ((m (if (bound-and-true-p +popup-buffer-mode) +popup-margin-width))) - (set-window-margins nil m m))))) - -(defvar hide-mode-line-format) -;;;###autoload -(defun +popup-set-modeline-on-enable-h () - "Don't show modeline in popup windows without a `modeline' window-parameter. -Possible values for this parameter are: - - t show the mode-line as normal - nil hide the modeline entirely (the default) - a function `mode-line-format' is set to its return value - -Any non-nil value besides the above will be used as the raw value for -`mode-line-format'." - (when (bound-and-true-p +popup-buffer-mode) - (let ((modeline (+popup-parameter 'modeline))) - (cond ((eq modeline 't)) - ((null modeline) - ;; TODO use `mode-line-format' window parameter instead (emacs 26+) - (hide-mode-line-mode +1)) - ((let ((hide-mode-line-format - (if (functionp modeline) - (funcall modeline) - modeline))) - (hide-mode-line-mode +1))))))) -(put '+popup-set-modeline-on-enable-h 'permanent-local-hook t) - -;;;###autoload -(defun +popup-unset-modeline-on-disable-h () - "Restore the modeline when `+popup-buffer-mode' is deactivated." - (when (and (not (bound-and-true-p +popup-buffer-mode)) - (bound-and-true-p hide-mode-line-mode)) - (hide-mode-line-mode -1))) - -;;;###autoload -(defun +popup-close-on-escape-h () - "If called inside a popup, try to close that popup window (see -`+popup/close'). If called outside, try to close all popup windows (see -`+popup/close-all')." - (if (+popup-window-p) - (+popup/close) - (+popup/close-all))) - -;;;###autoload -(defun +popup-cleanup-rules-h () - "Cleans up any duplicate popup rules." - (interactive) - (setq +popup--display-buffer-alist - (cl-delete-duplicates +popup--display-buffer-alist - :key #'car :test #'equal :from-end t)) - (when +popup-mode - (setq display-buffer-alist +popup--display-buffer-alist))) - -;;;###autoload -(defun +popup-kill-buffer-hook-h () - "TODO" - (when-let (window (get-buffer-window)) - (when (+popup-window-p window) - (let ((+popup--inhibit-transient t)) - (+popup--delete-window window))))) - - -;; -;; Commands - -;;;###autoload -(defalias 'other-popup #'+popup/other) - -;;;###autoload -(defun +popup/buffer () - "Open this buffer in a popup window." - (interactive) - (let ((+popup-default-display-buffer-actions - '(+popup-display-buffer-stacked-side-window-fn)) - (display-buffer-alist +popup--display-buffer-alist) - (buffer (current-buffer))) - (push (+popup-make-rule "." +popup-defaults) display-buffer-alist) - (bury-buffer) - (pop-to-buffer buffer))) - -;;;###autoload -(defun +popup/other () - "Cycle through popup windows, like `other-window'. Ignores regular windows." - (interactive) - (if-let (popups (cl-remove-if-not - (lambda (w) (or (+popup-window-p w) - ;; This command should be able to hop between - ;; windows with a `no-other-window' - ;; parameter, since `other-window' won't. - (window-parameter w 'no-other-window))) - (window-list))) - (select-window (if (+popup-window-p) - (let ((window (selected-window))) - (or (car-safe (cdr (memq window popups))) - (car (delq window popups)) - (car popups))) - (car popups))) - (user-error "No popups are open"))) - -;;;###autoload -(defun +popup/close (&optional window force-p) - "Close WINDOW, if it's a popup window. - -This will do nothing if the popup's `quit' window parameter is either nil or -'other. This window parameter is ignored if FORCE-P is non-nil." - (interactive - (list (selected-window) - current-prefix-arg)) - (let ((window (or window (selected-window)))) - (when (and (+popup-window-p window) - (or force-p - (memq (+popup-parameter-fn 'quit window window) - '(t current)))) - (when +popup--remember-last - (+popup--remember (list window))) - (delete-window window) - t))) - -;;;###autoload -(defun +popup/close-all (&optional force-p) - "Close all open popup windows. - -This will ignore popups with an `quit' parameter that is either nil or 'current. -This window parameter is ignored if FORCE-P is non-nil." - (interactive "P") - (let (targets +popup--remember-last) - (dolist (window (+popup-windows)) - (when (or force-p - (memq (+popup-parameter-fn 'quit window window) - '(t other))) - (push window targets))) - (when targets - (+popup--remember targets) - (mapc #'delete-window targets) - t))) - -;;;###autoload -(defun +popup/toggle () - "Toggle any visible popups. -If no popups are available, display the *Messages* buffer in a popup window." - (interactive) - (let ((+popup--inhibit-transient t)) - (cond ((+popup-windows) (+popup/close-all t)) - ((ignore-errors (+popup/restore))) - ((display-buffer (get-buffer "*Messages*")))))) - -;;;###autoload -(defun +popup/restore () - "Restore the last popups that were closed, if any." - (interactive) - (unless +popup--last - (error "No popups to restore")) - (cl-loop for (buffer . state) in +popup--last - if (buffer-live-p buffer) - do (+popup-buffer buffer (+popup-alist-from-window-state state))) - (setq +popup--last nil) - t) - -;;;###autoload -(defun +popup/raise (window &optional arg) - "Raise the current popup window into a regular window and -return it. If prefix ARG, raise the current popup into a new -window and return that window." - (interactive - (list (selected-window) current-prefix-arg)) - (cl-check-type window window) - (unless (+popup-window-p window) - (user-error "Cannot raise a non-popup window")) - (let ((buffer (current-buffer)) - (+popup--inhibit-transient t) - +popup--remember-last) - (+popup/close window 'force) - (if arg - (pop-to-buffer buffer) - (switch-to-buffer buffer)) - (selected-window))) - -;;;###autoload -(defun +popup/diagnose () - "Reveal what popup rule will be used for the current buffer." - (interactive) - (if-let (rule (cl-loop with bname = (buffer-name) - for (pred . action) in display-buffer-alist - if (and (functionp pred) (funcall pred bname action)) - return (cons pred action) - else if (and (stringp pred) (string-match-p pred bname)) - return (cons pred action))) - (message "Rule matches: %s" rule) - (message "No popup rule for this buffer"))) - - -;; -;;; Advice - -;;;###autoload -(defun +popup-close-a (&rest _) - "TODO" - (+popup/close nil t)) - -;;;###autoload -(defun +popup-save-a (fn &rest args) - "Sets aside all popups before executing the original function, usually to -prevent the popup(s) from messing up the UI (or vice versa)." - (save-popups! (apply fn args))) - -;;;###autoload -(defun +popup-display-buffer-fullframe-fn (buffer alist) - "Displays the buffer fullscreen." - (let ((wconf (current-window-configuration))) - (when-let (window (or (display-buffer-reuse-window buffer alist) - (display-buffer-same-window buffer alist) - (display-buffer-pop-up-window buffer alist) - (display-buffer-use-some-window buffer alist))) - (set-window-parameter window 'saved-wconf wconf) - (add-to-list 'window-persistent-parameters '(saved-wconf . t)) - (delete-other-windows window) - window))) - -;;;###autoload -(defun +popup-display-buffer-stacked-side-window-fn (buffer alist) - "A `display-buffer' action that serves as an alternative to -`display-buffer-in-side-window', but allows for stacking popups with the `vslot' -alist entry. - -Accepts the same arguments as `display-buffer-in-side-window'. You must set -`window--sides-inhibit-check' to non-nil for this work properly." - (let* ((side (or (cdr (assq 'side alist)) 'bottom)) - (slot (or (cdr (assq 'slot alist)) 0)) - (vslot (or (cdr (assq 'vslot alist)) 0)) - (left-or-right (memq side '(left right))) - (display-buffer-mark-dedicated (or display-buffer-mark-dedicated 'popup))) - - (cond ((not (memq side '(top bottom left right))) - (error "Invalid side %s specified" side)) - ((not (numberp slot)) - (error "Invalid slot %s specified" slot)) - ((not (numberp vslot)) - (error "Invalid vslot %s specified" vslot))) - - (let* ((major (get-window-with-predicate - (lambda (window) - (and (eq (window-parameter window 'window-side) side) - (eq (window-parameter window 'window-vslot) vslot))) - nil)) - (reversed (window--sides-reverse-on-frame-p (selected-frame))) - (windows - (cond ((window-live-p major) - (list major)) - ((window-valid-p major) - (let* ((first (window-child major)) - (next (window-next-sibling first)) - (windows (list next first))) - (setq reversed (> (window-parameter first 'window-slot) - (window-parameter next 'window-slot))) - (while (setq next (window-next-sibling next)) - (setq windows (cons next windows))) - (if reversed windows (nreverse windows)))))) - (slots (if major (max 1 (window-child-count major)))) - (max-slots - (nth (plist-get '(left 0 top 1 right 2 bottom 3) side) - window-sides-slots)) - (window--sides-inhibit-check t) - window this-window this-slot prev-window next-window - best-window best-slot abs-slot) - - (cond ((and (numberp max-slots) (<= max-slots 0)) - nil) - ((not windows) - (cl-letf (((symbol-function 'window--make-major-side-window-next-to) - (lambda (_side) (frame-root-window (selected-frame))))) - (when-let (window (window--make-major-side-window buffer side slot alist)) - (set-window-parameter window 'window-vslot vslot) - (add-to-list 'window-persistent-parameters '(window-vslot . writable)) - window))) - (t - ;; Scan windows on SIDE. - (catch 'found - (dolist (window windows) - (setq this-slot (window-parameter window 'window-slot)) - (cond ((not (numberp this-slot))) - ((= this-slot slot) ; A window with a matching slot found - (setq this-window window) - (throw 'found t)) - (t - ;; Check if this window has a better slot value wrt the - ;; slot of the window we want. - (setq abs-slot - (if (or (and (> this-slot 0) (> slot 0)) - (and (< this-slot 0) (< slot 0))) - (abs (- slot this-slot)) - (+ (abs slot) (abs this-slot)))) - (unless (and best-slot (<= best-slot abs-slot)) - (setq best-window window) - (setq best-slot abs-slot)) - (if reversed - (cond - ((<= this-slot slot) - (setq next-window window)) - ((not prev-window) - (setq prev-window window))) - (cond - ((<= this-slot slot) - (setq prev-window window)) - ((not next-window) - (setq next-window window)))))))) - - ;; `this-window' is the first window with the same SLOT. - ;; `prev-window' is the window with the largest slot < SLOT. A new - ;; window will be created after it. - ;; `next-window' is the window with the smallest slot > SLOT. A new - ;; window will be created before it. - ;; `best-window' is the window with the smallest absolute - ;; difference of its slot and SLOT. - (or (and this-window - ;; Reuse `this-window'. - (with-current-buffer buffer - (setq window--sides-shown t)) - (window--display-buffer - buffer this-window 'reuse alist)) - (and (or (not max-slots) (< slots max-slots)) - (or (and next-window - ;; Make new window before `next-window'. - (let ((next-side (if left-or-right 'above 'left)) - (+popup--internal t) - (window-combination-resize 'side)) - (setq window - (ignore-errors (split-window next-window nil next-side))))) - (and prev-window - ;; Make new window after `prev-window'. - (let ((prev-side (if left-or-right 'below 'right)) - (+popup--internal t) - (window-combination-resize 'side)) - (setq window - (ignore-errors (split-window prev-window nil prev-side)))))) - (set-window-parameter window 'window-slot slot) - (with-current-buffer buffer - (setq window--sides-shown t)) - (window--display-buffer - buffer window 'window alist)) - (and best-window - ;; Reuse `best-window'. - (progn - ;; Give best-window the new slot value. - (set-window-parameter best-window 'window-slot slot) - (with-current-buffer buffer - (setq window--sides-shown t)) - (window--display-buffer - buffer best-window 'reuse alist))))))))) diff --git a/.config/emacs/modules/ui/popup/autoload/settings.el b/.config/emacs/modules/ui/popup/autoload/settings.el deleted file mode 100644 index 9e7d450..0000000 --- a/.config/emacs/modules/ui/popup/autoload/settings.el +++ /dev/null @@ -1,190 +0,0 @@ -;;; ui/popup/autoload/settings.el -*- lexical-binding: t; -*- - -;;;###autoload -(defvar +popup--display-buffer-alist nil) - -;;;###autoload -(defvar +popup-defaults - (list :side 'bottom - :height 0.16 - :width 40 - :quit t - :select #'ignore - :ttl 5) - "Default properties for popup rules defined with `set-popup-rule!'.") - -;;;###autoload -(defun +popup-make-rule (predicate plist) - (if (plist-get plist :ignore) - (list predicate nil) - (let* ((plist (append plist +popup-defaults)) - (alist - `((actions . ,(plist-get plist :actions)) - (side . ,(plist-get plist :side)) - (size . ,(plist-get plist :size)) - (window-width . ,(plist-get plist :width)) - (window-height . ,(plist-get plist :height)) - (slot . ,(plist-get plist :slot)) - (vslot . ,(plist-get plist :vslot)))) - (params - `((ttl . ,(plist-get plist :ttl)) - (quit . ,(plist-get plist :quit)) - (select . ,(plist-get plist :select)) - (modeline . ,(plist-get plist :modeline)) - (autosave . ,(plist-get plist :autosave)) - ,@(plist-get plist :parameters)))) - `(,predicate (+popup-buffer) - ,@alist - (window-parameters ,@params))))) - -;;;###autodef -(defun set-popup-rule! (predicate &rest plist) - "Define a popup rule. - -These rules affect buffers displayed with `pop-to-buffer' and `display-buffer' -(or their siblings). Buffers displayed with `switch-to-buffer' (and its -variants) will not be affected by these rules (as they are unaffected by -`display-buffer-alist', which powers the popup management system). - -PREDICATE can be either a) a regexp string (matched against the buffer's name) -or b) a function that takes two arguments (a buffer name and the ACTION argument -of `display-buffer') and returns a boolean. - -PLIST can be made up of any of the following properties: - -:ignore BOOL - If BOOL is non-nil, popups matching PREDICATE will not be handled by the popup - system. Use this for buffers that have their own window management system like - magit or helm. - -:actions ACTIONS - ACTIONS is a list of functions or an alist containing (FUNCTION . ALIST). See - `display-buffer''s second argument for more information on its format and what - it accepts. If omitted, `+popup-default-display-buffer-actions' is used. - -:side 'bottom|'top|'left|'right - Which side of the frame to open the popup on. This is only respected if - `+popup-display-buffer-stacked-side-window-fn' or `display-buffer-in-side-window' - is in :actions or `+popup-default-display-buffer-actions'. - -:size/:width/:height FLOAT|INT|FN - Determines the size of the popup. If more than one of these size properties are - given :size always takes precedence, and is mapped with window-width or - window-height depending on what :side the popup is opened. Setting a height - for a popup that opens on the left or right is harmless, but comes into play - if two popups occupy the same :vslot. - - If a FLOAT (0 < x < 1), the number represents how much of the window will be - consumed by the popup (a percentage). - If an INT, the number determines the size in lines (height) or units of - character width (width). - If a function, it takes one argument: the popup window, and can do whatever it - wants with it, typically resize it, like `+popup-shrink-to-fit'. - -:slot/:vslot INT - (This only applies to popups with a :side and only if :actions is blank or - contains the `+popup-display-buffer-stacked-side-window-fn' action) These control - how multiple popups are laid out. INT can be any integer, positive and - negative. - - :slot controls lateral positioning (e.g. the horizontal positioning for - top/bottom popups, or vertical positioning for left/right popups). - :vslot controls popup stacking (from the edge of the frame toward the center). - - Let's assume popup A and B are opened with :side 'bottom, in that order. - If they possess the same :slot and :vslot, popup B will replace popup A. - If popup B has a higher :slot, it will open to the right of popup A. - If popup B has a lower :slot, it will open to the left of popup A. - If popup B has a higher :vslot, it will open above popup A. - If popup B has a lower :vslot, it will open below popup A. - -:ttl INT|BOOL|FN - Stands for time-to-live. It can be t, an integer, nil or a function. This - controls how (and if) the popup system will clean up after the popup. - - If any non-zero integer, wait that many seconds before killing the buffer (and - any associated processes). - If 0, the buffer is immediately killed. - If nil, the buffer won't be killed and is left to its own devices. - If t, resort to the default :ttl in `+popup-defaults'. If none exists, this is - the same as nil. - If a function, it takes one argument: the target popup buffer. The popup - system does nothing else and ignores the function's return value. - -:quit FN|BOOL|'other|'current - Can be t, 'other, 'current, nil, or a function. This determines the behavior - of the ESC/C-g keys in or outside of popup windows. - - If t, close the popup if ESC/C-g is pressed anywhere. - If 'other, close this popup if ESC/C-g is pressed outside of any popup. This - is great for popups you may press ESC/C-g a lot in. - If 'current, close the current popup if ESC/C-g is pressed from inside of the - popup. This makes it harder to accidentally close a popup until you really - want to. - If nil, pressing ESC/C-g will never close this popup. - If a function, it takes one argument: the to-be-closed popup window, and is - run when ESC/C-g is pressed while that popup is open. It must return one of - the other values to determine the fate of the popup. - -:select BOOL|FN - Can be a boolean or function. The boolean determines whether to focus the - popup window after it opens (non-nil) or focus the origin window (nil). - - If a function, it takes two arguments: the popup window and originating window - (where you were before the popup opened). The popup system does nothing else - and ignores the function's return value. - -:modeline BOOL|FN|LIST - Can be t (show the default modeline), nil (show no modeline), a function that - returns a modeline format or a valid value for `mode-line-format' to be used - verbatim. The function takes no arguments and is run in the context of the - popup buffer. - -:autosave BOOL|FN - This parameter determines what to do with modified buffers when closing popup - windows. It accepts t, 'ignore, a function or nil. - - If t, no prompts. Just save them automatically (if they're file-visiting - buffers). Same as 'ignore for non-file-visiting buffers. - If nil (the default), prompt the user what to do if the buffer is - file-visiting and modified. - If 'ignore, no prompts, no saving. Just silently kill it. - If a function, it is run with one argument: the popup buffer, and must return - non-nil to save or nil to do nothing (but no prompts). - -:parameters ALIST - An alist of custom window parameters. See `(elisp)Window Parameters'. - -If any of these are omitted, defaults derived from `+popup-defaults' will be -used. - -\(fn PREDICATE &key IGNORE ACTIONS SIDE SIZE WIDTH HEIGHT SLOT VSLOT TTL QUIT SELECT MODELINE AUTOSAVE PARAMETERS)" - (declare (indent defun)) - (push (+popup-make-rule predicate plist) +popup--display-buffer-alist) - (when (bound-and-true-p +popup-mode) - (setq display-buffer-alist +popup--display-buffer-alist)) - +popup--display-buffer-alist) - -;;;###autodef -(defun set-popup-rules! (&rest rulesets) - "Defines multiple popup rules. - -Every entry in RULESETS should be a list of alists where the CAR is the -predicate and CDR is a plist. See `set-popup-rule!' for details on the predicate -and plist. - -Example: - - (set-popup-rules! - '((\"^ \\*\" :slot 1 :vslot -1 :size #'+popup-shrink-to-fit) - (\"^\\*\" :slot 1 :vslot -1 :select t)) - '((\"^\\*Completions\" :slot -1 :vslot -2 :ttl 0) - (\"^\\*Compil\\(?:ation\\|e-Log\\)\" :size 0.3 :ttl 0 :quit t)))" - (declare (indent 0)) - (dolist (rules rulesets) - (dolist (rule rules) - (push (+popup-make-rule (car rule) (cdr rule)) - +popup--display-buffer-alist))) - (when (bound-and-true-p +popup-mode) - (setq display-buffer-alist +popup--display-buffer-alist)) - +popup--display-buffer-alist) diff --git a/.config/emacs/modules/ui/popup/config.el b/.config/emacs/modules/ui/popup/config.el deleted file mode 100644 index 10e0387..0000000 --- a/.config/emacs/modules/ui/popup/config.el +++ /dev/null @@ -1,181 +0,0 @@ -;;; ui/popup/config.el -*- lexical-binding: t; -*- - -(defconst +popup-window-parameters '(ttl quit select modeline popup) - "A list of custom parameters to be added to `window-persistent-parameters'. -Modifying this has no effect, unless done before ui/popup loads.") - -(defvar +popup-default-display-buffer-actions - '(+popup-display-buffer-stacked-side-window-fn) - "The functions to use to display the popup buffer.") - -(defvar +popup-default-alist - '((window-height . 0.16) ; remove later - (reusable-frames . visible)) - "The default alist for `display-buffer-alist' rules.") - -(defvar +popup-default-parameters - '((transient . t) ; remove later - (quit . t) ; remove later - (select . ignore) ; remove later - (no-other-window . t)) - "The default window parameters.") - -(defvar +popup-margin-width 1 - "Size of the margins to give popup windows. Set this to nil to disable margin -adjustment.") - -(defvar +popup--inhibit-transient nil) -(defvar +popup--inhibit-select nil) -(defvar +popup--old-display-buffer-alist nil) -(defvar +popup--remember-last t) -(defvar +popup--last nil) -(defvar-local +popup--timer nil) - - -;; -;; Global modes - -(defvar +popup-mode-map (make-sparse-keymap) - "Active keymap in a session with the popup system enabled. See -`+popup-mode'.") - -(defvar +popup-buffer-mode-map - (let ((map (make-sparse-keymap))) - (when (featurep! :editor evil) - ;; For maximum escape coverage in emacs state buffers; this only works in - ;; GUI Emacs, in tty Emacs use C-g instead - (define-key map [escape] #'doom/escape)) - map) - "Active keymap in popup windows. See `+popup-buffer-mode'.") - -(define-minor-mode +popup-mode - "Global minor mode representing Doom's popup management system." - :init-value nil - :global t - :keymap +popup-mode-map - (cond (+popup-mode - (add-hook 'doom-escape-hook #'+popup-close-on-escape-h 'append) - (setq +popup--old-display-buffer-alist display-buffer-alist - display-buffer-alist +popup--display-buffer-alist - window--sides-inhibit-check t) - (dolist (prop +popup-window-parameters) - (push (cons prop 'writable) window-persistent-parameters))) - (t - (remove-hook 'doom-escape-hook #'+popup-close-on-escape-h) - (setq display-buffer-alist +popup--old-display-buffer-alist - window--sides-inhibit-check nil) - (+popup-cleanup-rules-h) - (dolist (prop +popup-window-parameters) - (delq (assq prop window-persistent-parameters) - window-persistent-parameters))))) - -(define-minor-mode +popup-buffer-mode - "Minor mode for individual popup windows. - -It is enabled when a buffer is displayed in a popup window and disabled when -that window has been changed or closed." - :init-value nil - :keymap +popup-buffer-mode-map - (if (not +popup-buffer-mode) - (remove-hook 'after-change-major-mode-hook #'+popup-set-modeline-on-enable-h t) - (add-hook 'after-change-major-mode-hook #'+popup-set-modeline-on-enable-h - nil 'local) - (when (timerp +popup--timer) - (remove-hook 'kill-buffer-hook #'+popup-kill-buffer-hook-h t) - (cancel-timer +popup--timer) - (setq +popup--timer nil)))) - -(put '+popup-buffer-mode 'permanent-local t) -(put '+popup-buffer-mode 'permanent-local-hook t) -(put '+popup-set-modeline-on-enable-h 'permanent-local-hook t) - - -;; -;; Macros - -(defmacro with-popup-rules! (rules &rest body) - "Evaluate BODY with popup RULES. RULES is a list of popup rules. Each rule -should match the arguments of `+popup-define' or the :popup setting." - (declare (indent defun)) - `(let ((+popup--display-buffer-alist +popup--old-display-buffer-alist) - display-buffer-alist) - (set-popup-rules! ,rules) - (when (bound-and-true-p +popup-mode) - (setq display-buffer-alist +popup--display-buffer-alist)) - ,@body)) - -(defmacro save-popups! (&rest body) - "Sets aside all popups before executing the original function, usually to -prevent the popup(s) from messing up the UI (or vice versa)." - `(let* ((in-popup-p (+popup-buffer-p)) - (popups (+popup-windows)) - (+popup--inhibit-transient t) - buffer-list-update-hook - +popup--last) - (dolist (p popups) - (+popup/close p 'force)) - (unwind-protect - (progn ,@body) - (when popups - (let ((origin (selected-window))) - (+popup/restore) - (unless in-popup-p - (select-window origin))))))) - - -;; -;; Default popup rules & bootstrap - -(set-popup-rules! - (when (featurep! +all) - '(("^\\*" :slot 1 :vslot -1 :select t) - ("^ \\*" :slot 1 :vslot -1 :size +popup-shrink-to-fit))) - (when (featurep! +defaults) - '(("^\\*Completions" :ignore t) - ("^\\*Local variables\\*$" - :vslot -1 :slot 1 :size +popup-shrink-to-fit) - ("^\\*\\(?:[Cc]ompil\\(?:ation\\|e-Log\\)\\|Messages\\)" - :vslot -2 :size 0.3 :autosave t :quit t :ttl nil) - ("^\\*\\(?:doom \\|Pp E\\)" ; transient buffers (no interaction required) - :vslot -3 :size +popup-shrink-to-fit :autosave t :select ignore :quit t :ttl 0) - ("^\\*doom:" ; editing buffers (interaction required) - :vslot -4 :size 0.35 :autosave t :select t :modeline t :quit nil :ttl t) - ("^\\*doom:\\(?:v?term\\|e?shell\\)-popup" ; editing buffers (interaction required) - :vslot -5 :size 0.35 :select t :modeline nil :quit nil :ttl nil) - ("^\\*\\(?:Wo\\)?Man " - :vslot -6 :size 0.45 :select t :quit t :ttl 0) - ("^\\*Calc" - :vslot -7 :side bottom :size 0.4 :select t :quit nil :ttl 0) - ("^\\*Customize" - :slot 2 :side right :size 0.5 :select t :quit nil) - ("^ \\*undo-tree\\*" - :slot 2 :side left :size 20 :select t :quit t) - ;; `help-mode', `helpful-mode' - ("^\\*\\([Hh]elp\\|Apropos\\)" - :slot 2 :vslot -8 :size 0.35 :select t) - ("^\\*eww\\*" ; `eww' (and used by dash docsets) - :vslot -11 :size 0.35 :select t) - ("^\\*xwidget" - :vslot -11 :size 0.35 :select nil) - ("^\\*info\\*$" ; `Info-mode' - :slot 2 :vslot 2 :size 0.45 :select t))) - '(("^\\*Warnings" :vslot 99 :size 0.25) - ("^\\*Backtrace" :vslot 99 :size 0.4 :quit nil) - ("^\\*CPU-Profiler-Report " :side bottom :vslot 100 :slot 1 :height 0.4 :width 0.5 :quit nil) - ("^\\*Memory-Profiler-Report " :side bottom :vslot 100 :slot 2 :height 0.4 :width 0.5 :quit nil) - ("^\\*Process List\\*" :side bottom :vslot 101 :size 0.25 :select t :quit t) - ("^\\*\\(?:Proced\\|timer-list\\|Abbrevs\\|Output\\|Occur\\|unsent mail.*?\\|message\\)\\*" :ignore t))) - -(add-hook 'doom-init-ui-hook #'+popup-mode 'append) - -(add-hook! '+popup-buffer-mode-hook - #'+popup-adjust-fringes-h - #'+popup-adjust-margins-h - #'+popup-set-modeline-on-enable-h - #'+popup-unset-modeline-on-disable-h) - - -;; -;;; Hacks - -(load! "+hacks") diff --git a/.config/emacs/modules/ui/popup/test/test-popup.el b/.config/emacs/modules/ui/popup/test/test-popup.el deleted file mode 100644 index 945f5a9..0000000 --- a/.config/emacs/modules/ui/popup/test/test-popup.el +++ /dev/null @@ -1,212 +0,0 @@ -;; -*- no-byte-compile: t; -*- -;;; ui/popup/test/test-popup.el - -(require! :ui popup) - -(describe "ui/popup" - :var (display-buffer-alist - +popup-default-display-buffer-actions - +popup--display-buffer-alist - +popup-defaults - wconf) - - (before-all - (delete-other-windows) - (switch-to-buffer "*scratch*") - (setq wconf (current-window-configuration)) - (+popup-mode +1)) - (after-all - (+popup-mode -1)) - - (before-each - (setq display-buffer-alist nil - +popup--display-buffer-alist nil - +popup-default-display-buffer-actions '(+popup-display-buffer-stacked-side-window-fn) - +popup-defaults '(:side bottom :select ignore :ttl nil :slot 1 :vslot 1))) - (after-each - (set-window-configuration wconf)) - - (describe "set-popup-rule!" - (it "sets popup rules" - (set-popup-rule! "does-not-exist" :size 10) - (let ((rule (cdr (assoc "does-not-exist" display-buffer-alist)))) - (expect rule :to-contain '(+popup-buffer)) - (expect rule :to-contain '(size . 10)))) - (it "shadows old rules" - (set-popup-rule! "a" :size 10) - (set-popup-rule! "a" :size 20) - (expect (cdr (assoc "a" display-buffer-alist)) - :to-contain '(size . 20))) - (it "resolves to defaults" - (let ((+popup-defaults '(:size 5))) - (set-popup-rule! "a") - (expect (cdr (assoc "a" display-buffer-alist)) - :to-contain '(size . 5))))) - - (describe "popup rules" - :var (origin a b c d e f g) - (before-all (setq origin (current-buffer))) - (before-each - (dolist (name '(a b c d e f g)) - (set name (get-buffer-create (symbol-name name))))) - (after-each - (let (kill-buffer-query-functions kill-buffer-hook) - (dolist (x (list a b c d e f g)) - (ignore-errors (delete-window (get-buffer-window x))) - (kill-buffer x)))) - - (describe "slot positioning" - (before-each - (set-popup-rules! - '(("a" :slot 1 :vslot 1) - ("b" :slot 2 :vslot 1) - ("c" :slot 1 :vslot 2) - ("d" :slot 2 :vslot 2) - ("e" :slot 1 :vslot 3) - ("f" :slot 1 :vslot 3) - ("g")))) - - (it "replaces popups with the same slots" - (mapc #'display-buffer (list e f)) - (expect (length (+popup-windows)) :to-be 1)) - - (it "replaces popups among multiple that have the same slots" - (let ((first (display-buffer a)) - (second (display-buffer b)) - (third (display-buffer e)) - (fourth (display-buffer f))) - (expect (+popup-windows) :to-have-same-items-as - (list first second fourth)))) - - (describe ":slot" - (it "opens left of others if lower" - (let ((first (display-buffer b)) - (second (display-buffer a))) - (expect (length (+popup-windows)) :to-be 2) - (expect (window-in-direction 'left first t) - :to-equal second))) - (it "opens right of others if higher" - (let ((first (display-buffer a)) - (second (display-buffer b))) - (expect (length (+popup-windows)) :to-be 2) - (expect (window-in-direction 'right first t) - :to-equal second))) - (it "obeys default :slot" - (let ((window (display-buffer g))) - (expect (window-parameter window 'window-slot) :to-be 1) - (expect (window-parameter window 'window-vslot) :to-be 1)))) - - (describe ":vslot" - ;; TODO Implement this, somehow - (xit "opens lower :vslot popups above others" - (let ((first (display-buffer c)) - (second (display-buffer a))) - (expect (length (+popup-windows)) :to-be 2) - (expect (window-in-direction 'above first t) - :to-equal second))) - (it "opens higher :vslot popups below others" - (let ((first (display-buffer c)) - (second (display-buffer e))) - (expect (length (+popup-windows)) :to-be 2) - (expect (window-in-direction 'below first t) - :to-equal second))))) - - (describe ":select" - (it "selects the popup if non-nil" - (set-popup-rule! "^a$" :select t) - (display-buffer a) - (expect (current-buffer) :to-equal a)) - (it "selects the originating window if nil" - (set-popup-rule! "^a$" :select nil) - (display-buffer a) - (expect (current-buffer) :to-equal origin)) - (it "fall back to base selection if passed #'ignore" - (spy-on 'ignore) - (set-popup-rule! "^a$" :select #'ignore) - (save-window-excursion - (display-buffer a) - (expect (current-buffer) :to-equal origin)) - (save-window-excursion - (pop-to-buffer a) - (expect (current-buffer) :to-equal a)) - (expect 'ignore :to-have-been-called-times 2))) - - (describe ":modeline" - (it "disables the mode-line if nil" - (set-popup-rule! "a" :modeline nil :select t) - (display-buffer a) - (expect mode-line-format :to-be nil)) - (it "uses the default mode-line if t" - (set-popup-rule! "a" :modeline t :select t) - (display-buffer a) - (expect mode-line-format :to-equal (default-value 'mode-line-format))) - (it "uses a predefined mode-line if passed a symbol" - (set-popup-rule! "a" :modeline '("x") :select t) - (display-buffer a) - (expect mode-line-format :to-equal '("x"))) - (it "runs the handler if passed a function" - (set-popup-rule! "a" :modeline (lambda () (setq mode-line-format '("x"))) :select t) - (display-buffer a) - (expect mode-line-format :to-equal '("x")))) - - ;; TODO - (xdescribe ":autosave") - - (describe ":quit" - (it "will close from anywhere if :quit = t" - (set-popup-rule! "a" :quit t) - (save-window-excursion - (display-buffer a) - (call-interactively #'+popup/close-all) - (expect (get-buffer-window a) :to-be nil)) - (save-window-excursion - (pop-to-buffer a) - (call-interactively #'+popup/close) - (expect (get-buffer-window a) :to-be nil))) - (it "will only close from outside if :quit = 'other" - (set-popup-rule! "a" :quit 'other) - (save-window-excursion - (display-buffer a) - (call-interactively #'+popup/close-all) - (expect (get-buffer-window a) :to-be nil)) - (save-window-excursion - (pop-to-buffer a) - (call-interactively #'+popup/close) - (expect (get-buffer-window a)))) - (it "will only close from inside if :quit = 'current" - (set-popup-rule! "a" :quit 'current) - (save-window-excursion - (display-buffer a) - (call-interactively #'+popup/close-all) - (expect (get-buffer-window a))) - (save-window-excursion - (pop-to-buffer a) - (call-interactively #'+popup/close) - (expect (get-buffer-window a) :to-be nil))) - (it "never close a if :quit = nil" - (set-popup-rule! "a" :quit nil) - (save-window-excursion - (display-buffer a) - (call-interactively #'+popup/close-all) - (expect (get-buffer-window a))) - (save-window-excursion - (pop-to-buffer a) - (call-interactively #'+popup/close) - (expect (get-buffer-window a))))) - - ;; TODO - (xdescribe ":ttl") - (xdescribe ":size") - (xdescribe ":width") - (xdescribe ":height") - (xdescribe ":side") - (xdescribe ":actions")) - - ;; TODO - (xdescribe "predicate functions" - (describe "buffer-p") - (describe "window-p")) - - ;; TODO - (xdescribe "save-popups!") - (xdescribe "with-popup-rules!")) diff --git a/.config/emacs/modules/ui/tabs/README.org b/.config/emacs/modules/ui/tabs/README.org deleted file mode 100644 index 7d4cb95..0000000 --- a/.config/emacs/modules/ui/tabs/README.org +++ /dev/null @@ -1,18 +0,0 @@ -#+TITLE: ui/tabs -#+DATE: July 12, 2019 -#+SINCE: v2.1 -#+STARTUP: inlineimages - -* Table of Contents :TOC_3:noexport: -- [[#description][Description]] - - [[#module-flags][Module Flags]] - - [[#plugins][Plugins]] - -* Description -This module adds an Atom-esque tab bar to the Emacs UI. - -** Module Flags -This module provides no flags. - -** Plugins -+ [[https://github.com/ema2159/centaur-tabs][centaur-tabs]] diff --git a/.config/emacs/modules/ui/tabs/autoload.el b/.config/emacs/modules/ui/tabs/autoload.el deleted file mode 100644 index d20a977..0000000 --- a/.config/emacs/modules/ui/tabs/autoload.el +++ /dev/null @@ -1,18 +0,0 @@ -;;; ui/tabs/autoload.el -*- lexical-binding: t; -*- -;;;###if (featurep! :editor evil) - -;;;###autoload (autoload '+tabs:next-or-goto "ui/tabs/autoload" nil t) -(evil-define-command +tabs:next-or-goto (index) - "Switch to the next tab, or to INDEXth tab if a count is given." - (interactive "") - (if index - (centaur-tabs-select-visible-nth-tab index) - (centaur-tabs-forward))) - -;;;###autoload (autoload '+tabs:previous-or-goto "ui/tabs/autoload" nil t) -(evil-define-command +tabs:previous-or-goto (index) - "Switch to the previous tab, or to INDEXth tab if a count is given." - (interactive "") - (if index - (centaur-tabs-select-visible-nth-tab index) - (centaur-tabs-backward))) diff --git a/.config/emacs/modules/ui/tabs/config.el b/.config/emacs/modules/ui/tabs/config.el deleted file mode 100644 index fba46ed..0000000 --- a/.config/emacs/modules/ui/tabs/config.el +++ /dev/null @@ -1,26 +0,0 @@ -;;; ui/tabs/config.el -*- lexical-binding: t; -*- - -(use-package! centaur-tabs - :hook (doom-first-file . centaur-tabs-mode) - :init - (setq centaur-tabs-set-icons t - centaur-tabs-gray-out-icons 'buffer - centaur-tabs-set-bar 'left - centaur-tabs-set-modified-marker t - centaur-tabs-close-button "✕" - centaur-tabs-modified-marker "•" - ;; Scrolling (with the mouse wheel) past the end of the tab list - ;; replaces the tab list with that of another Doom workspace. This - ;; prevents that. - centaur-tabs-cycle-scope 'tabs) - - :config - (add-hook! '(+doom-dashboard-mode-hook +popup-buffer-mode-hook) - (defun +tabs-disable-centaur-tabs-mode-maybe-h () - "Disable `centaur-tabs-mode' in current buffer." - (when (centaur-tabs-mode-on-p) - (centaur-tabs-local-mode))))) - - -;; TODO tab-bar-mode (emacs 27) -;; TODO tab-line-mode (emacs 27) diff --git a/.config/emacs/modules/ui/tabs/packages.el b/.config/emacs/modules/ui/tabs/packages.el deleted file mode 100644 index eff9eb9..0000000 --- a/.config/emacs/modules/ui/tabs/packages.el +++ /dev/null @@ -1,4 +0,0 @@ -;; -*- no-byte-compile: t; -*- -;;; ui/tabs/packages.el - -(package! centaur-tabs :pin "5860a5c40c2318797f1274ea4c6907ae77ea1ec9") diff --git a/.config/emacs/modules/ui/treemacs/README.org b/.config/emacs/modules/ui/treemacs/README.org deleted file mode 100644 index 5314892..0000000 --- a/.config/emacs/modules/ui/treemacs/README.org +++ /dev/null @@ -1,71 +0,0 @@ -#+TITLE: ui/treemacs -#+DATE: April 5, 2021 -#+SINCE: v2.0.4 -#+STARTUP: inlineimages nofold - -* Table of Contents :TOC_3:noexport: -- [[#description][Description]] - - [[#maintainers][Maintainers]] - - [[#module-flags][Module Flags]] - - [[#plugins][Plugins]] -- [[#prerequisites][Prerequisites]] -- [[#features][Features]] -- [[#configuration][Configuration]] -- [[#troubleshooting][Troubleshooting]] - -* Description -[[https://github.com/Alexander-Miller/treemacs][Treemacs]] is a file and project explorer similar to NeoTree or vim’s NerdTree, but largely inspired by the Project Explorer in Eclipse. It shows the file system outlines of your projects in a simple tree layout allowing quick navigation and exploration, while also possessing basic file management utilities. -It includes: - -+ Integration with Git (when =:tools magit= is enabled) -+ Integration with Evil (when =:editor evil +everywhere= is enabled) -+ Workspace awareness (when =:ui workspaces= is enabled) - -** Maintainers -+ This module has no dedicated maintainers. - -** Module Flags -+ =+lsp= Enable ~lsp-treemacs~ integration and add shortcuts for common commands. - -** Plugins -+ [[https://github.com/Alexander-Miller/treemacs/][treemacs]] -+ [[https://github.com/Alexander-Miller/treemacs/#treemacs-projectile][treemacs-projectile]] -+ =:editor evil +everywhere= - + [[https://github.com/Alexander-Miller/treemacs/#treemacs-evil][treemacs-evil]] -+ =:tools magit= - + [[https://github.com/Alexander-Miller/treemacs/#treemacs-magit][treemacs-magit]] -+ =:ui workspaces= - + [[https://github.com/Alexander-Miller/treemacs/#treemacs-persptreemacs-perspective][treemacs-persp]] -+ =+lsp= - + [[https://github.com/emacs-lsp/lsp-treemacs][lsp-treemacs]] - -* Prerequisites -If ~+treemacs-git-mode~ is set to ~extended~ or ~deferred~ you will need to have -~python3~ installed. - -* Features -The project bar can be opened using =SPC o p=. - -| Keybind | Description | -|---------+-----------------------------------------------------------------| -| =o s= | Open a horizontal dired buffer on the currently highlighted node | -| =o v= | Open a vertical dired buffer on the currently highlighted node | - -* Configuration -The variable ~+treemacs-git-mode~ sets the type of git integration that treemacs -has. - -There are 3 possible values: - - 1. simple, which highlights only files based on their git status, and is - slightly faster, - 2. extended, which highlights both files and directories, but requires - python, - 3. deferred, same as extended, but highlights asynchronously. - -the default being simple - -This must be set before treemacs has loaded. - -* TODO Troubleshooting -# Common issues and their solution, or places to look for help. diff --git a/.config/emacs/modules/ui/treemacs/autoload.el b/.config/emacs/modules/ui/treemacs/autoload.el deleted file mode 100644 index 9d01f1d..0000000 --- a/.config/emacs/modules/ui/treemacs/autoload.el +++ /dev/null @@ -1,17 +0,0 @@ -;;; ui/treemacs/autoload.el -*- lexical-binding: t; -*- - -;;;###autoload -(defun +treemacs/toggle () - "Initialize or toggle treemacs. - -Ensures that only the current project is present and all other projects have -been removed. - -Use `treemacs' command for old functionality." - (interactive) - (require 'treemacs) - (pcase (treemacs-current-visibility) - (`visible (delete-window (treemacs-get-local-window))) - (_ (if (doom-project-p) - (treemacs-add-and-display-current-project) - (treemacs))))) diff --git a/.config/emacs/modules/ui/treemacs/config.el b/.config/emacs/modules/ui/treemacs/config.el deleted file mode 100644 index 4cbfd9c..0000000 --- a/.config/emacs/modules/ui/treemacs/config.el +++ /dev/null @@ -1,77 +0,0 @@ -;;; ui/treemacs/config.el -*- lexical-binding: t; -*- - -(defvar +treemacs-git-mode 'simple - "Type of git integration for `treemacs-git-mode'. - -There are 3 possible values: - - 1) `simple', which highlights only files based on their git status, and is - slightly faster, - 2) `extended', which highlights both files and directories, but requires - python, - 3) `deferred', same as extended, but highlights asynchronously. - -This must be set before `treemacs' has loaded.") - - -;; -;;; Packages - -(use-package! treemacs - :defer t - :init - (setq treemacs-follow-after-init t - treemacs-is-never-other-window t - treemacs-sorting 'alphabetic-case-insensitive-asc - treemacs-persist-file (concat doom-cache-dir "treemacs-persist") - treemacs-last-error-persist-file (concat doom-cache-dir "treemacs-last-error-persist")) - :config - ;; Don't follow the cursor - (treemacs-follow-mode -1) - - (when +treemacs-git-mode - ;; If they aren't supported, fall back to simpler methods - (when (and (memq +treemacs-git-mode '(deferred extended)) - (not (executable-find "python3"))) - (setq +treemacs-git-mode 'simple)) - (treemacs-git-mode +treemacs-git-mode) - (setq treemacs-collapse-dirs - (if (memq treemacs-git-mode '(extended deferred)) - 3 - 0)))) - - -(use-package! treemacs-evil - :when (featurep! :editor evil +everywhere) - :defer t - :init - (after! treemacs (require 'treemacs-evil)) - (add-to-list 'doom-evil-state-alist '(?T . treemacs)) - :config - (define-key! evil-treemacs-state-map - [return] #'treemacs-RET-action - [tab] #'treemacs-TAB-action - "TAB" #'treemacs-TAB-action - ;; REVIEW Fix #1875 to be consistent with C-w {v,s}, but this should really - ;; be considered upstream. - "o v" #'treemacs-visit-node-horizontal-split - "o s" #'treemacs-visit-node-vertical-split)) - - -(use-package! treemacs-projectile - :after treemacs) - - -(use-package! treemacs-magit - :when (featurep! :tools magit) - :after treemacs magit) - - -(use-package! treemacs-persp - :when (featurep! :ui workspaces) - :after treemacs - :config (treemacs-set-scope-type 'Perspectives)) - -(use-package! lsp-treemacs - :when (featurep! +lsp) - :after (treemacs lsp)) diff --git a/.config/emacs/modules/ui/treemacs/doctor.el b/.config/emacs/modules/ui/treemacs/doctor.el deleted file mode 100644 index 255732f..0000000 --- a/.config/emacs/modules/ui/treemacs/doctor.el +++ /dev/null @@ -1,5 +0,0 @@ -;;; ui/treemacs/doctor.el -*- lexical-binding: t; -*- - -(assert! (not (and (featurep! +lsp) - (featurep! :tools lsp +eglot))) - "+lsp flag is not supported with eglot, only with lsp-mode.") diff --git a/.config/emacs/modules/ui/treemacs/packages.el b/.config/emacs/modules/ui/treemacs/packages.el deleted file mode 100644 index f99048f..0000000 --- a/.config/emacs/modules/ui/treemacs/packages.el +++ /dev/null @@ -1,14 +0,0 @@ -;; -*- no-byte-compile: t; -*- -;;; ui/treemacs/packages.el - -(package! treemacs :pin "1820db42c6478455340a2bd962120b1e2b0bf3f6") -;; These packages have no :pin because they're in the same repo -(when (featurep! :editor evil +everywhere) - (package! treemacs-evil)) -(package! treemacs-projectile) -(when (featurep! :tools magit) - (package! treemacs-magit)) -(when (featurep! :ui workspaces) - (package! treemacs-persp)) -(when (featurep! +lsp) - (package! lsp-treemacs :pin "c40a381730251039d33400cc14539c1e0729385f")) diff --git a/.config/emacs/modules/ui/unicode/README.org b/.config/emacs/modules/ui/unicode/README.org deleted file mode 100644 index 82de531..0000000 --- a/.config/emacs/modules/ui/unicode/README.org +++ /dev/null @@ -1,92 +0,0 @@ -#+TITLE: ui/unicode -#+DATE: June 8, 2020 -#+SINCE: v2.0 -#+STARTUP: inlineimages nofold - - -* Table of Contents :TOC_3:noexport: -- [[#description][Description]] - - [[#maintainers][Maintainers]] - - [[#module-flags][Module Flags]] - - [[#plugins][Plugins]] -- [[#prerequisites][Prerequisites]] -- [[#features][Features]] -- [[#configuration][Configuration]] - - [[#getting-fonts-with-good-coverage][Getting fonts with good coverage]] - - [[#advanced-configuration][Advanced configuration]] -- [[#troubleshooting][Troubleshooting]] - - [[#emacs-daemon-mode][Emacs daemon mode]] - -* Description -This module extends Doom's ability to display non-English unicode. -It is primarily useful for non-English Emacs users, for whom Doom's built-in unicode support in insufficient. - -This module relies on the [[https://github.com/rolandwalker/unicode-fonts][unicode-fonts]] package. It tries to setup the default emacs fontset to cover as many unicode glyphs as possible by scanning all available glyphs from all available fonts. - -When this module is enabled... - -+ Emacs will prefer to use the ~doom-unicode-font~ font to display non-latin glyphs if it provides coverage for them. -+ The first time you run Emacs a unicode cache will be generated -- this will take a while! -+ The cache will be regenerated every time Emacs is made aware of new fonts or you change the font configuration e.g. by modifying ~doom-unicode-font~. -+ The cache will be stored and should not be regenerated unless font-related configuration or the versions of relevant packages changes. - - -** Maintainers -This module has no dedicated maintainers. - -** Module Flags -This module provides no flags. - -** Plugins -+ [[https://github.com/rolandwalker/unicode-fonts][unicode-fonts]] - -* Prerequisites -This module has no prerequisites. - -* Features -# An in-depth list of features, how to use them, and their dependencies. - -* Configuration -The first font that will be analyzed to see if it contains the glyphs of non-latin characters will be ~doom-unicode-font~. To set this font place -#+BEGIN_SRC elisp -(setq doom-unicode-font (font-spec :family "Fira Mono")) -#+END_SRC -in your private =config.el= file. If your ~doom-font~ provides good unicode coverage you just set -#+BEGIN_SRC elisp -(setq doom-unicode-font doom-font) -#+END_SRC -If your font does not provide some glyphs, this package will try its best to find another font that does. - -** Getting fonts with good coverage -A list of fonts with good unicode coverage can be found on the page of the [[https://github.com/rolandwalker/unicode-fonts#minimum-useful-fonts][unicode-fonts]] package. - -** Advanced configuration -Consult the [[https://github.com/rolandwalker/unicode-fonts][unicode-fonts]] package documentation for a description of more advanced configuration. The configuration should be placed, as usual, in your private =config.el= wrapped in an ~(after! unicode-fonts)~ block. The variable ~unicode-fonts-blocks~ contains a list of all unicode block names and their character ranges. The default fonts to search for glyphs are in the variable ~unicode-fonts-block-font-mapping~. - -If you want to use the font =Symbola= for =Miscellaneous Symbols= by default you could add -#+BEGIN_SRC elisp -(after! unicode-fonts - (push "Symbola" (cadr (assoc "Miscellaneous Symbols" unicode-fonts-block-font-mapping)))) -#+END_SRC -to your =config.el=. - -If you want to redefine several blocks an efficient way would be -#+BEGIN_SRC elisp -(after! unicode-fonts - (dolist (unicode-block '("Mathematical Alphanumeric Symbols" - "Mathematical Operators" - "Miscellaneous Mathematical Symbols-A" - "Miscellaneous Mathematical Symbols-B" - "Miscellaneous Symbols" - "Miscellaneous Symbols and Arrows" - "Miscellaneous Symbols and Pictographs")) - (push "DejaVu Math TeX Gyre" (cadr (assoc unicode-block unicode-fonts-block-font-mapping))))) -#+END_SRC - -You can find a list of fonts available to emacs using ~M-x counsel-fonts~. - - -* Troubleshooting -# Common issues and their solution, or places to look for help. -** TODO Emacs daemon mode -Currently this module may fail setup fonts when emacs is run in daemon mode. See [[https://github.com/hlissner/doom-emacs/issues/3328][Bug 3328]]. diff --git a/.config/emacs/modules/ui/unicode/autoload.el b/.config/emacs/modules/ui/unicode/autoload.el deleted file mode 100644 index 4b12339..0000000 --- a/.config/emacs/modules/ui/unicode/autoload.el +++ /dev/null @@ -1,27 +0,0 @@ -;;; ui/unicode/autoload.el -*- lexical-binding: t; -*- - -;;;###autoload -(add-hook! 'doom-init-ui-hook - (defun +unicode-init-fonts-h () - "Set up `unicode-fonts' to eventually run; accommodating the daemon, if -necessary." - (setq-default bidi-display-reordering t - doom-unicode-font nil) - (if (display-graphic-p) - (+unicode-setup-fonts-h (selected-frame)) - (add-hook 'after-make-frame-functions #'+unicode-setup-fonts-h)))) - -;;;###autoload -(defun +unicode-setup-fonts-h (&optional frame) - "Initialize `unicode-fonts', if in a GUI session. - -If doom-unicode-font is set, add it as preferred font for all unicode blocks." - (when (and frame (display-graphic-p frame)) - (with-selected-frame frame - (require 'unicode-fonts) - (when doom-unicode-font - (let ((doom-unicode-font-family (plist-get (font-face-attributes doom-unicode-font) :family))) - (dolist (unicode-block unicode-fonts-block-font-mapping) - (push doom-unicode-font-family (cadr unicode-block))))) - ;; NOTE will impact startup time on first run - (unicode-fonts-setup)))) diff --git a/.config/emacs/modules/ui/unicode/packages.el b/.config/emacs/modules/ui/unicode/packages.el deleted file mode 100644 index aea7974..0000000 --- a/.config/emacs/modules/ui/unicode/packages.el +++ /dev/null @@ -1,4 +0,0 @@ -;; -*- no-byte-compile: t; -*- -;;; ui/unicode/packages.el - -(package! unicode-fonts :pin "47f2397ade28eba621baa865fd69e4efb71407a5") diff --git a/.config/emacs/modules/ui/vc-gutter/autoload.el b/.config/emacs/modules/ui/vc-gutter/autoload.el deleted file mode 100644 index 28d9de6..0000000 --- a/.config/emacs/modules/ui/vc-gutter/autoload.el +++ /dev/null @@ -1,34 +0,0 @@ -;;; ui/vc-gutter/autoload.el -*- lexical-binding: t; -*- -;;;###if (featurep! :ui hydra) - -;;;###autoload (autoload '+vc/gutter-hydra/body "ui/vc-gutter/autoload" nil t) -(defhydra +vc/gutter-hydra - (:body-pre (git-gutter-mode 1) :hint nil) - " - [git gutter] - Movement Hunk Actions Misc. +%-4s(car (git-gutter:statistic))/ -%-4s(cdr (git-gutter:statistic)) - ╭──────────────────────────────────┴────────────────╯ - ^_g_^ [_s_] stage [_R_] set start Rev - ^_k_^ [_r_] revert - ^↑ ^ [_m_] mark - ^↓ ^ [_p_] popup ╭───────────────────── - ^_j_^ │[_q_] quit - ^_G_^ │[_Q_] Quit and disable" - ("j" (progn (git-gutter:next-hunk 1) (recenter))) - ("k" (progn (git-gutter:previous-hunk 1) (recenter))) - ("g" (progn (goto-char (point-min)) (git-gutter:next-hunk 1))) - ("G" (progn (goto-char (point-min)) (git-gutter:previous-hunk 1))) - ("s" git-gutter:stage-hunk) - ("r" git-gutter:revert-hunk) - ("m" git-gutter:mark-hunk) - ("p" git-gutter:popup-hunk) - ("R" git-gutter:set-start-revision) - ("q" - (when (get-buffer git-gutter:popup-buffer) - (kill-buffer (get-buffer git-gutter:popup-buffer))) - :color blue) - ("Q" - (progn (git-gutter-mode -1) - (when (get-buffer git-gutter:popup-buffer) - (kill-buffer (get-buffer git-gutter:popup-buffer)))) - :color blue)) diff --git a/.config/emacs/modules/ui/vc-gutter/config.el b/.config/emacs/modules/ui/vc-gutter/config.el deleted file mode 100644 index 3f0a30c..0000000 --- a/.config/emacs/modules/ui/vc-gutter/config.el +++ /dev/null @@ -1,121 +0,0 @@ -;;; ui/vc-gutter/config.el -*- lexical-binding: t; -*- - -(defvar +vc-gutter-in-margin nil - "If non-nil, use the margin for diffs instead of the fringe.") - -(defvar +vc-gutter-in-remote-files nil - "If non-nil, enable the vc gutter in remote files (e.g. open through TRAMP).") - -(defvar +vc-gutter-diff-unsaved-buffer nil - "If non-nil, `diff-hl-flydiff-mode' will be activated. This allows on-the-fly -diffing, even for unsaved buffers.") - -(defvar +vc-gutter-default-style t - "If non-nil, enable the default look of the vc gutter. -This means subtle thin bitmaps on the left, an arrow bitmap for flycheck, and -flycheck indicators moved to the right fringe.") - - -;; -;;; Packages - -(use-package! git-gutter - :commands git-gutter:revert-hunk git-gutter:stage-hunk - :init - (add-hook! 'find-file-hook - (defun +vc-gutter-init-maybe-h () - "Enable `git-gutter-mode' in the current buffer. -If the buffer doesn't represent an existing file, `git-gutter-mode's activation -is deferred until the file is saved. Respects `git-gutter:disabled-modes'." - (let ((file-name (buffer-file-name (buffer-base-buffer)))) - (cond - ((and (file-remote-p (or file-name default-directory)) - (not +vc-gutter-in-remote-files))) - ;; If not a valid file, wait until it is written/saved to activate - ;; git-gutter. - ((not (and file-name (vc-backend file-name))) - (add-hook 'after-save-hook #'+vc-gutter-init-maybe-h nil 'local)) - ;; Allow git-gutter or git-gutter-fringe to activate based on the type - ;; of frame we're in. This allows git-gutter to work for silly geese - ;; who open both tty and gui frames from the daemon. - ((if (and (display-graphic-p) - (require 'git-gutter-fringe nil t)) - (setq-local git-gutter:init-function #'git-gutter-fr:init - git-gutter:view-diff-function #'git-gutter-fr:view-diff-infos - git-gutter:clear-function #'git-gutter-fr:clear - git-gutter:window-width -1) - (setq-local git-gutter:init-function 'nil - git-gutter:view-diff-function #'git-gutter:view-diff-infos - git-gutter:clear-function #'git-gutter:clear-diff-infos - git-gutter:window-width 1)) - (unless (memq major-mode git-gutter:disabled-modes) - (git-gutter-mode +1) - (remove-hook 'after-save-hook #'+vc-gutter-init-maybe-h 'local))))))) - - ;; Disable in Org mode, as per syl20bnr/spacemacs#10555 and - ;; syohex/emacs-git-gutter#24. Apparently, the mode-enabling function for - ;; global minor modes gets called for new buffers while they are still in - ;; `fundamental-mode', before a major mode has been assigned. I don't know why - ;; this is the case, but adding `fundamental-mode' here fixes the issue. - (setq git-gutter:disabled-modes '(fundamental-mode image-mode pdf-view-mode)) - :config - (set-popup-rule! "^\\*git-gutter" :select nil :size '+popup-shrink-to-fit) - - ;; Only enable the backends that are available, so it doesn't have to check - ;; when opening each buffer. - (setq git-gutter:handled-backends - (cons 'git (cl-remove-if-not #'executable-find (list 'hg 'svn 'bzr) - :key #'symbol-name))) - - ;; Update git-gutter on focus (in case I was using git externally) - (add-hook 'focus-in-hook #'git-gutter:update-all-windows) - - (add-hook! '(doom-escape-hook doom-switch-window-hook) :append - (defun +vc-gutter-update-h (&rest _) - "Refresh git-gutter on ESC. Return nil to prevent shadowing other -`doom-escape-hook' hooks." - (ignore (or (memq this-command '(git-gutter:stage-hunk - git-gutter:revert-hunk)) - inhibit-redisplay - (if git-gutter-mode - (git-gutter) - (+vc-gutter-init-maybe-h)))))) - ;; update git-gutter when using magit commands - (advice-add #'magit-stage-file :after #'+vc-gutter-update-h) - (advice-add #'magit-unstage-file :after #'+vc-gutter-update-h) - - (defadvice! +vc-gutter--fix-linearity-of-hunks-a (diffinfos is-reverse) - "Fixes `git-gutter:next-hunk' and `git-gutter:previous-hunk' sometimes - jumping to random hunks." - :override #'git-gutter:search-near-diff-index - (cl-position-if (let ((lineno (line-number-at-pos)) - (fn (if is-reverse #'> #'<))) - (lambda (line) (funcall fn lineno line))) - diffinfos - :key #'git-gutter-hunk-start-line - :from-end is-reverse))) - - -;; subtle diff indicators in the fringe -(after! git-gutter-fringe - (when +vc-gutter-default-style - ;; standardize default fringe width - (if (fboundp 'fringe-mode) (fringe-mode '4)) - - ;; places the git gutter outside the margins. - (setq-default fringes-outside-margins t) - ;; thin fringe bitmaps - (define-fringe-bitmap 'git-gutter-fr:added [224] - nil nil '(center repeated)) - (define-fringe-bitmap 'git-gutter-fr:modified [224] - nil nil '(center repeated)) - (define-fringe-bitmap 'git-gutter-fr:deleted [128 192 224 240] - nil nil 'bottom))) - -(after! flycheck - (when +vc-gutter-default-style - ;; let diff have left fringe, flycheck can have right fringe - (setq flycheck-indication-mode 'right-fringe) - ;; A non-descript, left-pointing arrow - (define-fringe-bitmap 'flycheck-fringe-bitmap-double-arrow - [16 48 112 240 112 48 16] nil nil 'center))) diff --git a/.config/emacs/modules/ui/vc-gutter/packages.el b/.config/emacs/modules/ui/vc-gutter/packages.el deleted file mode 100644 index 9cb2cae..0000000 --- a/.config/emacs/modules/ui/vc-gutter/packages.el +++ /dev/null @@ -1,4 +0,0 @@ -;; -*- no-byte-compile: t; -*- -;;; ui/vc-gutter/packages.el - -(package! git-gutter-fringe :pin "648cb5b57faec55711803cdc9434e55a733c3eba") diff --git a/.config/emacs/modules/ui/vi-tilde-fringe/README.org b/.config/emacs/modules/ui/vi-tilde-fringe/README.org deleted file mode 100644 index 4c43c83..0000000 --- a/.config/emacs/modules/ui/vi-tilde-fringe/README.org +++ /dev/null @@ -1,42 +0,0 @@ -#+TITLE: ui/vi-tilde-fringe -#+DATE: May 22, 2021 -#+SINCE: v2.0.5 -#+STARTUP: inlineimages nofold - -* Table of Contents :TOC_3:noexport: -- [[#description][Description]] - - [[#maintainers][Maintainers]] - - [[#module-flags][Module Flags]] - - [[#plugins][Plugins]] -- [[#prerequisites][Prerequisites]] -- [[#configuration][Configuration]] - -* Description -Displays a tilde(~) in the left fringe to indicate an empty line, similar to Vi. - -** Maintainers -This module has no dedicated maintainers. - -** Module Flags -This module provides no flags. - -** Plugins -+ [[https://github.com/syl20bnr/vi-tilde-fringe][vi-tilde-fringe]] - -* Prerequisites -This module has no prerequisites. - -* Configuration -By default, doom activates ~vi-tilde-fringe-mode~ for ~prog-mode~, ~text-mode~ and ~conf-mode~. To change this to your liking, you can remove any of the modes from the list - -#+begin_src emacs-lisp -;; in ~/.doom.d/config.el -(remove-hook 'text-mode-hook #'vi-tilde-fringe-mode) -#+end_src - -or add new modes where you would like ~vi-tilde-fringe-mode~ enabled. - -#+begin_src emacs-lisp -;; in ~/.doom.d/config.el -(add-hook 'org-mode-hook #'vi-tilde-fringe-mode) -#+end_src diff --git a/.config/emacs/modules/ui/vi-tilde-fringe/autoload.el b/.config/emacs/modules/ui/vi-tilde-fringe/autoload.el deleted file mode 100644 index 0d695a6..0000000 --- a/.config/emacs/modules/ui/vi-tilde-fringe/autoload.el +++ /dev/null @@ -1,5 +0,0 @@ -;;; ui/vi-tilde-fringe/autoload.el -*- lexical-binding: t; -*- - -;;;###autoload -(add-hook! '(prog-mode-hook text-mode-hook conf-mode-hook) - #'vi-tilde-fringe-mode) diff --git a/.config/emacs/modules/ui/vi-tilde-fringe/packages.el b/.config/emacs/modules/ui/vi-tilde-fringe/packages.el deleted file mode 100644 index 36b4004..0000000 --- a/.config/emacs/modules/ui/vi-tilde-fringe/packages.el +++ /dev/null @@ -1,4 +0,0 @@ -;; -*- no-byte-compile: t; -*- -;;; ui/vi-tilde-fringe/packages.el - -(package! vi-tilde-fringe :pin "f1597a8d54535bb1d84b442577b2024e6f910308") diff --git a/.config/emacs/modules/ui/window-select/README.org b/.config/emacs/modules/ui/window-select/README.org deleted file mode 100644 index 25e5c04..0000000 --- a/.config/emacs/modules/ui/window-select/README.org +++ /dev/null @@ -1,66 +0,0 @@ -#+TITLE: ui/window-select -#+DATE: October 8, 2017 -#+SINCE: v2.0.7 -#+STARTUP: inlineimages - -* Table of Contents :TOC: -- [[#description][Description]] - - [[#module-flags][Module Flags]] - - [[#packages][Packages]] -- [[#prerequisites][Prerequisites]] -- [[#features][Features]] -- [[#configuration][Configuration]] - - [[#ace-window][ace-window]] - - [[#switch-window][switch-window]] - -* Description -This module provides several methods for selecting windows without the use of -the mouse or spatial navigation (e.g. =C-w {h,j,k,l}=). - -The command ~other-window~ is remapped to either ~switch-window~ or -~ace-window~, depending on which backend you've enabled. It is bound to ~C-x o~ -(and ~C-w C-w~ for evil users). - -It also provides numbered windows and selection with the ~winum~ package, if -desired. Evil users can jump to window N in =C-w = (where N is a number -between 0 and 9). Non evil users have =C-x w = instead. - -** Module Flags -+ =+switch-window= Use the switch-window package as the backend, instead of - ace-window (avy). -+ =+numbers= Enable numbered windows and window selection (using winum). - -** Packages -+ [[https://github.com/dimitri/switch-window][switch-window]] (if =+switch-window=) -+ [[https://github.com/abo-abo/ace-window][ace-window]] (if =+switch-window= isn't enabled) -+ [[https://github.com/deb0ch/emacs-winum][winum]] (if =+numbers=) - -* Prerequisites -This module has no additional dependencies. - -* TODO Features -* Configuration -This module provides two backends, both providing the same functionality, but -with different visual cues. They are =ace-window= and =switch-window=. - -** ace-window -The first character of the buffers changes to a highlighted, user-selectable -character. - - + Pros: the content of the buffers are always visible. - + Cons: The display characters are small and difficult to see (see below for a way to enlarge them). - -**** Custom font-face example -This changes the ace-window display to show a white letter with a red background. The box attribute adds some padding. -#+BEGIN_SRC elisp -(custom-set-faces! - '(aw-leading-char-face - :foreground "white" :background "red" - :weight bold :height 2.5 :box (:line-width 10 :color "red"))) -#+END_SRC - -** switch-window -Replaces the entire buffer with large letters. - - + Pros: The displayed characters are /really/ easy to see. - + Cons: You can't see the contents of the buffers. diff --git a/.config/emacs/modules/ui/window-select/config.el b/.config/emacs/modules/ui/window-select/config.el deleted file mode 100644 index a82f7eb..0000000 --- a/.config/emacs/modules/ui/window-select/config.el +++ /dev/null @@ -1,40 +0,0 @@ -;;; ui/window-select/config.el -*- lexical-binding: t; -*- - -(use-package! switch-window - :when (featurep! +switch-window) - :defer t - :init - (global-set-key [remap other-window] #'switch-window) - :config - (setq switch-window-shortcut-style 'qwerty - switch-window-qwerty-shortcuts '("a" "s" "d" "f" "g" "h" "j" "k" "l"))) - - -(use-package! ace-window - :unless (featurep! +switch-window) - :defer t - :init - (global-set-key [remap other-window] #'ace-window) - :config - (unless (featurep! +numbers) - (setq aw-keys '(?a ?s ?d ?f ?g ?h ?j ?k ?l))) - (setq aw-scope 'frame - aw-background t)) - - -(use-package! winum - :when (featurep! +numbers) - :after-call doom-switch-window-hook - :config - (winum-mode +1) - (map! :map evil-window-map - "0" #'winum-select-window-0-or-10 - "1" #'winum-select-window-1 - "2" #'winum-select-window-2 - "3" #'winum-select-window-3 - "4" #'winum-select-window-4 - "5" #'winum-select-window-5 - "6" #'winum-select-window-6 - "7" #'winum-select-window-7 - "8" #'winum-select-window-8 - "9" #'winum-select-window-9)) diff --git a/.config/emacs/modules/ui/window-select/packages.el b/.config/emacs/modules/ui/window-select/packages.el deleted file mode 100644 index 5119b55..0000000 --- a/.config/emacs/modules/ui/window-select/packages.el +++ /dev/null @@ -1,9 +0,0 @@ -;; -*- no-byte-compile: t; -*- -;;; ui/window-select/packages.el - -(if (featurep! +switch-window) - (package! switch-window :pin "8d9fe251d8d38b223d643df975876356ddfc1b98") - (package! ace-window :pin "c7cb315c14e36fded5ac4096e158497ae974bec9")) - -(when (featurep! +numbers) - (package! winum :pin "c5455e866e8a5f7eab6a7263e2057aff5f1118b9")) diff --git a/.config/emacs/modules/ui/workspaces/README.org b/.config/emacs/modules/ui/workspaces/README.org deleted file mode 100644 index 55335b0..0000000 --- a/.config/emacs/modules/ui/workspaces/README.org +++ /dev/null @@ -1,104 +0,0 @@ -#+TITLE: ui/workspaces -#+DATE: February 4, 2017 -#+SINCE: v1.3 -#+STARTUP: inlineimages - -* Table of Contents :TOC: -- [[#description][Description]] - - [[#module-flags][Module Flags]] - - [[#packages][Packages]] -- [[#prerequisites][Prerequisites]] -- [[#features][Features]] - - [[#isolated-buffer-list][Isolated buffer-list]] - - [[#automatic-workspaces][Automatic workspaces]] - - [[#session-persistence][Session persistence]] - - [[#workspace-persistence][Workspace persistence]] -- [[#appendix][Appendix]] - - [[#commands--keybindings][Commands & Keybindings]] - - [[#api][API]] - -* Description -This module adds support for workspaces, powered by persp_mode, as well as a API -for manipulating them. - -#+begin_quote -There are many ways to use workspaces. I spawn a workspace per task. Say I'm -working in the main workspace, when I realize there is a bug in another part of -my project. I open a new workspace and deal with it in there. In the meantime, I -need to check my email, so mu4e gets its own workspace. - -Once I've completed the task, I close the workspace and return to main. -#+end_quote - -** Module Flags -This module provides no flags. - -** Packages -+ [[https://github.com/Bad-ptr/persp-mode.el][persp-mode]] - -* Prerequisites -This module has no additional dependencies. - -* Features -** Isolated buffer-list -When persp-mode is active, ~doom-buffer-list~ becomes workspace-restricted. You -can overcome this by using ~buffer-list~. - -** Automatic workspaces -A workspace is automatically created (and switched to) when you: - -+ Create a new frame (with =make-frame=; bound to =M-N= by default). -+ Switch to a project using ~projectile-switch-project~. - -** Session persistence -By default, your session is autosaved when you quit Emacs (or disable -~persp-mode~). You can load a previous session with ~M-x -+workspace/load-session~ or ~:sl[oad]~ (ex command). - -You can supply either a name to load a specific session to replace your current -one. - -** Workspace persistence -If you'd like to save a specific workspace, use ~M-x +workspace/save~, which can -be loaded into the current session (as another workspace) with ~M-x -+workspace/load~. - -* Appendix -** Commands & Keybindings -Here is a list of available commands, their default keybindings (defined in -[[../../config/default/+evil-bindings.el][private/default/+bindings.el]]), and corresponding ex commands (if any -- defined -in [[../../editor/evil/+commands.el][private/default/+evil-commands.el]]). - -| command | key / ex command | description | -|-----------------------------------+----------------------------+------------------------------------------------------------| -| ~+workspace/new~ | =SPC TAB n= | Create a new, blank workspace | -| ~+workspace/display~ | =SPC TAB TAB= | Display open workspaces in the mode-line | -| ~+workspace/load~ | =SPC TAB l= | Load a saved workspace into the current session | -| ~+workspace/restore-last-session~ | =SPC TAB R= | Restore last session | -| ~+workspace/rename~ | =SPC TAB r= | Rename the current workspace | -| ~+workspace/save~ | =SPC TAB s= | Save the current workspace to a file | -| ~+workspace/switch-to~ | =SPC TAB .= | Switch to an open workspace | -| ~+workspace/other~ | =SPC TAB `= | Switch to last workspace | -| ~+workspace/switch-left~ | =SPC TAB [= / =[ w= / =gT= | Switch to previous workspace | -| ~+workspace/switch-right~ | =SPC TAB ]= / =] w= / =gt= | Switch to next workspace | -| ~+workspace/delete~ | =SPC TAB d= | Delete the current workspace | -| ~+workspace/kill-session~ | =SPC TAB x= / =:sclear= | Clears the current session (kills all windows and buffers) | - -** API -+ ~+workspace-list~ -> list -+ ~+workspace-list-names~ -> list -+ ~+workspace-buffer-list &optional PERSP~ -> bool -+ ~+workspace-p OBJ~ -> bool -+ ~+workspace-exists-p NAME~ -> bool -+ ~+workspace-get NAME &optional NOERROR~ -> Struct -+ ~+workspace-current &optional FRAME WINDOW~ -> Struct -+ ~+workspace-current-name~ -> string -+ ~+workspace-load NAME~ -+ ~+workspace-load-session NAME~ -+ ~+workspace-save NAME~ -+ ~+workspace-save-session NAME~ -+ ~+workspace-new NAME~ -+ ~+workspace-rename NAME NEW-NAME~ -+ ~+workspace-delete NAME &optional INHIBIT-KILL-P~ -+ ~+workspace-switch NAME &optional AUTO-CREATE-P~ -+ ~+workspace-protected-p NAME~ -> bool diff --git a/.config/emacs/modules/ui/workspaces/autoload/evil.el b/.config/emacs/modules/ui/workspaces/autoload/evil.el deleted file mode 100644 index ceaa051..0000000 --- a/.config/emacs/modules/ui/workspaces/autoload/evil.el +++ /dev/null @@ -1,39 +0,0 @@ -;;; ui/workspaces/autoload/evil.el -*- lexical-binding: t; -*- -;;;###if (featurep! :editor evil) - -;;;###autoload (autoload '+workspace:save "ui/workspaces/autoload/evil" nil t) -(evil-define-command +workspace:save (&optional name) - "Ex wrapper around `+workspace/save-session'." - (interactive "") (+workspace/save name)) - -;;;###autoload (autoload '+workspace:load "ui/workspaces/autoload/evil" nil t) -(evil-define-command +workspace:load (&optional name) - "Ex wrapper around `+workspace/load-session'." - (interactive "") (+workspace/load name)) - -;;;###autoload (autoload '+workspace:new "ui/workspaces/autoload/evil" nil t) -(evil-define-command +workspace:new (bang name) - "Ex wrapper around `+workspace/new'. If BANG, clone the current workspace." - (interactive "") (+workspace/new name bang)) - -;;;###autoload (autoload '+workspace:rename "ui/workspaces/autoload/evil" nil t) -(evil-define-command +workspace:rename (new-name) - "Ex wrapper around `+workspace/rename'." - (interactive "") (+workspace/rename new-name)) - -;;;###autoload (autoload '+workspace:delete "ui/workspaces/autoload/evil" nil t) -(evil-define-command +workspace:delete () - "Ex wrapper around `+workspace/delete'." - (interactive) (+workspace/delete (+workspace-current-name))) - -;;;###autoload (autoload '+workspace:switch-next "ui/workspaces/autoload/evil" nil t) -(evil-define-command +workspace:switch-next (&optional count) - "Switch to next workspace. If COUNT, switch to COUNT-th workspace." - (interactive "") - (if count (+workspace/switch-to count) (+workspace/cycle +1))) - -;;;###autoload (autoload '+workspace:switch-previous "ui/workspaces/autoload/evil" nil t) -(evil-define-command +workspace:switch-previous (&optional count) - "Switch to previous workspace. If COUNT, switch to COUNT-th workspace." - (interactive "") - (if count (+workspace/switch-to count) (+workspace/cycle -1))) diff --git a/.config/emacs/modules/ui/workspaces/autoload/workspaces.el b/.config/emacs/modules/ui/workspaces/autoload/workspaces.el deleted file mode 100644 index e59611a..0000000 --- a/.config/emacs/modules/ui/workspaces/autoload/workspaces.el +++ /dev/null @@ -1,584 +0,0 @@ -;;; ui/workspaces/autoload/workspaces.el -*- lexical-binding: t; -*- - -(defvar +workspace--last nil) -(defvar +workspace--index 0) - -;;;###autoload -(defface +workspace-tab-selected-face '((t (:inherit highlight))) - "The face for selected tabs displayed by `+workspace/display'" - :group 'persp-mode) - -;;;###autoload -(defface +workspace-tab-face '((t (:inherit default))) - "The face for selected tabs displayed by `+workspace/display'" - :group 'persp-mode) - - -;; -;;; Library - -(defun +workspace--protected-p (name) - (equal name persp-nil-name)) - -(defun +workspace--generate-id () - (or (cl-loop for name in (+workspace-list-names) - when (string-match-p "^#[0-9]+$" name) - maximize (string-to-number (substring name 1)) into max - finally return (if max (1+ max))) - 1)) - - -;;; Predicates -;;;###autoload -(defalias #'+workspace-p #'perspective-p - "Return t if OBJ is a perspective hash table.") - -;;;###autoload -(defun +workspace-exists-p (name) - "Returns t if NAME is the name of an existing workspace." - (member name (+workspace-list-names))) - -;;;###autoload -(defalias #'+workspace-contains-buffer-p #'persp-contain-buffer-p - "Return non-nil if BUFFER is in WORKSPACE (defaults to current workspace).") - - -;;; Getters -;;;###autoload -(defalias #'+workspace-current #'get-current-persp - "Return the currently active workspace.") - -;;;###autoload -(defun +workspace-get (name &optional noerror) - "Return a workspace named NAME. Unless NOERROR is non-nil, this throws an -error if NAME doesn't exist." - (cl-check-type name string) - (when-let (persp (persp-get-by-name name)) - (cond ((+workspace-p persp) persp) - ((not noerror) - (error "No workspace called '%s' was found" name))))) - -;;;###autoload -(defun +workspace-current-name () - "Get the name of the current workspace." - (safe-persp-name (+workspace-current))) - -;;;###autoload -(defun +workspace-list () - "Return a list of workspace structs (satisifes `+workspace-p')." - ;; We don't use `hash-table-values' because it doesn't ensure order in older - ;; versions of Emacs - (cl-loop for name in persp-names-cache - if (gethash name *persp-hash*) - collect it)) - -;;;###autoload -(defun +workspace-list-names () - "Return the list of names of open workspaces." - persp-names-cache) - -;;;###autoload -(defun +workspace-buffer-list (&optional persp) - "Return a list of buffers in PERSP. - -PERSP can be a string (name of a workspace) or a workspace (satisfies -`+workspace-p'). If nil or omitted, it defaults to the current workspace." - (let ((persp (or persp (+workspace-current)))) - (unless (+workspace-p persp) - (user-error "Not in a valid workspace (%s)" persp)) - (persp-buffers persp))) - -;;;###autoload -(defun +workspace-orphaned-buffer-list () - "Return a list of buffers that aren't associated with any perspective." - (cl-remove-if #'persp--buffer-in-persps (buffer-list))) - - -;;; Actions -;;;###autoload -(defun +workspace-load (name) - "Loads a single workspace (named NAME) into the current session. Can only -retrieve perspectives that were explicitly saved with `+workspace-save'. - -Returns t if successful, nil otherwise." - (when (+workspace-exists-p name) - (user-error "A workspace named '%s' already exists." name)) - (persp-load-from-file-by-names - (expand-file-name +workspaces-data-file persp-save-dir) - *persp-hash* (list name)) - (+workspace-exists-p name)) - -;;;###autoload -(defun +workspace-save (name) - "Saves a single workspace (NAME) from the current session. Can be loaded again -with `+workspace-load'. NAME can be the string name of a workspace or its -perspective hash table. - -Returns t on success, nil otherwise." - (unless (+workspace-exists-p name) - (error "'%s' is an invalid workspace" name)) - (let ((fname (expand-file-name +workspaces-data-file persp-save-dir))) - (persp-save-to-file-by-names fname *persp-hash* (list name)) - (and (member name (persp-list-persp-names-in-file fname)) - t))) - -;;;###autoload -(defun +workspace-new (name) - "Create a new workspace named NAME. If one already exists, return nil. -Otherwise return t on success, nil otherwise." - (when (+workspace--protected-p name) - (error "Can't create a new '%s' workspace" name)) - (when (+workspace-exists-p name) - (error "A workspace named '%s' already exists" name)) - (let ((persp (persp-add-new name)) - (+popup--inhibit-transient t)) - (save-window-excursion - (let ((ignore-window-parameters t) - (+popup--inhibit-transient t)) - (persp-delete-other-windows)) - (switch-to-buffer (doom-fallback-buffer)) - (setf (persp-window-conf persp) - (funcall persp-window-state-get-function (selected-frame)))) - persp)) - -;;;###autoload -(defun +workspace-rename (name new-name) - "Rename the current workspace named NAME to NEW-NAME. Returns old name on -success, nil otherwise." - (when (+workspace--protected-p name) - (error "Can't rename '%s' workspace" name)) - (persp-rename new-name (+workspace-get name))) - -;;;###autoload -(defun +workspace-delete (workspace &optional inhibit-kill-p) - "Delete the workspace denoted by WORKSPACE, which can be the name of a perspective -or its hash table. If INHIBIT-KILL-P is non-nil, don't kill this workspace's -buffers." - (unless (stringp workspace) - (setq workspace (persp-name workspace))) - (when (+workspace--protected-p workspace) - (error "Can't delete '%s' workspace" workspace)) - (+workspace-get workspace) ; error checking - (persp-kill workspace inhibit-kill-p) - (not (+workspace-exists-p workspace))) - -;;;###autoload -(defun +workspace-switch (name &optional auto-create-p) - "Switch to another workspace named NAME (a string). - -If AUTO-CREATE-P is non-nil, create the workspace if it doesn't exist, otherwise -throws an error." - (unless (+workspace-exists-p name) - (if auto-create-p - (+workspace-new name) - (error "%s is not an available workspace" name))) - (let ((old-name (+workspace-current-name))) - (unless (equal old-name name) - (setq +workspace--last - (or (and (not (string= old-name persp-nil-name)) - old-name) - +workspaces-main)) - (persp-frame-switch name)) - (equal (+workspace-current-name) name))) - - -;; -;;; Commands - -;;;###autoload -(defalias '+workspace/restore-last-session #'doom/quickload-session) - -;;;###autoload -(defun +workspace/load (name) - "Load a workspace and switch to it. If called with C-u, try to reload the -current workspace (by name) from session files." - (interactive - (list - (if current-prefix-arg - (+workspace-current-name) - (completing-read - "Workspace to load: " - (persp-list-persp-names-in-file - (expand-file-name +workspaces-data-file persp-save-dir)))))) - (if (not (+workspace-load name)) - (+workspace-error (format "Couldn't load workspace %s" name)) - (+workspace/switch-to name) - (+workspace/display))) - -;;;###autoload -(defun +workspace/save (name) - "Save the current workspace. If called with C-u, autosave the current -workspace." - (interactive - (list - (if current-prefix-arg - (+workspace-current-name) - (completing-read "Workspace to save: " (+workspace-list-names))))) - (if (+workspace-save name) - (+workspace-message (format "'%s' workspace saved" name) 'success) - (+workspace-error (format "Couldn't save workspace %s" name)))) - -;;;###autoload -(defun +workspace/rename (new-name) - "Rename the current workspace." - (interactive (list (read-from-minibuffer "New workspace name: "))) - (condition-case-unless-debug ex - (let* ((current-name (+workspace-current-name)) - (old-name (+workspace-rename current-name new-name))) - (unless old-name - (error "Failed to rename %s" current-name)) - (+workspace-message (format "Renamed '%s'->'%s'" old-name new-name) 'success)) - ('error (+workspace-error ex t)))) - -;;;###autoload -(defun +workspace/delete (name) - "Delete this workspace. If called with C-u, prompts you for the name of the -workspace to delete." - (interactive - (let ((current-name (+workspace-current-name))) - (list - (if current-prefix-arg - (completing-read (format "Delete workspace (default: %s): " current-name) - (+workspace-list-names) - nil nil nil nil current-name) - current-name)))) - (condition-case-unless-debug ex - ;; REVIEW refactor me - (let ((workspaces (+workspace-list-names))) - (if (not (member name workspaces)) - (+workspace-message (format "'%s' workspace doesn't exist" name) 'warn) - (cond ((delq (selected-frame) (persp-frames-with-persp (get-frame-persp))) - (user-error "Can't close workspace, it's visible in another frame")) - ((not (equal (+workspace-current-name) name)) - (+workspace-delete name)) - ((cdr workspaces) - (+workspace-delete name) - (+workspace-switch - (if (+workspace-exists-p +workspace--last) - +workspace--last - (car (+workspace-list-names)))) - (unless (doom-buffer-frame-predicate (window-buffer)) - (switch-to-buffer (doom-fallback-buffer)))) - (t - (+workspace-switch +workspaces-main t) - (unless (string= (car workspaces) +workspaces-main) - (+workspace-delete name)) - (doom/kill-all-buffers (doom-buffer-list)))) - (+workspace-message (format "Deleted '%s' workspace" name) 'success))) - ('error (+workspace-error ex t)))) - -;;;###autoload -(defun +workspace/kill-session (&optional interactive) - "Delete the current session, all workspaces, windows and their buffers." - (interactive (list t)) - (let ((windows (length (window-list))) - (persps (length (+workspace-list-names))) - (buffers 0)) - (let ((persp-autokill-buffer-on-remove t)) - (unless (cl-every #'+workspace-delete (+workspace-list-names)) - (+workspace-error "Could not clear session"))) - (+workspace-switch +workspaces-main t) - (setq buffers (doom/kill-all-buffers (buffer-list))) - (when interactive - (message "Killed %d workspace(s), %d window(s) & %d buffer(s)" - persps windows buffers)))) - -;;;###autoload -(defun +workspace/kill-session-and-quit () - "Kill emacs without saving anything." - (interactive) - (let ((persp-auto-save-opt 0)) - (kill-emacs))) - -;;;###autoload -(defun +workspace/new (&optional name clone-p) - "Create a new workspace named NAME. If CLONE-P is non-nil, clone the current -workspace, otherwise the new workspace is blank." - (interactive (list nil current-prefix-arg)) - (unless name - (setq name (format "#%s" (+workspace--generate-id)))) - (condition-case e - (cond ((+workspace-exists-p name) - (error "%s already exists" name)) - (clone-p (persp-copy name t)) - (t - (+workspace-switch name t) - (+workspace/display))) - ((debug error) (+workspace-error (cadr e) t)))) - -;;;###autoload -(defun +workspace/new-named (name) - "Create a new workspace with a given NAME." - (interactive "sWorkspace Name: ") - (+workspace/new name)) - -;;;###autoload -(defun +workspace/switch-to (index) - "Switch to a workspace at a given INDEX. A negative number will start from the -end of the workspace list." - (interactive - (list (or current-prefix-arg - (if (featurep! :completion ivy) - (ivy-read "Switch to workspace: " - (+workspace-list-names) - :caller #'+workspace/switch-to - :preselect (+workspace-current-name)) - (completing-read "Switch to workspace: " (+workspace-list-names)))))) - (when (and (stringp index) - (string-match-p "^[0-9]+$" index)) - (setq index (string-to-number index))) - (condition-case-unless-debug ex - (let ((names (+workspace-list-names)) - (old-name (+workspace-current-name))) - (cond ((numberp index) - (let ((dest (nth index names))) - (unless dest - (error "No workspace at #%s" (1+ index))) - (+workspace-switch dest))) - ((stringp index) - (+workspace-switch index t)) - (t - (error "Not a valid index: %s" index))) - (unless (called-interactively-p 'interactive) - (if (equal (+workspace-current-name) old-name) - (+workspace-message (format "Already in %s" old-name) 'warn) - (+workspace/display)))) - ('error (+workspace-error (cadr ex) t)))) - -;;;###autoload -(dotimes (i 9) - (defalias (intern (format "+workspace/switch-to-%d" i)) - (lambda () (interactive) (+workspace/switch-to i)) - (format "Switch to workspace #%d" (1+ i)))) - -;;;###autoload -(defun +workspace/switch-to-final () - "Switch to the final workspace in open workspaces." - (interactive) - (+workspace/switch-to (car (last (+workspace-list-names))))) - -;;;###autoload -(defun +workspace/other () - "Switch to the last activated workspace." - (interactive) - (+workspace/switch-to +workspace--last)) - -;;;###autoload -(defun +workspace/cycle (n) - "Cycle n workspaces to the right (default) or left." - (interactive (list 1)) - (let ((current-name (+workspace-current-name))) - (if (equal current-name persp-nil-name) - (+workspace-switch +workspaces-main t) - (condition-case-unless-debug ex - (let* ((persps (+workspace-list-names)) - (perspc (length persps)) - (index (cl-position current-name persps))) - (when (= perspc 1) - (user-error "No other workspaces")) - (+workspace/switch-to (% (+ index n perspc) perspc)) - (unless (called-interactively-p 'interactive) - (+workspace/display))) - ('user-error (+workspace-error (cadr ex) t)) - ('error (+workspace-error ex t)))))) - -;;;###autoload -(defun +workspace/switch-left () (interactive) (+workspace/cycle -1)) - -;;;###autoload -(defun +workspace/switch-right () (interactive) (+workspace/cycle +1)) - -;;;###autoload -(defun +workspace/close-window-or-workspace () - "Close the selected window. If it's the last window in the workspace, either -close the workspace (as well as its associated frame, if one exists) and move to -the next." - (interactive) - (let ((delete-window-fn (if (featurep 'evil) #'evil-window-delete #'delete-window))) - (if (window-dedicated-p) - (funcall delete-window-fn) - (let ((current-persp-name (+workspace-current-name))) - (cond ((or (+workspace--protected-p current-persp-name) - (cdr (doom-visible-windows))) - (funcall delete-window-fn)) - - ((cdr (+workspace-list-names)) - (let ((frame-persp (frame-parameter nil 'workspace))) - (if (string= frame-persp (+workspace-current-name)) - (delete-frame) - (+workspace/delete current-persp-name)))) - - ((+workspace-error "Can't delete last workspace" t))))))) - -;;;###autoload -(defun +workspace/swap-left (&optional count) - "Swap the current workspace with the COUNTth workspace on its left." - (interactive "p") - (let* ((current-name (+workspace-current-name)) - (count (or count 1)) - (index (- (cl-position current-name persp-names-cache :test #'equal) - count)) - (names (remove current-name persp-names-cache))) - (unless names - (user-error "Only one workspace")) - (let ((index (min (max 0 index) (length names)))) - (setq persp-names-cache - (append (cl-subseq names 0 index) - (list current-name) - (cl-subseq names index)))) - (when (called-interactively-p 'any) - (+workspace/display)))) - -;;;###autoload -(defun +workspace/swap-right (&optional count) - "Swap the current workspace with the COUNTth workspace on its right." - (interactive "p") - (funcall-interactively #'+workspace/swap-left (- count))) - - -;; -;;; Tabs display in minibuffer - -(defun +workspace--tabline (&optional names) - (let ((names (or names (+workspace-list-names))) - (current-name (+workspace-current-name))) - (mapconcat - #'identity - (cl-loop for name in names - for i to (length names) - collect - (propertize (format " [%d] %s " (1+ i) name) - 'face (if (equal current-name name) - '+workspace-tab-selected-face - '+workspace-tab-face))) - " "))) - -(defun +workspace--message-body (message &optional type) - (concat (+workspace--tabline) - (propertize " | " 'face 'font-lock-comment-face) - (propertize (format "%s" message) - 'face (pcase type - ('error 'error) - ('warn 'warning) - ('success 'success) - ('info 'font-lock-comment-face))))) - -;;;###autoload -(defun +workspace-message (message &optional type) - "Show an 'elegant' message in the echo area next to a listing of workspaces." - (message "%s" (+workspace--message-body message type))) - -;;;###autoload -(defun +workspace-error (message &optional noerror) - "Show an 'elegant' error in the echo area next to a listing of workspaces." - (funcall (if noerror #'message #'error) - "%s" (+workspace--message-body message 'error))) - -;;;###autoload -(defun +workspace/display () - "Display a list of workspaces (like tabs) in the echo area." - (interactive) - (let (message-log-max) - (message "%s" (+workspace--tabline)))) - - -;; -;;; Hooks - -;;;###autoload -(defun +workspaces-delete-associated-workspace-h (&optional frame) - "Delete workspace associated with current frame. -A workspace gets associated with a frame when a new frame is interactively -created." - (when (and persp-mode (not (bound-and-true-p with-editor-mode))) - (unless frame - (setq frame (selected-frame))) - (let ((frame-persp (frame-parameter frame 'workspace))) - (when (string= frame-persp (+workspace-current-name)) - (+workspace/delete frame-persp))))) - -;;;###autoload -(defun +workspaces-associate-frame-fn (frame &optional _new-frame-p) - "Create a blank, new perspective and associate it with FRAME." - (when persp-mode - (if (not (persp-frame-list-without-daemon)) - (+workspace-switch +workspaces-main t) - (with-selected-frame frame - (+workspace-switch (format "#%s" (+workspace--generate-id)) t) - (unless (doom-real-buffer-p (current-buffer)) - (switch-to-buffer (doom-fallback-buffer))) - (set-frame-parameter frame 'workspace (+workspace-current-name)) - ;; ensure every buffer has a buffer-predicate - (persp-set-frame-buffer-predicate frame)) - (run-at-time 0.1 nil #'+workspace/display)))) - -(defvar +workspaces--project-dir nil) -;;;###autoload -(defun +workspaces-set-project-action-fn () - "A `projectile-switch-project-action' that sets the project directory for -`+workspaces-switch-to-project-h'." - (setq +workspaces--project-dir default-directory)) - -;;;###autoload -(defun +workspaces-switch-to-project-h (&optional dir) - "Creates a workspace dedicated to a new project. If one already exists, switch -to it. If in the main workspace and it's empty, recycle that workspace, without -renaming it. - -Afterwords, runs `+workspaces-switch-project-function'. By default, this prompts -the user to open a file in the new project. - -This be hooked to `projectile-after-switch-project-hook'." - (when dir - (setq +workspaces--project-dir dir)) - ;; HACK Clear projectile-project-root, otherwise cached roots may interfere - ;; with project switch (see #3166) - (let (projectile-project-root) - (when (and persp-mode +workspaces--project-dir) - (when projectile-before-switch-project-hook - (with-temp-buffer - ;; Load the project dir-local variables into the switch buffer, so the - ;; action can make use of them - (setq default-directory +workspaces--project-dir) - (hack-dir-local-variables-non-file-buffer) - (run-hooks 'projectile-before-switch-project-hook))) - (unwind-protect - (if (and (not (null +workspaces-on-switch-project-behavior)) - (or (eq +workspaces-on-switch-project-behavior t) - (equal (safe-persp-name (get-current-persp)) persp-nil-name) - (+workspace-buffer-list))) - (let* ((persp - (let ((project-name (doom-project-name +workspaces--project-dir))) - (or (+workspace-get project-name t) - (+workspace-new project-name)))) - (new-name (persp-name persp))) - (+workspace-switch new-name) - (with-current-buffer (doom-fallback-buffer) - (setq default-directory +workspaces--project-dir) - (hack-dir-local-variables-non-file-buffer)) - (unless current-prefix-arg - (funcall +workspaces-switch-project-function +workspaces--project-dir)) - (+workspace-message - (format "Switched to '%s' in new workspace" new-name) - 'success)) - (with-current-buffer (doom-fallback-buffer) - (setq default-directory +workspaces--project-dir) - (hack-dir-local-variables-non-file-buffer) - (message "Switched to '%s'" (doom-project-name +workspaces--project-dir))) - (with-demoted-errors "Workspace error: %s" - (+workspace-rename (+workspace-current-name) (doom-project-name +workspaces--project-dir))) - (unless current-prefix-arg - (funcall +workspaces-switch-project-function +workspaces--project-dir))) - (run-hooks 'projectile-after-switch-project-hook) - (setq +workspaces--project-dir nil))))) - - -;; -;;; Advice - -;;;###autoload -(defun +workspaces-autosave-real-buffers-a (fn &rest args) - "Don't autosave if no real buffers are open." - (when (doom-real-buffer-list) - (apply fn args)) - t) diff --git a/.config/emacs/modules/ui/workspaces/config.el b/.config/emacs/modules/ui/workspaces/config.el deleted file mode 100644 index d71cf12..0000000 --- a/.config/emacs/modules/ui/workspaces/config.el +++ /dev/null @@ -1,279 +0,0 @@ -;;; ui/workspaces/config.el -*- lexical-binding: t; -*- - -;; `persp-mode' gives me workspaces, a workspace-restricted `buffer-list', and -;; file-based session persistence. I used workgroups2 before this, but abandoned -;; it because it was unstable and slow; `persp-mode' is neither (and still -;; maintained). -;; -;; NOTE persp-mode requires `workgroups' for file persistence in Emacs 24.4. - -(defvar +workspaces-main "main" - "The name of the primary and initial workspace, which cannot be deleted.") - -(defvar +workspaces-switch-project-function #'doom-project-find-file - "The function to run after `projectile-switch-project' or -`counsel-projectile-switch-project'. This function must take one argument: the -new project directory.") - -(defvar +workspaces-on-switch-project-behavior 'non-empty - "Controls the behavior of workspaces when switching to a new project. - -Can be one of the following: - -t Always create a new workspace for the project -'non-empty Only create a new workspace if the current one already has buffers - associated with it. -nil Never create a new workspace on project switch.") - -;; FIXME actually use this for wconf bookmark system -(defvar +workspaces-data-file "_workspaces" - "The basename of the file to store single workspace perspectives. Will be -stored in `persp-save-dir'.") - -(defvar +workspace--old-uniquify-style nil) - - -;; -;; Packages - -(use-package! persp-mode - :unless noninteractive - :commands persp-switch-to-buffer - :hook (doom-init-ui . persp-mode) - :config - (setq persp-autokill-buffer-on-remove 'kill-weak - persp-reset-windows-on-nil-window-conf nil - persp-nil-hidden t - persp-auto-save-fname "autosave" - persp-save-dir (concat doom-etc-dir "workspaces/") - persp-set-last-persp-for-new-frames t - persp-switch-to-added-buffer nil - persp-kill-foreign-buffer-behaviour 'kill - persp-remove-buffers-from-nil-persp-behaviour nil - persp-auto-resume-time -1 ; Don't auto-load on startup - persp-auto-save-opt (if noninteractive 0 1)) ; auto-save on kill - - - ;;;; Create main workspace - ;; The default perspective persp-mode creates is special and doesn't represent - ;; a real persp object, so buffers can't really be assigned to it, among other - ;; quirks, so I replace it with a "main" perspective. - (add-hook! '(persp-mode-hook persp-after-load-state-functions) - (defun +workspaces-ensure-no-nil-workspaces-h (&rest _) - (when persp-mode - (dolist (frame (frame-list)) - (when (string= (safe-persp-name (get-current-persp frame)) persp-nil-name) - ;; Take extra steps to ensure no frame ends up in the nil perspective - (persp-frame-switch (or (cadr (hash-table-keys *persp-hash*)) - +workspaces-main) - frame)))))) - - (add-hook! 'persp-mode-hook - (defun +workspaces-init-first-workspace-h (&rest _) - "Ensure a main workspace exists." - (when persp-mode - (let (persp-before-switch-functions) - ;; Try our best to hide the nil perspective. - (when (equal (car persp-names-cache) persp-nil-name) - (pop persp-names-cache)) - ;; ...and create a *real* main workspace to fill this role. - (unless (or (persp-get-by-name +workspaces-main) - ;; Start from 2 b/c persp-mode counts the nil workspace - (> (hash-table-count *persp-hash*) 2)) - (persp-add-new +workspaces-main)) - ;; HACK Fix #319: the warnings buffer gets swallowed when creating - ;; `+workspaces-main', so display it ourselves, if it exists. - (when-let (warnings (get-buffer "*Warnings*")) - (save-excursion - (display-buffer-in-side-window - warnings '((window-height . shrink-window-if-larger-than-buffer)))))))) - (defun +workspaces-init-persp-mode-h () - (cond (persp-mode - ;; `uniquify' breaks persp-mode. It renames old buffers, which causes - ;; errors when switching between perspective (their buffers are - ;; serialized by name and persp-mode expects them to have the same - ;; name when restored). - (when uniquify-buffer-name-style - (setq +workspace--old-uniquify-style uniquify-buffer-name-style)) - (setq uniquify-buffer-name-style nil) - ;; Ensure `persp-kill-buffer-query-function' is last - (remove-hook 'kill-buffer-query-functions #'persp-kill-buffer-query-function) - (add-hook 'kill-buffer-query-functions #'persp-kill-buffer-query-function t) - ;; Restrict buffer list to workspace - (advice-add #'doom-buffer-list :override #'+workspace-buffer-list)) - (t - (when +workspace--old-uniquify-style - (setq uniquify-buffer-name-style +workspace--old-uniquify-style)) - (advice-remove #'doom-buffer-list #'+workspace-buffer-list))))) - - ;; Per-workspace `winner-mode' history - (add-to-list 'window-persistent-parameters '(winner-ring . t)) - - (add-hook! 'persp-before-deactivate-functions - (defun +workspaces-save-winner-data-h (_) - (when (and (bound-and-true-p winner-mode) - (get-current-persp)) - (set-persp-parameter - 'winner-ring (list winner-currents - winner-ring-alist - winner-pending-undo-ring))))) - - (add-hook! 'persp-activated-functions - (defun +workspaces-load-winner-data-h (_) - (when (bound-and-true-p winner-mode) - (cl-destructuring-bind - (currents alist pending-undo-ring) - (or (persp-parameter 'winner-ring) (list nil nil nil)) - (setq winner-undo-frame nil - winner-currents currents - winner-ring-alist alist - winner-pending-undo-ring pending-undo-ring))))) - - ;;;; Registering buffers to perspectives - (add-hook! 'doom-switch-buffer-hook - (defun +workspaces-add-current-buffer-h () - "Add current buffer to focused perspective." - (or (not persp-mode) - (persp-buffer-filtered-out-p - (or (buffer-base-buffer (current-buffer)) - (current-buffer)) - persp-add-buffer-on-after-change-major-mode-filter-functions) - (persp-add-buffer (current-buffer) (get-current-persp) nil nil)))) - - (add-hook 'persp-add-buffer-on-after-change-major-mode-filter-functions - #'doom-unreal-buffer-p) - - (defadvice! +workspaces--evil-alternate-buffer-a (&optional window) - "Make `evil-alternate-buffer' ignore buffers outside the current workspace." - :override #'evil-alternate-buffer - (let* ((prev-buffers - (if persp-mode - (cl-remove-if-not #'persp-contain-buffer-p (window-prev-buffers) - :key #'car) - (window-prev-buffers))) - (head (car prev-buffers))) - (if (eq (car head) (window-buffer window)) - (cadr prev-buffers) - head))) - - ;; HACK Fixes #4196, #1525: selecting deleted buffer error when quitting Emacs - ;; or on some buffer listing ops. - (defadvice! +workspaces-remove-dead-buffers-a (persp) - :before #'persp-buffers-to-savelist - (when (perspective-p persp) - ;; HACK Can't use `persp-buffers' because of a race condition with its gv - ;; getter/setter not being defined in time. - (setf (aref persp 2) - (cl-delete-if-not #'persp-get-buffer-or-null (persp-buffers persp))))) - - ;; Delete the current workspace if closing the last open window - (define-key! persp-mode-map - [remap delete-window] #'+workspace/close-window-or-workspace - [remap evil-window-delete] #'+workspace/close-window-or-workspace) - - ;; per-frame workspaces - (setq persp-init-frame-behaviour t - persp-init-new-frame-behaviour-override nil - persp-interactive-init-frame-behaviour-override #'+workspaces-associate-frame-fn - persp-emacsclient-init-frame-behaviour-override #'+workspaces-associate-frame-fn) - (add-hook 'delete-frame-functions #'+workspaces-delete-associated-workspace-h) - (add-hook 'server-done-hook #'+workspaces-delete-associated-workspace-h) - - ;; per-project workspaces, but reuse current workspace if empty - ;; HACK?? needs review - (setq projectile-switch-project-action (lambda () (+workspaces-set-project-action-fn) (+workspaces-switch-to-project-h)) - counsel-projectile-switch-project-action - '(1 ("o" +workspaces-switch-to-project-h "open project in new workspace") - ("O" counsel-projectile-switch-project-action "jump to a project buffer or file") - ("f" counsel-projectile-switch-project-action-find-file "jump to a project file") - ("d" counsel-projectile-switch-project-action-find-dir "jump to a project directory") - ("D" counsel-projectile-switch-project-action-dired "open project in dired") - ("b" counsel-projectile-switch-project-action-switch-to-buffer "jump to a project buffer") - ("m" counsel-projectile-switch-project-action-find-file-manually "find file manually from project root") - ("w" counsel-projectile-switch-project-action-save-all-buffers "save all project buffers") - ("k" counsel-projectile-switch-project-action-kill-buffers "kill all project buffers") - ("r" counsel-projectile-switch-project-action-remove-known-project "remove project from known projects") - ("c" counsel-projectile-switch-project-action-compile "run project compilation command") - ("C" counsel-projectile-switch-project-action-configure "run project configure command") - ("e" counsel-projectile-switch-project-action-edit-dir-locals "edit project dir-locals") - ("v" counsel-projectile-switch-project-action-vc "open project in vc-dir / magit / monky") - ("s" (lambda (project) - (let ((projectile-switch-project-action - (lambda () (call-interactively #'+ivy/project-search)))) - (counsel-projectile-switch-project-by-name project))) "search project") - ("xs" counsel-projectile-switch-project-action-run-shell "invoke shell from project root") - ("xe" counsel-projectile-switch-project-action-run-eshell "invoke eshell from project root") - ("xt" counsel-projectile-switch-project-action-run-term "invoke term from project root") - ("X" counsel-projectile-switch-project-action-org-capture "org-capture into project"))) - - (when (featurep! :completion helm) - (after! helm-projectile - (setcar helm-source-projectile-projects-actions - '("Switch to Project" . +workspaces-switch-to-project-h)))) - - ;; Don't bother auto-saving the session if no real buffers are open. - (advice-add #'persp-asave-on-exit :around #'+workspaces-autosave-real-buffers-a) - - ;; Fix #1973: visual selection surviving workspace changes - (add-hook 'persp-before-deactivate-functions #'deactivate-mark) - - ;; Fix #1017: stop session persistence from restoring a broken posframe - (after! posframe - (add-hook! 'persp-after-load-state-functions - (defun +workspaces-delete-all-posframes-h (&rest _) - (posframe-delete-all)))) - - ;; Don't try to persist dead/remote buffers. They cause errors. - (add-hook! 'persp-filter-save-buffers-functions - (defun +workspaces-dead-buffer-p (buf) - ;; Fix #1525: Ignore dead buffers in PERSP's buffer list - (not (buffer-live-p buf))) - (defun +workspaces-remote-buffer-p (buf) - ;; And don't save TRAMP buffers; they're super slow to restore - (let ((dir (buffer-local-value 'default-directory buf))) - (ignore-errors (file-remote-p dir))))) - - ;; Otherwise, buffers opened via bookmarks aren't treated as "real" and are - ;; excluded from the buffer list. - (add-hook 'bookmark-after-jump-hook #'+workspaces-add-current-buffer-h) - - ;;; eshell - (persp-def-buffer-save/load - :mode 'eshell-mode :tag-symbol 'def-eshell-buffer - :save-vars '(major-mode default-directory)) - ;; compile - (persp-def-buffer-save/load - :mode 'compilation-mode :tag-symbol 'def-compilation-buffer - :save-vars '(major-mode default-directory compilation-directory - compilation-environment compilation-arguments)) - ;; magit - (persp-def-buffer-save/load - :mode 'magit-status-mode :tag-symbol 'def-magit-status-buffer - :save-vars '(default-directory) - :load-function (lambda (savelist &rest _) - (cl-destructuring-bind (buffer-name vars &rest _rest) (cdr savelist) - (magit-status (alist-get 'default-directory vars))))) - ;; Restore indirect buffers - (defvar +workspaces--indirect-buffers-to-restore nil) - (persp-def-buffer-save/load - :tag-symbol 'def-indirect-buffer - :predicate #'buffer-base-buffer - :save-function (lambda (buf tag vars) - (list tag (buffer-name buf) vars - (buffer-name (buffer-base-buffer buf)))) - :load-function (lambda (savelist &rest _rest) - (cl-destructuring-bind (buf-name _vars base-buf-name &rest _) - (cdr savelist) - (push (cons buf-name base-buf-name) - +workspaces--indirect-buffers-to-restore) - nil))) - (add-hook! 'persp-after-load-state-functions - (defun +workspaces-reload-indirect-buffers-h (&rest _) - (dolist (ibc +workspaces--indirect-buffers-to-restore) - (cl-destructuring-bind (buffer-name . base-buffer-name) ibc - (let ((base-buffer (get-buffer base-buffer-name))) - (when (buffer-live-p base-buffer) - (when (get-buffer buffer-name) - (setq buffer-name (generate-new-buffer-name buffer-name))) - (make-indirect-buffer base-buffer buffer-name t))))) - (setq +workspaces--indirect-buffers-to-restore nil)))) diff --git a/.config/emacs/modules/ui/workspaces/packages.el b/.config/emacs/modules/ui/workspaces/packages.el deleted file mode 100644 index a0a46fe..0000000 --- a/.config/emacs/modules/ui/workspaces/packages.el +++ /dev/null @@ -1,4 +0,0 @@ -;; -*- no-byte-compile: t; -*- -;;; ui/workspaces/packages.el - -(package! persp-mode :pin "298df111f081b5925f0aa0126a1b8d334117e0a2") diff --git a/.config/emacs/modules/ui/workspaces/test/test-workspaces.el b/.config/emacs/modules/ui/workspaces/test/test-workspaces.el deleted file mode 100644 index cc0e76c..0000000 --- a/.config/emacs/modules/ui/workspaces/test/test-workspaces.el +++ /dev/null @@ -1,124 +0,0 @@ -;; -*- no-byte-compile: t; -*- -;;; ui/workspaces/test/test-workspaces.el - -(describe "ui/workspaces" - :var (persp-auto-resume-time - persp-auto-save-opt - persp-switch-to-added-buffer - persp-autokill-persp-when-removed-last-buffer - persp-autokill-buffer-on-remove - in1 in2 out1 out2 - persp1 persp1-name persp2 persp2-name - wconf) - - (require! :ui workspaces) - (require 'persp-mode) - - (before-all - (delete-other-windows)) - - (before-each - (switch-to-buffer "*scratch*") - (setq wconf (current-window-configuration) - persp-auto-resume-time -1 - persp-auto-save-opt 0 - persp-switch-to-added-buffer nil - persp-autokill-persp-when-removed-last-buffer nil - persp-autokill-buffer-on-remove nil - in1 (get-buffer-create "in1") - in2 (get-buffer-create "in2") - out1 (get-buffer-create "out1") - out2 (get-buffer-create "out2")) - (doom-set-buffer-real in1 t) - (doom-set-buffer-real out1 t) - (let (noninteractive) - (persp-mode +1) - (let (persp-before-switch-functions persp-activated-functions) - (setq persp1-name +workspaces-main - persp1 (persp-add-new persp1-name) - persp2-name "test" - persp2 (persp-add-new persp2-name)) - (persp-switch persp1-name) - (persp-add-buffer (list in1 in2) persp1)))) - - (after-each - (let (kill-buffer-query-functions kill-buffer-hook) - (let (noninteractive ignore-window-parameters) - (dolist (persp (persp-names)) - (ignore-errors (persp-kill persp))) - (persp-mode -1)) - (set-window-configuration wconf) - (mapc #'kill-buffer (list in1 in2 out1 out2)))) - - ;; - (describe "switch" - (it "throws an error when switching to a non-existent workspace" - (expect (+workspace-switch "non-existent") :to-throw)) - (it "switches to a valid workspace" - (+workspace-switch persp2-name) - (expect (+workspace-current-name) :to-equal persp2-name))) - - (describe "current" - (it "returns the current workspace persp" - (expect (+workspace-p (+workspace-current))) - (expect (+workspace-current) :to-equal (get-current-persp))) - (it "returns the current workspace's name" - (expect (+workspace-current-name) :to-equal persp1-name) - (persp-switch (persp-name persp2)) - (expect (+workspace-current-name) :to-equal persp2-name))) - - (describe "exists-p" - (it "returns t for valid workspaces" - (expect (+workspace-exists-p persp1-name))) - (it "returns t for non-current (but valid) workspaces" - (expect (+workspace-exists-p persp2-name))) - (it "returns nil for non-existent workspaces" - (expect (+workspace-exists-p "non-existent") :to-be nil))) - - (describe "buffer membership" - (it "returns t for buffers in current workspace" - (expect (+workspace-contains-buffer-p in1))) - (it "returns nil for buffers outside of current workspace" - (expect (+workspace-contains-buffer-p out1) :to-be nil)) - (xit "returns a list of orphaned buffers" - (expect (+workspace-orphaned-buffer-list) :to-contain out2))) - - (describe "list" - (it "returns a list of names" - (expect (+workspace-list-names) - :to-have-same-items-as (list persp1-name persp2-name))) - (it "returns a list of perspective structs" - (expect (+workspace-list) - :to-have-same-items-as (list persp1 persp2)))) - - (describe "CRUD" - (it "creates new workspaces" - (+workspace-new "X") - (expect (+workspace-list-names) :to-contain "X")) - (it "renames an existing workspace" - (+workspace-rename persp2-name "X") - (expect (persp-name persp2) :to-equal "X") - (expect (+workspace-list-names) - :to-have-same-items-as (list persp1-name "X"))) - (it "deletes a live workspace" - (+workspace-delete persp2-name) - (expect (+workspace-list-names) :not :to-contain persp2-name))) - - (describe "command" - (describe "close-window-or-workspace" - (before-each - (+workspace-switch persp2-name) - (split-window) - (expect (length (doom-visible-windows)) :to-be 2)) - (it "kills window if more than one window" - (quiet! (+workspace/close-window-or-workspace)) - (expect (length (doom-visible-windows)) :to-be 1)) - (it "kills workspace on last window" - (quiet! (+workspace/close-window-or-workspace) - (+workspace/close-window-or-workspace)) - (expect (+workspace-current-name) :to-equal persp1-name))) - - (describe "rename" - (it "renames the current workspace" - (quiet! (+workspace/rename "X")) - (expect (+workspace-current-name) :to-equal "X"))))) diff --git a/.config/emacs/modules/ui/zen/README.org b/.config/emacs/modules/ui/zen/README.org deleted file mode 100644 index 103ef2e..0000000 --- a/.config/emacs/modules/ui/zen/README.org +++ /dev/null @@ -1,78 +0,0 @@ -#+TITLE: ui/zen -#+DATE: December 20, 2019 -#+SINCE: v3.0.0 -#+STARTUP: inlineimages - -* Table of Contents :TOC_3:noexport: -- [[#description][Description]] - - [[#usage][Usage]] - - [[#module-flags][Module Flags]] - - [[#plugins][Plugins]] - - [[#hacks][Hacks]] -- [[#prerequisites][Prerequisites]] -- [[#features][Features]] - - [[#distractions-free-mode][Distractions-free mode]] -- [[#configuration][Configuration]] - - [[#enable-fullscreen-on-activation][Enable fullscreen on activation]] - -* Description -This module provides two minor modes that make Emacs into a more comfortable -writing or coding environment. Folks familiar with "distraction-free" or "zen" -modes from other editors -- or [[https://github.com/rnkn/olivetti][olivetti]], [[https://github.com/zk-phi/sublimity][sublimity]], and [[https://github.com/IdoMagal/Tabula-Rasa][tabula-rasa]] (Emacs -plugins) -- will feel right at home. - -These modes are: - -+ ~mixed-pitch-mode~ :: Which renders (most) text in a variable pitch font (see - ~doom-variable-pitch-font~). Unlike ~variable-pitch-mode~, this will not - affect segments of text that are intended to remain in a fixed pitch font, - such as code blocks or ASCII tables. -+ ~writeroom-mode~ :: Our all-in-one "zen" mode that will: - 1. Center the current buffer. - 2. Remove superfluous UI elements (like the modeline). - 3. Activate ~mixed-pitch-mode~. - 4. Scale up the buffer's text slightly (see ~+zen-text-scale~). - 5. And make the window's borders slightly thicker (see - ~+zen-window-divider-size~). - -** Usage -This module provides two entry points: - -+ ~M-x +zen/toggle~ :: toggles ~writeroom-mode~ (restricted to the current - buffer). -+ ~M-x +zen/toggle-fullscreen~ :: toggles zen mode in full-screen mode (deletes - other windows and full screens the Emacs frame). - -Invoke either command again to undo the change. - -** Module Flags -This module provides no flags. - -** Plugins -+ [[https://github.com/joostkremers/writeroom-mode][writeroom-mode]] -+ [[https://gitlab.com/jabranham/mixed-pitch][mixed-pitch]] - -** Hacks -+ Doom has disabled all of writeroom-mode's "global" effects - (~writeroom-global-effects~ and ~writeroom-maximize-window~ are set to ~nil~), - and encapsulated them into the ~+zen/toggle-fullscreen~ command, whereas - ~+zen/toggle~ will only operate on the current buffer. This way, the user may - choose how far-reaching they want its effect to be. -+ ~text-scale~ has been advised to adjust ~visual-fill-column~'s margins, so its - text won't "squeeze" as you scale it up (or "spill" when scaled down). - -* Prerequisites -This module has no prerequisites. - -* Features -** Distractions-free mode -This can be activated with =SPC t z= for evil users. -Non-evil users can use =C-c t z= or 'M-x writeroom-mode'. - -* Configuration -** Enable fullscreen on activation -#+BEGIN_SRC elisp -(setq writeroom-fullscreen-effect t) -#+END_SRC - -Or fullscreen manually with =SPC t F= (or =F11= for non-evil users). diff --git a/.config/emacs/modules/ui/zen/autoload.el b/.config/emacs/modules/ui/zen/autoload.el deleted file mode 100644 index 9e97d19..0000000 --- a/.config/emacs/modules/ui/zen/autoload.el +++ /dev/null @@ -1,29 +0,0 @@ -;;; ui/zen/autoload.el -*- lexical-binding: t; -*- - -;;;###autoload -(defalias '+zen/toggle #'writeroom-mode) - -(defvar +zen--last-wconf nil) -;;;###autoload -(defun +zen/toggle-fullscreen () - "Toggle `writeroom-mode' fullscreen and delete all other windows. -Invoke again to revert to the window configuration before it was activated." - (interactive) - (require 'writeroom-mode) - (let ((writeroom-global-effects +zen--old-writeroom-global-effects) - (writeroom-maximize-window t)) - (if writeroom-mode - (progn - (set-frame-parameter - nil 'fullscreen - (let ((fullscreen-restore (frame-parameter nil 'fullscreen-restore))) - (if (memq fullscreen-restore '(maximized fullheight fullwidth)) - fullscreen-restore - nil))) - (set-window-configuration +zen--last-wconf)) - (setq +zen--last-wconf (current-window-configuration)) - (modify-frame-parameters - nil `((fullscreen . fullboth) - (fullscreen-restore . ,(frame-parameter nil 'fullscreen))))) - (let ((writeroom-global-effects (remq 'writeroom-set-fullscreen writeroom-global-effects))) - (call-interactively #'+zen/toggle)))) diff --git a/.config/emacs/modules/ui/zen/config.el b/.config/emacs/modules/ui/zen/config.el deleted file mode 100644 index d3a68d5..0000000 --- a/.config/emacs/modules/ui/zen/config.el +++ /dev/null @@ -1,75 +0,0 @@ -;;; ui/zen/config.el -*- lexical-binding: t; -*- - -(defvar +zen-mixed-pitch-modes '(adoc-mode rst-mode markdown-mode org-mode) - "What major-modes to enable `mixed-pitch-mode' in with `writeroom-mode'.") - -(defvar +zen-text-scale 2 - "The text-scaling level for `writeroom-mode'.") - -(defvar +zen-window-divider-size 4 - "Pixel size of window dividers when `writeroom-mode' is active.") - -(defvar +zen--old-window-divider-size nil) - - -;; -;;; Packages - -(after! writeroom-mode - ;; Users should be able to activate writeroom-mode in one buffer (e.g. an org - ;; buffer) and code in another. No global behavior should be applied. - ;; Fullscreening/maximizing will be opt-in. - (defvar +zen--old-writeroom-global-effects writeroom-global-effects) - (setq writeroom-global-effects nil) - (setq writeroom-maximize-window nil) - - (add-hook! 'writeroom-mode-hook :append - (defun +zen-enable-text-scaling-mode-h () - "Enable `mixed-pitch-mode' when in `+zen-mixed-pitch-modes'." - (when (/= +zen-text-scale 0) - (text-scale-set (if writeroom-mode +zen-text-scale 0)) - (visual-fill-column-adjust)))) - - (add-hook! 'global-writeroom-mode-hook - (defun +zen-toggle-large-window-dividers-h () - "Make window dividers larger and easier to see." - (when (bound-and-true-p window-divider-mode) - (if writeroom-mode - (setq +zen--old-window-divider-size - (cons window-divider-default-bottom-width - window-divider-default-right-width) - window-divider-default-bottom-width +zen-window-divider-size - window-divider-default-right-width +zen-window-divider-size) - (when +zen--old-window-divider-size - (setq window-divider-default-bottom-width (car +zen--old-window-divider-size) - window-divider-default-right-width (cdr +zen--old-window-divider-size)))) - (window-divider-mode +1)))) - - ;; Adjust margins when text size is changed - (advice-add #'text-scale-adjust :after #'visual-fill-column-adjust)) - - -(use-package! mixed-pitch - :hook (writeroom-mode . +zen-enable-mixed-pitch-mode-h) - :config - (defun +zen-enable-mixed-pitch-mode-h () - "Enable `mixed-pitch-mode' when in `+zen-mixed-pitch-modes'." - (when (apply #'derived-mode-p +zen-mixed-pitch-modes) - (mixed-pitch-mode (if writeroom-mode +1 -1)))) - - (pushnew! mixed-pitch-fixed-pitch-faces - 'org-date - 'org-footnote - 'org-special-keyword - 'org-property-value - 'org-ref-cite-face - 'org-tag - 'org-todo-keyword-todo - 'org-todo-keyword-habt - 'org-todo-keyword-done - 'org-todo-keyword-wait - 'org-todo-keyword-kill - 'org-todo-keyword-outd - 'org-todo - 'org-done - 'font-lock-comment-face)) diff --git a/.config/emacs/modules/ui/zen/packages.el b/.config/emacs/modules/ui/zen/packages.el deleted file mode 100644 index db113ac..0000000 --- a/.config/emacs/modules/ui/zen/packages.el +++ /dev/null @@ -1,5 +0,0 @@ -;; -*- no-byte-compile: t; -*- -;;; ui/zen/packages.el - -(package! writeroom-mode :pin "eac1da790f316f357ed76ed67fbb790d6a4d126a") -(package! mixed-pitch :pin "519e05f74825abf04b7d2e0e38ec040d013a125a") diff --git a/.config/emacs/test/shell.nix b/.config/emacs/test/shell.nix deleted file mode 100644 index 110606e..0000000 --- a/.config/emacs/test/shell.nix +++ /dev/null @@ -1,93 +0,0 @@ -# Builds a sandbox for Emacs (and optionally, Doom) with a particular version of -# Emacs. Use this as a basis for module shell.nix's. -# -# Usage examples: -# -# To create a doom environment with the test config: -# -# nix-shell -# -# With your own DOOMDIR: -# -# nix-shell --argstr doomdir ~/.config/doom -# -# With a specific version of Emacs -# -# nix-shell --argstr emacs 26 # 26.3 -# nix-shell --argstr emacs 26.3 # 26.3 -# nix-shell --argstr emacs 27 # 27.1 -# nix-shell --argstr emacs 27.1 # 27.1 -# nix-shell --argstr emacs 27.2 # 27.2 -# nix-shell --argstr emacs 28 # 28.0.50 -# nix-shell --argstr emacs gcc # 28.0.50 + native-comp -# nix-shell --argstr emacs pgtk+gcc # 28.0.50 + pgtk + native-comp -# nix-shell --argstr emacs ci-26.3 # 26.3 (barebones; no GUI) -# nix-shell --argstr emacs ci-27.1 # 27.1 (barebones; no GUI) -# nix-shell --argstr emacs ci-27.2 # 27.2 (barebones; no GUI) -# nix-shell --argstr emacs ci-HEAD # 28.0.50 (barebones; no GUI) - -# nixpkgs: provides Emacs 26.3 and 27.1 -{ pkgs ? import (fetchTarball "https://github.com/NixOS/nixpkgs/archive/20.09.tar.gz") - { - overlays = [ - # emacs-overlay: provides Emacs 28, native-comp, and pgtk - (import (fetchTarball "https://github.com/nix-community/emacs-overlay/archive/85cc3a1fd067440181a4902455912e7c08ec26c8.tar.gz")) - # nix-emacs-ci: provides CI versions of Emacs 26.3, 27.1, 27.2, and 28.0.50 - (_: _: (import (fetchTarball "https://github.com/purcell/nix-emacs-ci/archive/master.tar.gz"))) - # Pull Emacs 27.2 from later version of nixpkgs - (_: _: { emacs27-2 = (import (fetchTarball "https://github.com/NixOS/nixpkgs/archive/4c87cb87a2db6b9eb43541c1cf83f2a2f725fa25.tar.gz") {}).emacs; }) - ]; - } -, emacs ? "27" -, emacsdir ? "$(pwd)/.." -, doomdir ? "$(pwd)" -, doomlocaldir ? "$(pwd)/.local" }: - -let emacsPkg = (if emacs == "26" then pkgs.emacs26 - else if emacs == "26.3" then pkgs.emacs26 - else if emacs == "27" then pkgs.emacs27-2 - else if emacs == "27.1" then pkgs.emacs27 - else if emacs == "27.2" then pkgs.emacs27-2 - else if emacs == "28" then pkgs.emacsGit - else if emacs == "gcc" then pkgs.emacsGcc - else if emacs == "pgtk+gcc" then pkgs.emacsPgtkGcc - else if emacs == "ci-26.3" then pkgs.emacs-26-3 - else if emacs == "ci-27.1" then pkgs.emacs-27-1 - else if emacs == "ci-27.2" then pkgs.emacs-27-2 - else if emacs == "ci-28" then pkgs.emacs-snapshot - else pkgs.emacs); -in pkgs.stdenv.mkDerivation { - name = "doom-emacs"; - - buildInputs = [ - emacsPkg - pkgs.git - (pkgs.ripgrep.override {withPCRE2 = true;}) - ]; - - shellHook = '' - export EMACS="${emacsPkg}/bin/emacs" - export EMACSVERSION="$($EMACS --no-site-file --batch --eval '(princ emacs-version)')" - export EMACSDIR="$(readlink -f "${emacsdir}")/" - export DOOMDIR="$(readlink -f "${doomdir}")/" - export DOOMLOCALDIR="$(readlink -f "${doomlocaldir}").$EMACSVERSION/" - export DOOMNOCOMPILE=1 - export PATH="$EMACSDIR/bin:$PATH" - - echo "Running Emacs $EMACSVERSION (emacs=${emacs})" - echo "EMACSDIR=$EMACSDIR" - echo "DOOMDIR=$DOOMDIR" - echo "DOOMLOCALDIR=$DOOMLOCALDIR" - - # Copy your existing repos over to optimize on install times (but not the - # builds, because that may contain stale bytecode). - mkdir -p "$DOOMLOCALDIR/straight" - pushd "$DOOMLOCALDIR/straight" >/dev/null - if [[ -d "$EMACSDIR/.local/straight/repos" && ! -d ./repos ]]; then - echo "Copying '$EMACSDIR/.local/straight/repos' to './$(basename $DOOMLOCALDIR)straight/repos' to save time" - cp -r "$EMACSDIR/.local/straight/repos" ./repos - fi - popd >/dev/null - echo "Ready!" - ''; -} diff --git a/.config/gtk-4.0/settings.ini b/.config/gtk-4.0/settings.ini deleted file mode 100644 index 7c6461a..0000000 --- a/.config/gtk-4.0/settings.ini +++ /dev/null @@ -1,2 +0,0 @@ -[Settings] -gtk-application-prefer-dark-theme=0 diff --git a/.config/oh-my-zsh b/.config/oh-my-zsh deleted file mode 160000 index 67cc59b..0000000 --- a/.config/oh-my-zsh +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 67cc59b4258a13232cddfddd75f44d8ca2b80172 diff --git a/.config/pavucontrol.ini b/.config/pavucontrol.ini deleted file mode 100644 index 1b56620..0000000 --- a/.config/pavucontrol.ini +++ /dev/null @@ -1,8 +0,0 @@ -[window] -width=1255 -height=1365 -sinkInputType=1 -sourceOutputType=1 -sinkType=0 -sourceType=1 -showVolumeMeters=1 diff --git a/.config/pulse/cookie b/.config/pulse/cookie deleted file mode 100644 index 63850e08adb649ecd2f0f06182bf73d3566c8f2e..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 256 zcmV+b0ssCgL*0kP^RdihDSw64$u}H-l~KAyWJ>t9c_O7GmQo8);`PnMFddTY~WsGEw^GlZj>F+L5cD&Q-$lLTn6 z;EteaP_sj*cYjPYLTp|hO>-#t)=q=b^e&Sg<)r4UEHUgsp_cDDduc(mEQI6V/dev/null && \ - dbus-update-activation-environment --systemd DISPLAY WAYLAND_DISPLAY SWAYSOCK - # Monitors # You can get the names of your outputs by running: swaymsg -t get_outputs # output eDP-1 pos 0 0 res 1920x1200 @@ -98,8 +103,8 @@ output eDP-1 pos 0 0 res 1920x1200 output HDMI-A-1 pos 1920 0 res 3440x1440 # Wallpaper -output HDMI-A-1 bg /home/opal/dotfiles/.config/wallpapers/2.jpg fill #050402 -output eDP-1 bg /home/opal/dotfiles/.config/wallpapers/2.jpg fill #050402 +output HDMI-A-1 bg /home/opal/dotfiles/.config/wallpapers/3.jpg fill #050402 +output eDP-1 bg /home/opal/dotfiles/.config/wallpapers/3.jpg fill #050402 # Start a terminal bindsym $mod+Return exec $term diff --git a/.config/user-dirs.dirs b/.config/user-dirs.dirs index 39d3d7e..1e763ac 100644 --- a/.config/user-dirs.dirs +++ b/.config/user-dirs.dirs @@ -4,12 +4,12 @@ # Format is XDG_xxx_DIR="$HOME/yyy", where yyy is a shell-escaped # homedir-relative path, or XDG_xxx_DIR="/yyy", where /yyy is an # absolute path. No other format is supported. -# -XDG_DESKTOP_DIR="$HOME/" +# +XDG_DESKTOP_DIR="$HOME" XDG_DOWNLOAD_DIR="$HOME/downloads" -XDG_TEMPLATES_DIR="$HOME/" -XDG_PUBLICSHARE_DIR="$HOME/" +XDG_TEMPLATES_DIR="$HOME" +XDG_PUBLICSHARE_DIR="$HOME" XDG_DOCUMENTS_DIR="$HOME/documents" XDG_MUSIC_DIR="$HOME/music" XDG_PICTURES_DIR="$HOME/pictures" -XDG_VIDEOS_DIR="$HOME/" +XDG_VIDEOS_DIR="$HOME/videos" diff --git a/.config/zsh/.zshrc b/.config/zsh/.zshrc index 77c80d0..8cb7771 100644 --- a/.config/zsh/.zshrc +++ b/.config/zsh/.zshrc @@ -11,18 +11,15 @@ ENABLE_CORRECTION="true" plugins=(git) source $ZSH/oh-my-zsh.sh # This has to stay below plugins. -#### ~~~~ Autostart ~~~~ ##### -pfetch - #### ~~~~ Path Additions ~~~~ ##### export PATH=/home/opal/scripts:$PATH # Scripts +export PATH=/home/opal/go/bin:$PATH # Golang Path #### ~~~~ Locale ~~~~ ##### export LANG=en_US.UTF-8 - # #### ~~~~ Import ~~~~ ##### -# ALIAS_LOCATION="$XDG_CONFIG_HOME/zsh/zsh_aliases" -# FUNCTION_LOCATION="$XDG_CONFIG_HOME/zsh/zsh_functions" -# . $ALIAS_LOCATION -# . $FUNCTION_LOCATION +ALIAS_LOCATION="$XDG_CONFIG_HOME/zsh/zsh_aliases" +FUNCTION_LOCATION="$XDG_CONFIG_HOME/zsh/zsh_functions" +source $ALIAS_LOCATION +source $FUNCTION_LOCATION diff --git a/.stow-local-ignore b/.stow-local-ignore index bb20453..e0b882d 100644 --- a/.stow-local-ignore +++ b/.stow-local-ignore @@ -4,4 +4,5 @@ LICENSE README: .gitignore .gitmodules -archive/ +./archive/ +./screenshot.png diff --git a/desktop.org b/desktop.org index e799ce2..1d1662a 100644 --- a/desktop.org +++ b/desktop.org @@ -6,19 +6,18 @@ I prefer to use programs that I can extend the functionality of via configuratio * Sway -** General -*** Mod Key +** Mod Key #+begin_src shell :tangle ~/dotfiles/.config/sway/config :mkdirp yes set $mod Mod4 #+end_src -*** Directional Keys +** Directional Keys #+begin_src shell :tangle ~/dotfiles/.config/sway/config :mkdirp yes set $left h set $down j set $up k set $right l #+end_src -*** Applications +** Applications #+begin_src shell :tangle ~/dotfiles/.config/sway/config :mkdirp yes # Terminal set $term alacritty @@ -40,13 +39,13 @@ bindsym $mod+Shift+g exec grimshot save area bindsym $mod+Mod1+g exec grimshot save output bindsym $mod+Ctrl+g exec grimshot save window #+end_src -*** Opacity +** Opacity #+begin_src shell :tangle ~/dotfiles/.config/sway/config :mkdirp yes -set $opacity 0.90 +set $opacity 0.98 for_window [class=".*"] opacity $opacity for_window [app_id=".*"] opacity $opacity #+end_src -*** Borders and Gaps +** Borders and Gaps #+begin_src shell :tangle ~/dotfiles/.config/sway/config :mkdirp yes # Window Borders default_border none @@ -56,25 +55,35 @@ smart_gaps on gaps inner 10 gaps outer 10 #+end_src -*** Notifications +** Notifications #+begin_src shell :tangle ~/dotfiles/.config/sway/config :mkdirp yes # Dismiss notifications bindsym --locked $mod+d exec sh -c "notify-send 'Do Not Disturb' 'Turning on Do Not Disturb Mode'; sleep 2; makoctl set-mode do-not-disturb" #+end_src -*** Mouse Behavior +** Mouse Behavior #+begin_src shell :tangle ~/dotfiles/.config/sway/config :mkdirp yes # Hide mouse cursor after inactivity seat * hide_cursor 4000 #+end_src -*** Autostart +** Autostart #+begin_src shell :tangle ~/dotfiles/.config/sway/config :mkdirp yes # Notifications exec_always --no-startup-id dunst +# flash focus +exec --no-startup-id flashfocus + +# polkit +exec /usr/lib/polkit-gnome/polkit-gnome-authentication-agent-1 + +# gnome-keyring-daemon +exec eval $(gnome-keyring-daemon --start) +exec export SSH_AUTH_SOCK + # Wlsunset (Night Light) exec_always wlsunset -lsd 47.6, -122.3 -t 3200 -T 6500 #+end_src -*** Idle/Exit Behavior +** Idle/Exit Behavior #+begin_src shell :tangle ~/dotfiles/.config/sway/config :mkdirp yes ### Idle configuration # This will lock your screen after 300 seconds of inactivity, then turn off @@ -91,7 +100,7 @@ bindsym $mod+Shift+e exec swaynag -t custom -m 'Do you wish to fully reload your bindsym $mod+Shift+p exec swaynag -t custom -m 'What action would you like to perform?' -b 'Shutdown' 'poweroff' -b 'Restart' 'poweroff --reboot' #+end_src -*** Input +** Input #+begin_src shell :tangle ~/dotfiles/.config/sway/config :mkdirp yes ### Input configuration # @@ -115,11 +124,6 @@ input type:keyboard { repeat_rate 45 } #+end_src -*** Gnome Keyring -#+begin_src shell -exec eval $(gnome-keyring-daemon --start) -exec export SSH_AUTH_SOCK -#+end_src ** Wallpaper & Monitor(s) #+begin_src shell :tangle ~/dotfiles/.config/sway/config :mkdirp yes # Monitors @@ -130,8 +134,8 @@ output eDP-1 pos 0 0 res 1920x1200 output HDMI-A-1 pos 1920 0 res 3440x1440 # Wallpaper -output HDMI-A-1 bg /home/opal/dotfiles/.config/wallpapers/redfog.jpg fill #050402 -output eDP-1 bg /home/opal/dotfiles/.config/wallpapers/redfog.jpg fill #050402 +output HDMI-A-1 bg /home/opal/dotfiles/.config/wallpapers/3.jpg fill #050402 +output eDP-1 bg /home/opal/dotfiles/.config/wallpapers/3.jpg fill #050402 #+end_src ** Keybindings *** General @@ -634,22 +638,20 @@ ENABLE_CORRECTION="true" plugins=(git) source $ZSH/oh-my-zsh.sh # This has to stay below plugins. -#### ~~~~ Autostart ~~~~ ##### -pfetch - #### ~~~~ Path Additions ~~~~ ##### export PATH=/home/opal/scripts:$PATH # Scripts +export PATH=/home/opal/go/bin:$PATH # Golang Path #### ~~~~ Locale ~~~~ ##### export LANG=en_US.UTF-8 - # #### ~~~~ Import ~~~~ ##### -# ALIAS_LOCATION="$XDG_CONFIG_HOME/zsh/zsh_aliases" -# FUNCTION_LOCATION="$XDG_CONFIG_HOME/zsh/zsh_functions" -# . $ALIAS_LOCATION -# . $FUNCTION_LOCATION +ALIAS_LOCATION="$XDG_CONFIG_HOME/zsh/zsh_aliases" +FUNCTION_LOCATION="$XDG_CONFIG_HOME/zsh/zsh_functions" +source $ALIAS_LOCATION +source $FUNCTION_LOCATION #+end_src + ** zsh_aliases #+begin_src shell :tangle ~/dotfiles/.config/zsh/zsh_aliases # ~ Guix #