Update dot_bashrc
Update dot_config/bspwm/executable_bspwmrc Update dot_config/doom/config.el Update dot_config/doom/custom.el Update dot_config/doom/packages.el Update dot_config/emacs/README.md Update dot_config/emacs/bin/executable_doom Update dot_config/emacs/bin/executable_org-capture Update dot_config/emacs/bin/executable_org-tangle Update dot_config/emacs/core/autoload/buffers.el Update dot_config/emacs/core/autoload/config.el Update dot_config/emacs/core/autoload/debug.el Update dot_config/emacs/core/autoload/files.el Update dot_config/emacs/core/autoload/fonts.el Update dot_config/emacs/core/autoload/help.el Update dot_config/emacs/core/autoload/output.el Update dot_config/emacs/core/autoload/packages.el Update dot_config/emacs/core/autoload/plist.el Update dot_config/emacs/core/autoload/process.el Update dot_config/emacs/core/autoload/projects.el Update dot_config/emacs/core/autoload/store.el Update dot_config/emacs/core/autoload/text.el Update dot_config/emacs/core/autoload/themes.el Update dot_config/emacs/core/autoload/ui.el Update dot_config/emacs/core/cli/autoloads.el Update dot_config/emacs/core/cli/byte-compile.el Update dot_config/emacs/core/cli/doctor.el Update dot_config/emacs/core/cli/env.el Update dot_config/emacs/core/cli/install.el Update dot_config/emacs/core/cli/packages.el Update dot_config/emacs/core/cli/sync.el Update dot_config/emacs/core/cli/upgrade.el Update dot_config/emacs/core/core-cli.el Update dot_config/emacs/core/core-editor.el Update dot_config/emacs/core/core-keybinds.el Update dot_config/emacs/core/core-lib.el Update dot_config/emacs/core/core-modules.el Update dot_config/emacs/core/core-packages.el Update dot_config/emacs/core/core-projects.el Update dot_config/emacs/core/core-ui.el Update dot_config/emacs/core/core.el Update dot_config/emacs/core/packages.el Update dot_config/emacs/docs/faq.org Update dot_config/emacs/docs/getting_started.org Update dot_config/emacs/docs/modules.org Update dot_config/emacs/early-init.el Update dot_config/emacs/init.el Update dot_config/emacs/init.example.el Update dot_config/emacs/modules/app/calendar/autoload.el Update dot_config/emacs/modules/app/calendar/config.el Update dot_config/emacs/modules/app/calendar/packages.el Update dot_config/emacs/modules/app/irc/autoload/irc.el Update dot_config/emacs/modules/app/irc/config.el Update dot_config/emacs/modules/app/irc/packages.el Update dot_config/emacs/modules/app/rss/README.org Update dot_config/emacs/modules/app/rss/autoload.el Update dot_config/emacs/modules/app/rss/config.el Update dot_config/emacs/modules/app/rss/packages.el Update dot_config/emacs/modules/app/twitter/autoload.el Update dot_config/emacs/modules/app/twitter/config.el Update dot_config/emacs/modules/app/twitter/packages.el Update dot_config/emacs/modules/checkers/spell/config.el Update dot_config/emacs/modules/checkers/spell/packages.el Update dot_config/emacs/modules/checkers/syntax/packages.el Update dot_config/emacs/modules/completion/company/autoload.el Update dot_config/emacs/modules/completion/company/config.el Update dot_config/emacs/modules/completion/company/packages.el Update dot_config/emacs/modules/completion/helm/autoload/posframe.el Update dot_config/emacs/modules/completion/helm/config.el Update dot_config/emacs/modules/completion/helm/packages.el Update dot_config/emacs/modules/completion/ido/packages.el Update dot_config/emacs/modules/completion/ivy/README.org Update dot_config/emacs/modules/completion/ivy/autoload/ivy.el Update dot_config/emacs/modules/completion/ivy/config.el Update dot_config/emacs/modules/completion/ivy/packages.el Update dot_config/emacs/modules/config/default/+emacs-bindings.el Update dot_config/emacs/modules/config/default/+evil-bindings.el Update dot_config/emacs/modules/config/default/autoload/files.el Update dot_config/emacs/modules/config/default/autoload/text.el Update dot_config/emacs/modules/config/default/config.el Update dot_config/emacs/modules/config/default/packages.el Update dot_config/emacs/modules/config/literate/README.org Update dot_config/emacs/modules/config/literate/autoload.el Update dot_config/emacs/modules/editor/evil/README.org Update dot_config/emacs/modules/editor/evil/autoload/advice.el Update dot_config/emacs/modules/editor/evil/autoload/evil.el Update dot_config/emacs/modules/editor/evil/autoload/textobjects.el Update dot_config/emacs/modules/editor/evil/config.el Update dot_config/emacs/modules/editor/evil/init.el Update dot_config/emacs/modules/editor/evil/packages.el Update dot_config/emacs/modules/editor/file-templates/templates/c++-mode/__hpp Update dot_config/emacs/modules/editor/file-templates/templates/c-mode/__h Update dot_config/emacs/modules/editor/file-templates/templates/emacs-lisp-mode/__package Update dot_config/emacs/modules/editor/file-templates/templates/text-mode/__license-gpl3 Update dot_config/emacs/modules/editor/fold/config.el Update dot_config/emacs/modules/editor/format/config.el Update dot_config/emacs/modules/editor/god/packages.el Update dot_config/emacs/modules/editor/lispy/README.org Update dot_config/emacs/modules/editor/lispy/config.el Update dot_config/emacs/modules/editor/lispy/packages.el Update dot_config/emacs/modules/editor/multiple-cursors/config.el Update dot_config/emacs/modules/editor/multiple-cursors/packages.el Update dot_config/emacs/modules/editor/parinfer/README.org Update dot_config/emacs/modules/editor/parinfer/config.el Update dot_config/emacs/modules/editor/parinfer/packages.el Update dot_config/emacs/modules/editor/rotate-text/packages.el Update dot_config/emacs/modules/editor/snippets/autoload/snippets.el Update dot_config/emacs/modules/editor/snippets/packages.el Update dot_config/emacs/modules/editor/word-wrap/packages.el Update dot_config/emacs/modules/emacs/dired/README.org Update dot_config/emacs/modules/emacs/dired/config.el Update dot_config/emacs/modules/emacs/dired/packages.el Update dot_config/emacs/modules/emacs/ibuffer/README.org Update dot_config/emacs/modules/emacs/undo/README.org Update dot_config/emacs/modules/emacs/undo/config.el Update dot_config/emacs/modules/emacs/undo/packages.el Update dot_config/emacs/modules/emacs/vc/autoload/vc.el Update dot_config/emacs/modules/emacs/vc/config.el Update dot_config/emacs/modules/emacs/vc/packages.el Update dot_config/emacs/modules/email/mu4e/packages.el Update dot_config/emacs/modules/email/notmuch/README.org Update dot_config/emacs/modules/email/notmuch/autoload.el Update dot_config/emacs/modules/email/notmuch/config.el Update dot_config/emacs/modules/email/notmuch/packages.el Update dot_config/emacs/modules/email/wanderlust/packages.el Update dot_config/emacs/modules/input/chinese/README.org Update dot_config/emacs/modules/input/chinese/packages.el Update dot_config/emacs/modules/input/japanese/packages.el Update dot_config/emacs/modules/input/layout/+bepo.el Update dot_config/emacs/modules/input/layout/README.org Update dot_config/emacs/modules/input/layout/autoload/bepo.el Update dot_config/emacs/modules/input/layout/config.el Update dot_config/emacs/modules/lang/agda/packages.el Update dot_config/emacs/modules/lang/cc/README.org Update dot_config/emacs/modules/lang/cc/config.el Update dot_config/emacs/modules/lang/cc/packages.el Update dot_config/emacs/modules/lang/clojure/README.org Update dot_config/emacs/modules/lang/clojure/config.el Update dot_config/emacs/modules/lang/clojure/packages.el Update dot_config/emacs/modules/lang/common-lisp/doctor.el Update dot_config/emacs/modules/lang/common-lisp/packages.el Update dot_config/emacs/modules/lang/coq/packages.el Update dot_config/emacs/modules/lang/crystal/packages.el Update dot_config/emacs/modules/lang/csharp/README.org Update dot_config/emacs/modules/lang/csharp/config.el Update dot_config/emacs/modules/lang/csharp/packages.el Update dot_config/emacs/modules/lang/dart/config.el Update dot_config/emacs/modules/lang/dart/packages.el Update dot_config/emacs/modules/lang/data/packages.el Update dot_config/emacs/modules/lang/elixir/README.org Update dot_config/emacs/modules/lang/elixir/config.el Update dot_config/emacs/modules/lang/elixir/packages.el Update dot_config/emacs/modules/lang/elm/packages.el Update dot_config/emacs/modules/lang/emacs-lisp/autoload.el Update dot_config/emacs/modules/lang/emacs-lisp/config.el Update dot_config/emacs/modules/lang/emacs-lisp/demos.org Update dot_config/emacs/modules/lang/emacs-lisp/packages.el Update dot_config/emacs/modules/lang/erlang/packages.el Update dot_config/emacs/modules/lang/ess/packages.el Update dot_config/emacs/modules/lang/factor/config.el Update dot_config/emacs/modules/lang/factor/packages.el Update dot_config/emacs/modules/lang/fsharp/README.org Update dot_config/emacs/modules/lang/fsharp/packages.el Update dot_config/emacs/modules/lang/gdscript/config.el Update dot_config/emacs/modules/lang/gdscript/packages.el Update dot_config/emacs/modules/lang/go/README.org Update dot_config/emacs/modules/lang/go/packages.el Update dot_config/emacs/modules/lang/haskell/packages.el Update dot_config/emacs/modules/lang/idris/packages.el Update dot_config/emacs/modules/lang/java/+meghanada.el Update dot_config/emacs/modules/lang/java/autoload/java.el Update dot_config/emacs/modules/lang/java/config.el Update dot_config/emacs/modules/lang/java/packages.el Update dot_config/emacs/modules/lang/javascript/config.el Update dot_config/emacs/modules/lang/javascript/packages.el Update dot_config/emacs/modules/lang/json/README.org Update dot_config/emacs/modules/lang/json/packages.el Update dot_config/emacs/modules/lang/julia/README.org Update dot_config/emacs/modules/lang/julia/config.el Update dot_config/emacs/modules/lang/julia/packages.el Update dot_config/emacs/modules/lang/latex/+viewers.el Update dot_config/emacs/modules/lang/latex/README.org Update dot_config/emacs/modules/lang/latex/autoload.el Update dot_config/emacs/modules/lang/latex/config.el Update dot_config/emacs/modules/lang/latex/packages.el Update dot_config/emacs/modules/lang/lean/config.el Update dot_config/emacs/modules/lang/lean/packages.el Update dot_config/emacs/modules/lang/ledger/config.el Update dot_config/emacs/modules/lang/ledger/packages.el Update dot_config/emacs/modules/lang/lua/packages.el Update dot_config/emacs/modules/lang/markdown/config.el Update dot_config/emacs/modules/lang/markdown/packages.el Update dot_config/emacs/modules/lang/nix/autoload.el Update dot_config/emacs/modules/lang/nix/config.el Update dot_config/emacs/modules/lang/nix/packages.el Update dot_config/emacs/modules/lang/ocaml/README.org Update dot_config/emacs/modules/lang/ocaml/config.el Update dot_config/emacs/modules/lang/ocaml/packages.el Update dot_config/emacs/modules/lang/org/README.org Update dot_config/emacs/modules/lang/org/autoload/contrib-present.el Update dot_config/emacs/modules/lang/org/autoload/org-export.el Update dot_config/emacs/modules/lang/org/autoload/org-refile.el Update dot_config/emacs/modules/lang/org/autoload/org.el Update dot_config/emacs/modules/lang/org/config.el Update dot_config/emacs/modules/lang/org/contrib/brain.el Update dot_config/emacs/modules/lang/org/contrib/present.el Update dot_config/emacs/modules/lang/org/contrib/pretty.el Update dot_config/emacs/modules/lang/org/contrib/roam.el Update dot_config/emacs/modules/lang/org/packages.el Update dot_config/emacs/modules/lang/php/README.org Update dot_config/emacs/modules/lang/php/packages.el Update dot_config/emacs/modules/lang/purescript/config.el Update dot_config/emacs/modules/lang/purescript/packages.el Update dot_config/emacs/modules/lang/python/config.el Update dot_config/emacs/modules/lang/python/packages.el Update dot_config/emacs/modules/lang/racket/README.org Update dot_config/emacs/modules/lang/racket/packages.el Update dot_config/emacs/modules/lang/raku/packages.el Update dot_config/emacs/modules/lang/rest/README.org Update dot_config/emacs/modules/lang/ruby/README.org Update dot_config/emacs/modules/lang/ruby/config.el Update dot_config/emacs/modules/lang/ruby/packages.el Update dot_config/emacs/modules/lang/rust/README.org Update dot_config/emacs/modules/lang/rust/autoload.el Update dot_config/emacs/modules/lang/rust/config.el Update dot_config/emacs/modules/lang/rust/packages.el Update dot_config/emacs/modules/lang/scala/autoload.el Update dot_config/emacs/modules/lang/scala/packages.el Update dot_config/emacs/modules/lang/scheme/README.org Update dot_config/emacs/modules/lang/scheme/autoload.el Update dot_config/emacs/modules/lang/scheme/config.el Update dot_config/emacs/modules/lang/scheme/packages.el Update dot_config/emacs/modules/lang/sh/autoload.el Update dot_config/emacs/modules/lang/sh/executable_config.el Update dot_config/emacs/modules/lang/sh/packages.el Update dot_config/emacs/modules/lang/sml/packages.el Update dot_config/emacs/modules/lang/solidity/packages.el Update dot_config/emacs/modules/lang/swift/config.el Update dot_config/emacs/modules/lang/swift/packages.el Update dot_config/emacs/modules/lang/web/doctor.el Update dot_config/emacs/modules/lang/web/packages.el Update dot_config/emacs/modules/lang/yaml/README.org Update dot_config/emacs/modules/lang/yaml/packages.el Update dot_config/emacs/modules/os/macos/config.el Update dot_config/emacs/modules/os/tty/README.org Update dot_config/emacs/modules/os/tty/config.el Update dot_config/emacs/modules/os/tty/packages.el Update dot_config/emacs/modules/term/eshell/README.org Update dot_config/emacs/modules/term/eshell/config.el Update dot_config/emacs/modules/term/eshell/packages.el Update dot_config/emacs/modules/term/vterm/README.org Update dot_config/emacs/modules/term/vterm/autoload.el Update dot_config/emacs/modules/term/vterm/config.el Update dot_config/emacs/modules/term/vterm/packages.el Update dot_config/emacs/modules/tools/ansible/packages.el Update dot_config/emacs/modules/tools/biblio/packages.el Update dot_config/emacs/modules/tools/debugger/autoload/debugger.el Update dot_config/emacs/modules/tools/debugger/config.el Update dot_config/emacs/modules/tools/debugger/packages.el Update dot_config/emacs/modules/tools/direnv/config.el Update dot_config/emacs/modules/tools/direnv/packages.el Update dot_config/emacs/modules/tools/docker/config.el Update dot_config/emacs/modules/tools/docker/packages.el Update dot_config/emacs/modules/tools/editorconfig/README.org Update dot_config/emacs/modules/tools/editorconfig/config.el Update dot_config/emacs/modules/tools/editorconfig/packages.el Update dot_config/emacs/modules/tools/ein/README.org Update dot_config/emacs/modules/tools/ein/packages.el Update dot_config/emacs/modules/tools/eval/autoload/eval.el Update dot_config/emacs/modules/tools/eval/autoload/repl.el Update dot_config/emacs/modules/tools/eval/packages.el Update dot_config/emacs/modules/tools/gist/config.el Update dot_config/emacs/modules/tools/lookup/README.org Update dot_config/emacs/modules/tools/lookup/autoload/docsets.el Update dot_config/emacs/modules/tools/lookup/autoload/lookup.el Update dot_config/emacs/modules/tools/lookup/config.el Update dot_config/emacs/modules/tools/lookup/packages.el Update dot_config/emacs/modules/tools/lsp/+eglot.el Update dot_config/emacs/modules/tools/lsp/+lsp.el Update dot_config/emacs/modules/tools/lsp/README.org Update dot_config/emacs/modules/tools/lsp/autoload/flycheck-eglot.el Update dot_config/emacs/modules/tools/lsp/autoload/lsp-mode.el Update dot_config/emacs/modules/tools/lsp/packages.el Update dot_config/emacs/modules/tools/magit/autoload.el Update dot_config/emacs/modules/tools/magit/config.el Update dot_config/emacs/modules/tools/magit/packages.el Update dot_config/emacs/modules/tools/pass/packages.el Update dot_config/emacs/modules/tools/pdf/config.el Update dot_config/emacs/modules/tools/pdf/packages.el Update dot_config/emacs/modules/tools/prodigy/config.el Update dot_config/emacs/modules/tools/prodigy/packages.el Update dot_config/emacs/modules/tools/taskrunner/README.org Update dot_config/emacs/modules/tools/terraform/config.el Update dot_config/emacs/modules/tools/upload/README.org Update dot_config/emacs/modules/tools/upload/config.el Update dot_config/emacs/modules/tools/upload/packages.el Update dot_config/emacs/modules/ui/doom-dashboard/config.el Update dot_config/emacs/modules/ui/doom/README.org Update dot_config/emacs/modules/ui/doom/config.el Update dot_config/emacs/modules/ui/doom/packages.el Update dot_config/emacs/modules/ui/emoji/README.org Update dot_config/emacs/modules/ui/emoji/packages.el Update dot_config/emacs/modules/ui/hl-todo/config.el Update dot_config/emacs/modules/ui/hl-todo/packages.el Update dot_config/emacs/modules/ui/indent-guides/config.el Update dot_config/emacs/modules/ui/ligatures/config.el Update dot_config/emacs/modules/ui/modeline/+light.el Update dot_config/emacs/modules/ui/modeline/README.org Update dot_config/emacs/modules/ui/modeline/config.el Update dot_config/emacs/modules/ui/modeline/packages.el Update dot_config/emacs/modules/ui/nav-flash/autoload.el Update dot_config/emacs/modules/ui/nav-flash/config.el Update dot_config/emacs/modules/ui/nav-flash/packages.el Update dot_config/emacs/modules/ui/ophints/config.el Update dot_config/emacs/modules/ui/popup/autoload/popup.el Update dot_config/emacs/modules/ui/popup/config.el Update dot_config/emacs/modules/ui/tabs/packages.el Update dot_config/emacs/modules/ui/treemacs/config.el Update dot_config/emacs/modules/ui/treemacs/packages.el Update dot_config/emacs/modules/ui/unicode/README.org Update dot_config/emacs/modules/ui/vc-gutter/config.el Update dot_config/emacs/modules/ui/window-select/packages.el Update dot_config/emacs/modules/ui/workspaces/autoload/workspaces.el Update dot_config/emacs/modules/ui/workspaces/config.el Update dot_config/emacs/modules/ui/zen/README.org Update dot_config/emacs/modules/ui/zen/config.el Update dot_config/emacs/modules/ui/zen/packages.el Update dot_config/emacs/test/shell.nix Update dot_config/mimeapps.list Update dot_config/mpv/mpv.conf Update dot_config/polybar/config Update dot_config/sxhkd/sxhkdrc Update dot_local/spells/executable_linkhandler
This commit is contained in:
parent
69a350e1cb
commit
e4607593db
|
@ -57,3 +57,5 @@ alias \
|
|||
|
||||
# Play a random video file from the cd
|
||||
alias rnmv="mpv $(ls -p | grep -v / | shuf | head -1)"
|
||||
# Download the video link in the clipboard
|
||||
alias dlclp='youtube-dl --config-location .config/youtube-dl/altconfig "$(xsel -b)"'
|
||||
|
|
|
@ -2,7 +2,8 @@
|
|||
|
||||
pgrep -x sxhkd > /dev/null || sxhkd &
|
||||
|
||||
bspc monitor -d I II III IV V VI VII VIII IX X
|
||||
bspc monitor LVDS1 -d I II III IV V VI VII VIII IX
|
||||
bspc monitor VGA1 -d X
|
||||
|
||||
bspc config normal_border_color #42395D
|
||||
bspc config focused_border_color #C2FFDF
|
||||
|
@ -19,7 +20,17 @@ bspc rule -a Chromium desktop='^2'
|
|||
bspc rule -a mplayer2 state=floating
|
||||
bspc rule -a Kupfer.py focus=on
|
||||
bspc rule -a Screenkey manage=off
|
||||
bspc rule -a Emacs follow=on state=tiled
|
||||
bspc rule -a Emacs follow=on state=tiled desktop='^1'
|
||||
bspc rule -a Firefox desktop='^3'
|
||||
|
||||
launchpolybar
|
||||
picom
|
||||
pgrep -x picom > /dev/null || picom
|
||||
# Run picom in greyscale mode
|
||||
# picom -b --backend glx --glx-fshader-win "uniform sampler2D tex; uniform float opacity; void main() { vec4 c = texture2D(tex, gl_TexCoord[0].xy); float y = dot(c.rgb, vec3(0.2126, 0.7152, 0.0722)); gl_FragColor = opacity*vec4(y, y, y, c.a); }"
|
||||
|
||||
# unclutter hides the cursor after a period of inactivity
|
||||
pgrep -x unclutter > /dev/null || unclutter --timeout 10 -b
|
||||
|
||||
# Startup Apps I want
|
||||
pgrep -x emacs > /dev/null || emacs
|
||||
pgrep -x firefox > /dev/null || firefox
|
||||
|
|
|
@ -2,8 +2,6 @@
|
|||
|
||||
;; Place your private configuration here! Remember, you do not need to run 'doom
|
||||
;; sync' after modifying this file!
|
||||
(setq doom-font (font-spec :family "Iosevka Term" :size 12 :weight 'semi-light)
|
||||
doom-variable-pitch-font (font-spec :family "Iosevka Term"))
|
||||
|
||||
;; Some functionality uses this to identify you, e.g. GPG configuration, email
|
||||
;; clients, file templates and snippets.
|
||||
|
@ -22,6 +20,11 @@
|
|||
;; 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))
|
||||
(setq doom-font (font-spec :family "Iosevka Term" :size 20 :weight 'semi-light)
|
||||
doom-variable-pitch-font (font-spec :family "Iosevka Term"))
|
||||
;; This does some other things with fonts that I like, mainly unsets the dark
|
||||
;; background and changes the font size properly
|
||||
;; (custom-set-faces '(default ((t (:height 120)))))
|
||||
|
||||
;; 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
|
||||
|
@ -37,7 +40,10 @@
|
|||
;; numbers are disabled. For relative line numbers, set this to `relative'.
|
||||
(setq display-line-numbers-type t)
|
||||
|
||||
|
||||
;; Setting transparency
|
||||
;;(set-frame-parameter (selected-frame) 'alpha '(<active> [<inactive>]))
|
||||
(set-frame-parameter (selected-frame) 'alpha '(100 50))
|
||||
(add-to-list 'default-frame-alist '(alpha 100 50))
|
||||
;; Here are some additional functions/macros that could help you configure Doom:
|
||||
;;
|
||||
;; - `load!' for loading external *.el files relative to this one
|
||||
|
@ -55,11 +61,11 @@
|
|||
;; You can also try 'gd' (or 'C-c c d') to jump to their definition and see how
|
||||
;; they are implemented.
|
||||
;; Set the default browser to emacs-w3m
|
||||
;;(setq browse-url-browser-function `w3m-browse-url)
|
||||
(setq browse-url-browser-function `browse-url-firefox)
|
||||
(setq browse-url-browser-function `w3m-browse-url)
|
||||
;; (setq browse-url-browser-function `browse-url-xdg-open)
|
||||
(autoload `w3m-browse-url "w3m" "Ask a WWW browser to show a URL." t)
|
||||
;; Turn off line highlighting.
|
||||
(global-hl-line-mode -1)
|
||||
;; (global-hl-line-mode -1)
|
||||
|
||||
(defun copy-all ()
|
||||
"Copy entire buffer to clipboard"
|
||||
|
@ -74,20 +80,51 @@
|
|||
|
||||
(defun time ()
|
||||
(interactive)
|
||||
(insert (format-time-string "%H:%M:%S")))
|
||||
(insert (concat "Entry Time: " (format-time-string "%H:%M:%S"))))
|
||||
|
||||
(defun open-diary ()
|
||||
(interactive)
|
||||
(find-file(concat "~/wrt/diary/" (format-time-string "%Y-%m-%d") ".md")))
|
||||
|
||||
;; Initialize elfeed-org
|
||||
;; This hooks up elfeed-org to read the configuration when elfeed
|
||||
;; is started with =M-x elfeed=
|
||||
(elfeed-org)
|
||||
;; Set up leader keys for use with elfeed
|
||||
(setq elfeed-db-directory "~/.config/doom/elfeed/data")
|
||||
(setq rmh-elfeed-org-files '("~/.config/doom/elfeed/elfeed.org"))
|
||||
;;functions to support syncing .elfeed between machines
|
||||
;;makes sure elfeed reads index from disk before launching
|
||||
(defun bjm/elfeed-load-db-and-open ()
|
||||
"Wrapper to load the elfeed db from disk before opening"
|
||||
(interactive)
|
||||
(elfeed-db-load)
|
||||
(elfeed)
|
||||
(elfeed-search-update--force))
|
||||
|
||||
;;write to disk when quiting
|
||||
(defun bjm/elfeed-save-db-and-bury ()
|
||||
"Wrapper to save the elfeed db to disk before burying buffer"
|
||||
(interactive)
|
||||
(elfeed-db-save)
|
||||
(quit-window))
|
||||
(map! :leader
|
||||
;; Set up leader keys for use with elfeed
|
||||
(:prefix-map ("e" . "elfeed")
|
||||
:desc "Switch to Elfeed buffer" "f" #'elfeed
|
||||
:desc "Update Feeds" "u" #'elfeed-update
|
||||
:desc "Save db" "q" #'bjm/elfeed-save-db-and-bury
|
||||
:desc "Next Item" "n" #'elfeed-show-next)
|
||||
;; Set a toggle for disabling evil mode. It sometimes interferes with stuff
|
||||
(:prefix-map ("t" . "toggle")
|
||||
:desc "Turn off Evil-Mode" "e" #'turn-off-evil-mode))
|
||||
:desc "Turn off Evil-Mode" "e" #'turn-off-evil-mode)
|
||||
;; Some personal journaling functions
|
||||
(:prefix-map ("d" . "diary")
|
||||
:desc "Open Today's diary" "o" #'open-diary
|
||||
:desc "Entry Time line" "t" #'time
|
||||
:desc "Date" "d" #'date))
|
||||
|
||||
;; Apparently pdf-tools needs to be compiled every time we start emacs
|
||||
(pdf-tools-install)
|
||||
|
||||
;; Set up SLIME for fscking around with LISP
|
||||
(load (expand-file-name "~/.quicklisp/slime-helper.el"))
|
||||
|
|
|
@ -10,7 +10,6 @@
|
|||
'(cua-read-only-cursor-color "#8ac6f2")
|
||||
'(custom-safe-themes
|
||||
'("2809bcb77ad21312897b541134981282dc455ccd7c14d74cc333b6e549b824f3" default))
|
||||
'(elfeed-db-directory "~/.config/emacs/elfeed")
|
||||
'(highlight-changes-colors '("#e5786d" "#834c98"))
|
||||
'(highlight-symbol-colors
|
||||
'("#55204c0039fc" "#3f0a4e4240dc" "#5a2849c746fd" "#3fd2334a42f4" "#426a4d5455d9" "#537247613a13" "#46c549b0535c"))
|
||||
|
@ -39,9 +38,10 @@
|
|||
'((sequence "TODO(t@/!)" "PROJ(p)" "STRT(s)" "WAIT(w@/!)" "HOLD(h@/!)" "|" "DONE(d@)" "KILL(k@)")
|
||||
(sequence "[ ](T@)" "[-](S@/!)" "[?](W/!)" "|" "[X](D@)")))
|
||||
'(package-selected-packages '(pomodoro))
|
||||
'(pomodoro-desktop-notification t)
|
||||
'(pomodoro-sound-player "mpv")
|
||||
'(pos-tip-background-color "#2f2f2e")
|
||||
'(pos-tip-foreground-color "#999891")
|
||||
'(rmh-elfeed-org-files '("~/.config/emacs/elfeed/elfeed.org"))
|
||||
'(smartrep-mode-line-active-bg (solarized-color-blend "#8ac6f2" "#2f2f2e" 0.2))
|
||||
'(term-default-bg-color "#2a2a29")
|
||||
'(term-default-fg-color "#8d8b86")
|
||||
|
@ -58,4 +58,4 @@
|
|||
;; If you edit it by hand, you could mess it up, so be careful.
|
||||
;; Your init file should contain only one such instance.
|
||||
;; If there is more than one, they won't work right.
|
||||
'(default ((t (:inherit nil :extend nil :stipple nil :background "#21242b" :foreground "#bbc2cf" :inverse-video nil :box nil :strike-through nil :overline nil :underline nil :slant normal :weight normal :height 145 :width normal :foundry "BE5N" :family "Iosevka Term")))))
|
||||
)
|
||||
|
|
|
@ -15,6 +15,9 @@
|
|||
;; Slime for lisp stuff
|
||||
(package! slime)
|
||||
(package! url)
|
||||
;; pdf-tools is a DocView replacement. It relies on a daemon to render the pdfs via poppler
|
||||
(package! pdf-tools)
|
||||
|
||||
;; To install SOME-PACKAGE from MELPA, ELPA or emacsmirror:
|
||||
;(package! some-package)
|
||||
|
||||
|
|
|
@ -5,10 +5,11 @@
|
|||
[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)
|
||||
![Supports Emacs 26-27](https://img.shields.io/badge/Supports-Emacs_26.1_--_27.x-blueviolet.svg?style=flat-square&logo=GNU%20Emacs&logoColor=white)
|
||||
![Minimum Emacs version supported: 26.3](https://img.shields.io/badge/Emacs-26.3+-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=blue&label=Discord%20Chat&logo=discord&logoColor=white&style=flat-square)][Discord]
|
||||
[![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)
|
||||
|
||||
|
@ -97,8 +98,8 @@ Check out [the FAQ][FAQ] for answers to common questions about the project.
|
|||
|
||||
|
||||
# Prerequisites
|
||||
+ Git 2.23+
|
||||
+ Emacs 26.1+ (*27 is recommended*) with GNUTLS support
|
||||
+ Git 2.28+
|
||||
+ Emacs 26.3+ (*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)
|
||||
|
@ -204,21 +205,13 @@ kind!
|
|||
[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.
|
||||
|
||||
[![](https://sourcerer.io/fame/hlissner/hlissner/doom-emacs/images/0)](https://sourcerer.io/fame/hlissner/hlissner/doom-emacs/links/0)
|
||||
[![](https://sourcerer.io/fame/hlissner/hlissner/doom-emacs/images/1)](https://sourcerer.io/fame/hlissner/hlissner/doom-emacs/links/1)
|
||||
[![](https://sourcerer.io/fame/hlissner/hlissner/doom-emacs/images/2)](https://sourcerer.io/fame/hlissner/hlissner/doom-emacs/links/2)
|
||||
[![](https://sourcerer.io/fame/hlissner/hlissner/doom-emacs/images/3)](https://sourcerer.io/fame/hlissner/hlissner/doom-emacs/links/3)
|
||||
[![](https://sourcerer.io/fame/hlissner/hlissner/doom-emacs/images/4)](https://sourcerer.io/fame/hlissner/hlissner/doom-emacs/links/4)
|
||||
[![](https://sourcerer.io/fame/hlissner/hlissner/doom-emacs/images/5)](https://sourcerer.io/fame/hlissner/hlissner/doom-emacs/links/5)
|
||||
[![](https://sourcerer.io/fame/hlissner/hlissner/doom-emacs/images/6)](https://sourcerer.io/fame/hlissner/hlissner/doom-emacs/links/6)
|
||||
[![](https://sourcerer.io/fame/hlissner/hlissner/doom-emacs/images/7)](https://sourcerer.io/fame/hlissner/hlissner/doom-emacs/links/7)
|
||||
|
||||
|
||||
[contribute]: docs/contributing.org
|
||||
[discord]: https://discord.gg/qvGgnVx
|
||||
[discourse]: https://discourse.doomemacs.org
|
||||
[documentation]: docs/index.org
|
||||
[faq]: docs/faq.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
|
||||
|
|
|
@ -7,12 +7,14 @@
|
|||
:; 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 spiralling memory
|
||||
;; usage in longer sessions.
|
||||
;; 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
|
||||
|
@ -21,114 +23,144 @@
|
|||
(expand-file-name
|
||||
"../" (file-name-directory (file-truename load-file-name)))))
|
||||
|
||||
;; Handle some potential issues early
|
||||
(when (version< emacs-version "26.1")
|
||||
(error (concat "Detected Emacs %s (at %s).\n\n"
|
||||
"Doom only supports Emacs 26.1 and newer. 27.1 is highly recommended. A guide\n"
|
||||
"to install a newer version of Emacs can be found at:\n\n "
|
||||
(cond ((eq system-type 'darwin)
|
||||
"https://github.com/hlissner/doom-emacs/blob/develop/docs/getting_started.org#on-macos")
|
||||
((memq system-type '(cygwin windows-nt ms-dos))
|
||||
"https://github.com/hlissner/doom-emacs/blob/develop/docs/getting_started.org#on-windows")
|
||||
("https://github.com/hlissner/doom-emacs/blob/develop/docs/getting_started.org#on-linux"))
|
||||
"Aborting...")
|
||||
emacs-version
|
||||
(car command-line-args)))
|
||||
|
||||
(unless (file-exists-p (expand-file-name "core/core.el" user-emacs-directory))
|
||||
(error (concat "Couldn't find Doom Emacs in %S.\n\n"
|
||||
"This is likely because this script (or its parent directory) is a symlink.\n"
|
||||
"If you must use a symlink, you'll need to specify an EMACSDIR so Doom knows\n"
|
||||
"where to find itself. e.g.\n\n "
|
||||
(if (string-match-p "/fish$" (getenv "SHELL"))
|
||||
"env EMACSDIR=~/.emacs.d doom"
|
||||
"EMACSDIR=~/.emacs.d doom sync")
|
||||
"\n\n"
|
||||
"Aborting...")
|
||||
(abbreviate-file-name user-emacs-directory)
|
||||
(abbreviate-file-name load-file-name)))
|
||||
;;
|
||||
;;; Sanity checks
|
||||
|
||||
(when (and (equal (user-real-uid) 0)
|
||||
(not (file-in-directory-p user-emacs-directory "/root")))
|
||||
(error (concat "This script is running as root. This likely wasn't intentional and\n"
|
||||
"will cause file permissions errors later if this Doom install is\n"
|
||||
"ever used on a non-root account.\n\n"
|
||||
"Aborting...")))
|
||||
(when (version< emacs-version "26.3")
|
||||
(error
|
||||
(concat "Detected Emacs " emacs-version " (at " (car command-line-args) ").\n\n"
|
||||
"Doom only supports Emacs 26.3 and newer. 27.1 is highly recommended. A guide\n"
|
||||
"to install a newer version of Emacs can be found at:\n\n "
|
||||
(format "https://doomemacs.org/docs/getting_started.org#%s"
|
||||
(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))
|
||||
(when (> emacs-major-version 26)
|
||||
(require 'cl))
|
||||
(require 'cl)
|
||||
(unless site-run-file
|
||||
(let ((tail load-path))
|
||||
(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
|
||||
(let ((default-directory (car tail)))
|
||||
(load (expand-file-name "subdirs.el") t t t)
|
||||
(setq tail (cdr tail)))))
|
||||
(load "site-start" t t)))
|
||||
(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)
|
||||
|
||||
;; I 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 nil)
|
||||
|
||||
(kill-emacs
|
||||
(pcase
|
||||
(catch 'exit
|
||||
;; Process the arguments passed to this script. `doom-cli-execute' should
|
||||
;; return a boolean, integer (error code) or throw an 'exit event, which
|
||||
;; we handle specially.
|
||||
(apply #'doom-cli-execute :doom (cdr (member "--" argv))))
|
||||
;; Any non-zero integer is treated as an explicit exit code.
|
||||
((and (pred integerp) code) code)
|
||||
;; If, instead, we were given a string or list of strings, copy these as
|
||||
;; shell script commands to a temporary script file which this script will
|
||||
;; execute after this session finishes. Also accepts special keywords, like
|
||||
;; `:restart', to rerun the current command.
|
||||
((and (or (pred consp)
|
||||
(pred stringp)
|
||||
(pred keywordp))
|
||||
command)
|
||||
(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)
|
||||
((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
|
||||
doom--initial-process-environment
|
||||
: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)
|
||||
;; Anything else (e.g. booleans) is treated as a successful run. Yes, a `nil'
|
||||
;; indicates a successful run too!
|
||||
(_ 0)))
|
||||
;; 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)t
|
||||
;; Error code 128 is special: it means run the post-script after this
|
||||
;; session ends.
|
||||
128))))))
|
||||
|
|
|
@ -28,10 +28,14 @@ while getopts "hk:" opt; do
|
|||
done
|
||||
shift $((OPTIND-1))
|
||||
|
||||
[ -t 0 ] && str="$*" || str=$(cat)
|
||||
# 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
|
||||
[ "$TERM" = "alacritty" ] && export TERM=xterm-256color
|
||||
|
||||
if [ $daemon ]; then
|
||||
emacsclient -a "" \
|
||||
|
|
|
@ -145,7 +145,7 @@ trees with the :notangle: tag."
|
|||
(let ((backup (make-temp-file (file-name-base file) nil ".backup.org")))
|
||||
(unwind-protect
|
||||
;; Prevent slow hooks from interfering
|
||||
(let (org-mode-hook)
|
||||
(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)
|
||||
|
|
|
@ -85,7 +85,8 @@ If no project is active, return all buffers."
|
|||
;;;###autoload
|
||||
(defun doom-dired-buffer-p (buf)
|
||||
"Returns non-nil if BUF is a dired buffer."
|
||||
(with-current-buffer buf (derived-mode-p 'dired-mode)))
|
||||
(provided-mode-derived-p (buffer-local-value 'major-mode buf)
|
||||
'dired-mode))
|
||||
|
||||
;;;###autoload
|
||||
(defun doom-special-buffer-p (buf)
|
||||
|
@ -162,8 +163,9 @@ 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)
|
||||
(with-current-buffer buf
|
||||
(apply #'derived-mode-p modes)))
|
||||
(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)))))
|
||||
|
|
|
@ -82,14 +82,14 @@ Runs `doom-after-reload-hook' afterwards."
|
|||
(mapc #'require (cdr doom-incremental-packages))
|
||||
(doom--if-compile (format "%S sync -e" doom-bin)
|
||||
(let ((doom-reloading-p t))
|
||||
(run-hook-wrapped 'doom-before-reload-hook #'doom-try-run-hook)
|
||||
(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)))
|
||||
(run-hook-wrapped 'doom-after-reload-hook #'doom-try-run-hook)
|
||||
(doom-run-hooks 'doom-after-reload-hook)
|
||||
(message "Config successfully reloaded!"))
|
||||
(user-error "Failed to reload your config")))
|
||||
|
||||
|
|
|
@ -5,7 +5,8 @@
|
|||
|
||||
;;;###autoload
|
||||
(defvar doom-debug-variables
|
||||
'(debug-on-error
|
||||
'(async-debug
|
||||
debug-on-error
|
||||
doom-debug-p
|
||||
garbage-collection-messages
|
||||
gcmh-verbose
|
||||
|
@ -19,7 +20,6 @@
|
|||
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-old-values nil)
|
||||
(defvar doom--debug-vars-undefined nil)
|
||||
|
||||
(defun doom--watch-debug-vars-h (&rest _)
|
||||
|
@ -39,14 +39,14 @@ symbol and CDR is the value to set it to when `doom-debug-mode' is activated.")
|
|||
(dolist (var doom-debug-variables)
|
||||
(cond ((listp var)
|
||||
(cl-destructuring-bind (var . val) var
|
||||
(if (not (boundp var))
|
||||
(add-to-list 'doom--debug-vars-undefined var)
|
||||
(set-default
|
||||
var (if (not enabled)
|
||||
(alist-get var doom--debug-vars-old-values)
|
||||
(setf (alist-get var doom--debug-vars-old-values)
|
||||
(symbol-value var))
|
||||
val)))))
|
||||
(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)))))
|
||||
|
@ -76,13 +76,11 @@ symbol and CDR is the value to set it to when `doom-debug-mode' is activated.")
|
|||
emacs -Q -l init.el -f doom-run-all-startup-hooks-h"
|
||||
(setq after-init-time (current-time))
|
||||
(let ((inhibit-startup-hooks nil))
|
||||
(mapc (lambda (hook)
|
||||
(run-hook-wrapped hook #'doom-try-run-hook))
|
||||
'(after-init-hook
|
||||
delayed-warnings-hook
|
||||
emacs-startup-hook
|
||||
tty-setup-hook
|
||||
window-setup-hook))))
|
||||
(doom-run-hooks 'after-init-hook
|
||||
'delayed-warnings-hook
|
||||
'emacs-startup-hook
|
||||
'tty-setup-hook
|
||||
'window-setup-hook)))
|
||||
|
||||
|
||||
;;
|
||||
|
@ -93,7 +91,7 @@ symbol and CDR is the value to set it to when `doom-debug-mode' is activated.")
|
|||
(let (forms)
|
||||
(with-temp-buffer
|
||||
(insert-file-contents file)
|
||||
(let (emacs-lisp-mode) (emacs-lisp-mode))
|
||||
(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)
|
||||
|
@ -111,98 +109,112 @@ ready to be pasted in a bug report on github."
|
|||
(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
|
||||
(concat "\\<" (regexp-quote (user-login-name)) "\\>") "$USER"
|
||||
(abbreviate-file-name path))))
|
||||
`((system
|
||||
(type . ,system-type)
|
||||
(config . ,system-configuration)
|
||||
(shell . ,(abbrev-path shell-file-name))
|
||||
(uname . ,(if IS-WINDOWS "n/a" (sh "uname" "-msrv")))
|
||||
(path . ,(mapcar #'abbrev-path exec-path)))
|
||||
(emacs
|
||||
(dir . ,(abbrev-path (file-truename doom-emacs-dir)))
|
||||
(version . ,emacs-version)
|
||||
(build . ,(format-time-string "%b %d, %Y" emacs-build-time))
|
||||
(buildopts . ,system-configuration-options)
|
||||
(features . ,system-configuration-features)
|
||||
(traits . ,(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)))))
|
||||
(doom
|
||||
(dir . ,(abbrev-path (file-truename doom-private-dir)))
|
||||
(version . ,doom-version)
|
||||
,@(when doom-interactive-p
|
||||
`((font . ,(bound-and-true-p doom-font))
|
||||
(theme . ,(bound-and-true-p doom-theme))))
|
||||
(build . ,(sh "git" "log" "-1" "--format=%D %h %ci"))
|
||||
(elc-files
|
||||
. ,(length (doom-files-in `(,@doom-modules-dirs
|
||||
,doom-core-dir
|
||||
,doom-private-dir)
|
||||
:type 'files :match "\\.elc$")))
|
||||
(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
|
||||
,@(or (condition-case e
|
||||
(mapcar
|
||||
#'cdr (doom--collect-forms-in
|
||||
(doom-path doom-private-dir "packages.el")
|
||||
"package!"))
|
||||
(error (format "<%S>" e)))
|
||||
'("n/a")))
|
||||
(unpin
|
||||
,@(or (condition-case e
|
||||
(mapcan #'identity
|
||||
(mapcar
|
||||
#'cdr (doom--collect-forms-in
|
||||
(doom-path doom-private-dir "packages.el")
|
||||
"unpin!")))
|
||||
(error (format "<%S>" e)))
|
||||
'("n/a")))
|
||||
(elpa
|
||||
,@(or (condition-case e
|
||||
(progn
|
||||
(package-initialize)
|
||||
(cl-loop for (name . _) in package-alist
|
||||
collect (format "%s" name)))
|
||||
(error (format "<%S>" e)))
|
||||
'("n/a"))))))))
|
||||
(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))))))))
|
||||
|
||||
|
||||
;;
|
||||
|
@ -240,21 +252,23 @@ copies it to your clipboard, ready to be pasted into bug reports!"
|
|||
(let ((sexp (prin1-to-string (sexp-at-point))))
|
||||
(delete-region beg end)
|
||||
(insert sexp))))))
|
||||
(insert "```\n")
|
||||
(dolist (group info)
|
||||
(insert! "%-8s%-10s %s\n"
|
||||
((upcase (symbol-name (car group)))
|
||||
(caadr group)
|
||||
(cdadr group)))
|
||||
(dolist (spec (cddr group))
|
||||
(insert! (indent 8 "%-10s %s\n")
|
||||
((car spec) (cdr spec)))))
|
||||
(insert "```\n"))
|
||||
(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))
|
||||
(pop-to-buffer buffer)
|
||||
(kill-new (buffer-string))
|
||||
(print! (green "Copied your doom info to clipboard"))))))
|
||||
(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 ()
|
||||
|
@ -311,161 +325,9 @@ Some items are not supported by the `nsm.el' module."
|
|||
t)))))
|
||||
|
||||
|
||||
;;
|
||||
;;; Vanilla sandbox
|
||||
|
||||
(defun doom--run-sandbox (&optional mode)
|
||||
(interactive)
|
||||
(let ((contents (buffer-string))
|
||||
(file (make-temp-file "doom-sandbox-")))
|
||||
(require 'package)
|
||||
(with-temp-file file
|
||||
(prin1 `(progn
|
||||
(setq before-init-time (current-time)
|
||||
after-init-time nil
|
||||
noninteractive nil
|
||||
user-init-file ,file
|
||||
process-environment ',doom--initial-process-environment
|
||||
exec-path ',doom--initial-exec-path
|
||||
doom-debug-p t
|
||||
init-file-debug t
|
||||
doom--initial-load-path load-path
|
||||
load-path ',load-path
|
||||
package--init-file-ensured t
|
||||
package-user-dir ,package-user-dir
|
||||
package-archives ',package-archives
|
||||
user-emacs-directory ,doom-emacs-dir
|
||||
comp-deferred-compilation nil
|
||||
comp-eln-load-path ',(bound-and-true-p comp-eln-load-path)
|
||||
comp-async-env-modifier-form ',(bound-and-true-p comp-async-env-modifier-form)
|
||||
comp-deferred-compilation-black-list ',(bound-and-true-p comp-deferred-compilation-black-list))
|
||||
(with-eval-after-load 'undo-tree
|
||||
;; HACK `undo-tree' throws errors because `buffer-undo-tree'
|
||||
;; isn't correctly initialized
|
||||
(setq-default buffer-undo-tree (make-undo-tree)))
|
||||
(ignore-errors
|
||||
(delete-directory ,(expand-file-name "auto-save-list" doom-emacs-dir) 'parents)))
|
||||
(current-buffer))
|
||||
(prin1 `(unwind-protect
|
||||
(defun --run-- () ,(read (concat "(progn\n" contents "\n)")))
|
||||
(delete-file ,file))
|
||||
(current-buffer))
|
||||
(prin1 (pcase mode
|
||||
(`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)
|
||||
(run-hook-wrapped 'doom-init-modules-hook #'doom-try-run-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
|
||||
(package-initialize)
|
||||
(--run--))))
|
||||
(current-buffer))
|
||||
;; Redo all startup initialization, like running startup hooks and loading
|
||||
;; init files.
|
||||
(prin1 `(progn
|
||||
(fset 'doom-try-run-hook #',(symbol-function #'doom-try-run-hook))
|
||||
(fset 'doom-run-all-startup-hooks-h #',(symbol-function #'doom-run-all-startup-hooks-h))
|
||||
(doom-run-all-startup-hooks-h))
|
||||
(current-buffer)))
|
||||
(let ((args (if (eq mode 'doom)
|
||||
(list "-l" file)
|
||||
(list "-Q" "-l" file))))
|
||||
(require 'restart-emacs)
|
||||
(condition-case 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-file file)
|
||||
(signal (car e) (cdr e)))))))
|
||||
|
||||
(fset 'doom--run-vanilla-emacs (cmd! (doom--run-sandbox 'vanilla)))
|
||||
(fset 'doom--run-vanilla-doom (cmd! (doom--run-sandbox 'vanilla-doom)))
|
||||
(fset 'doom--run-vanilla-doom+ (cmd! (doom--run-sandbox 'vanilla-doom+)))
|
||||
(fset 'doom--run-full-doom (cmd! (doom--run-sandbox '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)
|
||||
(let* ((buffer-name "*doom:sandbox*")
|
||||
(exists (get-buffer buffer-name))
|
||||
(buf (get-buffer-create buffer-name)))
|
||||
(with-current-buffer buf
|
||||
(doom-sandbox-emacs-lisp-mode)
|
||||
(setq-local default-directory doom-emacs-dir)
|
||||
(unless (buffer-live-p exists)
|
||||
(insert-file-contents (doom-glob doom-core-dir "templates/VANILLA_SANDBOX"))
|
||||
(let ((contents (substitute-command-keys (buffer-string))))
|
||||
(erase-buffer)
|
||||
(insert contents "\n")))
|
||||
(goto-char (point-max)))
|
||||
(pop-to-buffer buf)))
|
||||
|
||||
|
||||
;;
|
||||
;;; Reporting bugs
|
||||
|
||||
;;;###autoload
|
||||
(defun doom/report-bug ()
|
||||
"Open a markdown buffer destinated to populate the New Issue page on Doom
|
||||
Emacs' issue tracker.
|
||||
|
||||
If called when a backtrace buffer is present, it and the output of `doom-info'
|
||||
will be automatically appended to the result."
|
||||
(interactive)
|
||||
(browse-url "https://github.com/hlissner/doom-emacs/issues/new/choose"))
|
||||
|
||||
;;;###autoload
|
||||
(defun doom/copy-buffer-contents (buffer-name)
|
||||
"Copy the contents of BUFFER-NAME to your clipboard."
|
||||
|
|
|
@ -36,12 +36,20 @@ This is used by `file-exists-p!' and `project-file-exists-p!'."
|
|||
`(file-exists-p ,filevar))
|
||||
,filevar)))))
|
||||
|
||||
(defun doom--path (&rest segments)
|
||||
(let ((segments (delq nil segments))
|
||||
;;;###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 dir (expand-file-name (car segments) dir)
|
||||
segments (cdr segments)))
|
||||
(setq segment (pop segments)
|
||||
dir (expand-file-name
|
||||
(if (listp segment)
|
||||
(apply #'doom-path dir segment)
|
||||
segment)
|
||||
dir)))
|
||||
dir))
|
||||
|
||||
;;;###autoload
|
||||
|
@ -49,28 +57,16 @@ This is used by `file-exists-p!' and `project-file-exists-p!'."
|
|||
"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
|
||||
(dir (apply #'doom--path segments)))
|
||||
(if (string-match-p "[[*?]" dir)
|
||||
(file-expand-wildcards dir t)
|
||||
(if (file-exists-p dir)
|
||||
dir))))
|
||||
|
||||
;;;###autoload
|
||||
(defun doom-path (&rest segments)
|
||||
"Constructs a file path from SEGMENTS.
|
||||
Ignores `nil' elements in SEGMENTS."
|
||||
(if segments
|
||||
(apply #'doom--path segments)
|
||||
(file!)))
|
||||
(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 (apply #'doom-path segments))
|
||||
(directory-file-name (file-name-directory path))))
|
||||
(when-let (path (doom-path segments))
|
||||
(directory-file-name path)))
|
||||
|
||||
;;;###autoload
|
||||
(cl-defun doom-files-in
|
||||
|
|
|
@ -71,10 +71,7 @@ FRAME parameter defaults to current frame."
|
|||
"Reload your fonts, if they're set.
|
||||
See `doom-init-fonts-h'."
|
||||
(interactive)
|
||||
(when doom-font
|
||||
(set-frame-font doom-font t))
|
||||
(doom-init-fonts-h)
|
||||
(mapc #'doom-init-extra-fonts-h (frame-list)))
|
||||
(doom-init-fonts-h 'reload))
|
||||
|
||||
;;;###autoload
|
||||
(defun doom/increase-font-size (count)
|
||||
|
@ -116,7 +113,8 @@ This uses `doom/increase-font-size' under the hood, and enlargens the font by
|
|||
:lighter " BIG"
|
||||
:global t
|
||||
(unless doom-font
|
||||
(user-error "`doom-font' must be set to a valid font"))
|
||||
(or (setq doom-font (face-attribute 'default :font))
|
||||
(user-error "`doom-font' must be set to a valid font")))
|
||||
(if doom-big-font
|
||||
(let ((font (if doom-big-font-mode doom-big-font doom-font)))
|
||||
(set-frame-font font 'keep-size t)
|
||||
|
|
|
@ -173,6 +173,28 @@ selection of all minor-modes, active or not."
|
|||
(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."
|
||||
|
@ -404,33 +426,31 @@ variables, this only lists variables that exist to be customized (defined with
|
|||
;;
|
||||
;;; `doom/help-packages'
|
||||
|
||||
(defun doom--help-insert-button (label &optional path)
|
||||
(cl-destructuring-bind (uri . qs)
|
||||
(let ((parts (split-string label "::" t)))
|
||||
(cons (string-trim (car parts))
|
||||
(string-join (cdr parts) "::")))
|
||||
(let ((path (or path label)))
|
||||
(insert-text-button
|
||||
uri
|
||||
'face 'link
|
||||
'follow-link t
|
||||
'action
|
||||
(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))
|
||||
(pcase (cond ((string-match-p "^https?://" qs) 'url)
|
||||
('file))
|
||||
((or `file `nil)
|
||||
(unless (file-exists-p path)
|
||||
(user-error "Path does not exist: %S" path))
|
||||
(let ((buffer (or (get-file-buffer path)
|
||||
(find-file path))))
|
||||
(when qs
|
||||
(with-current-buffer buffer
|
||||
(goto-char (point-min))
|
||||
(re-search-forward qs)
|
||||
(recenter)))))
|
||||
(`url (browse-url uri))))))))
|
||||
(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))
|
||||
|
@ -463,44 +483,41 @@ If prefix arg is present, refresh the cache."
|
|||
(if (and doom--help-packages-list (null current-prefix-arg))
|
||||
doom--help-packages-list
|
||||
(message "Generating packages list for the first time...")
|
||||
(sit-for 0.1)
|
||||
(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 #'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 (if guess
|
||||
(format "Select Doom package to search for (default %s): "
|
||||
guess)
|
||||
(format "Describe Doom package (%d): " (length packages)))
|
||||
(completing-read (format "Describe Doom package (%s): "
|
||||
(concat (when guess
|
||||
(format "default '%s', " guess))
|
||||
(format "total %d" (length packages))))
|
||||
packages nil t nil nil
|
||||
(if guess (symbol-name guess))))))))
|
||||
(when guess (symbol-name guess))))))))
|
||||
;; TODO Refactor me.
|
||||
(require 'core-packages)
|
||||
(doom-initialize-packages)
|
||||
(if (or (package-desc-p package)
|
||||
(and (symbolp package)
|
||||
(or (assq package package-alist)
|
||||
(assq package package--builtins))))
|
||||
(describe-package package)
|
||||
(help-setup-xref (list #'doom/help-packages package)
|
||||
(called-interactively-p 'interactive))
|
||||
(with-help-window (help-buffer)))
|
||||
(save-excursion
|
||||
(with-current-buffer (help-buffer)
|
||||
(let ((inhibit-read-only t)
|
||||
(indent (make-string 13 ? )))
|
||||
(goto-char (point-max))
|
||||
(if (re-search-forward "^ *Status: " nil t)
|
||||
(progn
|
||||
(end-of-line)
|
||||
(insert "\n"))
|
||||
(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")
|
||||
|
@ -515,38 +532,51 @@ If prefix arg is present, refresh the cache."
|
|||
pin
|
||||
"unpinned")
|
||||
"\n")
|
||||
|
||||
(package--print-help-section "Build")
|
||||
(let ((default-directory (straight--repos-dir (symbol-name package))))
|
||||
(insert (cdr (doom-call-process "git" "log" "-1" "--format=%D %h %ci"))
|
||||
"\n" indent))
|
||||
(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 ((repo-dir (straight--repos-dir (symbol-name package))))
|
||||
(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 (format "%s\n" (string-trim (pp-to-string recipe))))
|
||||
(package--print-help-section "Homepage")
|
||||
(doom--help-insert-button (doom--package-url package))))
|
||||
(insert
|
||||
(replace-regexp-in-string "\n" (concat "\n" indent)
|
||||
(pp-to-string recipe))))
|
||||
|
||||
(package--print-help-section "Homepage")
|
||||
(doom--help-insert-button (doom--package-url package)))
|
||||
|
||||
(`elpa (insert "[M]ELPA ")
|
||||
(doom--help-insert-button (doom--package-url package))
|
||||
(package--print-help-section "Location")
|
||||
(doom--help-insert-button
|
||||
(abbreviate-file-name
|
||||
(file-name-directory (locate-library (symbol-name package))))))
|
||||
(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))))))
|
||||
(file-name-directory
|
||||
(locate-library (symbol-name package))))))
|
||||
(`other (doom--help-insert-button
|
||||
(abbreviate-file-name
|
||||
(or (symbol-file package)
|
||||
|
@ -566,7 +596,9 @@ If prefix arg is present, refresh the cache."
|
|||
(let* ((module-path (pcase (car m)
|
||||
(:core doom-core-dir)
|
||||
(:private doom-private-dir)
|
||||
(category (doom-module-path category (cdr m)))))
|
||||
(category
|
||||
(doom-module-locate-path category
|
||||
(cdr m)))))
|
||||
(readme-path (expand-file-name "README.org" module-path)))
|
||||
(insert indent)
|
||||
(doom--help-insert-button
|
||||
|
@ -574,32 +606,23 @@ If prefix arg is present, refresh the cache."
|
|||
module-path)
|
||||
(insert " (")
|
||||
(if (file-exists-p readme-path)
|
||||
(doom--help-insert-button
|
||||
"readme"
|
||||
(expand-file-name
|
||||
"README.org"
|
||||
readme-path))
|
||||
(doom--help-insert-button "readme" readme-path)
|
||||
(insert "no readme"))
|
||||
(insert ")\n"))))
|
||||
|
||||
(package--print-help-section "Configs")
|
||||
(insert "This package is configured in the following locations:")
|
||||
(dolist (location (doom--help-package-configs package))
|
||||
(insert "\n" indent)
|
||||
(insert-text-button
|
||||
location
|
||||
'face 'link
|
||||
'follow-link t
|
||||
'action
|
||||
`(lambda (_)
|
||||
(cl-destructuring-bind (file line _match)
|
||||
',(split-string location ":")
|
||||
(find-file (expand-file-name file doom-emacs-dir))
|
||||
(goto-char (point-min))
|
||||
(forward-line (1- (string-to-number line)))
|
||||
(recenter)))))
|
||||
|
||||
(insert "\n\n")))))
|
||||
(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)
|
||||
(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)
|
||||
|
|
|
@ -39,7 +39,6 @@ and `format!' into colored output, where COLOR is any car of this list.")
|
|||
(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)
|
||||
|
@ -106,9 +105,11 @@ Accepts 'ansi and 'text-properties. nil means don't render colors.")
|
|||
;;;###autoload
|
||||
(defun doom--print (output)
|
||||
(unless (string-empty-p output)
|
||||
(princ output)
|
||||
(if noninteractive
|
||||
(send-string-to-terminal output)
|
||||
(princ output))
|
||||
(terpri)
|
||||
t))
|
||||
output))
|
||||
|
||||
;;;###autoload
|
||||
(defun doom--output-indent (width text &optional prefix)
|
||||
|
@ -254,12 +255,12 @@ DEST can be one or more of `standard-output', a buffer, a file"
|
|||
(insert-char out))
|
||||
(send-string-to-terminal (char-to-string out)))))
|
||||
(letf! (defun message (msg &rest args)
|
||||
(with-current-buffer log-buffer
|
||||
(print-group!
|
||||
(insert (doom--format (apply #'format msg args)) "\n")))
|
||||
(if doom-debug-p
|
||||
(doom--print (doom--format (apply #'format msg args)))
|
||||
(apply message msg args)))
|
||||
(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
|
||||
|
|
|
@ -164,8 +164,8 @@ each package."
|
|||
(mapc (fn! ((cat . mod))
|
||||
(if-let (packages-file
|
||||
(pcase cat
|
||||
(:private (doom-glob doom-private-dir "packages.el"))
|
||||
(:core (doom-glob doom-core-dir "packages.el"))
|
||||
(: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)
|
||||
|
|
|
@ -73,3 +73,21 @@ list, the pair is destructured into (CAR . CDR)."
|
|||
(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))
|
||||
|
|
|
@ -31,7 +31,7 @@ Warning: freezes indefinitely on any stdin prompt."
|
|||
(set-process-filter
|
||||
process (lambda (_process output)
|
||||
(princ output (current-buffer))
|
||||
(princ output)))
|
||||
(princ (doom--format output))))
|
||||
(set-process-sentinel
|
||||
process (lambda (process _event)
|
||||
(when (memq (process-status process) '(exit stop))
|
||||
|
@ -40,31 +40,3 @@ Warning: freezes indefinitely on any stdin prompt."
|
|||
(sit-for 0.1))
|
||||
(process-exit-status process))
|
||||
(string-trim (buffer-string)))))
|
||||
|
||||
(defvar doom--num-cpus nil)
|
||||
;;;###autoload
|
||||
(defun doom-num-cpus ()
|
||||
"Return the max number of processing units on this system.
|
||||
Tries to be portable. Returns 1 if cannot be determined."
|
||||
(or doom--num-cpus
|
||||
(setq doom--num-cpus
|
||||
(let ((cpus
|
||||
(cond ((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
|
||||
(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))))))
|
||||
|
|
|
@ -1,10 +1,13 @@
|
|||
;;; core/autoload/projects.el -*- lexical-binding: t; -*-
|
||||
|
||||
(defvar projectile-project-root nil)
|
||||
(defvar projectile-enable-caching)
|
||||
(defvar projectile-require-project-root)
|
||||
|
||||
;;;###autoload (autoload 'projectile-relevant-known-projects "projectile")
|
||||
;; 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)
|
||||
|
@ -80,7 +83,8 @@ they are absolute."
|
|||
(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 projectile-project-root))
|
||||
(let ((projectile-project-root
|
||||
(unless dir (bound-and-true-p projectile-project-root)))
|
||||
projectile-require-project-root)
|
||||
(projectile-project-root dir)))
|
||||
|
||||
|
@ -142,3 +146,10 @@ If DIR is not a project, it will be indexed (but not cached)."
|
|||
((doom-module-p :completion 'helm)
|
||||
#'helm-find-files)
|
||||
(#'find-file)))))
|
||||
|
||||
;;;###autoload
|
||||
(defun doom-project-ignored-p (project-root)
|
||||
"Return non-nil if remote or temporary file, or a straight package."
|
||||
(and (not (file-remote-p project-root))
|
||||
(or (file-in-directory-p project-root temporary-file-directory)
|
||||
(file-in-directory-p project-root doom-local-dir))))
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
(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 '(t)
|
||||
(defvar doom-store-persist-alist ()
|
||||
"An alist of alists, containing lists of variables for the doom cache library
|
||||
to persist across Emacs sessions.")
|
||||
|
||||
|
@ -16,30 +16,36 @@ 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))
|
||||
(defvar doom--inhibit-flush nil)
|
||||
|
||||
(defun doom-save-persistent-store-h ()
|
||||
"Hook to run when an Emacs session is killed. Saves all persisted variables
|
||||
listed in `doom-store-persist-alist' to files."
|
||||
"Hook to persist `doom-store's storage when Emacs is killed."
|
||||
(let (locations)
|
||||
(let ((doom--inhibit-flush t))
|
||||
(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)
|
||||
and do (cl-pushnew location 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
|
||||
;;; 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))))
|
||||
|
@ -51,48 +57,45 @@ to file when Emacs quits. This cannot persist buffer-local 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 (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-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-get (key location &optional default-value)
|
||||
(let* ((location-data (doom--store-init location))
|
||||
(data (gethash key location-data default-value)))
|
||||
(if (and (not (eq data default-value))
|
||||
(or (null (car data))
|
||||
(not (time-less-p (car data) (current-time)))))
|
||||
(cdr data)
|
||||
default-value)))
|
||||
|
||||
(defun doom--store-put (key value location &optional ttl)
|
||||
(puthash key (cons (if ttl (time-add (current-time) ttl)) value)
|
||||
(doom--store-init location))
|
||||
(doom--store-flush location))
|
||||
(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)
|
||||
(unless doom--inhibit-flush
|
||||
(let ((file-name-handler-alist nil)
|
||||
(coding-system-for-write 'binary)
|
||||
(write-region-annotate-functions nil)
|
||||
(write-region-post-annotation-function nil)
|
||||
(data (doom--store-init 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)))
|
||||
|
@ -100,28 +103,37 @@ the actual variables themselves or their values."
|
|||
|
||||
|
||||
;;;###autoload
|
||||
(defun doom-store-get (key &optional location default-value)
|
||||
(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."
|
||||
(doom--store-get key (or location doom-store-location) default-value))
|
||||
(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)
|
||||
(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'."
|
||||
(doom--store-put key value (or location doom-store-location) ttl))
|
||||
(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)
|
||||
(defun doom-store-rem (key &optional location noflush)
|
||||
"Clear a cache LOCATION (defaults to `doom-store-location')."
|
||||
(let ((location (or location doom-store-location)))
|
||||
(remhash key (doom--store-init location))
|
||||
(let ((table (doom--store-init "default")))
|
||||
(remhash 'test table)
|
||||
table)
|
||||
(remhash key (doom--store-init location))
|
||||
(unless noflush
|
||||
(doom--store-flush location)))
|
||||
|
||||
;;;###autoload
|
||||
|
|
|
@ -1,11 +1,13 @@
|
|||
;;; 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.
|
||||
|
||||
|
@ -42,16 +44,18 @@ lines, above and below, with only whitespace in between."
|
|||
"Return non-nil if POS is in a comment.
|
||||
POS defaults to the current position."
|
||||
(let ((pos (or pos (point))))
|
||||
(or (run-hook-with-args-until-success 'doom-point-in-comment-functions pos)
|
||||
(sp-point-in-comment pos))))
|
||||
(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))))
|
||||
(or (run-hook-with-args-until-success 'doom-point-in-string-functions pos)
|
||||
(sp-point-in-string pos))))
|
||||
(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)
|
||||
|
@ -73,9 +77,10 @@ Detects evil visual mode as well."
|
|||
"Return beginning position of selection.
|
||||
Uses `evil-visual-beginning' if available."
|
||||
(declare (side-effect-free t))
|
||||
(if (bound-and-true-p evil-local-mode)
|
||||
evil-visual-beginning
|
||||
(region-beginning)))
|
||||
(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 ()
|
||||
|
@ -149,8 +154,10 @@ in some cases."
|
|||
(> (point) bol))
|
||||
(backward-char))
|
||||
(skip-chars-backward " " bol)
|
||||
(unless (or (eq (char-after) 32) (eolp))
|
||||
(forward-char))
|
||||
(or (eq (char-after) 32)
|
||||
(eolp)
|
||||
(bolp)
|
||||
(forward-char))
|
||||
(point)))
|
||||
eol)))
|
||||
(list bol bot eot eol))))
|
||||
|
@ -251,7 +258,7 @@ the value of `indent-tab-mode'.
|
|||
|
||||
If ARG (universal argument) is non-nil, retab the current buffer using the
|
||||
opposite indentation style."
|
||||
(interactive "Pr")
|
||||
(interactive "P\nr")
|
||||
(unless (and beg end)
|
||||
(setq beg (point-min)
|
||||
end (point-max)))
|
||||
|
|
|
@ -1,5 +1,13 @@
|
|||
;;; 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)
|
||||
|
@ -9,13 +17,6 @@
|
|||
`((,(car spec) ((t ,(cdr spec))))))
|
||||
(`((,(car spec) ,(cdr spec))))))
|
||||
|
||||
;;;###autoload
|
||||
(defconst doom-customize-theme-hook nil)
|
||||
|
||||
(add-hook! 'doom-load-theme-hook
|
||||
(defun doom-apply-customized-faces-h ()
|
||||
(run-hooks 'doom-customize-theme-hook)))
|
||||
|
||||
;;;###autoload
|
||||
(defmacro custom-theme-set-faces! (theme &rest specs)
|
||||
"Apply a list of face SPECS as user customizations for THEME.
|
||||
|
@ -33,8 +34,14 @@ all themes. It will apply to all themes once they are loaded."
|
|||
(apply #'custom-theme-set-faces theme
|
||||
(mapcan #'doom--custom-theme-set-face
|
||||
(list ,@specs)))))))
|
||||
(when (or doom-init-theme-p (null doom-theme))
|
||||
;; 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))
|
||||
;; TODO Append to `doom-load-theme-hook' with DEPTH instead when Emacs
|
||||
;; 26.x support is dropped.
|
||||
(add-hook 'doom-customize-theme-hook #',fn 'append))))
|
||||
|
||||
;;;###autoload
|
||||
|
@ -47,13 +54,13 @@ doom-themes' API without worry."
|
|||
(declare (indent defun))
|
||||
`(custom-theme-set-faces! 'user ,@specs))
|
||||
|
||||
(defvar doom--prefer-theme-elc)
|
||||
;;;###autoload
|
||||
(defun doom/reload-theme ()
|
||||
"Reload the current color theme."
|
||||
(interactive)
|
||||
(let ((theme (or (car-safe custom-enabled-themes) doom-theme)))
|
||||
(when theme
|
||||
(mapc #'disable-theme custom-enabled-themes))
|
||||
(load-theme doom-theme 'noconfirm)
|
||||
(doom/reload-font)))
|
||||
(let ((themes (copy-sequence custom-enabled-themes)))
|
||||
(load-theme doom-theme t)
|
||||
(doom/reload-font)
|
||||
(message "%s %s"
|
||||
(propertize "Reloaded themes:" 'face 'bold)
|
||||
(mapconcat #'prin1-to-string themes ", "))))
|
||||
|
|
|
@ -48,7 +48,7 @@ are open."
|
|||
In interactive Emacs, this just inhibits messages from appearing in the
|
||||
minibuffer. They are still logged to *Messages*.
|
||||
|
||||
In tty Emacs, messages suppressed completely."
|
||||
In tty Emacs, messages are suppressed completely."
|
||||
(quiet! (apply orig-fn args)))
|
||||
|
||||
|
||||
|
@ -122,70 +122,35 @@ See `display-line-numbers' for what these values mean."
|
|||
;;;###autoload
|
||||
(defun doom/window-maximize-buffer (&optional arg)
|
||||
"Close other windows to focus on this one.
|
||||
|
||||
Activate again to undo this. If prefix ARG is non-nil, don't restore the last
|
||||
window configuration and re-maximize the current window. Alternatively, use
|
||||
`doom/window-enlargen'."
|
||||
Use `winner-undo' to undo this. Alternatively, use `doom/window-enlargen'."
|
||||
(interactive "P")
|
||||
(let ((param 'doom--maximize-last-wconf))
|
||||
(cl-destructuring-bind (window . wconf)
|
||||
(or (frame-parameter nil param)
|
||||
(cons nil nil))
|
||||
(set-frame-parameter
|
||||
nil param
|
||||
(if (and (equal window (selected-window))
|
||||
(not arg)
|
||||
(null (cdr (cl-remove-if #'window-dedicated-p (window-list))))
|
||||
wconf)
|
||||
(ignore
|
||||
(let ((source-window (selected-window)))
|
||||
(set-window-configuration wconf)
|
||||
(when (window-live-p source-window)
|
||||
(select-window source-window))))
|
||||
(when (and (bound-and-true-p +popup-mode)
|
||||
(+popup-window-p))
|
||||
(user-error "Cannot maximize a popup, use `+popup/raise' first or use `doom/window-enlargen' instead"))
|
||||
(prog1 (cons (selected-window) (or wconf (current-window-configuration)))
|
||||
(delete-other-windows)
|
||||
(add-hook 'doom-switch-window-hook #'doom--enlargened-forget-last-wconf-h)))))))
|
||||
(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 to focus on this one. Does not close other
|
||||
windows (unlike `doom/window-maximize-buffer'). Activate again to undo."
|
||||
"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 ((param 'doom--enlargen-last-wconf))
|
||||
(cl-destructuring-bind (window . wconf)
|
||||
(or (frame-parameter nil param)
|
||||
(cons nil nil))
|
||||
(set-frame-parameter
|
||||
nil param
|
||||
(if (and (equal window (selected-window))
|
||||
(not arg)
|
||||
wconf)
|
||||
(ignore
|
||||
(let ((source-window (selected-window)))
|
||||
(set-window-configuration wconf)
|
||||
(when (window-live-p source-window)
|
||||
(select-window source-window))))
|
||||
(prog1 (cons (selected-window) (or wconf (current-window-configuration)))
|
||||
(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))
|
||||
(add-hook 'doom-switch-window-hook #'doom--enlargened-forget-last-wconf-h)))))))))
|
||||
(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 ()
|
||||
|
|
|
@ -7,10 +7,14 @@ 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
|
||||
comp-deferred-compilation-deny-list
|
||||
native-comp-deferred-compilation-deny-list
|
||||
load-path
|
||||
auto-mode-alist
|
||||
interpreter-mode-alist
|
||||
|
@ -47,13 +51,15 @@ one wants that.")
|
|||
in (append (list doom-core-dir)
|
||||
(cdr (doom-module-load-path 'all-p))
|
||||
(list doom-private-dir))
|
||||
if (doom-glob dir "autoload.el") collect it
|
||||
if (doom-glob dir "autoload.el") collect (car it)
|
||||
if (doom-glob dir "autoload/*.el") append it)
|
||||
(mapcan #'doom-glob doom-autoloads-files)))
|
||||
(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)
|
||||
|
@ -189,35 +195,39 @@ one wants that.")
|
|||
(doom-autoloads--scan-autodefs
|
||||
file target-buffer module module-enabled-p))))
|
||||
|
||||
(defun doom-autoloads--scan (files &optional literal)
|
||||
(defun doom-autoloads--scan (files &optional exclude literal)
|
||||
(require 'autoload)
|
||||
(let (autoloads)
|
||||
(dolist (file
|
||||
(seq-filter #'file-readable-p files)
|
||||
(nreverse (delq nil autoloads)))
|
||||
(with-temp-buffer
|
||||
(print! (debug "- Scanning %s") (relpath file doom-emacs-dir))
|
||||
(if literal
|
||||
(insert-file-contents file)
|
||||
(doom-autoloads--scan-file file))
|
||||
(save-excursion
|
||||
(let ((filestr (prin1-to-string file)))
|
||||
(while (re-search-forward "\\_<load-file-name\\_>" 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)))))))
|
||||
(let (case-fold-search ; case-sensitive regexp from here on
|
||||
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 "\\_<load-file-name\\_>" 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))))))))
|
||||
|
|
|
@ -16,16 +16,21 @@ 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 (when core-p
|
||||
(list (doom-glob doom-emacs-dir "init.el")
|
||||
doom-core-dir))
|
||||
(when private-p
|
||||
(list doom-private-dir)))
|
||||
(append (list (doom-glob doom-emacs-dir "init.el")
|
||||
doom-core-dir)
|
||||
(cl-remove-if-not
|
||||
(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
|
||||
(lambda (path) (file-in-directory-p path doom-emacs-dir))
|
||||
(doom-rpartial #'file-in-directory-p doom-emacs-dir)
|
||||
;; Omit `doom-private-dir', which is always first
|
||||
(cdr (doom-module-load-path)))))
|
||||
recompile-p
|
||||
|
@ -94,7 +99,8 @@ If RECOMPILE-P is non-nil, only recompile out-of-date files."
|
|||
(noninteractive t)
|
||||
doom-interactive-p)
|
||||
(doom-initialize 'force)
|
||||
(quiet! (doom-initialize-packages))))
|
||||
(quiet! (doom-initialize-packages))
|
||||
(quiet! (doom-initialize-modules))))
|
||||
|
||||
(if (null targets)
|
||||
(print! (info "No targets to %scompile" (if recompile-p "re" "")))
|
||||
|
|
|
@ -48,15 +48,36 @@ in."
|
|||
|
||||
;; REVIEW Refactor me
|
||||
(print! (start "Checking your Emacs version..."))
|
||||
(cond
|
||||
(EMACS28+
|
||||
(warn! (concat "Emacs %s detected. Doom should support this version, but be prepared for "
|
||||
"Emacs updates causing breakages.")
|
||||
emacs-version))
|
||||
((= emacs-major-version 26)
|
||||
(warn! (concat "Emacs %s detected. Doom is dropping Emacs 26.x support very soon. Consider "
|
||||
"upgrading to Emacs 27.x.")
|
||||
emacs-version)))
|
||||
(print-group!
|
||||
(cond
|
||||
(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 26)
|
||||
(warn! "Emacs %s detected" emacs-version)
|
||||
(explain! "Doom is dropping Emacs 26.x support in June 2021. Consider "
|
||||
"upgrading to Emacs 27.1 (or better: 27.2) soon!"
|
||||
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 "\\_<[0-9]+\\.[0-9]+\\(\\.[0-9]+\\)\\_>" version)
|
||||
(match-string 0 version))))
|
||||
(if version
|
||||
(when (version< version "2.28")
|
||||
(error! "Git %s detected! Doom requires git 2.28 or newer!"
|
||||
version))
|
||||
(warn! "Cannot determine Git version. Doom requires git 2.28 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")
|
||||
|
@ -67,8 +88,7 @@ in."
|
|||
|
||||
(when EMACS27+
|
||||
(print! (start "Checking for great Emacs features..."))
|
||||
(unless (and (functionp 'json-serialize)
|
||||
(string-match-p "\\_<JSON\\_>" system-configuration-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. "
|
||||
|
@ -92,6 +112,19 @@ in."
|
|||
(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!
|
||||
|
@ -118,17 +151,18 @@ in."
|
|||
file (/ size 1024 1024.0))
|
||||
(explain! "Consider deleting it from your system (manually)"))))
|
||||
|
||||
(unless (executable-find "rg")
|
||||
(error! "Couldn't find the `rg' binary; this a hard dependecy for Doom, file searches may not work at all"))
|
||||
|
||||
(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! "Doom will disable bottom-up root search, which may reduce the accuracy of project\n"
|
||||
"detection."))
|
||||
(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")
|
||||
|
|
|
@ -45,16 +45,12 @@ Why this over exec-path-from-shell?
|
|||
(if (null clear-p)
|
||||
(doom-cli-reload-env-file
|
||||
'force env-file
|
||||
(append (if reject-only (list "."))
|
||||
(delq nil (list allow allow-only)))
|
||||
(append (if allow-only (list "."))
|
||||
(delq nil (list reject reject-only))))
|
||||
(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)))
|
||||
(user-error! "%S does not exist to be cleared" (path env-file)))
|
||||
(delete-file env-file)
|
||||
(print! (success "Successfully deleted %S")
|
||||
(path env-file)))))
|
||||
(print! (success "Successfully deleted %S") (path env-file)))))
|
||||
|
||||
|
||||
;;
|
||||
|
@ -62,9 +58,10 @@ Why this over exec-path-from-shell?
|
|||
|
||||
(defvar doom-env-blacklist
|
||||
'(;; State that may be problematic if overwritten
|
||||
"^HOME$" "^\\(OLD\\)?PWD$" "^SHLVL$" "^PS1$" "^R?PROMPT$" "^TERM$" "^USER$"
|
||||
"^HOME$" "^\\(OLD\\)?PWD$" "^SHLVL$" "^PS1$" "^R?PROMPT$" "^TERM\\(CAP\\)?$"
|
||||
"^USER$"
|
||||
;; X server or services' variables
|
||||
"^DISPLAY$" "^DBUS_SESSION_BUS_ADDRESS$"
|
||||
"^DISPLAY$" "^DBUS_SESSION_BUS_ADDRESS$" "^XAUTHORITY$"
|
||||
;; ssh and gpg variables (likely to become stale)
|
||||
"^SSH_\\(AUTH_SOCK\\|AGENT_PID\\)$" "^\\(SSH\\|GPG\\)_TTY$"
|
||||
"^GPG_AGENT_INFO$"
|
||||
|
@ -88,8 +85,7 @@ 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 (if env-file (expand-file-name env-file) doom-env-file))
|
||||
(process-environment doom--initial-process-environment))
|
||||
(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)
|
||||
|
@ -104,34 +100,40 @@ default, on Linux, this is '$SHELL -ic /usr/bin/env'. Variables in
|
|||
(goto-char (point-min))
|
||||
(insert
|
||||
(concat
|
||||
"# -*- mode: sh; 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"
|
||||
";; -*- 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 remember to preserve the null bytes at\n"
|
||||
"# the end of each line! 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\0\n"))
|
||||
(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 we just dump
|
||||
;; user's interactive shell, therefore simply dump
|
||||
;; `process-environment' to a file.
|
||||
(dolist (env process-environment)
|
||||
(if (cl-find-if (doom-rpartial #'string-match-p (car (split-string env "=")))
|
||||
(remq nil (append blacklist doom-env-blacklist)))
|
||||
(if (not (cl-find-if (doom-rpartial #'string-match-p (car (split-string env "=")))
|
||||
(remq nil (append whitelist doom-env-whitelist))))
|
||||
(print! (debug "Ignoring %s") env)
|
||||
(print! (debug "Whitelisted %s") env)
|
||||
(insert env "\0\n"))
|
||||
(insert env "\0\n")))
|
||||
(print! (success "Successfully generated %S")
|
||||
(path env-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)))))
|
||||
|
|
|
@ -18,10 +18,9 @@ This command does the following:
|
|||
|
||||
This command is idempotent and safe to reuse.
|
||||
|
||||
The location of DOOMDIR can be changed with the -p option, or by setting the
|
||||
DOOMDIR environment variable. e.g.
|
||||
The location of DOOMDIR can be changed with the environment variable of the same
|
||||
name. e.g.
|
||||
|
||||
doom -p ~/.config/doom install
|
||||
DOOMDIR=~/.config/doom doom install"
|
||||
(print! (green "Installing Doom Emacs!\n"))
|
||||
(let ((default-directory (doom-path "~")))
|
||||
|
@ -96,5 +95,5 @@ DOOMDIR environment variable. e.g.
|
|||
|
||||
(print! (success "\nFinished! Doom is ready to go!\n"))
|
||||
(with-temp-buffer
|
||||
(insert-file-contents (doom-glob doom-core-dir "templates/QUICKSTART_INTRO"))
|
||||
(insert-file-contents (doom-path doom-core-dir "templates/QUICKSTART_INTRO"))
|
||||
(print! "%s" (buffer-string)))))
|
||||
|
|
|
@ -21,10 +21,11 @@ Emacs (as byte-code is generally not forward-compatible)."
|
|||
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")
|
||||
(regraft-p ["-g" "--regraft"] "Regraft git repos (ie. compact them)"))
|
||||
((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
|
||||
|
@ -39,7 +40,8 @@ list remains lean."
|
|||
(not noelpa-p)
|
||||
(not norepos-p)
|
||||
(not nobuilds-p)
|
||||
regraft-p)
|
||||
(not noregraft-p)
|
||||
(not noeln-p))
|
||||
(doom-autoloads-reload))
|
||||
t)
|
||||
|
||||
|
@ -61,15 +63,30 @@ list remains lean."
|
|||
(if full commit (substring commit 0 7)))
|
||||
|
||||
(defun doom--commit-log-between (start-ref end-ref)
|
||||
(when-let*
|
||||
((status (straight--call
|
||||
"git" "log" "--oneline" "--no-merges"
|
||||
"-n" "26" end-ref (concat "^" (regexp-quote start-ref))))
|
||||
(output (string-trim-right (straight--process-get-output)))
|
||||
(lines (split-string output "\n")))
|
||||
(if (> (length lines) 25)
|
||||
(concat (string-join (butlast lines 1) "\n") "\n[...]")
|
||||
output)))
|
||||
(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))
|
||||
|
@ -99,30 +116,31 @@ list remains lean."
|
|||
(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)
|
||||
(when (straight-vc-fetch-from-remote recipe)
|
||||
(setq output (straight--process-get-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)))))))))
|
||||
(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 comp-eln-load-path)))
|
||||
(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'."
|
||||
|
@ -139,12 +157,12 @@ list remains lean."
|
|||
(concat doom--eln-output-path eln-name ".error"))
|
||||
|
||||
(defun doom--find-eln-file (eln-name)
|
||||
"Find `eln-name' on the `comp-eln-load-path'."
|
||||
"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)))
|
||||
comp-eln-load-path))
|
||||
native-comp-eln-load-path))
|
||||
|
||||
(defun doom--elc-file-outdated-p (file)
|
||||
"Check whether the corresponding .elc for `file' is outdated."
|
||||
|
@ -198,7 +216,7 @@ list remains lean."
|
|||
with previous = 0
|
||||
while (not (zerop pending))
|
||||
if (/= previous pending) do
|
||||
(print! (info "\033[KWaiting for %d async jobs...\033[1A" pending))
|
||||
(print! (start "\033[KNatively compiling %d files...\033[1A" pending))
|
||||
(setq previous pending)
|
||||
else do
|
||||
(let ((inhibit-message t))
|
||||
|
@ -228,55 +246,20 @@ list remains lean."
|
|||
(not (doom--find-eln-file (doom--eln-file-name file)))
|
||||
(not (cl-some (lambda (re)
|
||||
(string-match-p re file))
|
||||
comp-deferred-compilation-deny-list))) do
|
||||
native-comp-deferred-compilation-deny-list))) do
|
||||
(doom-log "Compiling %s" file)
|
||||
(native-compile-async file))))
|
||||
|
||||
(defun doom--bootstrap-trampolines ()
|
||||
"Build the trampolines we need to prevent hanging."
|
||||
(when (featurep 'comp)
|
||||
;; HACK The following list was obtained by running 'doom build', waiting for
|
||||
;; it to hang, then checking the eln-cache for trampolines. We
|
||||
;; simulate running 'doom build' twice by compiling the trampolines
|
||||
;; then restarting.
|
||||
(let (restart)
|
||||
(dolist (f '(abort-recursive-edit
|
||||
describe-buffer-bindings
|
||||
execute-kbd-macro
|
||||
handle-switch-frame
|
||||
load
|
||||
make-indirect-buffer
|
||||
make-process
|
||||
message
|
||||
read-char
|
||||
read-key-sequence
|
||||
select-window
|
||||
set-window-buffer
|
||||
top-level
|
||||
use-global-map
|
||||
use-local-map
|
||||
write-region))
|
||||
(unless (doom--find-eln-file
|
||||
(concat comp-native-version-dir "/"
|
||||
(comp-trampoline-filename f)))
|
||||
(print! (info "Compiling trampoline for %s") f)
|
||||
(comp-trampoline-compile f)
|
||||
(setq restart t)))
|
||||
(when restart
|
||||
(throw 'exit :restart)))))
|
||||
|
||||
|
||||
(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--bootstrap-trampolines)
|
||||
(doom-initialize-packages)
|
||||
(print! (start "Installing packages..."))
|
||||
(let ((pinned (doom-package-pinned-list)))
|
||||
(print-group!
|
||||
(add-hook 'comp-async-cu-done-hook #'doom--native-compile-done-h)
|
||||
(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)
|
||||
|
@ -297,7 +280,7 @@ declaration) or dependency thereof that hasn't already been."
|
|||
(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--call "git" "config" "core.autocrlf" "true")))))
|
||||
(straight--process-run "git" "config" "core.autocrlf" "true")))))
|
||||
(error
|
||||
(signal 'doom-package-error (list package e))))))
|
||||
(progn
|
||||
|
@ -311,7 +294,6 @@ declaration) or dependency thereof that hasn't already been."
|
|||
|
||||
(defun doom-cli-packages-build (&optional force-p)
|
||||
"(Re)build all packages."
|
||||
(doom--bootstrap-trampolines)
|
||||
(doom-initialize-packages)
|
||||
(print! (start "(Re)building %spackages...") (if force-p "all " ""))
|
||||
(print-group!
|
||||
|
@ -328,7 +310,7 @@ declaration) or dependency thereof that hasn't already been."
|
|||
(or (if force-p :all straight--packages-to-rebuild)
|
||||
(make-hash-table :test #'equal)))
|
||||
(recipes (doom-package-recipe-list)))
|
||||
(add-hook 'comp-async-cu-done-hook #'doom--native-compile-done-h)
|
||||
(add-hook 'native-comp-async-cu-done-functions #'doom--native-compile-done-h)
|
||||
(unless force-p
|
||||
(straight--make-build-cache-available))
|
||||
(if-let (built
|
||||
|
@ -337,17 +319,21 @@ declaration) or dependency thereof that hasn't already been."
|
|||
;; Ensure packages with outdated files/bytecode are rebuilt
|
||||
(let* ((build-dir (straight--build-dir package))
|
||||
(repo-dir (straight--repos-dir local-repo))
|
||||
(build (plist-get recipe :build))
|
||||
(build (if (plist-member recipe :build)
|
||||
(plist-get recipe :build)
|
||||
t))
|
||||
(want-byte-compile
|
||||
(or (eq build t)
|
||||
(memq 'compile build)))
|
||||
(want-native-compile
|
||||
(and (or (eq build t)
|
||||
(memq 'native-compile build))
|
||||
(require 'comp nil t))))
|
||||
(when (eq (car build) :not)
|
||||
(setq want-byte-compile (not want-byte-compile)
|
||||
want-native-compile (not 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)))
|
||||
(or (and (require 'comp nil t)
|
||||
(ignore-errors (native-comp-available-p)))
|
||||
(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)))
|
||||
|
@ -356,7 +342,7 @@ declaration) or dependency thereof that hasn't already been."
|
|||
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
|
||||
(when want-native-compile
|
||||
(push file doom--eln-output-expected))
|
||||
finally return outdated))
|
||||
(puthash package t straight--packages-to-rebuild))))
|
||||
|
@ -366,7 +352,7 @@ declaration) or dependency thereof that hasn't already been."
|
|||
(doom--wait-for-compile-jobs)
|
||||
(doom--write-missing-eln-errors)
|
||||
(print! (success "\033[KRebuilt %d package(s)") (length built)))
|
||||
(print! (success "No packages need rebuilding"))
|
||||
(print! (info "No packages need rebuilding"))
|
||||
nil))))
|
||||
|
||||
|
||||
|
@ -409,16 +395,18 @@ declaration) or dependency thereof that hasn't already been."
|
|||
(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)
|
||||
(when (straight-vc-fetch-from-remote recipe)
|
||||
(setq output (straight--process-get-output))
|
||||
(straight-merge-package package)
|
||||
(setq target-ref (straight-vc-get-commit type local-repo))
|
||||
(or (not (doom--same-commit-p target-ref ref))
|
||||
(cl-return))))
|
||||
(doom--straight-with (straight-vc-fetch-from-remote recipe)
|
||||
(when .it
|
||||
(setq output .output)
|
||||
(straight-merge-package package)
|
||||
(setq target-ref (straight-vc-get-commit type local-repo))
|
||||
(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)
|
||||
|
@ -432,7 +420,8 @@ declaration) or dependency thereof that hasn't already been."
|
|||
(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)))
|
||||
(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)
|
||||
|
@ -443,7 +432,8 @@ declaration) or dependency thereof that hasn't already been."
|
|||
(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)))))))
|
||||
(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)
|
||||
|
@ -452,11 +442,19 @@ declaration) or dependency thereof that hasn't already been."
|
|||
(cl-return)))
|
||||
(puthash local-repo t repos-to-rebuild)
|
||||
(puthash package t packages-to-rebuild)
|
||||
(print! (success "\033[K(%d/%d) %s updated (%s -> %s)")
|
||||
(print! (success "\033[K(%d/%d) %s: %s -> %s%s")
|
||||
i total local-repo
|
||||
(doom--abbrev-commit ref)
|
||||
(doom--abbrev-commit target-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)))
|
||||
|
@ -503,16 +501,18 @@ declaration) or dependency thereof that hasn't already been."
|
|||
(print! (warn "\033[KSkipping repos/%s because it is local" repo))
|
||||
(cl-return))
|
||||
(let ((before-size (doom-directory-size default-directory)))
|
||||
(straight--call "git" "reset" "--hard")
|
||||
(straight--call "git" "clean" "-ffd")
|
||||
(if (not (car (straight--call "git" "replace" "--graft" "HEAD")))
|
||||
(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))
|
||||
(straight--call "git" "reflog" "expire" "--expire=all" "--all")
|
||||
(straight--call "git" "gc" "--prune=now")
|
||||
(print! (success "\033[KRegrafted repos/%s (from %0.1fKB to %0.1fKB)")
|
||||
repo before-size (doom-directory-size default-directory))
|
||||
(print-group! (print! "%s" (straight--process-get-output))))
|
||||
t)))
|
||||
(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)
|
||||
|
@ -565,7 +565,23 @@ declaration) or dependency thereof that hasn't already been."
|
|||
(filename path)
|
||||
e)))))))
|
||||
|
||||
(defun doom-cli-packages-purge (&optional elpa-p builds-p repos-p regraft-repos-p)
|
||||
(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
|
||||
|
@ -607,4 +623,8 @@ If ELPA-P, include packages installed with package.el (M-x package-install)."
|
|||
(/= 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)))))))
|
||||
(doom--cli-packages-regraft-repos repos-to-regraft))
|
||||
(when (require 'comp nil t)
|
||||
(if (not eln-p)
|
||||
(ignore (print! (info "Skipping native bytecode")))
|
||||
(doom--cli-packages-purge-eln))))))))
|
||||
|
|
|
@ -31,7 +31,7 @@ stale."
|
|||
(doom-cli-packages-build)
|
||||
(when update-p
|
||||
(doom-cli-packages-update))
|
||||
(doom-cli-packages-purge purge-p 'builds-p purge-p purge-p)
|
||||
(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")))
|
||||
|
|
|
@ -44,6 +44,16 @@ following shell commands:
|
|||
(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."
|
||||
|
@ -116,9 +126,22 @@ following shell commands:
|
|||
(print! (start "Upgrading Doom Emacs..."))
|
||||
(print-group!
|
||||
(doom-clean-byte-compiled-files)
|
||||
(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)))
|
||||
(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
|
||||
|
|
|
@ -1,32 +1,5 @@
|
|||
;;; core/core-cli.el --- -*- lexical-binding: t; no-byte-compile: t; -*-
|
||||
|
||||
(load! "autoload/process")
|
||||
(load! "autoload/plist")
|
||||
(load! "autoload/files")
|
||||
(load! "autoload/output")
|
||||
(require 'seq)
|
||||
|
||||
;; 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 the bare minimum is ready to go
|
||||
(require 'core-modules)
|
||||
(require 'core-packages)
|
||||
(doom-initialize-core-packages)
|
||||
|
||||
;; 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)
|
||||
|
||||
|
||||
;;
|
||||
;;; Variables
|
||||
|
||||
(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
|
||||
|
@ -43,11 +16,12 @@ additional CLI commands, or reconfigure existing ones to better suit their
|
|||
purpose.")
|
||||
|
||||
(defvar doom-cli-log-file (concat doom-local-dir "doom.log")
|
||||
"File to write the extended output to.")
|
||||
"Where to write the extended output to.")
|
||||
|
||||
(defvar doom-cli-log-error-file (concat doom-local-dir "doom.error.log")
|
||||
"File to write the last backtrace to.")
|
||||
"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)
|
||||
|
@ -60,369 +34,47 @@ purpose.")
|
|||
|
||||
|
||||
;;
|
||||
;;; CLI library
|
||||
;;; Bootstrap
|
||||
|
||||
(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!"))))
|
||||
(require 'seq)
|
||||
(load! "autoload/process")
|
||||
(load! "autoload/system")
|
||||
(load! "autoload/plist")
|
||||
(load! "autoload/files")
|
||||
(load! "autoload/output")
|
||||
|
||||
(cl-defstruct doom-cli-option
|
||||
(symbol)
|
||||
(flags ())
|
||||
(args ())
|
||||
(desc "TODO"))
|
||||
(load! "cli/lib/debugger")
|
||||
(load! "cli/lib/lib")
|
||||
(load! "cli/lib/straight-hacks")
|
||||
|
||||
(defun doom--cli-get-option (cli flag)
|
||||
(cl-find-if (doom-partial #'member flag)
|
||||
(doom-cli-optlist cli)
|
||||
:key #'doom-cli-option-flags))
|
||||
;; 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))
|
||||
|
||||
(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))
|
||||
;; 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))
|
||||
|
||||
((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))))))
|
||||
;; Ensure straight and core packages are ready to go for CLI commands.
|
||||
(require 'core-modules)
|
||||
(require 'core-packages)
|
||||
(doom-initialize-core-packages)
|
||||
|
||||
((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))))))
|
||||
;; 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)
|
||||
|
||||
(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))
|
||||
|
||||
|
||||
;;
|
||||
;;; Debugger
|
||||
|
||||
(cl-defun doom-cli--debugger (error data)
|
||||
(cl-incf num-nonmacro-input-events)
|
||||
(cl-destructuring-bind (backtrace &optional type data . _)
|
||||
(cons (doom-cli--backtrace) data)
|
||||
(cond
|
||||
((and (bound-and-true-p straight-process-buffer)
|
||||
(stringp data)
|
||||
(string-match-p (regexp-quote straight-process-buffer)
|
||||
data))
|
||||
(print! (error "There was an unexpected package error"))
|
||||
(print-group!
|
||||
(print! "%s" (string-trim-right (straight--process-get-output)))))
|
||||
((print! (error "There was an unexpected error"))
|
||||
(print-group!
|
||||
(print! "%s %s" (bold "Message:") (get type 'error-message))
|
||||
(print! "%s %S" (bold "Data:") (cons type data))
|
||||
(when backtrace
|
||||
(print! (bold "Backtrace:"))
|
||||
(print-group!
|
||||
(dolist (frame (seq-take backtrace 10))
|
||||
(print!
|
||||
"%0.74s" (replace-regexp-in-string
|
||||
"[\n\r]" "\\\\n" (format "%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))
|
||||
(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)))
|
||||
|
||||
|
||||
;;
|
||||
;;; straight.el hacks
|
||||
|
||||
;; 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-discard-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 "
|
||||
. "^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 (orig-fn &optional prompt)
|
||||
:around #'straight-are-you-sure
|
||||
(or doom-auto-accept
|
||||
(if doom-interactive-p
|
||||
(funcall orig-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-discard-options
|
||||
if (string-match-p prompt-re prompt)
|
||||
return (string-match-p opt-re option)))
|
||||
|
||||
(defadvice! doom--straight-fallback-to-tty-prompt-a (orig-fn prompt actions)
|
||||
"Modifies straight to prompt on the terminal when in noninteractive sessions."
|
||||
:around #'straight--popup-raw
|
||||
(if doom-interactive-p
|
||||
(funcall orig-fn prompt actions)
|
||||
(let ((doom--straight-discard-options doom--straight-discard-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 (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-discard-options nil)
|
||||
(green (concat desc " (Recommended)")))
|
||||
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) "
|
||||
(mapconcat #'number-to-string
|
||||
(number-sequence 1 (length options))
|
||||
", ")))
|
||||
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)))))))))
|
||||
|
||||
(defadvice! doom--straight-respect-print-indent-a (args)
|
||||
"Indent straight progress messages to respect `doom-output-indent', so we
|
||||
don't have to pass whitespace to `straight-use-package's fourth argument
|
||||
everywhere we use it (and internally)."
|
||||
:filter-args #'straight-use-package
|
||||
(cl-destructuring-bind
|
||||
(melpa-style-recipe &optional no-clone no-build cause interactive)
|
||||
args
|
||||
(list melpa-style-recipe no-clone no-build
|
||||
(if (and (not cause)
|
||||
(boundp 'doom-output-indent)
|
||||
(> doom-output-indent 0))
|
||||
(make-string (1- (or doom-output-indent 1)) 32)
|
||||
cause)
|
||||
interactive)))
|
||||
;; 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)))
|
||||
|
||||
|
||||
;;
|
||||
|
@ -448,7 +100,7 @@ Environment variables:
|
|||
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-file
|
||||
(with-output-to! doom--cli-log-buffer
|
||||
(catch 'exit
|
||||
(when (and (not (getenv "__DOOMRESTART"))
|
||||
(or doomdir
|
||||
|
@ -475,20 +127,41 @@ Environment variables:
|
|||
(when command
|
||||
(push command args))
|
||||
(setq command "help"))
|
||||
(if (null command)
|
||||
(doom-cli-execute "help")
|
||||
(let ((start-time (current-time)))
|
||||
(run-hooks 'doom-cli-pre-hook)
|
||||
(when (apply #'doom-cli-execute command args)
|
||||
(run-hooks 'doom-cli-post-hook)
|
||||
(print! (success "Finished in %.4fs")
|
||||
(float-time (time-subtract (current-time) start-time))))))))
|
||||
(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' %s")
|
||||
(string-join
|
||||
(cons (or (ignore-errors
|
||||
(doom-cli-name (doom-cli-get command)))
|
||||
command)
|
||||
args)
|
||||
" ")
|
||||
(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) " "))
|
||||
2)
|
||||
5)
|
||||
;; TODO Not implemented yet
|
||||
(doom-cli-wrong-number-of-arguments-error
|
||||
(cl-destructuring-bind (route opt arg n d) (cdr e)
|
||||
|
@ -496,7 +169,7 @@ Environment variables:
|
|||
(mapconcat #'symbol-name route " ") arg n d)
|
||||
(print-group!
|
||||
(apply #'doom-cli-execute "help" (mapcar #'symbol-name route))))
|
||||
3)
|
||||
6)
|
||||
;; TODO Not implemented yet
|
||||
(doom-cli-unrecognized-option-error
|
||||
(let ((option (cadr e)))
|
||||
|
@ -505,7 +178,7 @@ Environment variables:
|
|||
(print! "The %S syntax isn't supported. Use '%s %s' instead."
|
||||
option (car (split-string option "="))
|
||||
(match-string 1 option))))
|
||||
4)
|
||||
7)
|
||||
;; TODO Not implemented yet
|
||||
(doom-cli-deprecated-error
|
||||
(cl-destructuring-bind (route . commands) (cdr e)
|
||||
|
@ -514,10 +187,10 @@ Environment variables:
|
|||
(print-group!
|
||||
(dolist (command commands)
|
||||
(print! (info "%s") command))))
|
||||
5)
|
||||
8)
|
||||
(user-error
|
||||
(print! (warn "%s") (cadr e))
|
||||
1)))
|
||||
9)))
|
||||
|
||||
|
||||
;;
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
;;; core-editor.el -*- lexical-binding: t; -*-
|
||||
|
||||
(defvar doom-detect-indentation-excluded-modes '(fundamental-mode so-long-mode)
|
||||
(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.")
|
||||
|
||||
|
@ -119,13 +120,57 @@ possible."
|
|||
|
||||
(add-hook! 'after-save-hook
|
||||
(defun doom-guess-mode-h ()
|
||||
"Guess major mode when saving a file in `fundamental-mode'."
|
||||
"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))))))
|
||||
|
||||
;; 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 (orig-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 orig-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 (orig-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 (pop alist)))
|
||||
(if (string-match (car elt) file)
|
||||
(setq backup-directory (cdr elt)
|
||||
alist nil))))
|
||||
(let ((file (funcall orig-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
|
||||
|
@ -168,7 +213,7 @@ possible."
|
|||
;; 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.
|
||||
;; 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
|
||||
|
@ -216,17 +261,18 @@ possible."
|
|||
revert-without-query (list "."))
|
||||
|
||||
;; `auto-revert-mode' and `global-auto-revert-mode' would, normally, abuse the
|
||||
;; heck out of inotify handles _or_ aggresively poll your buffer list every X
|
||||
;; seconds. Too many inotify handles can grind Emacs to a halt if you preform
|
||||
;; 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 tens or hundreds.
|
||||
;; buffer list grows into the hundreds.
|
||||
;;
|
||||
;; So Doom uses a different strategy: we lazily auto revert buffers when the
|
||||
;; user a) saves a file, b) switches to a buffer (or its window), or c) you
|
||||
;; focus Emacs (after using another program). This way, Emacs only ever has to
|
||||
;; operate on, at minimum, a single buffer and, at maximum, X buffers, where X
|
||||
;; is the number of open windows (which is rarely, if ever, over 10).
|
||||
;; 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))
|
||||
|
@ -245,26 +291,25 @@ possible."
|
|||
: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
|
||||
(defun doom--recent-file-truename (file)
|
||||
(if (or (file-remote-p file nil t)
|
||||
(not (file-remote-p file)))
|
||||
(file-truename file)
|
||||
(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))
|
||||
(setq recentf-filename-handlers
|
||||
'(;; Text properties inflate the size of recentf's files, and there is
|
||||
;; no purpose in persisting them, so we strip them out.
|
||||
substring-no-properties
|
||||
;; Resolve symlinks of local files. Otherwise we get duplicate
|
||||
;; entries opening symlinks.
|
||||
doom--recent-file-truename
|
||||
;; Replace $HOME with ~, which is more portable, and reduces how much
|
||||
;; horizontal space the recentf listing uses to list recent files.
|
||||
abbreviate-file-name)
|
||||
recentf-save-file (concat doom-cache-dir "recentf")
|
||||
recentf-auto-cleanup 'never
|
||||
recentf-max-menu-items 0
|
||||
recentf-max-saved-items 200)
|
||||
|
||||
;; 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 ()
|
||||
|
@ -276,10 +321,15 @@ possible."
|
|||
|
||||
(add-hook! 'dired-mode-hook
|
||||
(defun doom--recentf-add-dired-directory-h ()
|
||||
"Add dired directory to recentf file list."
|
||||
"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))
|
||||
|
||||
|
||||
|
@ -287,30 +337,41 @@ possible."
|
|||
;; persist variables across sessions
|
||||
:defer-incrementally custom
|
||||
:hook (doom-first-input . savehist-mode)
|
||||
:init
|
||||
(setq savehist-file (concat doom-cache-dir "savehist"))
|
||||
: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-unpropertize-kill-ring-h ()
|
||||
"Remove text properties from `kill-ring' for a smaller savehist file."
|
||||
(setq kill-ring (cl-loop for item in kill-ring
|
||||
if (stringp item)
|
||||
collect (substring-no-properties item)
|
||||
else if item collect it)))))
|
||||
(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)
|
||||
:init
|
||||
(setq save-place-file (concat doom-cache-dir "saveplace")
|
||||
save-place-limit 100)
|
||||
: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."
|
||||
|
@ -325,20 +386,20 @@ possible."
|
|||
(defadvice! doom--dont-prettify-saveplace-cache-a (orig-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 we replace calls to `pp' with the much faster `prin1'."
|
||||
files, so this replace calls to `pp' with the much faster `prin1'."
|
||||
:around #'save-place-alist-to-file
|
||||
(letf! ((#'pp #'prin1)) (funcall orig-fn))))
|
||||
|
||||
|
||||
(use-package! server
|
||||
:when (display-graphic-p)
|
||||
:after-call pre-command-hook after-find-file focus-out-hook
|
||||
: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
|
||||
(setq server-auth-dir (concat doom-emacs-dir "server/"))
|
||||
(unless (server-running-p)
|
||||
(server-start)))
|
||||
|
||||
|
@ -397,6 +458,8 @@ files, so we replace calls to `pp' with the much faster `prin1'."
|
|||
(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 ()
|
||||
|
@ -434,7 +497,6 @@ files, so we replace calls to `pp' with the much faster `prin1'."
|
|||
(message ""))))) ; warn silently
|
||||
(funcall orig-fn arg)))))
|
||||
|
||||
|
||||
(use-package! helpful
|
||||
;; a better *help* buffer
|
||||
:commands helpful--read-symbol
|
||||
|
@ -478,6 +540,8 @@ files, so we replace calls to `pp' with the much faster `prin1'."
|
|||
: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
|
||||
|
@ -530,8 +594,8 @@ on."
|
|||
|
||||
;; You're likely writing lisp in the minibuffer, therefore, disable these
|
||||
;; quote pairs, which lisps doesn't use for strings:
|
||||
(sp-local-pair 'minibuffer-inactive-mode "'" nil :actions nil)
|
||||
(sp-local-pair 'minibuffer-inactive-mode "`" nil :actions nil)
|
||||
(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)
|
||||
|
@ -566,7 +630,6 @@ on."
|
|||
;; wide buffers.
|
||||
(appendq! so-long-minor-modes
|
||||
'(flycheck-mode
|
||||
flyspell-mode
|
||||
spell-fu-mode
|
||||
eldoc-mode
|
||||
smartparens-mode
|
||||
|
|
|
@ -28,6 +28,8 @@ and Emacs states, and for non-evil users.")
|
|||
|
||||
(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
|
||||
|
@ -165,7 +167,7 @@ interface.
|
|||
|
||||
See `doom-localleader-key' and `doom-localleader-alt-key' to change the
|
||||
localleader prefix."
|
||||
(if (featurep 'evil)
|
||||
(if (featurep! :editor evil)
|
||||
;; :non-normal-prefix doesn't apply to non-evil sessions (only evil's
|
||||
;; emacs state)
|
||||
`(general-define-key
|
||||
|
|
|
@ -94,10 +94,10 @@ at the values with which this function was called."
|
|||
(lambda (&rest pre-args)
|
||||
(apply fn (append pre-args args))))
|
||||
|
||||
(defun doom-lookup-key (keys &optional keymap)
|
||||
(defun doom-lookup-key (keys &rest keymaps)
|
||||
"Like `lookup-key', but search active keymaps if KEYMAP is omitted."
|
||||
(if keymap
|
||||
(lookup-key keymap keys)
|
||||
(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
|
||||
|
@ -260,9 +260,18 @@ See `general-key-dispatch' for what other arguments it accepts in BRANCHES."
|
|||
(when (cl-oddp (length branches))
|
||||
(setq fallback (car (last branches))
|
||||
branches (butlast branches)))
|
||||
`(general-predicate-dispatch ,fallback
|
||||
:docstring ,docstring
|
||||
,@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)
|
||||
|
||||
|
@ -352,13 +361,10 @@ This is a wrapper around `eval-after-load' that:
|
|||
(require package nil 'noerror))
|
||||
#'progn
|
||||
#'with-no-warnings)
|
||||
(let ((body (macroexp-progn body)))
|
||||
`(if (featurep ',package)
|
||||
,body
|
||||
;; 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 ',body)))))
|
||||
;; 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 ((not (keywordp p))
|
||||
`(after! (:and ,@package) ,@body))
|
||||
|
@ -486,8 +492,8 @@ 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 and/or :append, which will make the hook
|
||||
buffer-local or append to the list of hooks (respectively),
|
||||
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 one function, a quoted list
|
||||
thereof, a list of `defun's, or body forms (implicitly wrapped in a
|
||||
lambda).
|
||||
|
@ -504,10 +510,12 @@ This macro accepts, in order:
|
|||
append-p
|
||||
local-p
|
||||
remove-p
|
||||
depth
|
||||
forms)
|
||||
(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))))
|
||||
(let ((first (car-safe (car rest))))
|
||||
|
@ -529,7 +537,7 @@ This macro accepts, in order:
|
|||
(dolist (func func-forms)
|
||||
(push (if remove-p
|
||||
`(remove-hook ',hook #',func ,local-p)
|
||||
`(add-hook ',hook #',func ,append-p ,local-p))
|
||||
`(add-hook ',hook #',func ,(or depth append-p) ,local-p))
|
||||
forms)))
|
||||
(macroexp-progn
|
||||
(append defn-forms
|
||||
|
@ -650,7 +658,7 @@ set earlier in the ‘setq-local’. The return value of the
|
|||
(macroexp-progn (nreverse expr)))))
|
||||
|
||||
(eval-when! (version< emacs-version "27.1")
|
||||
;; DEPRECATED Backported from Emacs 27; earlier verisons don't have REMOTE arg
|
||||
;; DEPRECATED Backported from Emacs 27. Remove when 26.x support is dropped.
|
||||
(defun executable-find (command &optional remote)
|
||||
"Search for COMMAND in `exec-path' and return the absolute file name.
|
||||
Return nil if COMMAND is not found anywhere in `exec-path'. If
|
||||
|
@ -671,8 +679,8 @@ REMOTE is non-nil, search on the remote host indicated by
|
|||
(file-name-quote default-directory))))
|
||||
(locate-file command exec-path exec-suffixes 1)))))
|
||||
|
||||
(unless (fboundp 'exec-path)
|
||||
;; DEPRECATED Backported from Emacs 27.1
|
||||
(eval-when! (not (fboundp 'exec-path))
|
||||
;; DEPRECATED Backported from Emacs 27.1. Remove when 26.x support is dropped.
|
||||
(defun exec-path ()
|
||||
"Return list of directories to search programs to run in remote subprocesses.
|
||||
The remote host is identified by `default-directory'. For remote
|
||||
|
|
|
@ -117,12 +117,13 @@ non-nil."
|
|||
(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)
|
||||
(run-hook-wrapped 'doom-before-init-modules-hook #'doom-try-run-hook)
|
||||
(doom-run-hooks 'doom-before-init-modules-hook)
|
||||
(unless no-config-p
|
||||
(maphash (doom-module-loader doom-module-config-file) doom-modules)
|
||||
(run-hook-wrapped 'doom-init-modules-hook #'doom-try-run-hook)
|
||||
(doom-run-hooks 'doom-init-modules-hook)
|
||||
(load! "config" doom-private-dir t)
|
||||
(load custom-file 'noerror (not doom-debug-mode))))))
|
||||
(when custom-file
|
||||
(load custom-file 'noerror (not doom-debug-mode)))))))
|
||||
|
||||
|
||||
;;
|
||||
|
@ -279,8 +280,8 @@ those directories. The first returned path is always `doom-private-dir'."
|
|||
(:if (if (eval (cadr m) t)
|
||||
(push (caddr m) mplist)
|
||||
(prependq! mplist (cdddr m))))
|
||||
(test (if (or (eval (cadr m) t)
|
||||
(eq test :unless))
|
||||
(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))
|
||||
|
@ -288,7 +289,7 @@ those directories. The first returned path is always `doom-private-dir'."
|
|||
(when-let (new (assq module obsolete))
|
||||
(let ((newkeys (cdr new)))
|
||||
(if (null newkeys)
|
||||
(message "WARNING %s module was removed" key)
|
||||
(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 ", "))
|
||||
|
@ -302,10 +303,11 @@ those directories. The first returned path is always `doom-private-dir'."
|
|||
mplist)
|
||||
(push (car key) mplist))
|
||||
(throw 'doom-modules t))))
|
||||
(push (funcall fn category module
|
||||
:flags (if (listp m) (cdr m))
|
||||
:path (doom-module-locate-path category module))
|
||||
results))))))
|
||||
(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)))
|
||||
|
@ -314,8 +316,7 @@ those directories. The first returned path is always `doom-private-dir'."
|
|||
"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
|
||||
(cl-loop for path in (cdr (doom-module-load-path 'all))
|
||||
collect (doom-module-from-path path))
|
||||
(mapcar #'doom-module-from-path (cdr (doom-module-load-path 'all)))
|
||||
doom-modules))
|
||||
|
||||
|
||||
|
@ -331,7 +332,7 @@ This value is cached. If REFRESH-P, then don't use the cached value."
|
|||
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 inadvertantly install their
|
||||
;; 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'.
|
||||
|
|
|
@ -77,7 +77,7 @@ uses a straight or package.el command directly).")
|
|||
;;
|
||||
;;; Straight
|
||||
|
||||
(setq straight-base-dir doom-local-dir
|
||||
(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
|
||||
|
@ -96,10 +96,7 @@ uses a straight or package.el command directly).")
|
|||
;; 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
|
||||
;; Prefix declarations are unneeded bulk added to our autoloads file. Best
|
||||
;; we don't have to deal with them at all.
|
||||
autoload-compute-prefixes nil)
|
||||
straight-vc-git-default-clone-depth '(1 single-branch))
|
||||
|
||||
(with-eval-after-load 'straight
|
||||
;; `let-alist' is built into Emacs 26 and onwards
|
||||
|
@ -121,27 +118,57 @@ uses a straight or package.el command directly).")
|
|||
"://github.com/"
|
||||
(or (plist-get recipe :repo) "raxod502/straight.el")))
|
||||
(branch (or (plist-get recipe :branch) straight-repository-branch))
|
||||
(call (if doom-debug-p #'doom-exec-process #'doom-call-process)))
|
||||
(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)
|
||||
(message "Installing straight...")
|
||||
(cond
|
||||
((eq straight-vc-git-default-clone-depth 'full)
|
||||
(funcall call "git" "clone" "--origin" "origin" repo-url repo-dir))
|
||||
((null pin)
|
||||
(funcall call "git" "clone" "--origin" "origin" repo-url repo-dir
|
||||
"--depth" (number-to-string straight-vc-git-default-clone-depth)
|
||||
"--branch" straight-repository-branch
|
||||
"--single-branch" "--no-tags"))
|
||||
((integerp straight-vc-git-default-clone-depth)
|
||||
(make-directory repo-dir t)
|
||||
(let ((default-directory repo-dir))
|
||||
(funcall call "git" "init")
|
||||
(funcall call "git" "checkout" "-b" straight-repository-branch)
|
||||
(funcall call "git" "remote" "add" "origin" repo-url)
|
||||
(funcall call "git" "fetch" "origin" pin
|
||||
"--depth" (number-to-string straight-vc-git-default-clone-depth)
|
||||
"--no-tags")
|
||||
(funcall call "git" "checkout" "--detach" pin)))))
|
||||
(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.28")
|
||||
(user-error "Git %s detected! Doom requires git 2.28 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))
|
||||
;; git init's -b switch was introduced in 2.28. As much as I'd
|
||||
;; like to, the dependency is unavoidable because straight.el
|
||||
;; uses it internally.
|
||||
(funcall call "git" "init" "-b" 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")
|
||||
(with-temp-buffer
|
||||
|
@ -154,10 +181,20 @@ uses a straight or package.el command directly).")
|
|||
(defun doom--ensure-core-packages (packages)
|
||||
(doom-log "Installing core packages")
|
||||
(dolist (package packages)
|
||||
(let ((name (car package)))
|
||||
(let* ((name (car package))
|
||||
(repo (symbol-name name)))
|
||||
(when-let (recipe (plist-get (cdr package) :recipe))
|
||||
(straight-override-recipe (cons name recipe)))
|
||||
(straight-use-package name))))
|
||||
(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."
|
||||
|
@ -190,21 +227,11 @@ processed."
|
|||
(let (packages)
|
||||
(dolist (package doom-packages)
|
||||
(cl-destructuring-bind
|
||||
(name &key recipe disable ignore shadow &allow-other-keys) package
|
||||
(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 shadow
|
||||
(straight-override-recipe (cons shadow '(:local-repo nil)))
|
||||
(let ((site-load-path (copy-sequence doom--initial-load-path))
|
||||
lib)
|
||||
(while (setq
|
||||
lib (locate-library (concat (symbol-name shadow) ".el")
|
||||
nil site-load-path))
|
||||
(let ((lib (directory-file-name (file-name-directory lib))))
|
||||
(setq site-load-path (delete lib site-load-path)
|
||||
load-path (delete lib load-path))))))
|
||||
(when recipe
|
||||
(straight-override-recipe (cons name recipe)))
|
||||
(appendq! packages (cons name (straight--get-dependencies name)))))))
|
||||
|
@ -255,7 +282,7 @@ processed."
|
|||
(plist-put recipe :type 'git)
|
||||
recipe))
|
||||
(repo (if-let (local-repo (plist-get recipe :local-repo))
|
||||
(file-name-nondirectory (directory-file-name local-repo))
|
||||
(directory-file-name local-repo)
|
||||
(ignore-errors (straight-vc-local-repo-name recipe)))))
|
||||
repo
|
||||
(symbol-name package)))
|
||||
|
@ -278,12 +305,15 @@ processed."
|
|||
(copy-sequence deps))))
|
||||
|
||||
(defun doom-package-depending-on (package &optional noerror)
|
||||
"Return a list of packages that depend on the package named NAME."
|
||||
(cl-check-type name symbol)
|
||||
"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 name)
|
||||
(unless (or (doom-package-build-recipe package)
|
||||
noerror)
|
||||
(error "Couldn't find %s, is it installed?" name))
|
||||
(error "Couldn't find %s, is it installed?" package))
|
||||
(cl-loop for pkg in (hash-table-keys straight--build-cache)
|
||||
for deps = (doom-package-dependencies pkg)
|
||||
if (memq package deps)
|
||||
|
@ -349,6 +379,8 @@ installed."
|
|||
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)
|
||||
|
@ -398,8 +430,8 @@ ones."
|
|||
(when (and (not ignore)
|
||||
(not disable)
|
||||
(or pin unpin))
|
||||
(setf (alist-get (doom-package-recipe-repo name) alist
|
||||
nil 'remove #'equal)
|
||||
(setf (alist-get (file-name-nondirectory (doom-package-recipe-repo name))
|
||||
alist nil 'remove #'equal)
|
||||
(unless unpin pin)))))))
|
||||
|
||||
(defun doom-package-recipe-list ()
|
||||
|
@ -418,7 +450,7 @@ ones."
|
|||
;;; Module package macros
|
||||
|
||||
(cl-defmacro package!
|
||||
(name &rest plist &key built-in recipe ignore _type _pin _disable _shadow)
|
||||
(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
|
||||
|
@ -455,10 +487,6 @@ Accepts the following properties:
|
|||
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.
|
||||
:shadow PACKAGE
|
||||
Informs Doom that this package is shadowing a built-in PACKAGE; the original
|
||||
package will be removed from `load-path' to mitigate conflicts, and this new
|
||||
package will satisfy any dependencies on PACKAGE in the future.
|
||||
|
||||
Returns t if package is successfully registered, and nil if it was disabled
|
||||
elsewhere."
|
||||
|
@ -469,7 +497,7 @@ elsewhere."
|
|||
(when built-in
|
||||
(when (and (not ignore)
|
||||
(equal built-in '(quote prefer)))
|
||||
(setq built-in `(locate-library ,(symbol-name name) nil doom--initial-load-path)))
|
||||
(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)
|
||||
|
@ -493,8 +521,8 @@ elsewhere."
|
|||
(when-let (recipe (plist-get plist :recipe))
|
||||
(cl-destructuring-bind
|
||||
(&key local-repo _files _flavor
|
||||
_build _pre-build _post-build _no-byte-compile
|
||||
_no-native-compile _no-autoloads _type _repo _host _branch
|
||||
_build _pre-build _post-build _includes
|
||||
_type _repo _host _branch
|
||||
_remote _nonrecursive _fork _depth)
|
||||
recipe
|
||||
;; Expand :local-repo from current directory
|
||||
|
|
|
@ -23,7 +23,8 @@ debian, and derivatives). On most it's 'fd'.")
|
|||
:commands (projectile-project-root
|
||||
projectile-project-name
|
||||
projectile-project-p
|
||||
projectile-locate-dominating-file)
|
||||
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
|
||||
|
@ -34,7 +35,8 @@ debian, and derivatives). On most it's 'fd'.")
|
|||
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 '("~/" "/tmp"))
|
||||
projectile-ignored-projects '("~/")
|
||||
projectile-ignored-project-function #'doom-project-ignored-p)
|
||||
|
||||
(global-set-key [remap evil-jump-to-tag] #'projectile-find-tag)
|
||||
(global-set-key [remap find-tag] #'projectile-find-tag)
|
||||
|
@ -117,6 +119,9 @@ 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)
|
||||
|
@ -125,30 +130,18 @@ c) are not valid projectile projects."
|
|||
doom-projectile-cache-limit)
|
||||
(member (substring proot 0 -1) blacklist)
|
||||
(and doom-projectile-cache-purge-non-projects
|
||||
(not (doom-project-p proot))))
|
||||
(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))))
|
||||
|
||||
;; It breaks projectile's project root resolution if HOME is a project (e.g.
|
||||
;; it's a git repo). In that case, we disable bottom-up root searching to
|
||||
;; prevent issues. This makes project resolution a little slower and less
|
||||
;; accurate in some cases.
|
||||
(let ((default-directory "~"))
|
||||
(when (cl-find-if #'projectile-file-exists-p
|
||||
projectile-project-root-files-bottom-up)
|
||||
(doom-log "HOME appears to be a project. Disabling bottom-up root search.")
|
||||
(setq projectile-project-root-files
|
||||
(append projectile-project-root-files-bottom-up
|
||||
projectile-project-root-files)
|
||||
projectile-project-root-files-bottom-up nil)))
|
||||
|
||||
;; Some utilities have issues with windows-style paths in MSYS, so emit
|
||||
;; unix-style paths instead.
|
||||
;; Some MSYS utilities auto expanded the `/' path separator, so we need to prevent it.
|
||||
(when IS-WINDOWS
|
||||
(setenv "MSYS_NO_PATHCONV" "1"))
|
||||
(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
|
||||
|
@ -185,7 +178,7 @@ And if it's a function, evaluate it."
|
|||
;; 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 /")))
|
||||
(if IS-WINDOWS " --path-separator=/")))
|
||||
("find . -type f -print0"))))
|
||||
|
||||
(defadvice! doom--projectile-default-generic-command-a (orig-fn &rest args)
|
||||
|
|
|
@ -3,9 +3,6 @@
|
|||
;;
|
||||
;;; Variables
|
||||
|
||||
(defvar doom-init-theme-p nil
|
||||
"If non-nil, a theme has been loaded.")
|
||||
|
||||
(defvar doom-theme nil
|
||||
"A symbol representing the Emacs theme to load at startup.
|
||||
|
||||
|
@ -35,10 +32,7 @@ Must be a `font-spec', a font object, an XFT font string, or an XLFD string. See
|
|||
|
||||
An omitted font size means to inherit `doom-font''s size.")
|
||||
|
||||
(defvar doom-unicode-font
|
||||
(if IS-MAC
|
||||
(font-spec :family "Apple Color Emoji")
|
||||
(font-spec :family "Symbola"))
|
||||
(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.
|
||||
|
@ -47,8 +41,17 @@ The defaults on macOS and Linux are Apple Color Emoji and Symbola, respectively.
|
|||
|
||||
An omitted font size means to inherit `doom-font''s size.")
|
||||
|
||||
(defvar doom-unicode-extra-fonts nil
|
||||
"Fonts to inject into the Unicode charset before `doom-unicode-font'.")
|
||||
(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.")
|
||||
|
||||
|
||||
;;
|
||||
|
@ -156,8 +159,12 @@ or if the current buffer is read-only or not file-visiting."
|
|||
;;
|
||||
;;; General UX
|
||||
|
||||
;; Simpler confirmation prompt when killing Emacs
|
||||
;; 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).
|
||||
|
@ -194,8 +201,8 @@ or if the current buffer is read-only or not file-visiting."
|
|||
;; for tall lines.
|
||||
auto-window-vscroll nil
|
||||
;; mouse
|
||||
mouse-wheel-scroll-amount '(5 ((shift) . 2))
|
||||
mouse-wheel-progressive-speed nil) ; don't accelerate scrolling
|
||||
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)
|
||||
|
@ -239,29 +246,29 @@ windows, switch to `doom-fallback-buffer'. Otherwise, delegate to original
|
|||
(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)))
|
||||
(doom-inhibit-switch-buffer-hooks t)
|
||||
(inhibit-redisplay t)
|
||||
buffer-list-update-hook)
|
||||
(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")))
|
||||
(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)
|
||||
(let ((inhibit-redisplay t)
|
||||
(doom-inhibit-switch-buffer-hooks 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 'doom-switch-buffer-hook 'buffer-list-update-hook)
|
||||
t)))))
|
||||
|
||||
|
||||
|
@ -286,12 +293,16 @@ windows, switch to `doom-fallback-buffer'. Otherwise, delegate to original
|
|||
(setq frame-resize-pixelwise t)
|
||||
|
||||
;; But do not resize windows pixelwise, this can cause crashes in some cases
|
||||
;; where we resize windows too quickly.
|
||||
;; 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 avoid using `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)
|
||||
|
@ -310,21 +321,18 @@ windows, switch to `doom-fallback-buffer'. Otherwise, delegate to original
|
|||
window-divider-default-right-width 1)
|
||||
(add-hook 'doom-init-ui-hook #'window-divider-mode)
|
||||
|
||||
;; 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)
|
||||
|
||||
;; always avoid GUI
|
||||
;; 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 GUIs altogether and have Emacs handle the prompting, since
|
||||
;; its promtps are governed by the same rules and keybinds as the rest of Emacs.
|
||||
(setq use-dialog-box nil)
|
||||
;; Don't display floating tooltips; display their contents in the echo-area,
|
||||
;; because native tooltips are ugly.
|
||||
(when (bound-and-true-p tooltip-mode)
|
||||
(tooltip-mode -1))
|
||||
;; ...especially on linux
|
||||
(when IS-LINUX
|
||||
(setq x-gtk-use-system-tooltips nil))
|
||||
|
||||
;; Favor vertical splits over horizontal ones. Screens are usually wide.
|
||||
;; Favor vertical splits over horizontal ones. Monitors are trending toward
|
||||
;; wide, rather than tall.
|
||||
(setq split-width-threshold 160
|
||||
split-height-threshold nil)
|
||||
|
||||
|
@ -347,8 +355,7 @@ windows, switch to `doom-fallback-buffer'. Otherwise, delegate to original
|
|||
;; Typing yes/no is obnoxious when y/n will do
|
||||
(fset #'yes-or-no-p #'y-or-n-p)
|
||||
|
||||
;; Try really hard to keep the cursor from getting stuck in the read-only prompt
|
||||
;; portion of the minibuffer.
|
||||
;; 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)
|
||||
|
||||
|
@ -361,7 +368,8 @@ windows, switch to `doom-fallback-buffer'. Otherwise, delegate to original
|
|||
|
||||
|
||||
(after! comint
|
||||
(setq comint-prompt-read-only t))
|
||||
(setq comint-prompt-read-only t
|
||||
comint-buffer-maximum-size 2048)) ; double the default
|
||||
|
||||
|
||||
(after! compile
|
||||
|
@ -369,7 +377,11 @@ windows, switch to `doom-fallback-buffer'. Otherwise, delegate to original
|
|||
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))
|
||||
(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
|
||||
|
@ -392,7 +404,9 @@ windows, switch to `doom-fallback-buffer'. Otherwise, delegate to original
|
|||
;; 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)
|
||||
(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
|
||||
|
@ -400,19 +414,14 @@ windows, switch to `doom-fallback-buffer'. Otherwise, delegate to original
|
|||
;; which users expect to control hl-line in Emacs.
|
||||
(define-globalized-minor-mode global-hl-line-mode hl-line-mode
|
||||
(lambda ()
|
||||
(and (not hl-line-mode)
|
||||
(cond ((null global-hl-line-modes) nil)
|
||||
(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))))
|
||||
|
||||
;; Not having to render the hl-line overlay in multiple buffers offers a tiny
|
||||
;; performance boost. I also don't need to see it in other buffers.
|
||||
(setq hl-line-sticky-flag nil
|
||||
global-hl-line-sticky-flag nil)
|
||||
|
||||
;; 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)
|
||||
|
@ -477,13 +486,16 @@ windows, switch to `doom-fallback-buffer'. Otherwise, delegate to original
|
|||
all-the-icons-material
|
||||
all-the-icons-alltheicon)
|
||||
:preface
|
||||
(setq doom-unicode-extra-fonts
|
||||
(list "Weather Icons"
|
||||
"github-octicons"
|
||||
"FontAwesome"
|
||||
"all-the-icons"
|
||||
"file-icons"
|
||||
"Material Icons"))
|
||||
(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 (orig-fn &rest args)
|
||||
|
@ -502,6 +514,8 @@ windows, switch to `doom-fallback-buffer'. Otherwise, delegate to original
|
|||
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)
|
||||
|
@ -516,17 +530,19 @@ windows, switch to `doom-fallback-buffer'. Otherwise, delegate to original
|
|||
|
||||
;;;###package rainbow-delimiters
|
||||
;; Helps us distinguish stacked delimiter pairs, especially in parentheses-drunk
|
||||
;; languages like Lisp.
|
||||
(setq rainbow-delimiters-max-face-count 3)
|
||||
;; 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 computation
|
||||
;; 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 makes it easier to tell the
|
||||
;; 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)
|
||||
|
||||
|
@ -552,111 +568,72 @@ windows, switch to `doom-fallback-buffer'. Otherwise, delegate to original
|
|||
;; Always prioritize the user's themes above the built-in/packaged ones.
|
||||
(setq custom-theme-load-path
|
||||
(cons 'custom-theme-directory
|
||||
(remq 'custom-theme-directory custom-theme-load-path)))
|
||||
(delq 'custom-theme-directory custom-theme-load-path)))
|
||||
|
||||
;; Underline looks a bit better when drawn lower
|
||||
(setq x-underline-at-descent-line t)
|
||||
|
||||
;; DEPRECATED In Emacs 27
|
||||
(defvar doom--prefer-theme-elc nil
|
||||
"If non-nil, `load-theme' will prefer the compiled theme (unlike its default
|
||||
behavior). Do not set this directly, this is let-bound in `doom-init-theme-h'.")
|
||||
|
||||
(defun doom-init-fonts-h ()
|
||||
(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
|
||||
(append (when doom-font
|
||||
`((fixed-pitch ((t (:font ,doom-font))))))
|
||||
(when doom-serif-font
|
||||
`((fixed-pitch-serif ((t (:font ,doom-serif-font))))))
|
||||
(when doom-variable-pitch-font
|
||||
`((variable-pitch ((t (:font ,doom-variable-pitch-font))))))))
|
||||
;; Never save these settings to `custom-file'
|
||||
(dolist (sym '(fixed-pitch fixed-pitch-serif variable-pitch))
|
||||
(put sym 'saved-face nil))
|
||||
(cond
|
||||
(doom-font
|
||||
(cl-pushnew
|
||||
;; Avoiding `set-frame-font' because it does a lot of extra, expensive
|
||||
;; work we can avoid by setting the font frame parameter instead.
|
||||
(cons 'font
|
||||
(cond ((stringp doom-font) doom-font)
|
||||
((fontp doom-font) (font-xlfd-name doom-font))
|
||||
((signal 'wrong-type-argument (list '(fontp stringp)
|
||||
doom-font)))))
|
||||
default-frame-alist
|
||||
:key #'car :test #'eq))
|
||||
;; 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)))))
|
||||
(when reload
|
||||
(set-frame-font doom-font t)))
|
||||
((display-graphic-p)
|
||||
;; We try our best to record your system font, so `doom-big-font-mode'
|
||||
;; can still use it to compute a larger font size with.
|
||||
(setq font-use-system-font t
|
||||
doom-font (face-attribute 'default :font)))))
|
||||
|
||||
(defun doom-init-extra-fonts-h (&optional frame)
|
||||
"Loads `doom-variable-pitch-font',`doom-serif-font' and `doom-unicode-font'."
|
||||
(condition-case e
|
||||
(with-selected-frame (or frame (selected-frame))
|
||||
(when doom-font
|
||||
(set-face-attribute 'fixed-pitch nil :font doom-font))
|
||||
(when doom-serif-font
|
||||
(set-face-attribute 'fixed-pitch-serif nil :font doom-serif-font))
|
||||
(when doom-variable-pitch-font
|
||||
(set-face-attribute 'variable-pitch nil :font doom-variable-pitch-font))
|
||||
(when (fboundp 'set-fontset-font)
|
||||
(dolist (font (cons doom-unicode-font doom-unicode-extra-fonts))
|
||||
(set-fontset-font t 'unicode font nil 'prepend)))
|
||||
(run-hooks 'after-setting-font-hook))
|
||||
((debug error)
|
||||
(if (string-prefix-p "Font not available: " (error-message-string e))
|
||||
(lwarn 'doom-ui :warning
|
||||
"Could not find the '%s' font on your system, falling back to system font"
|
||||
(font-get (caddr e) :family))
|
||||
(signal 'doom-error e)))))
|
||||
(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 (&optional frame)
|
||||
"Load the theme specified by `doom-theme' in FRAME."
|
||||
(when (and doom-theme
|
||||
(not (eq doom-theme 'default))
|
||||
(not (memq doom-theme custom-enabled-themes)))
|
||||
(when (and doom-theme (not (custom-theme-enabled-p doom-theme)))
|
||||
;; Fix #1397: if `doom-init-theme-h' is used on `after-make-frame-functions'
|
||||
;; (for daemon sessions), the new frame must be focused to ensure the theme
|
||||
;; loads correctly.
|
||||
(with-selected-frame (or frame (selected-frame))
|
||||
(let ((doom--prefer-theme-elc t)) ; DEPRECATED in Emacs 27
|
||||
(load-theme doom-theme t)))))
|
||||
(load-theme doom-theme t))))
|
||||
|
||||
(defadvice! doom--load-theme-a (orig-fn theme &optional no-confirm no-enable)
|
||||
"Run `doom-load-theme-hook' on `load-theme' and fix its issues.
|
||||
|
||||
1. Disable previously enabled themes.
|
||||
2. Don't let face-remapping screw up loading the new theme
|
||||
(*cough*`mixed-pitch-mode').
|
||||
3. Record the current theme in `doom-theme'."
|
||||
"Record `doom-theme', disable old themes, and trigger `doom-load-theme-hook'."
|
||||
:around #'load-theme
|
||||
;; HACK Run `load-theme' from an estranged buffer, where we can be assured
|
||||
;; that buffer-local face remaps (by `mixed-pitch-mode', for instance)
|
||||
;; won't interfere with changing themes.
|
||||
;; 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
|
||||
(when-let (result (funcall orig-fn theme no-confirm no-enable))
|
||||
(unless no-enable
|
||||
(setq doom-theme theme
|
||||
doom-init-theme-p t)
|
||||
;; `load-theme' doesn't disable previously enabled themes, which seems
|
||||
;; like what you'd want. You could always use `enable-theme' to activate
|
||||
;; multiple themes instead.
|
||||
(mapc #'disable-theme (remq theme (remq 'use-package custom-enabled-themes)))
|
||||
(run-hooks 'doom-load-theme-hook))
|
||||
result)))
|
||||
|
||||
(eval-when! (not EMACS27+)
|
||||
;; DEPRECATED `doom--load-theme-a' handles this for us after the theme is
|
||||
;; loaded, but this only works on Emacs 27+. Disabling old themes
|
||||
;; must be done *before* the theme is loaded in Emacs 26.
|
||||
(defadvice! doom--disable-previous-themes-a (theme &optional _no-confirm no-enable)
|
||||
"Disable other themes when loading a new one."
|
||||
:before #'load-theme
|
||||
(unless no-enable
|
||||
(mapc #'disable-theme (remq 'use-package custom-enabled-themes))))
|
||||
|
||||
;; DEPRECATED Not needed in Emacs 27
|
||||
(defadvice! doom--prefer-compiled-theme-a (orig-fn &rest args)
|
||||
"Have `load-theme' prioritize the byte-compiled theme.
|
||||
This offers a moderate boost in startup (or theme switch) time, so long as
|
||||
`doom--prefer-theme-elc' is non-nil."
|
||||
:around #'load-theme
|
||||
(if (or (null after-init-time)
|
||||
doom--prefer-theme-elc)
|
||||
(letf! (defun locate-file (filename path &optional _suffixes predicate)
|
||||
(funcall locate-file filename path '("c" "") predicate))
|
||||
(apply orig-fn args))
|
||||
(apply orig-fn args))))
|
||||
(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 orig-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))))))
|
||||
|
||||
|
||||
;;
|
||||
|
@ -664,7 +641,11 @@ This offers a moderate boost in startup (or theme switch) time, so long as
|
|||
|
||||
(defun doom-init-ui-h ()
|
||||
"Initialize Doom's user interface by applying all its advice and hooks."
|
||||
(run-hook-wrapped 'doom-init-ui-hook #'doom-try-run-hook)
|
||||
;; 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)
|
||||
|
||||
(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)
|
||||
|
@ -684,17 +665,16 @@ This offers a moderate boost in startup (or theme switch) time, so long as
|
|||
(dolist (fn '(switch-to-buffer display-buffer))
|
||||
(advice-add fn :around #'doom-run-switch-buffer-hooks-a)))
|
||||
|
||||
;; Apply `doom-font' et co
|
||||
(add-hook 'doom-after-init-modules-hook #'doom-init-fonts-h)
|
||||
(add-hook 'doom-load-theme-hook #'doom-init-extra-fonts-h)
|
||||
|
||||
;; Apply `doom-theme'
|
||||
(add-hook (if (daemonp)
|
||||
'after-make-frame-functions
|
||||
'doom-init-ui-hook)
|
||||
'doom-after-init-modules-hook)
|
||||
#'doom-init-theme-h)
|
||||
|
||||
(add-hook 'window-setup-hook #'doom-init-ui-h)
|
||||
;; Apply `doom-font' et co
|
||||
(add-hook 'doom-after-init-modules-hook #'doom-init-fonts-h)
|
||||
|
||||
(add-hook 'window-setup-hook #'doom-init-ui-h 'append)
|
||||
|
||||
|
||||
;;
|
||||
|
@ -713,8 +693,9 @@ This offers a moderate boost in startup (or theme switch) time, so long as
|
|||
(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, so we define it to prevent void-function
|
||||
;; errors emitted from packages that blindly try to use it.
|
||||
;; 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))
|
||||
|
||||
|
@ -727,15 +708,17 @@ disable it to fix all that visual noise."
|
|||
(add-function :around whitespace-enable-predicate #'doom-disable-whitespace-mode-in-childframes-a))
|
||||
|
||||
;; Don't display messages in the minibuffer when using the minibuffer
|
||||
(defmacro doom-silence-motion-key (command key)
|
||||
(let ((key-command (intern (format "doom/silent-%s" command))))
|
||||
`(progn
|
||||
(defun ,key-command ()
|
||||
(interactive)
|
||||
(ignore-errors (call-interactively ',command)))
|
||||
(define-key minibuffer-local-map (kbd ,key) #',key-command))))
|
||||
(doom-silence-motion-key backward-delete-char "<backspace>")
|
||||
(doom-silence-motion-key delete-char "<delete>")
|
||||
;; DEPRECATED Remove when Emacs 26.x support is dropped.
|
||||
(eval-when! (not EMACS27+)
|
||||
(defmacro doom-silence-motion-key (command key)
|
||||
(let ((key-command (intern (format "doom/silent-%s" command))))
|
||||
`(progn
|
||||
(defun ,key-command ()
|
||||
(interactive)
|
||||
(ignore-errors (call-interactively ',command)))
|
||||
(define-key minibuffer-local-map (kbd ,key) #',key-command))))
|
||||
(doom-silence-motion-key backward-delete-char "<backspace>")
|
||||
(doom-silence-motion-key delete-char "<delete>"))
|
||||
|
||||
(provide 'core-ui)
|
||||
;;; core-ui.el ends here
|
||||
|
|
|
@ -28,19 +28,25 @@ envvar will enable this at startup.")
|
|||
(defconst IS-WINDOWS (memq system-type '(cygwin windows-nt ms-dos)))
|
||||
(defconst IS-BSD (or IS-MAC (eq system-type 'berkeley-unix)))
|
||||
|
||||
;; 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))))
|
||||
|
||||
;; Unix tools look for HOME, but this is normally not defined on Windows.
|
||||
(when (and IS-WINDOWS (null (getenv-internal "HOME")))
|
||||
(setenv "HOME" (getenv "USERPROFILE"))
|
||||
(setq abbreviated-home-dir nil))
|
||||
|
||||
;; Contrary to what many Emacs users have in their configs, you really don't
|
||||
;; need more than this to make UTF-8 the default coding system:
|
||||
(when (fboundp 'set-charset-priority)
|
||||
(set-charset-priority 'unicode)) ; pretty
|
||||
(prefer-coding-system 'utf-8) ; pretty
|
||||
(setq locale-coding-system 'utf-8) ; please
|
||||
;; The clipboard's on Windows could be in a wider (or thinner) encoding than
|
||||
;; utf-8 (likely UTF-16), so let Emacs/the OS decide what encoding to use there.
|
||||
;; 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")
|
||||
;; ...but the clipboard's on Windows could be in another encoding (likely
|
||||
;; utf-16), so let Emacs/the OS decide what to use there.
|
||||
(unless IS-WINDOWS
|
||||
(setq selection-coding-system 'utf-8)) ; with sugar on top
|
||||
|
||||
|
@ -127,57 +133,68 @@ users).")
|
|||
|
||||
(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 before `doom/reload' has reloaded Doom.")
|
||||
"A list of hooks to run after `doom/reload' has reloaded Doom.")
|
||||
|
||||
(defvar doom-before-reload-hook nil
|
||||
"A list of hooks to run after `doom/reload' has reloaded Doom.")
|
||||
"A list of hooks to run before `doom/reload' has reloaded Doom.")
|
||||
|
||||
|
||||
;;
|
||||
;;; Native Compilation support (http://akrl.sdf.org/gccemacs.html)
|
||||
|
||||
;; Prevent unwanted runtime builds in gccemacs (native-comp); packages are
|
||||
;; compiled ahead-of-time when they are installed and site files are compiled
|
||||
;; when gccemacs is installed.
|
||||
(setq comp-deferred-compilation nil)
|
||||
;; REVIEW Remove after a month
|
||||
(when EMACS28+
|
||||
(mapc (lambda (varset)
|
||||
(unless (boundp (car varset))
|
||||
(defvaralias (car varset) (cdr varset))))
|
||||
'((native-comp-deferred-compilation . comp-deferred-compilation)
|
||||
(native-comp-deferred-compilation-deny-list . comp-deferred-compilation-deny-list)
|
||||
(native-comp-eln-load-path . comp-eln-load-path)
|
||||
(native-comp-warning-on-missing-source . comp-warning-on-missing-source)
|
||||
(native-comp-driver-options . comp-native-driver-options)
|
||||
(native-comp-async-query-on-exit . comp-async-query-on-exit)
|
||||
(native-comp-async-report-warnings-errors . comp-async-report-warnings-errors)
|
||||
(native-comp-async-env-modifier-form . comp-async-env-modifier-form)
|
||||
(native-comp-async-all-done-hook . comp-async-all-done-hook)
|
||||
(native-comp-async-cu-done-functions . comp-async-cu-done-functions)
|
||||
(native-comp-async-jobs-number . comp-async-jobs-number)
|
||||
(native-comp-never-optimize-functions . comp-never-optimize-functions)
|
||||
(native-comp-bootstrap-deny-list . comp-bootstrap-deny-list)
|
||||
(native-comp-always-compile . comp-always-compile)
|
||||
(native-comp-verbose . comp-verbose)
|
||||
(native-comp-debug . comp-debug)
|
||||
(native-comp-speed . comp-speed))))
|
||||
|
||||
;; Don't store eln files in ~/.emacs.d/eln-cache (they are likely to be purged
|
||||
;; when upgrading Doom).
|
||||
(when (boundp 'comp-eln-load-path)
|
||||
(add-to-list 'comp-eln-load-path (concat doom-cache-dir "eln/")))
|
||||
(when (boundp 'native-comp-eln-load-path)
|
||||
(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 'comp-deferred-compilation-deny-list)
|
||||
(mapc (apply-partially #'add-to-list 'native-comp-deferred-compilation-deny-list)
|
||||
(let ((local-dir-re (concat "\\`" (regexp-quote doom-local-dir))))
|
||||
(list (concat "\\`" (regexp-quote doom-autoloads-file) "\\'")
|
||||
(concat local-dir-re ".*/evil-collection-vterm\\.el\\'")
|
||||
(concat local-dir-re ".*/with-editor\\.el\\'")
|
||||
;; https://github.com/nnicandro/emacs-jupyter/issues/297
|
||||
(concat local-dir-re ".*/jupyter-channel\\.el\\'"))))
|
||||
;; 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 ()
|
||||
:override #'comp-effective-async-max-jobs
|
||||
(if (zerop comp-async-jobs-number)
|
||||
(setq comp-num-cpus (doom-num-cpus))
|
||||
comp-async-jobs-number)))
|
||||
(concat local-dir-re ".*/jupyter-channel\\.el\\'")))))
|
||||
|
||||
|
||||
;;
|
||||
;;; Core libraries
|
||||
|
||||
;; Ensure Doom's core libraries are visible for loading
|
||||
(add-to-list 'load-path doom-core-dir)
|
||||
|
||||
;; Just the... bear necessities~
|
||||
(require 'subr-x)
|
||||
(require 'cl-lib)
|
||||
|
@ -208,7 +225,8 @@ users).")
|
|||
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.
|
||||
;; 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)
|
||||
|
||||
|
@ -246,8 +264,7 @@ config.el instead."
|
|||
;;; Optimizations
|
||||
|
||||
;; A second, case-insensitive pass over `auto-mode-alist' is time wasted, and
|
||||
;; indicates misconfiguration (or that the user needs to stop relying on case
|
||||
;; insensitivity).
|
||||
;; indicates misconfiguration (don't rely on case insensitivity for file names).
|
||||
(setq auto-mode-case-fold nil)
|
||||
|
||||
;; Disable bidirectional text rendering for a modest performance boost. I've set
|
||||
|
@ -279,31 +296,35 @@ config.el instead."
|
|||
;; fonts that are larger than the system default (which would resize the frame).
|
||||
(setq frame-inhibit-implied-resize t)
|
||||
|
||||
;; Adopt a sneaky garbage collection strategy of waiting until idle time to
|
||||
;; collect; staving off the collector while the user is working.
|
||||
(setq gcmh-idle-delay 5
|
||||
;; 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.
|
||||
(setq gcmh-idle-delay 5 ; default is 15s
|
||||
gcmh-high-cons-threshold (* 16 1024 1024) ; 16mb
|
||||
gcmh-verbose doom-debug-p)
|
||||
|
||||
;; Emacs "updates" its ui more often than it needs to, so we slow it down
|
||||
;; slightly from 0.5s:
|
||||
(setq idle-update-delay 1.0)
|
||||
;; 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 we inhibit it there anyway. This increases memory
|
||||
;; usage, however!
|
||||
;; hasn't been determined, but do it there anyway, just in case. This increases
|
||||
;; memory usage, however!
|
||||
(setq inhibit-compacting-font-caches t)
|
||||
|
||||
;; 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 with performance while scrolling.
|
||||
;; 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 IS-WINDOWS
|
||||
(setq w32-get-true-file-attributes nil ; decrease file IO workload
|
||||
w32-pipe-read-delay 0 ; faster ipc
|
||||
w32-pipe-read-delay 0 ; faster IPC
|
||||
w32-pipe-buffer-size (* 64 1024))) ; read more at a time (was 4K)
|
||||
|
||||
;; Remove command line options that aren't relevant to our current OS; means
|
||||
|
@ -313,9 +334,8 @@ config.el instead."
|
|||
|
||||
;; 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 until
|
||||
;; later in the startup process and, for some reason, it runs much faster
|
||||
;; when it does.
|
||||
;; 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
|
||||
|
@ -372,8 +392,7 @@ config.el instead."
|
|||
"Run MODE-local-vars-hook after local variables are initialized."
|
||||
(unless doom-inhibit-local-var-hooks
|
||||
(setq-local doom-inhibit-local-var-hooks t)
|
||||
(run-hook-wrapped (intern-soft (format "%s-local-vars-hook" major-mode))
|
||||
#'doom-try-run-hook)))
|
||||
(doom-run-hooks (intern-soft (format "%s-local-vars-hook" major-mode)))))
|
||||
|
||||
|
||||
;;
|
||||
|
@ -381,7 +400,7 @@ config.el instead."
|
|||
|
||||
(defvar doom-incremental-packages '(t)
|
||||
"A list of packages to load incrementally after startup. Any large packages
|
||||
here may cause noticable pauses, so it's recommended you break them up into
|
||||
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:
|
||||
|
||||
|
@ -417,21 +436,22 @@ intervals."
|
|||
(if (not now)
|
||||
(appendq! doom-incremental-packages packages)
|
||||
(while packages
|
||||
(let ((req (pop packages)))
|
||||
(let* ((gc-cons-threshold most-positive-fixnum)
|
||||
(req (pop packages)))
|
||||
(unless (featurep req)
|
||||
(doom-log "Incrementally loading %s" req)
|
||||
(condition-case e
|
||||
(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)
|
||||
(gc-cons-threshold most-positive-fixnum)
|
||||
(inhibit-message t)
|
||||
file-name-handler-alist)
|
||||
(require req nil t))
|
||||
t)
|
||||
(push req packages))
|
||||
((error debug)
|
||||
(error
|
||||
(message "Failed to load %S package incrementally, because: %s"
|
||||
req e)))
|
||||
(if (not packages)
|
||||
|
@ -456,17 +476,20 @@ If this is a daemon session, load them all immediately instead."
|
|||
;;
|
||||
;;; Bootstrap helpers
|
||||
|
||||
(defun doom-finish-init-h ()
|
||||
"Set `doom-init-time'."
|
||||
(setq doom-init-time
|
||||
(float-time (time-subtract (current-time) before-init-time))))
|
||||
|
||||
(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 doom--initial-load-path))
|
||||
(- (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))))))
|
||||
(or doom-init-time (doom-finish-init-h))))
|
||||
|
||||
(defun doom-load-envvars-file (file &optional noerror)
|
||||
"Read and set envvars from FILE.
|
||||
|
@ -475,69 +498,85 @@ 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)))
|
||||
(when-let
|
||||
(env
|
||||
(with-temp-buffer
|
||||
(save-excursion
|
||||
(setq-local coding-system-for-read 'utf-8)
|
||||
(insert "\0\n") ; to prevent off-by-one
|
||||
(insert-file-contents file))
|
||||
(save-match-data
|
||||
(when (re-search-forward "\0\n *\\([^#= \n]*\\)=" nil t)
|
||||
(setq
|
||||
env (split-string (buffer-substring (match-beginning 1) (point-max))
|
||||
"\0\n"
|
||||
'omit-nulls))))))
|
||||
(setq-default
|
||||
process-environment
|
||||
(append (nreverse 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)))
|
||||
env)))
|
||||
(with-temp-buffer
|
||||
(insert-file-contents file)
|
||||
(when-let (env (read (current-buffer)))
|
||||
(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)))
|
||||
env))))
|
||||
|
||||
(defun doom-try-run-hook (hook)
|
||||
(defun doom-run-hook (hook)
|
||||
"Run HOOK (a hook function) with better error handling.
|
||||
Meant to be used with `run-hook-wrapped'."
|
||||
(doom-log "Running doom hook: %s" hook)
|
||||
(condition-case e
|
||||
(condition-case-unless-debug e
|
||||
(funcall hook)
|
||||
((debug error)
|
||||
(error
|
||||
(signal 'doom-hook-error (list hook e))))
|
||||
;; return nil so `run-hook-wrapped' won't short circuit
|
||||
nil)
|
||||
|
||||
(defun doom-run-hook-on (hook-var triggers)
|
||||
"Configure HOOK-VAR to be invoked exactly once after init whenever any of the
|
||||
TRIGGERS are invoked. Once HOOK-VAR gets triggered, it resets to 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.
|
||||
|
||||
TRIGGERS is a list of quoted hooks and/or sharp-quoted functions."
|
||||
(let ((fn (intern (format "%s-h" hook-var))))
|
||||
(fset
|
||||
fn (lambda (&rest _)
|
||||
(when after-init-time
|
||||
(run-hook-wrapped hook-var #'doom-try-run-hook)
|
||||
(set hook-var nil))))
|
||||
(put hook-var 'permanent-local t)
|
||||
(dolist (on triggers)
|
||||
(if (functionp on)
|
||||
(advice-add on :before fn)
|
||||
(add-hook on fn)))))
|
||||
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 (if EMACS27+ -101))))
|
||||
fn)))
|
||||
|
||||
|
||||
;;
|
||||
;;; Bootstrapper
|
||||
|
||||
(defvar doom--initial-exec-path exec-path)
|
||||
(defvar doom--initial-load-path load-path)
|
||||
(defvar doom--initial-process-environment process-environment)
|
||||
|
||||
(defun doom-initialize (&optional force-p)
|
||||
"Bootstrap Doom, if it hasn't already (or if FORCE-P is non-nil).
|
||||
|
||||
|
@ -570,21 +609,19 @@ to least)."
|
|||
|
||||
;; Reset as much state as possible, so `doom-initialize' can be treated like
|
||||
;; a reset function. e.g. when reloading the config.
|
||||
(setq-default exec-path doom--initial-exec-path
|
||||
load-path doom--initial-load-path
|
||||
process-environment doom--initial-process-environment)
|
||||
(dolist (var '(exec-path load-path process-environment))
|
||||
(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 e
|
||||
(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)
|
||||
(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!
|
||||
|
@ -596,6 +633,8 @@ to least)."
|
|||
(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.
|
||||
|
@ -614,20 +653,16 @@ to least)."
|
|||
(eval-after-load 'package '(require 'core-packages))
|
||||
(eval-after-load 'straight '(doom-initialize-packages))
|
||||
|
||||
;; Bootstrap our GC manager
|
||||
(add-hook 'doom-first-buffer-hook #'gcmh-mode)
|
||||
|
||||
;; Bootstrap the interactive session
|
||||
(add-hook 'after-change-major-mode-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 '(after-find-file doom-switch-buffer-hook))
|
||||
(doom-run-hook-on 'doom-first-file-hook '(after-find-file dired-initial-position-hook))
|
||||
(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))
|
||||
(if doom-debug-p (doom-debug-mode +1))
|
||||
|
||||
;; Load core/core-*.el, the user's private init.el, then their config.el
|
||||
(doom-initialize-modules force-p))
|
||||
;; Bootstrap our GC manager
|
||||
(add-hook 'doom-first-buffer-hook #'gcmh-mode))
|
||||
|
||||
doom-init-p)
|
||||
|
||||
|
|
|
@ -17,33 +17,28 @@
|
|||
:branch ,straight-repository-branch
|
||||
:local-repo "straight.el"
|
||||
:files ("straight*.el"))
|
||||
:pin "a32c97cb427b7f14dfd066f36a58d1740e20ed69")
|
||||
:pin "e46292db6910e8e7701d53acaf188de0101ae30f")
|
||||
|
||||
;; core-modules.el
|
||||
(package! use-package
|
||||
:type 'core
|
||||
:pin "365c73d2618dd0040a32c2601c5456ab5495b812")
|
||||
:pin "a7422fb8ab1baee19adb2717b5b47b9c3812a84c")
|
||||
|
||||
;; core-ui.el
|
||||
(package! all-the-icons :pin "9aa16ae198073fe839a0abfa9a7d3a9dc85ef5f9")
|
||||
(package! all-the-icons :pin "d711dc10b2504c06500c171ea5860f15827fdb72")
|
||||
(package! hide-mode-line :pin "88888825b5b27b300683e662fa3be88d954b1cea")
|
||||
(package! highlight-numbers :pin "8b4744c7f46c72b1d3d599d4fb75ef8183dee307")
|
||||
(package! rainbow-delimiters :pin "f43d48a24602be3ec899345a3326ed0247b960c6")
|
||||
(package! rainbow-delimiters :pin "d576e6694ad3a3e88b2bb1363305b38fa364c149")
|
||||
(package! restart-emacs :pin "1607da2bc657fe05ae01f7fdf26f716eafead02c")
|
||||
|
||||
;; core-editor.el
|
||||
(package! better-jumper :pin "5ef53fcee4e74f397c8d275679e5596b52582b57")
|
||||
(package! dtrt-indent :pin "854b9a1ce93d9926018a0eb18e6e552769c5407d")
|
||||
(package! helpful :pin "584ecc887bb92133119f93a6716cdf7af0b51dca")
|
||||
(package! better-jumper :pin "411ecdf6e7a3e1b4ced7605070d2309e5fc46556")
|
||||
(package! dtrt-indent :pin "9714f2c5f1c9b7c21e732df8c15a870a88caba84")
|
||||
(package! helpful :pin "7e4b1f0d5572a4e2b8ee7a9b084ef863d0315a73")
|
||||
(package! pcre2el :pin "0b5b2a2c173aab3fd14aac6cf5e90ad3bf58fa7d")
|
||||
(package! smartparens :pin "63695c64233d215a92bf08e762f643cdb595bdd9")
|
||||
(package! so-long
|
||||
:built-in 'prefer ; included in Emacs 27+
|
||||
;; REVIEW so-long is slated to be published to ELPA eventually, but until then
|
||||
;; I've created my own mirror for it because git.savannah.gnu.org runs
|
||||
;; on a potato.
|
||||
:recipe (:host github :repo "hlissner/emacs-so-long")
|
||||
:pin "ed666b0716f60e8988c455804de24b55919e71ca")
|
||||
(package! smartparens :pin "25f4d6d1b732f4deabf922059d22a0a7dc04bd0a")
|
||||
;; DEPRECATED Built into Emacs 27+; remove when we drop 26 support
|
||||
(package! so-long :built-in 'prefer :pin "1da43ed63b5f9a8188eb8107bbad842d10831537")
|
||||
(package! ws-butler
|
||||
;; Use my fork of ws-butler, which has a few choice improvements and
|
||||
;; optimizations (the original has been abandoned).
|
||||
|
@ -51,8 +46,9 @@
|
|||
:pin "2bb49d3ee7d2cba133bc7e9cdac416cd1c5e4fe0")
|
||||
|
||||
;; core-projects.el
|
||||
(package! projectile :pin "c31bd41c0b9d6fba8837ebfd3a31dec0b3cd73c6")
|
||||
(package! projectile :pin "35c6f9898272796694d04ab4fc4fbc85751e6b44")
|
||||
(package! project :pin "ef2d4879d70a757e4c23c50a35c5a386eca910ed")
|
||||
|
||||
;; core-keybinds.el
|
||||
(package! general :pin "a0b17d207badf462311b2eef7c065b884462cb7c")
|
||||
(package! which-key :pin "428aedfce0157920814fbb2ae5d00b4aea89df88")
|
||||
(package! which-key :pin "5fb30301cb3b4fca5a0e1ce8ec1ef59290b79199")
|
||||
|
|
|
@ -1,5 +1,9 @@
|
|||
#+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?]]
|
||||
|
|
|
@ -35,7 +35,7 @@ us know!
|
|||
- [[#doom-emacs][Doom Emacs]]
|
||||
- [[#the-bindoom-utility][The ~bin/doom~ utility]]
|
||||
- [[#install-doom-manually][Install Doom Manually]]
|
||||
- [[#install-doom-alongside-other-configs-with-chemacs][Install Doom alongside other configs (with Chemacs)]]
|
||||
- [[#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]]
|
||||
|
@ -96,8 +96,8 @@ us know!
|
|||
* Install
|
||||
This is what you'll have installed by the end of this section:
|
||||
|
||||
- Git 2.23+
|
||||
- Emacs 26.1+ *(27.x is recommended)*
|
||||
- Git 2.28+
|
||||
- Emacs 26.3+ *(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) --
|
||||
|
@ -116,26 +116,50 @@ especially for LSP users. The installation guides below will touch on installing
|
|||
** Emacs & dependencies
|
||||
*** On Linux
|
||||
In the unusual case that Emacs 26.x is unavailable through your package manager,
|
||||
you'll have to [[https://www.gnu.org/software/emacs/manual/html_node/efaq/Installing-Emacs.html][build it from source]]. Otherwise:
|
||||
you'll have to [[https://www.gnu.org/software/emacs/manual/html_node/efaq/Installing-Emacs.html][build it from source]], but here are installation instructions for many popular Linux distributions:
|
||||
|
||||
**** Ubuntu
|
||||
Since only Emacs 25.3 is available on Ubuntu 18.04 (and 24.3 on Ubuntu 14 or
|
||||
16), extra steps are necessary to acquire 26.3:
|
||||
There are two challenges for Ubuntu users:
|
||||
|
||||
+ Ubuntu <= 18.04 only provide Emacs <= 25.3 (Doom requires 26.3+)
|
||||
+ Ubuntu <= 20.04 only provide git <= 2.25.1 (Doom requires 2.28+)
|
||||
|
||||
To get around these:
|
||||
|
||||
***** Git
|
||||
To install Git 2.28:
|
||||
|
||||
#+BEGIN_SRC bash
|
||||
add-apt-repository ppa:git-core/ppa
|
||||
apt update
|
||||
apt install git
|
||||
#+END_SRC
|
||||
|
||||
***** Emacs
|
||||
To install Emacs 27, you'll need either a PPA or Snap:
|
||||
|
||||
#+BEGIN_SRC bash
|
||||
add-apt-repository ppa:kelleyk/emacs
|
||||
apt-get update
|
||||
apt-get install emacs26
|
||||
apt-get install emacs27
|
||||
#+END_SRC
|
||||
|
||||
Then install the dependencies:
|
||||
Or through snap:
|
||||
|
||||
#+BEGIN_SRC bash
|
||||
# required dependencies
|
||||
apt-get install git ripgrep
|
||||
# optional dependencies
|
||||
apt-get install fd-find
|
||||
snap install emacs --classic
|
||||
#+END_SRC
|
||||
|
||||
To install Emacs 27 on Ubuntu, you'll need to build it from source.
|
||||
***** 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
|
||||
|
@ -162,7 +186,7 @@ permanently with the following added to ~etc/nixos/configuration.nix~:
|
|||
environment.systemPackages = with pkgs; [
|
||||
# required dependencies
|
||||
git
|
||||
emacs # Emacs 26.3
|
||||
emacs # Emacs 27.2
|
||||
ripgrep
|
||||
# optional dependencies
|
||||
coreutils # basic GNU utilities
|
||||
|
@ -171,14 +195,14 @@ environment.systemPackages = with pkgs; [
|
|||
];
|
||||
#+END_SRC
|
||||
|
||||
Installing Emacs 27 will require [[https://github.com/nix-community/emacs-overlay/issues][nix-community/emacs-overlay]]:
|
||||
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 = with pkgs; [
|
||||
emacsUnstable # Installs Emacs 27
|
||||
environment.systemPackages = [
|
||||
pkgs.emacsGcc # Installs Emacs 28 + native-comp
|
||||
];
|
||||
#+END_SRC
|
||||
|
||||
|
@ -238,22 +262,22 @@ xcode-select --install
|
|||
For Emacs itself, these three formulas are the best options, ordered from most
|
||||
to least recommended for Doom (based on compatibility).
|
||||
|
||||
- [[https://github.com/d12frosted/homebrew-emacs-plus][emacs-plus]]:
|
||||
#+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://bitbucket.org/mituharu/emacs-mac/overview][emacs-mac]] is another acceptable option. It offers slightly better integration
|
||||
with macOS, native emojis and better childframe support. However, at the time
|
||||
of writing, it [[https://github.com/railwaycat/homebrew-emacsmacport/issues/52][lacks multi-tty support]] (which impacts daemon usage):
|
||||
- [[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
|
||||
|
@ -272,9 +296,9 @@ likely* to cause issues later on. They are not recommended:
|
|||
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]] (26.3) and [[https://ports.macports.org/port/emacs-devel/summary][emacs-devel]] (27) -- Installs terminal-only Emacs
|
||||
+ [[https://ports.macports.org/port/emacs-app/summary][emacs-app]] (26.3), [[https://ports.macports.org/port/emacs-app-devel/summary][emacs-app-devel]] (27) -- Installs GUI Emacs
|
||||
+ [[https://ports.macports.org/port/emacs-mac-app/summary][emacs-mac-app]] (26.3) -- the [[https://bitbucket.org/mituharu/emacs-mac][Mitsuharu Yamamoto mac port]]
|
||||
+ [[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
|
||||
|
@ -337,14 +361,18 @@ Now we're ready to move on!
|
|||
[[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 fd llvm
|
||||
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 fd llvm
|
||||
scoop install git emacs ripgrep
|
||||
# Optional dependencies
|
||||
scoop install fd llvm
|
||||
#+END_SRC
|
||||
|
||||
**** With a precompiled binary + Git Bash
|
||||
|
@ -353,7 +381,7 @@ scoop install git emacs ripgrep fd llvm
|
|||
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 26.3 from http://ftp.wayne.edu/gnu/emacs/windows/emacs-26/
|
||||
- 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~
|
||||
|
@ -504,8 +532,8 @@ emacs --batch -f all-the-icons-install-fonts
|
|||
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 Chemacs)
|
||||
[[https://github.com/plexus/chemacs][Chemacs]] is a bootloader for Emacs. It allows you to switch between multiple
|
||||
*** 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:
|
||||
|
||||
|
@ -515,22 +543,20 @@ the default config:
|
|||
~/doom-emacs/bin/doom install
|
||||
#+END_SRC
|
||||
|
||||
2. Download [[https://raw.githubusercontent.com/plexus/chemacs/master/.emacs][the Chemacs' startup script]] to =~/.emacs=:
|
||||
2. Move aside any existing config and install Chemacs2 as your new =~/.emacs.d=:
|
||||
#+BEGIN_SRC bash :eval no
|
||||
wget -O ~/.emacs https://raw.githubusercontent.com/plexus/chemacs/master/.emacs
|
||||
[ -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
|
||||
|
||||
#+begin_quote
|
||||
*WARNING:* the =~/.emacs.d= directory must not exist for this to work.
|
||||
#+end_quote
|
||||
|
||||
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")))
|
||||
("spacemacs" . ((user-emacs-directory . "~/spacemacs")))
|
||||
("prelude" . ((user-emacs-directory . "~/prelude"))))
|
||||
("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:
|
||||
|
@ -595,13 +621,13 @@ 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. 26 -> 27 or vice versa) run ~doom build~ too.
|
||||
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. 26 -> 27). Alternatively, reinstall all your packages by deleting
|
||||
(e.g. 27 -> 28). Alternatively, reinstall all your packages by deleting
|
||||
=~/.emacs.d/.local=, then run ~doom sync~.
|
||||
|
||||
* TODO Migrate
|
||||
|
@ -708,7 +734,7 @@ denoted by a plus prefix:
|
|||
#+END_SRC
|
||||
|
||||
Different modules support different flags. You'll find a comprehensive list of
|
||||
available modules and their supported flags in [[file:index.org::*Module list][the Module Index]]. Flags that a
|
||||
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
|
||||
|
@ -932,9 +958,9 @@ live testing. To do this specify a ~:local-repo~ in that package's recipe:
|
|||
;; you want:
|
||||
:files ("*.el" "src/lisp/*.el")
|
||||
|
||||
;; With ':no-byte-compile t' you can avoid having to run 'doom sync'
|
||||
;; every time you change the package.
|
||||
:no-byte-compile t))
|
||||
;; 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
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#+TITLE: Module Appendix
|
||||
#+TITLE: Module Index
|
||||
#+STARTUP: nofold
|
||||
|
||||
Functionality in Doom is divided into collections of code called modules (à la
|
||||
|
@ -27,14 +27,16 @@ 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
|
||||
+ rss =+org= - an RSS client in Emacs
|
||||
+ [[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
|
||||
+ spell =+everywhere +aspell +hunspell +enchant= - Spell checking
|
||||
+ grammar - TODO
|
||||
+ [[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
|
||||
|
@ -49,7 +51,7 @@ completion.
|
|||
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.
|
||||
|
||||
+ literate - For users with literate configs. This will tangle+compile a
|
||||
+ [[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
|
||||
|
@ -78,33 +80,35 @@ Modules that reconfigure or augment packages or features built into Emacs.
|
|||
+ 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
|
||||
+ vc - TODO
|
||||
+ [[file:../modules/emacs/vc/README.org][vc]] - TODO
|
||||
|
||||
* :email
|
||||
+ [[file:../modules/email/mu4e/README.org][mu4e]] =+gmail= - TODO
|
||||
+ notmuch - 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
|
||||
+ crystal - 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
|
||||
+ emacs-lisp - TODO
|
||||
+ erlang =+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
|
||||
|
@ -118,15 +122,15 @@ Modules that bring support for a language or group of languages to Emacs.
|
|||
+ 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
|
||||
+ julia =+lsp= - TODO
|
||||
+ kotlin =+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
|
||||
+ lua =+fennel +moonscript= - 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
|
||||
+ nix - 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
|
||||
|
@ -140,8 +144,8 @@ Modules that bring support for a language or group of languages to Emacs.
|
|||
+ rst - TODO
|
||||
+ [[file:../modules/lang/ruby/README.org][ruby]] =+lsp +rvm +rbenv +rails +chruby=
|
||||
+ [[file:../modules/lang/rust/README.org][rust]] =+lsp= - TODO
|
||||
+ scala =+lsp= - TODO
|
||||
+ [[file:../modules/lang/scheme/README.org][scheme]] - 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
|
||||
|
@ -149,18 +153,19 @@ Modules that bring support for a language or group of languages to Emacs.
|
|||
+ 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
|
||||
+ tty =+osc= - Improves the terminal Emacs experience.
|
||||
+ [[file:../modules/os/tty/README.org][tty]] =+osc= - Improves the terminal Emacs experience.
|
||||
|
||||
* :term
|
||||
Modules that offer terminal emulation.
|
||||
|
||||
+ eshell - TODO
|
||||
+ [[file:../modules/term/eshell/README.org][eshell]] - TODO
|
||||
+ shell - TODO
|
||||
+ term - TODO
|
||||
+ [[file:../modules/term/vterm/README.org][vterm]] - TODO
|
||||
|
@ -181,14 +186,14 @@ Small modules that give Emacs access to external tools & services.
|
|||
+ [[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
|
||||
+ pass =+auth= - TODO
|
||||
+ pdf - TODO
|
||||
+ [[file:../modules/tools/pass/README.org][pass]] =+auth= - TODO
|
||||
+ [[file:../modules/tools/pdf/README.org][pdf]] - TODO
|
||||
+ prodigy - TODO
|
||||
+ rgb - 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
|
||||
+ upload - TODO
|
||||
+ [[file:../modules/tools/upload/README.org][upload]] - TODO
|
||||
|
||||
* :ui
|
||||
Aesthetic modules that affect the Emacs interface or user experience.
|
||||
|
@ -198,7 +203,7 @@ Aesthetic modules that affect the Emacs interface or user experience.
|
|||
+ [[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
|
||||
+ fill-column - TODO
|
||||
+ [[file:../modules/ui/fill-column/README.org][fill-column]] - TODO
|
||||
+ [[file:../modules/ui/hl-todo/README.org][hl-todo]] - TODO
|
||||
+ [[file:../modules/ui/hydra/README.org][hydra]] - TODO
|
||||
+ indent-guides - TODO
|
||||
|
@ -210,7 +215,7 @@ Aesthetic modules that affect the Emacs interface or user experience.
|
|||
+ [[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
|
||||
+ treemacs - 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
|
||||
|
|
|
@ -8,6 +8,14 @@
|
|||
;; 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.
|
||||
;; REVIEW Remove after a couple months
|
||||
(if (boundp 'comp-deferred-compilation)
|
||||
(setq comp-deferred-compilation nil)
|
||||
(setq native-comp-deferred-compilation 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.
|
||||
|
@ -19,22 +27,23 @@
|
|||
(setq package-enable-at-startup nil)
|
||||
(fset #'package--ensure-init-file #'ignore) ; DEPRECATED Removed in 28
|
||||
|
||||
;; `file-name-handler-alist' is consulted on every `require', `load' and various
|
||||
;; path/io functions. You get a minor speed up by nooping this. However, this
|
||||
;; may 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)
|
||||
(unless (daemonp)
|
||||
(defvar doom--initial-file-name-handler-alist file-name-handler-alist)
|
||||
(setq file-name-handler-alist nil)
|
||||
;; 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 ()
|
||||
;; Re-add rather than `setq', because changes to `file-name-handler-alist'
|
||||
;; since startup ought to be preserved.
|
||||
(dolist (handler file-name-handler-alist)
|
||||
(add-to-list 'doom--initial-file-name-handler-alist handler))
|
||||
(setq file-name-handler-alist doom--initial-file-name-handler-alist))
|
||||
(add-hook 'emacs-startup-hook #'doom-reset-file-handler-alist-h))
|
||||
(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)))
|
||||
|
||||
;; Ensure Doom is running out of this file's directory
|
||||
(setq user-emacs-directory (file-name-directory load-file-name))
|
||||
|
|
|
@ -27,15 +27,31 @@
|
|||
;;
|
||||
;;; License: MIT
|
||||
|
||||
;; Fix shitty transparency
|
||||
(set-frame-parameter (selected-frame) 'alpha '(80 . 50))
|
||||
(add-to-list 'default-frame-alist '(alpha . (80 . 50)))
|
||||
|
||||
;; 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))
|
||||
|
||||
;; And let 'er rip!
|
||||
;; 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)
|
||||
|
|
|
@ -80,7 +80,7 @@
|
|||
|
||||
:checkers
|
||||
syntax ; tasing you for every semicolon you forget
|
||||
;;spell ; tasing you for misspelling mispelling
|
||||
;;(spell +flyspell) ; tasing you for misspelling mispelling
|
||||
;;grammar ; tasing grammar mistake every you make
|
||||
|
||||
:tools
|
||||
|
@ -111,7 +111,8 @@
|
|||
|
||||
:lang
|
||||
;;agda ; types of types of types of types...
|
||||
;;cc ; C/C++/Obj-C madness
|
||||
;;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
|
||||
|
@ -124,6 +125,7 @@
|
|||
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
|
||||
;;fsharp ; ML stands for Microsoft's Language
|
||||
;;fstar ; (dependent) types and (monadic) effects and Z3
|
||||
|
@ -138,9 +140,8 @@
|
|||
;;julia ; a better, faster MATLAB
|
||||
;;kotlin ; a better, slicker Java(Script)
|
||||
;;latex ; writing papers in Emacs has never been so fun
|
||||
;;lean
|
||||
;;factor
|
||||
;;ledger ; an accounting system in Emacs
|
||||
;;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
|
||||
|
@ -159,7 +160,7 @@
|
|||
;;(ruby +rails) ; 1.step {|i| p "Ruby is #{i.even? ? 'love' : 'life'}"}
|
||||
;;rust ; Fe2O3.unwrap().unwrap().unwrap().unwrap()
|
||||
;;scala ; java, but good
|
||||
;;scheme ; a fully conniving family of lisps
|
||||
;;(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.
|
||||
|
@ -167,6 +168,7 @@
|
|||
;;terra ; Earth and Moon in alignment for performance.
|
||||
;;web ; the tubes
|
||||
;;yaml ; JSON, but readable
|
||||
;;zig ; C, but simpler
|
||||
|
||||
:email
|
||||
;;(mu4e +gmail)
|
||||
|
@ -175,6 +177,8 @@
|
|||
|
||||
: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
|
||||
|
|
|
@ -29,11 +29,12 @@
|
|||
"TODO"
|
||||
(interactive)
|
||||
(if (featurep! :ui workspaces)
|
||||
(+workspace/delete "Calendar")
|
||||
(doom-kill-matching-buffers "^\\*cfw:")
|
||||
(when (+workspace-exists-p "Calendar")
|
||||
(+workspace/delete "Calendar"))
|
||||
(when (window-configuration-p +calendar--wconf)
|
||||
(set-window-configuration +calendar--wconf))
|
||||
(setq +calendar--wconf nil)))
|
||||
(setq +calendar--wconf nil))
|
||||
(doom-kill-matching-buffers "^\\*cfw[:-]"))
|
||||
|
||||
;;;###autoload
|
||||
(defun +calendar/open-calendar ()
|
||||
|
|
|
@ -22,10 +22,52 @@
|
|||
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)
|
||||
(add-hook 'cfw:calendar-mode-hook #'hide-mode-line-mode)
|
||||
|
||||
(advice-add #'cfw:render-button :override #'+calendar-cfw:render-button-a))
|
||||
|
||||
|
@ -37,22 +79,17 @@
|
|||
cfw:open-org-calendar-withkevin
|
||||
my-open-calendar))
|
||||
|
||||
|
||||
(use-package! calfw-cal
|
||||
:commands (cfw:cal-create-source))
|
||||
|
||||
|
||||
(use-package! calfw-ical
|
||||
:commands (cfw:ical-create-source))
|
||||
|
||||
|
||||
(use-package! org-gcal
|
||||
:commands (org-gcal-sync
|
||||
org-gcal-fetch
|
||||
org-gcal-post-at-point
|
||||
org-gcal-delete-at-point)
|
||||
:defer t
|
||||
:init
|
||||
(defvar org-gcal-dir (concat doom-cache-dir "org-gcal/"))
|
||||
(defvar org-gcal-token-file (concat org-gcal-dir "token.gpg"))
|
||||
:config
|
||||
;; hack to avoid the deferred.el error
|
||||
(defun org-gcal--notify (title mes)
|
||||
(message "org-gcal::%s - %s" title mes)))
|
||||
(defvar org-gcal-token-file (concat org-gcal-dir "token.gpg")))
|
||||
|
|
|
@ -5,4 +5,4 @@
|
|||
(package! calfw-org :pin "03abce97620a4a7f7ec5f911e669da9031ab9088")
|
||||
(package! calfw-cal :pin "03abce97620a4a7f7ec5f911e669da9031ab9088")
|
||||
(package! calfw-ical :pin "03abce97620a4a7f7ec5f911e669da9031ab9088")
|
||||
(package! org-gcal :pin "2cad2d8c175975dea42903cd4e3fd8bec423c01a")
|
||||
(package! org-gcal :pin "4c2616a4f85adc77b91aa054bb10e76b06f706d5")
|
||||
|
|
|
@ -63,32 +63,13 @@ workspace for it."
|
|||
(+workspace/delete +irc--workspace-name)))))
|
||||
|
||||
;;;###autoload
|
||||
(defun +irc/ivy-jump-to-channel (&optional this-server)
|
||||
"Jump to an open channel or server buffer with ivy. If THIS-SERVER (universal
|
||||
(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")
|
||||
(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))))
|
||||
(call-interactively
|
||||
(cond ((featurep! :completion ivy) #'+irc/ivy-jump-to-channel)
|
||||
((user-error "No jump-to-channel backend is enabled. Enable ivy!")))))
|
||||
|
||||
;;;###autoload
|
||||
(defun +irc/tracking-next-buffer ()
|
||||
|
|
|
@ -149,8 +149,7 @@ playback.")
|
|||
"p" #'circe-command-PART
|
||||
"Q" #'+irc/quit
|
||||
"R" #'circe-reconnect
|
||||
(:when (featurep! :completion ivy)
|
||||
"c" #'+irc/ivy-jump-to-channel))
|
||||
"c" #'+irc/jump-to-channel)
|
||||
(:map circe-channel-mode-map
|
||||
"n" #'circe-command-NAMES)))
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
;; -*- no-byte-compile: t; -*-
|
||||
;;; app/irc/packages.el
|
||||
|
||||
(package! circe :pin "d98986ce933c380b47d727beea8bad81bda65dc9")
|
||||
(package! circe :pin "4778675e0c3bde1c028085b7d96693fe033d2c72")
|
||||
(package! circe-notifications :pin "291149ac12877bbd062da993479d3533a26862b0")
|
||||
|
|
|
@ -68,7 +68,7 @@ When using ~+org~ flag then configuration is easier. You can use ~org-mode~ to c
|
|||
+ 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))~
|
||||
+ 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
|
||||
|
|
|
@ -1,8 +1,21 @@
|
|||
;;; app/rss/autoload.el -*- lexical-binding: t; -*-
|
||||
|
||||
(defvar +rss--wconf nil)
|
||||
|
||||
;;;###autoload
|
||||
(defalias '=rss #'elfeed
|
||||
"Activate (or switch to) `elfeed' in its workspace.")
|
||||
(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 ()
|
||||
|
@ -77,7 +90,12 @@
|
|||
(with-current-buffer b
|
||||
(remove-hook 'kill-buffer-hook #'+rss-cleanup-h :local)
|
||||
(kill-buffer b)))
|
||||
(mapc #'kill-buffer show-buffers)))
|
||||
(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)))
|
||||
|
||||
|
||||
;;
|
||||
|
|
|
@ -65,10 +65,14 @@ easier to scroll through.")
|
|||
:when (featurep! +org)
|
||||
:after elfeed
|
||||
:preface
|
||||
(setq rmh-elfeed-org-files (list "/home/dorian/.config/doom/elfeed.org"))
|
||||
(setq rmh-elfeed-org-files (list "elfeed.org"))
|
||||
:config
|
||||
(and (let ((default-directory org-directory))
|
||||
(setq rmh-elfeed-org-files
|
||||
(cl-remove-if-not
|
||||
#'file-exists-p (mapcar #'expand-file-name rmh-elfeed-org-files))))
|
||||
(elfeed-org)))
|
||||
(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))))))
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
;; -*- no-byte-compile: t; -*-
|
||||
;;; app/rss/packages.el
|
||||
|
||||
(package! elfeed :pin "7b2b6fadaa498fef2ba212a50da4a8afa2a5d305")
|
||||
(package! elfeed-org :pin "77b6bbf222487809813de260447d31c4c59902c9")
|
||||
(package! elfeed :pin "e29c8b91450bd42d90041231f769c4e5fe5070da")
|
||||
(when (featurep! +org)
|
||||
(package! elfeed-org :pin "268efdd0121fa61f63b722c30e0951c5d31224a4"))
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
;;;###autoload
|
||||
(defun +twitter-display-buffer-fn (buf)
|
||||
"A replacement display-buffer command for `twittering-pop-to-buffer-function'
|
||||
that works with the feature/popup module."
|
||||
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'
|
||||
|
|
|
@ -38,9 +38,6 @@
|
|||
(when (featurep! :ui popup)
|
||||
(setq twittering-pop-to-buffer-function #'+twitter-display-buffer-fn))
|
||||
|
||||
(after! solaire-mode
|
||||
(add-hook 'twittering-mode-hook #'solaire-mode))
|
||||
|
||||
;; Custom header-line for twitter buffers
|
||||
(add-hook! 'twittering-mode-hook
|
||||
(defun +twitter-switch-mode-and-header-line-h ()
|
||||
|
|
|
@ -2,4 +2,4 @@
|
|||
;;; app/twitter/packages.el
|
||||
|
||||
(package! twittering-mode :pin "114891e8fdb4f06b1326a6cf795e49c205cf9e29")
|
||||
(package! avy :pin "bbf1e7339eba06784dfe86643bb0fbddf5bb0342")
|
||||
(package! avy :pin "e92cb37457b43336b765630dbfbea8ba4be601fa")
|
||||
|
|
|
@ -88,8 +88,10 @@
|
|||
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
|
||||
|
@ -135,7 +137,22 @@
|
|||
(cmds! (memq 'spell-fu-incorrect-face (face-at-point nil t))
|
||||
#'+spell/correct))
|
||||
|
||||
;; TODO PR this fix upstream!
|
||||
(defadvice! +spell--fix-face-detection-a (orig-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 orig-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)
|
||||
|
|
|
@ -2,11 +2,11 @@
|
|||
;;; checkers/spell/packages.el
|
||||
|
||||
(if (not (featurep! +flyspell))
|
||||
(package! spell-fu :pin "a7db58747131dca2eee0e0757c3d254d391ddd1c")
|
||||
(package! flyspell-correct :pin "6d603a1dc51918f7f8aaf99dd5443f74a0afc794")
|
||||
(package! spell-fu :pin "30c5eea9440915c2795670ecdbf836f3cb9dcc1b")
|
||||
(package! flyspell-correct :pin "d19a090b978a249fc8f6d8b14309a5705a6bb483")
|
||||
(cond ((featurep! :completion ivy)
|
||||
(package! flyspell-correct-ivy))
|
||||
((featurep! :completion helm)
|
||||
(package! flyspell-correct-helm))
|
||||
((package! flyspell-correct-popup)))
|
||||
(package! flyspell-lazy :pin "3ebf68cc9eb10c972a2de8d7861cbabbbce69570"))
|
||||
(package! flyspell-lazy :pin "0fc5996bcee20b46cbd227ae948d343c3bef7339"))
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
;; -*- no-byte-compile: t; -*-
|
||||
;;; checkers/syntax/packages.el
|
||||
|
||||
(package! flycheck :pin "79c9245ee0bd1722d41c865fef69aa2b1ac08fde")
|
||||
(package! flycheck :pin "f8c679fff349850c80541a31de50009c3c15d4c9")
|
||||
(package! flycheck-popup-tip :pin "ef86aad907f27ca076859d8d9416f4f7727619c6")
|
||||
(when (featurep! +childframe)
|
||||
(package! flycheck-posframe :pin "66b73ddb93b357fe9b849d2aa14d5cc9e89e9ffd"))
|
||||
(package! flycheck-posframe :pin "8f60c9bf124ab9597d681504a73fdf116a0bde12"))
|
||||
|
||||
;; TODO flymake?
|
||||
|
|
|
@ -81,8 +81,10 @@ Examples:
|
|||
;;;###autoload
|
||||
(defun +company-has-completion-p ()
|
||||
"Return non-nil if a completion candidate exists at point."
|
||||
(and (company-manual-begin)
|
||||
(= company-candidates-length 1)))
|
||||
(when company-mode
|
||||
(unless company-candidates-length
|
||||
(company-manual-begin))
|
||||
(= company-candidates-length 1)))
|
||||
|
||||
;;;###autoload
|
||||
(defun +company/toggle-auto-completion ()
|
||||
|
|
|
@ -1,14 +1,22 @@
|
|||
;;; completion/company/config.el -*- lexical-binding: t; -*-
|
||||
|
||||
(use-package! company
|
||||
:commands company-complete-common company-manual-begin company-grab-line
|
||||
: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 message-mode help-mode gud-mode)
|
||||
company-global-modes
|
||||
'(not erc-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
|
||||
|
@ -32,6 +40,9 @@
|
|||
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)
|
||||
|
@ -55,8 +66,6 @@
|
|||
|
||||
(add-hook 'after-change-major-mode-hook #'+company-init-backends-h 'append)
|
||||
|
||||
(when (featurep! +tng)
|
||||
(company-tng-mode +1))
|
||||
|
||||
;; NOTE Fix #1335: ensure `company-emulation-alist' is the first item of
|
||||
;; `emulation-mode-map-alists', thus higher priority than keymaps of
|
||||
|
@ -73,6 +82,7 @@
|
|||
(after! eldoc
|
||||
(eldoc-add-command 'company-complete-selection
|
||||
'company-complete-common
|
||||
'company-capf
|
||||
'company-abort)))
|
||||
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
;; -*- no-byte-compile: t; -*-
|
||||
;;; completion/company/packages.el
|
||||
|
||||
(package! company :pin "97cfbc3967c195fb4ccb171735b9b1dea97e681a")
|
||||
(package! company :pin "ee3177cdad47cbe92242eeb52c7bdb9505282db6")
|
||||
(package! company-dict :pin "cd7b8394f6014c57897f65d335d6b2bd65dab1f4")
|
||||
(when (featurep! +childframe)
|
||||
(package! company-box :pin "be37a9a30dc112ab172af21af694e2cb04a74f85"))
|
||||
(package! company-box :pin "aa5f09a5492344e3cc831f0f169a6a8345dec358"))
|
||||
|
|
|
@ -15,8 +15,7 @@ bottom, which is easier on the eyes on big displays."
|
|||
(defun +helm-posframe-display-fn (buffer &optional _resume)
|
||||
"TODO"
|
||||
(setq helm--buffer-in-new-frame-p t)
|
||||
(let ((solaire-p (bound-and-true-p solaire-mode))
|
||||
(params (copy-sequence +helm-posframe-parameters)))
|
||||
(let ((params (copy-sequence +helm-posframe-parameters)))
|
||||
(let-alist params
|
||||
(require 'posframe)
|
||||
(posframe-show
|
||||
|
@ -24,14 +23,14 @@ bottom, which is easier on the eyes on big displays."
|
|||
:position (point)
|
||||
:poshandler +helm-posframe-handler
|
||||
:respect-header-line helm-echo-input-in-header-line
|
||||
:width
|
||||
:min-width
|
||||
(max (cl-typecase .width
|
||||
(integer .width)
|
||||
(float (truncate (* (frame-width) .width)))
|
||||
(function (funcall .width))
|
||||
(t 0))
|
||||
.min-width)
|
||||
:height
|
||||
:min-height
|
||||
(max (cl-typecase .height
|
||||
(integer .height)
|
||||
(float (truncate (* (frame-height) .height)))
|
||||
|
@ -45,9 +44,6 @@ bottom, which is easier on the eyes on big displays."
|
|||
(unless (or (null +helm-posframe-text-scale)
|
||||
(= +helm-posframe-text-scale 0))
|
||||
(with-current-buffer buffer
|
||||
(when (and (featurep 'solaire-mode)
|
||||
(not solaire-p))
|
||||
(solaire-mode +1))
|
||||
(text-scale-set +helm-posframe-text-scale)))))
|
||||
|
||||
;;;###autoload
|
||||
|
|
|
@ -1,23 +1,22 @@
|
|||
;;; completion/helm/config.el -*- lexical-binding: t; -*-
|
||||
|
||||
;; Posframe (requires +childframe)
|
||||
(defvar +helm-posframe-handler #'+helm-poshandler-frame-center-near-bottom-fn
|
||||
"The function that determines the location of the childframe. It should return
|
||||
a cons cell representing the X and Y coordinates. See
|
||||
(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.")
|
||||
"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.5)
|
||||
(width . 0.65)
|
||||
(height . 0.35)
|
||||
(min-width . 80)
|
||||
(min-height . 16))
|
||||
"TODO")
|
||||
|
||||
"Default parameters for the helm childframe.")
|
||||
|
||||
;;
|
||||
;;; Packages
|
||||
|
@ -189,3 +188,12 @@ be negative.")
|
|||
|
||||
(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))
|
||||
|
|
|
@ -1,19 +1,21 @@
|
|||
;; -*- no-byte-compile: t; -*-
|
||||
;;; completion/helm/packages.el
|
||||
|
||||
(package! helm :pin "75562eec4879e7f72119ceee40ab5087c705267e")
|
||||
(package! helm :pin "a7bd522073e4c959ae88ff9eeb2191528242705e")
|
||||
(package! helm-rg :pin "ee0a3c09da0c843715344919400ab0a0190cc9dc")
|
||||
(package! helm-c-yasnippet :pin "28699d9a9caa8b4d37fd66368d93b6c65828c235")
|
||||
(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 "2f3a2a03d6cb9419c25b432637aa11c8d2f9f3b7")
|
||||
(package! helm-projectile :pin "58123f14c392021714fc5d23b9f95c7f95ce07f1")
|
||||
(package! swiper-helm :pin "93fb6db87bc6a5967898b5fd3286954cc72a0008")
|
||||
(when (featurep! +fuzzy)
|
||||
(package! helm-flx :pin "6640fac5cb16bee73c95b8ed1248a4e5e113690e"))
|
||||
(when (featurep! +childframe)
|
||||
(package! posframe :pin "efd7ea490defc53a5b78e7469a3a35d225b766cc"))
|
||||
(package! posframe :pin "739d8fd1081bdd0d20dee9e437d64df58747b871"))
|
||||
(when (featurep! :lang org)
|
||||
(package! helm-org :pin "b7a18dfc17e8b933956d61d68c435eee03a96c24"))
|
||||
(package! helm-org :pin "d67186d3a64e610c03a5f3d583488f018fb032e4"))
|
||||
(when (featurep! +icons)
|
||||
(package! helm-icons :pin "8d2f5e705c8b78a390677cf242024739c932fc95"))
|
||||
(package! helm-descbinds :pin "b72515982396b6e336ad7beb6767e95a80fca192")
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
;;; completion/ido/packages.el
|
||||
|
||||
(package! flx-ido :pin "647cb2f92f9936c62e277d7a74ad54a80502d255")
|
||||
(package! ido-completing-read+ :pin "b9ca2566b867464c25b720e2148d240961c110e7")
|
||||
(package! ido-completing-read+ :pin "00674721e4fce283c918f7316f1158da1d469910")
|
||||
(package! ido-sort-mtime :pin "f638ff0c922af862f5211779f2311a27fde428eb")
|
||||
(package! ido-vertical-mode :pin "5a6e17048528c328c129db6dccfe605f301ddef2")
|
||||
(package! ido-vertical-mode :pin "b1659e967da0687abceca733b389ace24004fa66")
|
||||
(package! crm-custom :pin "f1aaccf64306a5f99d9bf7ba815d7ea41c15518d")
|
||||
|
|
|
@ -28,7 +28,7 @@
|
|||
|
||||
* 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 ripgrep.
|
||||
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
|
||||
|
@ -76,7 +76,7 @@ brew install ripgrep
|
|||
|
||||
*** Arch Linux
|
||||
#+BEGIN_SRC sh :dir /sudo::
|
||||
sudo pacman --needed --noconfirm -S ripgrep
|
||||
sudo pacman -S ripgrep
|
||||
#+END_SRC
|
||||
|
||||
*** openSUSE
|
||||
|
|
|
@ -289,13 +289,13 @@ The point of this is to avoid Emacs locking up indexing massive file trees."
|
|||
(rxt-quote-pcre (doom-thing-at-point-or-region)))))
|
||||
directory args
|
||||
(or prompt
|
||||
(format "rg%s [%s]: "
|
||||
args
|
||||
(format "Search project [%s]: "
|
||||
(cond ((equal directory default-directory)
|
||||
"./")
|
||||
((equal directory project-root)
|
||||
(projectile-project-name))
|
||||
((file-relative-name directory project-root))))))))
|
||||
((file-relative-name directory project-root)))
|
||||
(string-trim args))))))
|
||||
|
||||
;;;###autoload
|
||||
(defun +ivy/project-search (&optional arg initial-query directory)
|
||||
|
|
|
@ -45,6 +45,9 @@ results 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
|
||||
|
@ -153,7 +156,8 @@ results 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-mode +1)
|
||||
(ivy-rich-project-root-cache-mode +1))
|
||||
|
||||
|
||||
(use-package! all-the-icons-ivy
|
||||
|
@ -184,6 +188,7 @@ results buffer.")
|
|||
[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-ex-registers] #'counsel-evil-registers
|
||||
[remap evil-show-marks] #'counsel-mark-ring
|
||||
[remap execute-extended-command] #'counsel-M-x
|
||||
|
@ -199,7 +204,7 @@ results buffer.")
|
|||
[remap recentf-open-files] #'counsel-recentf
|
||||
[remap set-variable] #'counsel-set-variable
|
||||
[remap swiper] #'counsel-grep-or-swiper
|
||||
[remap unicode-chars-list-chars] #'counsel-unicode-char
|
||||
[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)
|
||||
|
@ -222,15 +227,6 @@ results buffer.")
|
|||
(when (stringp counsel-rg-base-command)
|
||||
(setq counsel-rg-base-command (split-string counsel-rg-base-command)))
|
||||
|
||||
;; REVIEW Fix #3215: prevents mingw on Windows throwing an error trying to
|
||||
;; expand / to an absolute path. Remove this when it is fixed upstream
|
||||
;; in counsel.
|
||||
(when (and (memq system-type '(windows-nt ms-dos))
|
||||
(listp counsel-rg-base-command)
|
||||
(member "--path-separator" counsel-rg-base-command))
|
||||
(setf (cadr (member "--path-separator" counsel-rg-base-command))
|
||||
"/"))
|
||||
|
||||
;; Integrate with `helpful'
|
||||
(setq counsel-describe-function-function #'helpful-callable
|
||||
counsel-describe-variable-function #'helpful-variable)
|
||||
|
@ -299,7 +295,7 @@ results buffer.")
|
|||
(cl-loop for dir in projectile-globally-ignored-directories
|
||||
collect "--glob"
|
||||
collect (concat "!" dir))
|
||||
(if IS-WINDOWS (list "--path-separator" "/"))))
|
||||
(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."))
|
||||
|
@ -389,12 +385,14 @@ results buffer.")
|
|||
'(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)
|
||||
'(: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)))
|
||||
|
|
|
@ -1,24 +1,24 @@
|
|||
;; -*- no-byte-compile: t; -*-
|
||||
;;; completion/ivy/packages.el
|
||||
|
||||
(package! swiper :pin "d2891aab7b816aebf21ebd01ce33933a6ac6244f")
|
||||
(package! swiper :pin "a5eade0c77b7dd78cdea0f246683c6cb00f7b7c6")
|
||||
(package! ivy)
|
||||
(package! ivy-hydra)
|
||||
(package! ivy-avy)
|
||||
(package! counsel)
|
||||
|
||||
(package! amx :pin "ccfc92c600df681df5e8b5fecec328c462ceb71e")
|
||||
(package! amx :pin "37f9c7ae55eb0331b27200fb745206fc58ceffc0")
|
||||
(package! counsel-projectile :pin "06b03c1080d3ccc3fa9b9c41b1ccbcf13f058e4b")
|
||||
(package! ivy-rich :pin "f8a1f5c90d2a113b597ef5903634c089fce3365b")
|
||||
(package! wgrep :pin "f0ef9bfa44db503cdb2f83fcfbd2fa4e2382ef1f")
|
||||
(package! ivy-rich :pin "600b8183ed0be8668dcc548cc2c8cb94b001363b")
|
||||
(package! wgrep :pin "f9687c28bbc2e84f87a479b6ce04407bb97cfb23")
|
||||
|
||||
(if (featurep! +prescient)
|
||||
(package! ivy-prescient :pin "42adc802d3ba6c747bed7ea1f6e3ffbbdfc7192d")
|
||||
(package! ivy-prescient :pin "4a0f5405798cfcb98ea005078ef2e2d490e922c4")
|
||||
(when (featurep! +fuzzy)
|
||||
(package! flx :pin "647cb2f92f9936c62e277d7a74ad54a80502d255")))
|
||||
|
||||
(when (featurep! +childframe)
|
||||
(package! ivy-posframe :pin "83047d440ff132d5a45acde5955f71853edeefb9"))
|
||||
(package! ivy-posframe :pin "084cc59ea2cd62afaa51445ada3d00404749a541"))
|
||||
|
||||
(when (featurep! +icons)
|
||||
(package! all-the-icons-ivy :pin "a70cbfa1effe36efc946a823a580cec686d5e88d"))
|
||||
|
|
|
@ -53,7 +53,14 @@
|
|||
: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))
|
||||
:desc "Jump to symbol in any workspace" "J" #'helm-lsp-global-workspace-symbol)
|
||||
(: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
|
||||
|
@ -72,13 +79,14 @@
|
|||
: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/open-private-config
|
||||
: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 filename" "y" #'+default/yank-buffer-filename
|
||||
: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)
|
||||
|
||||
|
@ -104,6 +112,7 @@
|
|||
(:prefix-map ("s" . "search")
|
||||
:desc "Search project for symbol" "." #'+default/search-project-for-symbol-at-point
|
||||
:desc "Search buffer" "b" #'swiper
|
||||
:desc "Search all open buffers" "B" #'swiper-all
|
||||
:desc "Search current directory" "d" #'+default/search-cwd
|
||||
:desc "Search other directory" "D" #'+default/search-other-cwd
|
||||
:desc "Locate file" "f" #'+lookup/file
|
||||
|
@ -128,7 +137,7 @@
|
|||
: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" #'unicode-chars-list-chars
|
||||
:desc "Unicode" "u" #'insert-char
|
||||
:desc "From clipboard" "y" #'+default/yank-pop)
|
||||
|
||||
;;; <leader> n --- notes
|
||||
|
@ -292,12 +301,13 @@
|
|||
(:when (featurep! :lang org +pomodoro)
|
||||
:desc "Pomodoro timer" "t" #'org-pomodoro)
|
||||
(:when (featurep! :ui zen)
|
||||
:desc "Zen mode" "z" #'writeroom-mode))
|
||||
:desc "Zen mode" "z" #'+zen/toggle
|
||||
:desc "Zen mode (fullscreen)" "Z" #'+zen/toggle-fullscreen))
|
||||
|
||||
;;; <leader> v --- versioning
|
||||
(:prefix-map ("v" . "versioning")
|
||||
:desc "Git revert file" "R" #'vc-revert
|
||||
:desc "Kill link to remote" "y" #'browse-at-remote-kill
|
||||
: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
|
||||
|
@ -325,7 +335,7 @@
|
|||
: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" "." #'browse-at-remote
|
||||
: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
|
||||
|
|
|
@ -42,13 +42,32 @@
|
|||
(bound-and-true-p yas-minor-mode)
|
||||
(yas-maybe-expand-abbrev-key-filter 'yas-expand))
|
||||
#'yas-expand
|
||||
(and (featurep! :completion company +tng)
|
||||
(+company-has-completion-p))
|
||||
#'company-complete-common)
|
||||
:v [tab] (cmds! (and (bound-and-true-p yas-minor-mode)
|
||||
(and (bound-and-true-p company-mode)
|
||||
(featurep! :completion company +tng))
|
||||
#'company-indent-or-complete-common)
|
||||
:m [tab] (cmds! (and (bound-and-true-p yas-minor-mode)
|
||||
(evil-visual-state-p)
|
||||
(or (eq evil-visual-selection 'line)
|
||||
(not (memq (char-after) (list ?\( ?\[ ?\{ ?\} ?\] ?\))))))
|
||||
#'yas-insert-snippet)
|
||||
#'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)
|
||||
|
@ -107,8 +126,8 @@
|
|||
|
||||
;;; :completion
|
||||
(map! (:when (featurep! :completion company)
|
||||
:i "C-@" (cmds! (not (minibufferp)) #'+company/complete)
|
||||
:i "C-SPC" (cmds! (not (minibufferp)) #'+company/complete)
|
||||
: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'
|
||||
|
@ -350,6 +369,12 @@
|
|||
(: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! :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)
|
||||
|
@ -392,12 +417,13 @@
|
|||
: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 filename" "y" #'+default/yank-buffer-filename)
|
||||
:desc "Yank file path" "y" #'+default/yank-buffer-path
|
||||
:desc "Yank file path from project" "Y" #'+default/yank-buffer-path-relative-to-project)
|
||||
|
||||
;;; <leader> g --- git/version control
|
||||
(:prefix-map ("g" . "git")
|
||||
:desc "Revert file" "R" #'vc-revert
|
||||
:desc "Copy link to remote" "y" #'browse-at-remote-kill
|
||||
: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)
|
||||
|
@ -430,7 +456,7 @@
|
|||
: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" #'browse-at-remote
|
||||
: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
|
||||
|
@ -463,7 +489,7 @@
|
|||
:desc "Evil ex path" "p" (cmd! (evil-ex "R!echo "))
|
||||
:desc "From evil register" "r" #'evil-ex-registers
|
||||
:desc "Snippet" "s" #'yas-insert-snippet
|
||||
:desc "Unicode" "u" #'unicode-chars-list-chars
|
||||
:desc "Unicode" "u" #'insert-char
|
||||
:desc "From clipboard" "y" #'+default/yank-pop)
|
||||
|
||||
;;; <leader> n --- notes
|
||||
|
@ -527,6 +553,7 @@
|
|||
: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
|
||||
|
@ -632,6 +659,7 @@
|
|||
;;; <leader> s --- search
|
||||
(:prefix-map ("s" . "search")
|
||||
:desc "Search buffer" "b" #'swiper
|
||||
:desc "Search all open buffers" "B" #'swiper-all
|
||||
:desc "Search current directory" "d" #'+default/search-cwd
|
||||
:desc "Search other directory" "D" #'+default/search-other-cwd
|
||||
:desc "Locate file" "f" #'locate
|
||||
|
@ -681,7 +709,8 @@
|
|||
(:when (featurep! :editor word-wrap)
|
||||
:desc "Soft line wrapping" "w" #'+word-wrap-mode)
|
||||
(:when (featurep! :ui zen)
|
||||
:desc "Zen mode" "z" #'writeroom-mode)))
|
||||
: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))))
|
||||
|
|
|
@ -45,9 +45,16 @@ If prefix ARG is non-nil, prompt for the search path."
|
|||
(interactive "P")
|
||||
(if arg
|
||||
(call-interactively #'projectile-discover-projects-in-directory)
|
||||
(if projectile-project-search-path
|
||||
(mapc #'projectile-discover-projects-in-directory projectile-project-search-path)
|
||||
(user-error "`projectile-project-search-path' is empty; don't know where to search"))))
|
||||
(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)
|
||||
(if (not (file-accessible-directory-p dir))
|
||||
(message "%S was inaccessible and couldn't searched" dir)
|
||||
(projectile-discover-projects-in-directory dir)))))))
|
||||
|
||||
;;;###autoload
|
||||
(defun +default/dired (arg)
|
||||
|
|
|
@ -32,13 +32,24 @@
|
|||
((error "No kill-ring search backend available. Enable ivy or helm!")))))
|
||||
|
||||
;;;###autoload
|
||||
(defun +default/yank-buffer-filename ()
|
||||
(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 (bound-and-true-p list-buffers-directory)))
|
||||
(message (kill-new (abbreviate-file-name filename)))
|
||||
(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 ()
|
||||
"Copy the current buffer's path to the kill ring."
|
||||
(interactive)
|
||||
(+default/yank-buffer-path (doom-project-root)))
|
||||
|
||||
;;;###autoload
|
||||
(defun +default/insert-file-path (arg)
|
||||
"Insert the file name (absolute path if prefix ARG).
|
||||
|
@ -55,10 +66,12 @@ If `buffer-file-name' isn't set, uses `default-directory'."
|
|||
"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 (ignore-errors (sp-get-thing)))
|
||||
(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)
|
||||
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
|
||||
|
@ -76,13 +89,9 @@ possible, or just one char if that's not possible."
|
|||
(> tab-width 1)
|
||||
(not (bolp))
|
||||
(not (doom-point-in-string-p))
|
||||
(save-excursion (>= (- (skip-chars-backward " \t")) tab-width)))
|
||||
(let ((movement (% (current-column) tab-width)))
|
||||
(when (= movement 0)
|
||||
(setq movement tab-width))
|
||||
(delete-char (- movement)))
|
||||
(unless (memq (char-before) (list ?\n ?\ ))
|
||||
(insert " ")))
|
||||
(>= (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)))))
|
||||
|
|
|
@ -100,7 +100,11 @@
|
|||
(dolist (brace '("(" "{" "["))
|
||||
(sp-pair brace nil
|
||||
:post-handlers '(("||\n[i]" "RET") ("| " "SPC"))
|
||||
;; I likely don't want a new pair if adjacent to a word or opening brace
|
||||
;; 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
|
||||
|
@ -244,7 +248,7 @@ Continues comments if executed from a commented line. Consults
|
|||
(interactive "*")
|
||||
(when (and +default-want-RET-continue-comments
|
||||
(doom-point-in-comment-p)
|
||||
(fboundp comment-line-break-function))
|
||||
(functionp comment-line-break-function))
|
||||
(funcall comment-line-break-function nil)
|
||||
t))
|
||||
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
;; -*- no-byte-compile: t; -*-
|
||||
;;; config/default/packages.el
|
||||
|
||||
(package! avy :pin "bbf1e7339eba06784dfe86643bb0fbddf5bb0342")
|
||||
(package! avy :pin "e92cb37457b43336b765630dbfbea8ba4be601fa")
|
||||
(package! drag-stuff :pin "6d06d846cd37c052d79acd0f372c13006aa7e7c8")
|
||||
(package! link-hint :pin "e897897d6a92b4ffdbff33acf69f5c661da1123a")
|
||||
(package! link-hint :pin "09ba5727d8ba4a2e5d4f5ce924aaebbc7478ff13")
|
||||
|
||||
(unless (featurep! :editor evil)
|
||||
(package! expand-region :pin "ea6b4cbb9985ddae532bd2faf9bb00570c9f2781"))
|
||||
(package! expand-region :pin "4b8322774d9c1d8b64a0049d1dbbc1e7ce80c1a0"))
|
||||
|
|
|
@ -13,7 +13,6 @@
|
|||
- [[#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]]
|
||||
- [[#modularizing-your-literate-config-with-include-directives][Modularizing your literate config with ~#+INCLUDE~ directives]]
|
||||
- [[#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]]
|
||||
|
@ -86,21 +85,6 @@ echo Hello world
|
|||
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]].
|
||||
|
||||
** Modularizing your literate config with ~#+INCLUDE~ directives
|
||||
Literate configs can be split up into separate files and imported into a central
|
||||
=config.org= using the ~#+INCLUDE~ org directive. Here are some examples:
|
||||
#+BEGIN_SRC org
|
||||
,#+INCLUDE other-file.org
|
||||
,#+INCLUDE: "~/my-book/chapter2.org" :minlevel 1
|
||||
,#+INCLUDE: "~/.emacs" :lines "5-10"
|
||||
,#+INCLUDE: "~/.emacs" :lines "-10"
|
||||
,#+INCLUDE: "~/.emacs" :lines "10-"
|
||||
,#+INCLUDE: "./paper.org::*conclusion" :lines 1-20
|
||||
,#+INCLUDE: "./paper.org::#theory" :only-contents t
|
||||
#+END_SRC
|
||||
|
||||
See [[https://orgmode.org/manual/Include-Files.html][this entry in the Emacs manual]] for more on this directive.
|
||||
|
||||
* Troubleshooting
|
||||
** How to tangle to =DOOMDIR/init.el=
|
||||
If your literate needs are more complex (e.g. you want to make your init.el
|
||||
|
|
|
@ -23,57 +23,38 @@ byte-compiled from.")
|
|||
(letf! ((default-directory doom-private-dir)
|
||||
(target +literate-config-file)
|
||||
(cache +literate-config-cache-file)
|
||||
(dest (expand-file-name (concat (file-name-base target) ".el")))
|
||||
;; Operate on a copy because `org-babel-tangle' has
|
||||
;; side-effects we need to undo immediately as not to
|
||||
;; overwrite the user's config; it's bad ettiquite.
|
||||
(backup (make-temp-file (concat (file-name-nondirectory target) ".")))
|
||||
|
||||
;; HACK A hack to prevent ob-tangle from operating relative to
|
||||
;; the backup file and thus tangling to the wrong
|
||||
;; destinations.
|
||||
(defun org-babel-tangle-single-block (&rest args)
|
||||
(let* ((spec (apply org-babel-tangle-single-block args))
|
||||
(file (nth 1 spec))
|
||||
(file (if (file-equal-p file backup) target file))
|
||||
(file (if org-babel-tangle-use-relative-file-links
|
||||
(file-relative-name file)
|
||||
file)))
|
||||
(setf (nth 1 spec) file)
|
||||
spec))
|
||||
(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!
|
||||
(unwind-protect
|
||||
(with-temp-file backup
|
||||
(insert-file-contents target)
|
||||
(let ((buffer-file-name backup)
|
||||
;; 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))
|
||||
(org-mode)
|
||||
(with-silent-modifications
|
||||
;; Tangling won't ordinarily expand #+INCLUDE directives,
|
||||
;; so I do it myself.
|
||||
(org-export-expand-include-keyword)
|
||||
(org-babel-tangle nil dest))))
|
||||
(ignore-errors (delete-file backup)))
|
||||
(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 "__NOTANGLE=1 $@"))))))
|
||||
(throw 'exit "__DOOMRESTART=1 __NOTANGLE=1 $@"))))))
|
||||
|
||||
;;;###autoload
|
||||
(defalias '+literate/reload #'doom/reload)
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#+TITLE: feature/evil
|
||||
#+TITLE: editor/evil
|
||||
#+DATE: February 2, 2017
|
||||
#+SINCE: v2.0
|
||||
#+STARTUP: inlineimages nofold
|
||||
|
|
|
@ -106,7 +106,7 @@ more information on modifiers."
|
|||
(cond ((sp-point-in-comment pos)
|
||||
(setq evil-auto-indent nil)
|
||||
(if comment-line-break-function
|
||||
(funcall 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)
|
||||
|
@ -179,28 +179,31 @@ more information on modifiers."
|
|||
(if file (evil-edit file)))
|
||||
|
||||
;;;###autoload (autoload '+evil-join-a "editor/evil/autoload/advice" nil nil)
|
||||
(evil-define-operator +evil-join-a (beg end)
|
||||
(defun +evil-join-a (orig-fn beg end)
|
||||
"Join the selected lines.
|
||||
|
||||
This advice improves on `evil-join' by removing comment delimiters when joining
|
||||
commented lines, by using `fill-region-as-paragraph'.
|
||||
|
||||
From https://github.com/emacs-evil/evil/issues/606"
|
||||
:motion evil-line
|
||||
(let* ((count (count-lines beg end))
|
||||
(count (if (> count 1) (1- count) count))
|
||||
(fixup-mark (make-marker)))
|
||||
(unwind-protect
|
||||
(dotimes (var count)
|
||||
(if (and (bolp) (eolp))
|
||||
(join-line 1)
|
||||
(let* ((end (line-beginning-position 3))
|
||||
(fill-column (1+ (- end beg))))
|
||||
(set-marker fixup-mark (line-end-position))
|
||||
(fill-region-as-paragraph beg end nil t)
|
||||
(goto-char fixup-mark)
|
||||
(fixup-whitespace))))
|
||||
(set-marker fixup-mark nil))))
|
||||
;; But revert to the default we're not in a comment, where
|
||||
;; `fill-region-as-paragraph' is too greedy.
|
||||
(if (not (doom-point-in-comment-p (min (max beg (1+ (point))) end)))
|
||||
(funcall orig-fn beg end)
|
||||
(let* ((count (count-lines beg end))
|
||||
(count (if (> count 1) (1- count) count))
|
||||
(fixup-mark (make-marker)))
|
||||
(unwind-protect
|
||||
(dotimes (var count)
|
||||
(if (and (bolp) (eolp))
|
||||
(join-line 1)
|
||||
(let* ((end (line-beginning-position 3))
|
||||
(fill-column (1+ (- end beg))))
|
||||
(set-marker fixup-mark (line-end-position))
|
||||
(fill-region-as-paragraph beg end nil t)
|
||||
(goto-char fixup-mark)
|
||||
(fixup-whitespace))))
|
||||
(set-marker fixup-mark nil)))))
|
||||
|
||||
;;;###autoload
|
||||
(defun +evil--fix-dabbrev-in-minibuffer-h ()
|
||||
|
|
|
@ -92,6 +92,22 @@ the only window, use evil-window-move-* (e.g. `evil-window-move-far-left')."
|
|||
"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."
|
||||
|
@ -123,7 +139,7 @@ the only window, use evil-window-move-* (e.g. `evil-window-move-far-left')."
|
|||
"Wrapper around `doom/retab'."
|
||||
:motion nil :move-point nil :type line
|
||||
(interactive "<r>")
|
||||
(doom/retab beg end))
|
||||
(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)
|
||||
|
|
|
@ -46,6 +46,7 @@ This excludes the protocol and querystring."
|
|||
;;;###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
|
||||
'(("'" . "'")
|
||||
("\"" . "\"")
|
||||
|
@ -57,6 +58,7 @@ This excludes the protocol and querystring."
|
|||
;;;###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
|
||||
'(("'" . "'")
|
||||
("\"" . "\"")
|
||||
|
|
|
@ -27,18 +27,19 @@ directives. By default, this only recognizes C directives.")
|
|||
(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-want-visual-char-semi-exclusive t
|
||||
evil-ex-search-vim-style-regexp t
|
||||
(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
|
||||
;; cursor appearance
|
||||
;; 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)
|
||||
|
@ -63,10 +64,8 @@ directives. By default, this only recognizes C directives.")
|
|||
:config
|
||||
(evil-select-search-module 'evil-search-module 'evil-search)
|
||||
|
||||
(put 'evil-define-key* 'lisp-indent-function 'defun)
|
||||
|
||||
;; stop copying each visual state move to the clipboard:
|
||||
;; https://bitbucket.org/lyro/evil/issue/336/osx-visual-state-copies-the-region-on
|
||||
;; 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)
|
||||
|
@ -82,21 +81,19 @@ directives. By default, this only recognizes C directives.")
|
|||
("^\\*Command Line" :size 8)))))
|
||||
|
||||
;; Change the cursor color in emacs state. We do it this roundabout way
|
||||
;; instead of changing `evil-default-cursor' (or `evil-emacs-state-cursor') so
|
||||
;; it won't interfere with users who have changed these variables.
|
||||
(defvar +evil--default-cursor-color "#ffffff")
|
||||
(defvar +evil--emacs-cursor-color "#ff9999")
|
||||
|
||||
(add-hook! 'doom-load-theme-hook
|
||||
;; 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 ()
|
||||
(setq +evil--default-cursor-color (face-background 'cursor)
|
||||
+evil--emacs-cursor-color (face-foreground 'warning))))
|
||||
(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 +evil--default-cursor-color))
|
||||
(evil-set-cursor-color (get 'cursor 'evil-normal-color)))
|
||||
(defun +evil-emacs-cursor-fn ()
|
||||
(evil-set-cursor-color +evil--emacs-cursor-color))
|
||||
(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)
|
||||
|
||||
|
||||
|
@ -165,7 +162,7 @@ directives. By default, this only recognizes C directives.")
|
|||
(abort-recursive-edit)))
|
||||
|
||||
;; Make J (evil-join) remove comment delimiters when joining lines.
|
||||
(advice-add #'evil-join :override #'+evil-join-a)
|
||||
(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.
|
||||
|
@ -310,7 +307,7 @@ directives. By default, this only recognizes C directives.")
|
|||
|
||||
(use-package! evil-escape
|
||||
:commands evil-escape
|
||||
:after-call pre-command-hook
|
||||
: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)
|
||||
|
@ -318,15 +315,14 @@ directives. By default, this only recognizes C directives.")
|
|||
evil-escape-delay 0.15)
|
||||
(evil-define-key* '(insert replace visual operator) 'global "\C-g" #'evil-escape)
|
||||
:config
|
||||
;; no `evil-escape' in minibuffer, unless `evil-collection-setup-minibuffer'
|
||||
;; is enabled, where we could be in insert mode in the minibuffer.
|
||||
;; `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)))))
|
||||
;; so that evil-escape-mode-hook runs, and can be toggled by evil-mc
|
||||
(evil-escape-mode +1))
|
||||
(evil-normal-state-p))))))
|
||||
|
||||
|
||||
(use-package! evil-exchange
|
||||
|
@ -351,20 +347,16 @@ directives. By default, this only recognizes C directives.")
|
|||
|
||||
|
||||
(use-package! evil-snipe
|
||||
:commands (evil-snipe-mode
|
||||
evil-snipe-override-mode
|
||||
evil-snipe-local-mode
|
||||
evil-snipe-override-local-mode)
|
||||
:after-call pre-command-hook
|
||||
: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)
|
||||
(evil-snipe-mode +1)
|
||||
(evil-snipe-override-mode +1))
|
||||
(pushnew! evil-snipe-disabled-modes 'Info-mode 'calc-mode 'treemacs-mode))
|
||||
|
||||
|
||||
(use-package! evil-surround
|
||||
|
@ -420,7 +412,6 @@ directives. By default, this only recognizes C directives.")
|
|||
|
||||
(map! :v "@" #'+evil:apply-macro
|
||||
:m [C-i] #'evil-jump-forward
|
||||
:m [tab] #'evil-jump-item
|
||||
|
||||
;; implement dictionary keybinds
|
||||
;; evil already defines 'z=' to `ispell-word' = correct word at point
|
||||
|
@ -493,7 +484,9 @@ directives. By default, this only recognizes C directives.")
|
|||
:nv "K" #'+lookup/documentation
|
||||
:nv "gd" #'+lookup/definition
|
||||
:nv "gD" #'+lookup/references
|
||||
:nv "gf" #'+lookup/file)
|
||||
:nv "gf" #'+lookup/file
|
||||
:nv "gI" #'+lookup/implementations
|
||||
:nv "gA" #'+lookup/assignments)
|
||||
(:when (featurep! :tools eval)
|
||||
:nv "gr" #'+eval:region
|
||||
:n "gR" #'+eval/buffer
|
||||
|
@ -529,6 +522,9 @@ directives. By default, this only recognizes C directives.")
|
|||
"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
|
||||
|
@ -562,7 +558,7 @@ directives. By default, this only recognizes C directives.")
|
|||
:textobj "u" #'+evil:inner-url-txtobj #'+evil:outer-url-txtobj
|
||||
:textobj "x" #'evil-inner-xml-attr #'evil-outer-xml-attr
|
||||
|
||||
;; evil-easymotion (see `+evil/easymotion')
|
||||
;; evil-easymotion
|
||||
(:after evil-easymotion
|
||||
:m "gs" evilem-map
|
||||
(:map evilem-map
|
||||
|
|
|
@ -30,6 +30,7 @@
|
|||
(defvar +evil-collection-disabled-list
|
||||
'(anaconda-mode
|
||||
buff-menu
|
||||
calc
|
||||
comint
|
||||
company
|
||||
custom
|
||||
|
@ -42,6 +43,7 @@
|
|||
image
|
||||
kotlin-mode
|
||||
occur
|
||||
outline
|
||||
package-menu
|
||||
simple
|
||||
slime
|
||||
|
@ -54,6 +56,8 @@ variable for an explanation of the defaults (in comments). See
|
|||
|
||||
;; 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)
|
||||
|
||||
;; We handle loading evil-collection ourselves
|
||||
(defvar evil-collection--supported-modes nil)
|
||||
|
@ -277,6 +281,8 @@ and complains if a module is loaded too early (during startup)."
|
|||
|
||||
(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
|
||||
|
|
|
@ -1,23 +1,25 @@
|
|||
;; -*- no-byte-compile: t; -*-
|
||||
;;; editor/evil/packages.el
|
||||
|
||||
(package! evil :pin "cc9d6886b418389752a0591b9fcb270e83234cf9")
|
||||
(package! evil :pin "1b3db6349d04adfc68f707b0edd800f5ab3cb374")
|
||||
(package! evil-args :pin "758ad5ae54ad34202064fec192c88151c08cb387")
|
||||
(package! evil-easymotion :pin "f96c2ed38ddc07908db7c3c11bcd6285a3e8c2e9")
|
||||
(package! evil-embrace :pin "4379adea032b25e359d01a36301b4a5afdd0d1b7")
|
||||
(package! evil-embrace :pin "464e8ec52ff78edf3c9060143fc375f6ce5f275f")
|
||||
(package! evil-escape
|
||||
:recipe (:host github :repo "hlissner/evil-escape")
|
||||
:pin "819f1ee1cf3f69a1ae920e6004f2c0baeebbe077")
|
||||
(package! evil-exchange :pin "3030e21ee16a42dfce7f7cf86147b778b3f5d8c1")
|
||||
(package! evil-exchange :pin "ac50f21b29b6e3a111e10a9e88ae61c907ac5ee8")
|
||||
(package! evil-indent-plus :pin "0c7501e6efed661242c3a20e0a6c79a6455c2c40")
|
||||
(package! evil-lion :pin "6b03593f5dd6e7c9ca02207f9a73615cf94c93ab")
|
||||
(package! evil-nerd-commenter :pin "563cdc154b1f29d181b883563dd37be7eafafdee")
|
||||
(package! evil-nerd-commenter :pin "b8ac35fe019df5602c31912f65303a3d8ad0066c")
|
||||
(package! evil-numbers
|
||||
:recipe (:host github :repo "janpath/evil-numbers")
|
||||
:pin "006da406d175c05fedca4431cccd569e20bef92c")
|
||||
(package! evil-snipe :pin "6dcac7f2516c6137a2de532fc2c052f242559ee3")
|
||||
(package! evil-surround :pin "346d4d85fcf1f9517e9c4991c1efe68b4130f93a")
|
||||
(package! evil-textobj-anyblock :pin "ff00980f0634f95bf2ad9956b615a155ea8743be")
|
||||
(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")
|
||||
|
@ -33,4 +35,4 @@
|
|||
(package! neotree)
|
||||
(autoload 'neotree-make-executor "neotree" nil nil 'macro))
|
||||
|
||||
(package! evil-collection :pin "ffbf149f0e09d8c2068f9f5098255555d7983696"))
|
||||
(package! evil-collection :pin "b6025cf9eaf7b4659db918548fd6d96ed17fddc6"))
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
# group: file templates
|
||||
# contributor: Henrik Lissner
|
||||
# --
|
||||
#ifndef ${1:__`(upcase (file-name-base buffer-file-name))`_H_$(upcase yas-text)}
|
||||
#ifndef ${1:`(upcase (file-name-base buffer-file-name))`_H_$(upcase yas-text)}
|
||||
#define $1
|
||||
|
||||
$0
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
# group: file templates
|
||||
# contributor: Henrik Lissner
|
||||
# --
|
||||
#ifndef ${1:__`(upcase (file-name-base buffer-file-name))`_H_$(upcase yas-text)}
|
||||
#ifndef ${1:`(upcase (file-name-base buffer-file-name))`_H_$(upcase yas-text)}
|
||||
#define $1
|
||||
|
||||
$0
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
;;
|
||||
;; Copyright (C) `(format-time-string "%Y")` `user-full-name`
|
||||
;;
|
||||
;; Author: `user-full-name` <http://github/`user-login-name`>
|
||||
;; Author: `user-full-name` <https://github.com/`(cl-find-if-not #'string-empty-p (list (cdr (doom-call-process "git" "config" "github.user")) user-login-name))`>
|
||||
;; Maintainer: `user-full-name` <`user-mail-address`>
|
||||
;; Created: `(format-time-string "%B %d, %Y")`
|
||||
;; Modified: `(format-time-string "%B %d, %Y")`
|
||||
|
|
|
@ -659,11 +659,11 @@ Also add information on how to contact you by electronic and paper mail.
|
|||
notice like this when it starts in an interactive mode:
|
||||
|
||||
${3:<program>} Copyright (C) ${1:`(format-time-string "%Y")`} ${2:`user-full-name`}
|
||||
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
||||
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.
|
||||
under certain conditions; type \`show c' for details.
|
||||
|
||||
The hypothetical commands `show w' and `show c' should show the appropriate
|
||||
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".
|
||||
|
||||
|
|
|
@ -9,9 +9,10 @@
|
|||
[remap evil-open-fold-rec] #'+fold/open
|
||||
[remap evil-close-folds] #'+fold/close-all
|
||||
[remap evil-open-folds] #'+fold/open-all)
|
||||
(evil-define-key* 'motion 'global
|
||||
"zj" #'+fold/next
|
||||
"zk" #'+fold/previous))
|
||||
(after! evil
|
||||
(evil-define-key* 'motion 'global
|
||||
"zj" #'+fold/next
|
||||
"zk" #'+fold/previous)))
|
||||
|
||||
|
||||
;;
|
||||
|
|
|
@ -1,10 +1,11 @@
|
|||
;;; editor/format/config.el -*- lexical-binding: t; -*-
|
||||
|
||||
(defvar +format-on-save-enabled-modes
|
||||
'(not emacs-lisp-mode ; elisp's mechanisms are good enough
|
||||
sql-mode ; sqlformat is currently broken
|
||||
tex-mode ; latexindent is broken
|
||||
latex-mode)
|
||||
'(not emacs-lisp-mode ; elisp's mechanisms are good enough
|
||||
sql-mode ; sqlformat is currently broken
|
||||
tex-mode ; latexindent is broken
|
||||
latex-mode
|
||||
org-msg-edit-mode) ; doesn't need a formatter
|
||||
"A list of major modes in which to reformat the buffer upon saving.
|
||||
|
||||
If this list begins with `not', then it negates the list.
|
||||
|
@ -33,18 +34,38 @@ select buffers.")
|
|||
;;
|
||||
;;; Bootstrap
|
||||
|
||||
(defun +format-enable-for-lsp-on-save-maybe-h ()
|
||||
"Enable LSP formatter when LSP client is available."
|
||||
(remove-hook 'lsp-mode-hook #'+format-enable-for-lsp-on-save-maybe-h 'local)
|
||||
(cond ((not +format-with-lsp) nil)
|
||||
((bound-and-true-p lsp-mode)
|
||||
(when (lsp-feature? "textDocument/formatting")
|
||||
(+format-enable-on-save-h))
|
||||
t)
|
||||
((bound-and-true-p eglot--managed-mode)
|
||||
(when (eglot--server-capable :documentRangeFormattingProvider)
|
||||
(+format-enable-on-save-h))
|
||||
t)
|
||||
((bound-and-true-p lsp--buffer-deferred)
|
||||
(add-hook 'lsp-mode-hook #'+format-enable-for-lsp-on-save-maybe-h
|
||||
nil 'local)
|
||||
t)))
|
||||
|
||||
(defun +format-enable-on-save-maybe-h ()
|
||||
"Enable formatting on save in certain major modes.
|
||||
|
||||
This is controlled by `+format-on-save-enabled-modes'."
|
||||
(unless (or (eq major-mode 'fundamental-mode)
|
||||
(cond ((booleanp +format-on-save-enabled-modes)
|
||||
(null +format-on-save-enabled-modes))
|
||||
((eq (car +format-on-save-enabled-modes) 'not)
|
||||
(memq major-mode (cdr +format-on-save-enabled-modes)))
|
||||
((not (memq major-mode +format-on-save-enabled-modes))))
|
||||
(not (require 'format-all nil t)))
|
||||
(+format-enable-on-save-h)))
|
||||
(and (not (eq major-mode 'fundamental-mode))
|
||||
(cond ((booleanp +format-on-save-enabled-modes)
|
||||
+format-on-save-enabled-modes)
|
||||
((eq (car-safe +format-on-save-enabled-modes) 'not)
|
||||
(not (memq major-mode (cdr +format-on-save-enabled-modes))))
|
||||
((memq major-mode +format-on-save-enabled-modes))
|
||||
((not (require 'format-all nil t))))
|
||||
(not (+format-enable-for-lsp-on-save-maybe-h))
|
||||
(let (current-prefix-arg) ; never prompt
|
||||
(car (format-all--probe)))
|
||||
(+format-enable-on-save-h)))
|
||||
|
||||
(when (featurep! +onsave)
|
||||
(add-hook 'after-change-major-mode-hook #'+format-enable-on-save-maybe-h))
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
;; -*- no-byte-compile: t; -*-
|
||||
;;; editor/god/packages.el
|
||||
|
||||
(package! god-mode :pin "f51c8f60e55393cced8cb0bd4a5bf0ab1612caa4")
|
||||
(package! god-mode :pin "02a402b2323e025f77e89cf56d5e678e31a2d2f6")
|
||||
|
|
|
@ -21,6 +21,7 @@ This includes:
|
|||
- [[http://docs.hylang.org/en/stable/][Hy]]
|
||||
- [[http://lfe.io/][LFE]]
|
||||
- Clojure
|
||||
- [[https://fennel-lang.org][Fennel]]
|
||||
|
||||
If evil is enabled, lispyville would also be activated for every mode where
|
||||
lispy is active
|
||||
|
|
|
@ -3,12 +3,23 @@
|
|||
(use-package! lispy
|
||||
:hook ((lisp-mode . lispy-mode)
|
||||
(emacs-lisp-mode . lispy-mode)
|
||||
(ielm-mode . lispy-mode)
|
||||
(scheme-mode . lispy-mode)
|
||||
(racket-mode . lispy-mode)
|
||||
(hy-mode . lispy-mode)
|
||||
(lfe-mode . lispy-mode)
|
||||
(dune-mode . lispy-mode)
|
||||
(clojure-mode . lispy-mode))
|
||||
(clojure-mode . lispy-mode)
|
||||
(fennel-mode . lispy-mode))
|
||||
:init
|
||||
(add-hook! 'eval-expression-minibuffer-setup-hook
|
||||
(defun doom-init-lispy-in-eval-expression-h ()
|
||||
"Enable `lispy-mode' in the minibuffer for `eval-expression'."
|
||||
(lispy-mode)
|
||||
;; When `lispy-key-theme' has `parinfer', the TAB key doesn't do
|
||||
;; completion, neither (kbd "<tab>"/"TAB"/"C-i")/[tab]/"\C-i" works in
|
||||
;; terminal as tested so remapping is used as a workaround
|
||||
(local-set-key (vector 'remap (lookup-key lispy-mode-map (kbd "TAB"))) #'completion-at-point)))
|
||||
:config
|
||||
(setq lispy-close-quotes-at-end-p t)
|
||||
(add-hook 'lispy-mode-hook #'turn-off-smartparens-mode))
|
||||
|
@ -27,4 +38,14 @@
|
|||
additional
|
||||
additional-insert))
|
||||
:config
|
||||
(lispyville-set-key-theme))
|
||||
(lispyville-set-key-theme)
|
||||
;; REVIEW Delete this once https://github.com/noctuid/lispyville/pull/297 is merged
|
||||
(defadvice! +lispy--fix-lispyville-end-of-defun-a (_)
|
||||
"lispyville-end-of-defun doesn't go to the next defun when
|
||||
point is already at the end of a defun, whereas
|
||||
lispyville-beginning-of-defun does."
|
||||
:before #'lispyville-end-of-defun
|
||||
(when (<= (- (line-end-position)
|
||||
(point))
|
||||
1)
|
||||
(forward-line))))
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
;; -*- no-byte-compile: t; -*-
|
||||
;;; editor/lispyville/packages.el
|
||||
|
||||
(package! lispy :pin "5c8a59ae7dd3dd342e7c86a8c0acdbd13e2989f3")
|
||||
(package! lispy :pin "38a7df4cbb16cfe3d62dc8ea98b50e2d9a572e58")
|
||||
(when (featurep! :editor evil)
|
||||
(package! lispyville :pin "0f13f26cd6aa71f9fd852186ad4a00c4294661cd"))
|
||||
(package! lispyville :pin "89316f01822b2135e52ca27fd308d207ef618052"))
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue